andrewmcgr / klipper_tmc_autotune

TMC stepper driver autotuning Klipper python extra
GNU General Public License v3.0
605 stars 131 forks source link

Move code ouf of the klippy:ready handler into a deferred callback. #203

Open rschaeuble opened 11 hours ago

rschaeuble commented 11 hours ago

Currently the klippy:ready event handler breaks the rules by pausing the reactor. This happens when using mcu_tmc.

As a result of that, the printer will appear ready to Moonraker before it really, which then can lead to Moonraker sending commands to a not-ready Klipper. A scenario where this happens (moonraker-timelapse) and details can be found in the discussion of https://github.com/Klipper3d/klipper/pull/6631.

This fix moves the problematic code out of the event handler by registering a callback which then runs the tuning.