power: abort a scheduled firmware restart if klipper reports ready

This handles a specific scenario where a power device is bound to the Klipper service and is configured to perform a firmware restart after power on.  In this case, we can detect if the firmware restart is required and abort it if necessary.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-09 07:42:30 -05:00 committed by Eric Callahan
parent 739af51904
commit 7f11214609
1 changed files with 3 additions and 0 deletions

View File

@ -315,6 +315,9 @@ class PowerDevice:
if not self.need_scheduled_restart: if not self.need_scheduled_restart:
return return
self.need_scheduled_restart = False self.need_scheduled_restart = False
if state == "ready":
logging.info("Klipper reports 'ready', aborting firmware restart")
return
event_loop = self.server.get_event_loop() event_loop = self.server.get_event_loop()
kapis: APIComp = self.server.lookup_component("klippy_apis") kapis: APIComp = self.server.lookup_component("klippy_apis")
event_loop.delay_callback( event_loop.delay_callback(