I am trying to create an OctoPrint plugin that displays the status of the 3D Printer using a strip of LEDs. To give you some details on how it's working:
After startup, a thread is created as an 'effect runner', it's job is to start the strip (strip = rpi_ws281x.PixelStrip and strip.begin) and then just loop over the effect named by a queue, to communicate current printing state etc.
Whenever the user changes settings, this thread is stopped and restarted with the new settings. This bit works
When the user wants to end the server, OctoPrint calls an on_shutdown event, which my plugin is supposed to react to and end the thread in the same way it does on settings change. However, looking through the deugger it never gets this far.
When I stop the server, I am immediately presented with a Segmentation fault from somewhere within this library. My implementation works when I create a FakeStrip instead of a PixelStrip (Class I made to test the strip, does nothing). Running the library using threads (Outside OctoPrint) and handling a KeyboardInterupt works too.
I have come a long way down this road, so my question is really, is there anything that goes on behind the scenes so that this library also reacts to the signal to end?
Any help, insight, examples of other implementations, or really anything would be really appreciated. Thanks!
Edit: This happens on any version I try going back to 4.2, as I'm on a Pi4
Edit2: For more details, I'm running it over SPI as OctoPrint shouldn't be run as root
Hi there!
I am trying to create an OctoPrint plugin that displays the status of the 3D Printer using a strip of LEDs. To give you some details on how it's working:
strip = rpi_ws281x.PixelStrip
andstrip.begin
) and then just loop over the effect named by a queue, to communicate current printing state etc.on_shutdown
event, which my plugin is supposed to react to and end the thread in the same way it does on settings change. However, looking through the deugger it never gets this far.When I stop the server, I am immediately presented with a Segmentation fault from somewhere within this library. My implementation works when I create a
FakeStrip
instead of aPixelStrip
(Class I made to test the strip, does nothing). Running the library using threads (Outside OctoPrint) and handling aKeyboardInterupt
works too.I have come a long way down this road, so my question is really, is there anything that goes on behind the scenes so that this library also reacts to the signal to end?
Any help, insight, examples of other implementations, or really anything would be really appreciated. Thanks!
Edit: This happens on any version I try going back to 4.2, as I'm on a Pi4
Edit2: For more details, I'm running it over SPI as OctoPrint shouldn't be run as root