From 6fa22aae6b1b2a84fef6d592b1aebb0caa661091 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 25 May 2023 19:21:18 +0200 Subject: [PATCH] adjust neopixel busy time (#18723) * adjust neopixel busy time * Adjust time for Berry --- tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino | 12 ++++++++---- tasmota/tasmota_xlgt_light/xlgt_01_ws2812.ino | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino index c3af02426..4b5b542da 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino @@ -134,11 +134,15 @@ extern "C" { if (s_sk6812_grbw) s_sk6812_grbw->Begin(); break; case 2: // # 02 : show void -> void - if (s_ws2812_grb) s_ws2812_grb->Show(); - if (s_sk6812_grbw) s_sk6812_grbw->Show(); + { + uint32_t pixels_size; // number of bytes to push + if (s_ws2812_grb) { s_ws2812_grb->Show(); pixels_size = s_ws2812_grb->PixelsSize(); } + if (s_sk6812_grbw) { s_sk6812_grbw->Show(); pixels_size = s_ws2812_grb->PixelsSize(); } + // Wait for RMT/I2S to complete fixes distortion due to analogRead -// delay(5); - SystemBusyDelay(5); // Max 256 leds + // 1ms is needed for 96 bytes + SystemBusyDelay((pixels_size + 95) / 96); + } break; case 3: // # 03 : CanShow void -> bool if (s_ws2812_grb) be_pushbool(vm, s_ws2812_grb->CanShow()); diff --git a/tasmota/tasmota_xlgt_light/xlgt_01_ws2812.ino b/tasmota/tasmota_xlgt_light/xlgt_01_ws2812.ino index 13032fdf8..3312a8322 100644 --- a/tasmota/tasmota_xlgt_light/xlgt_01_ws2812.ino +++ b/tasmota/tasmota_xlgt_light/xlgt_01_ws2812.ino @@ -218,7 +218,7 @@ void Ws2812LibStripShow(void) { #if defined(USE_WS2812_DMA) || defined(USE_WS2812_RMT) || defined(USE_WS2812_I2S) // Wait for DMA/RMT/I2S to complete fixes distortion due to analogRead // delay((Settings->light_pixels >> 6) +1); // 256 / 64 = 4 +1 = 5 - SystemBusyDelay((Settings->light_pixels >> 6) +1); // 256 / 64 = 4 +1 = 5 + SystemBusyDelay( (Settings->light_pixels + 31) >> 5); // (256 + 32) / 32 = 8 #endif }