Skip to content

Commit 69768c9

Browse files
torwagdpgeorge
authored andcommitted
esp8266/espneopixel: Disable IRQs during eps.neopixel_write.
Interrupts during neopixel_write causes timing problems and therefore wrong light patterns. Switching off IRQs should help to keep the strict timing schedule.
1 parent e4d6a10 commit 69768c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

esp8266/espneopixel.c

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void /*ICACHE_RAM_ATTR*/ esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32
4141
}
4242
#endif
4343

44+
uint32_t irq_state = mp_hal_quiet_timing_enter();
4445
for(t = time0;; t = time0) {
4546
if(pix & mask) t = time1; // Bit high duration
4647
while(((c = mp_hal_ticks_cpu()) - startTime) < period); // Wait for bit start
@@ -55,4 +56,5 @@ void /*ICACHE_RAM_ATTR*/ esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32
5556
}
5657
}
5758
while((mp_hal_ticks_cpu() - startTime) < period); // Wait for last bit
59+
mp_hal_quiet_timing_exit(irq_state);
5860
}

0 commit comments

Comments
 (0)