Vylepseny iterator
This commit is contained in:
parent
83b6b1ebbd
commit
6916d0be5e
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user