Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.59k stars 3.13k forks source link

Receiving adalight over serial crashes ESP 32. Reference #2618 #3409

Closed AZDane closed 4 months ago

AZDane commented 11 months ago

What happened?

Adalight over serial causes ESP 32 (CP2104) crash.

To Reproduce Bug

To replicate, use HyperHDR to send adalight data over a serial connection to ESP 32 board. Board will crash and reboot after a short period of time. Lowest baud rates will not crash the ESP 32, but will be unusable for my purpose. I use 266 SK6812 LEDs for TV Ambilight.

Expected Behavior

Serial data should not cause board crashes.

Install Method

Binary from WLED.me

What version of WLED?

WLED 14.0b6

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

softhack007 commented 11 months ago

It might be a watchdog reset. The main loop in wled_serial.cpp runs as long as there is data in the serial receive buffer. At 230Kbaud, this is basically "always". So after max 300ms of continuously receiving, the task watchdog will bite, and esp32 reboots.

The solution could be to add a time limit to the while loop, and force-exit after maybe 30ms of receiving - this would be needed any way, to ensure that other WLED features have a chance to run.

https://github.com/Aircoookie/WLED/blob/332be7edd69853f70aebf92b83a4f0f275bcfa96/wled00/wled_serial.cpp#L83

github-actions[bot] commented 5 months ago

Hey! This issue has been open for quite some time without any new comments now. It will be closed automatically in a week if no further activity occurs. Thank you for using WLED! ✨