adjust neopixel busy time (#18723)

* adjust neopixel busy time

* Adjust time for Berry
This commit is contained in:
s-hadinger 2023-05-25 19:21:18 +02:00 committed by GitHub
parent e05d75248e
commit 6fa22aae6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -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());

View File

@ -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
}