Fix WS2812 string distortions during analogRead()

Fix WS2812 string distortions during analogRead()
This commit is contained in:
Theo Arends 2023-05-24 15:09:26 +02:00
parent b715f03db6
commit 4be618fe7b
1 changed files with 5 additions and 0 deletions

View File

@ -317,6 +317,11 @@ uint16_t AdcRead(uint32_t pin, uint32_t factor) {
// factor 3 = 8 samples
// factor 4 = 16 samples
// factor 5 = 32 samples
#ifdef USE_LIGHT
if ((XLGT_01 == TasmotaGlobal.light_driver) && LightPower()) {
delay(5); // analogRead() interferes with DMA/RMT so wait for a decent amount of time
}
#endif // USE_LIGHT
uint32_t samples = 1 << factor;
uint32_t analog = 0;
for (uint32_t i = 0; i < samples; i++) {