Skip to content

Commit

Permalink
delayed_gcode: make UPDATE_DELAYED_GCODE safe for klippy:ready handlers
Browse files Browse the repository at this point in the history
When another klippy:ready handler executes UPDATE_DELAYED_GCODE before
DelayedGcode's ready handler runs, then self.timer_handler is None,
causing update_timer() to fail.

Signed-off-by: Rolf Schäuble <[email protected]>
  • Loading branch information
rschaeuble committed Jul 2, 2024
1 parent 4d21ffc commit 59ab129
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion klippy/extras/delayed_gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def cmd_UPDATE_DELAYED_GCODE(self, gcmd):
self.duration = gcmd.get_float('DURATION', minval=0.)
if self.inside_timer:
self.repeat = (self.duration != 0.)
else:
elif self.timer_handler is not None:
# Update the timer if it has already been created. A klippy:ready
# handler might call this method before that happened.
waketime = self.reactor.NEVER
if self.duration:
waketime = self.reactor.monotonic() + self.duration
Expand Down

0 comments on commit 59ab129

Please sign in to comment.