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 Jun 29, 2024
1 parent 4d21ffc commit c8ec9d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion klippy/extras/delayed_gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def cmd_UPDATE_DELAYED_GCODE(self, gcmd):
waketime = self.reactor.NEVER
if self.duration:
waketime = self.reactor.monotonic() + self.duration
self.reactor.update_timer(self.timer_handler, waketime)

# Update the timer if it has already been created. A klippy:ready
# handler might call this method before that happened.
if self.timer_handler is not None:
self.reactor.update_timer(self.timer_handler, waketime)

def load_config_prefix(config):
return DelayedGcode(config)

0 comments on commit c8ec9d2

Please sign in to comment.