fix navigation animation
This commit is contained in:
19
main/led.c
19
main/led.c
@ -321,7 +321,10 @@ static void show_strip(led_strip_t *strip)
|
||||
// Convert RGB to GRB for WS2812B
|
||||
uint8_t *grb_data = malloc(strip->num_leds * 3);
|
||||
if (!grb_data)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to allocate GRB buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < strip->num_leds; i++)
|
||||
{
|
||||
@ -334,7 +337,21 @@ static void show_strip(led_strip_t *strip)
|
||||
.loop_count = 0,
|
||||
};
|
||||
|
||||
rmt_transmit(strip->rmt_channel, strip->encoder, grb_data, strip->num_leds * 3, &tx_config);
|
||||
esp_err_t ret = rmt_transmit(strip->rmt_channel, strip->encoder, grb_data, strip->num_leds * 3, &tx_config);
|
||||
if (ret != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "RMT transmit failed: %s", esp_err_to_name(ret));
|
||||
free(grb_data);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for transmission to complete before freeing buffer
|
||||
ret = rmt_tx_wait_all_done(strip->rmt_channel, pdMS_TO_TICKS(100));
|
||||
if (ret != ESP_OK)
|
||||
{
|
||||
ESP_LOGW(TAG, "RMT wait timeout");
|
||||
}
|
||||
|
||||
free(grb_data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user