Is it possible to execute commands asynchronously from Klipper extensions. For example, if I want to be able to control Neopixels from an extensions but without interrupting what the printer is already doing.
My understanding is that Klipper can insert GCode commands in the command stream, which can me it appear that multiple things are happening at the same time.
However, those commands are executed after whatever is already in the queue. Also, if there is a GCode command that takes a long time (like M190), nothing else can be executed at the same time. So, anything that comes after an M190 will wait for that command to complete.
Not sure what you mean by “extension”. It’s now possible to control neopixels asynchronously via the SET_LED_TEMPLATE command ( G-Codes - Klipper documentation ). It’s also possible to write a Klipper “extras” python module to invoke asynchronous actions. The API server also supports async actions ( API server - Klipper documentation ) though not currently for LEDs.
By “extension” I mean a Klipper “extras” python module.
I looked at the SET_LED_TEMPLATE command and it just manipulates the LEDs directly through the LedHelper instance, setting the colors and doing the updates. However, doesn’t that just insert commands in the stream that is sent to the MCU? Not sure how the MCU works but won’t the update of a long chain of LEDs delay the execution of GCodes?