OctoPrint-WS281x_LED_Status
OctoPrint-WS281x_LED_Status copied to clipboard
[Bug]: Torch does not turn off
Description of the bug
I want to use only torch mode. The LEDs turn on if I e.g. press the torch button or if I configure it to turn on automatically when viewing the webcam. But they do not turn off after the configured time frame or after pressing the button again if enabled toggle. They do turn off if I e.g. save the settings or do this via the Utilities page.
Steps to reproduce
- Enable torch mode and configure that it lasts for e.g. 5 seconds
- Save settings. LEDs are off.
- Press torch button at the top. LEDs turn on.
- Wait for 5 seconds. LEDs stay on.
What happened instead?
LEDs stay on.
Plugin version
0.8.1
OctoPrint version
1.8.6
(if relevant) OctoPi version
0.18.0
Log Files & Screenshots
No response
Anything else?
No response
Log Files & Screenshots
No response
Please enable debug logging, and then upload the plugin_ws281x_led_status_debug.log
file after you have reproduced the issue.
You can see in the log that I first try it with a timeout of 4 seconds and then with enabled toggle. In both cases the torch does not turn off. When I press the torch button to disable it nothing gets logged.
This is likely a bug that has been triggered by all the other effects being disabled. The way the plugin turns the torch off is by replacing it with whatever effect was running previously. Here that gets blocked because everything is disabled.
As a workaround, you could try enabling the startup effect, set it to solid colour black (so it's like it's off) and then if I understand correctly the torch will work as intended.
This part of the code is quite fragile as there are loads of different conditions to work through, at some point I plan to rewrite how it works but it won't be for a while - hopefully the workaround works as I won't be able to fix the issue at the moment.
For the workaround to work, I had to reboot the raspberry when settings the off color on startup effect before the torch worked correctly.