From 6916d0be5e332195b61176faa1aa980b1f1497da Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Sat, 10 Feb 2024 18:14:57 +0100 Subject: [PATCH] Vylepseny iterator --- src/WSLed.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WSLed.cpp b/src/WSLed.cpp index c386bcf..9b6fd09 100644 --- a/src/WSLed.cpp +++ b/src/WSLed.cpp @@ -55,10 +55,10 @@ void wsLED::show() { #if defined(ARDUINO_ARCH_ESP32) uint32_t bits_to_send = ((uint32_t) color[0] << 16) | ((uint32_t) color[1] << 8) | (uint32_t) color[2]; uint32_t mask = 1 << (BITS_PER_LED_CMD - 1); - for (uint32_t bit = 0; bit < BITS_PER_LED_CMD; bit++) { + for (auto & bit : led_data_buffer) { uint32_t bit_is_set = bits_to_send & mask; - led_data_buffer[bit] = bit_is_set ? (rmt_item32_t){{{T1H, 1, T1L, 0}}} : (rmt_item32_t){{{T0H, 1, T0L, 0}}}; + bit = bit_is_set ? (rmt_item32_t){{{T1H, 1, T1L, 0}}} : (rmt_item32_t){{{T0H, 1, T0L, 0}}}; mask >>= 1; } ESP_ERROR_CHECK(rmt_write_items(LED_RMT_TX_CHANNEL, led_data_buffer, LED_BUFFER_ITEMS, false));