zcalibrate: use the new method manual_probe is_active to improve detection of status
This commit is contained in:
parent
294623c13f
commit
062e51f9be
@ -225,8 +225,13 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
self._screen._ws.klippy.gcode_script(f'G0 X{x_position} Y{y_position} F3000')
|
self._screen._ws.klippy.gcode_script(f'G0 X{x_position} Y{y_position} F3000')
|
||||||
|
|
||||||
def process_busy(self, busy):
|
def process_busy(self, busy):
|
||||||
for button in self.buttons:
|
if busy:
|
||||||
self.buttons[button].set_sensitive(not busy)
|
for button in self.buttons:
|
||||||
|
self.buttons[button].set_sensitive(False)
|
||||||
|
elif self._printer.get_stat("manual_probe", "is_active"):
|
||||||
|
self.buttons_calibrating()
|
||||||
|
else:
|
||||||
|
self.buttons_not_calibrating()
|
||||||
|
|
||||||
def process_update(self, action, data):
|
def process_update(self, action, data):
|
||||||
if action == "notify_busy":
|
if action == "notify_busy":
|
||||||
@ -237,23 +242,18 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
self.widgets['zposition'].set_text("Z: ?")
|
self.widgets['zposition'].set_text("Z: ?")
|
||||||
elif "gcode_move" in data and "gcode_position" in data['gcode_move']:
|
elif "gcode_move" in data and "gcode_position" in data['gcode_move']:
|
||||||
self.update_position(data['gcode_move']['gcode_position'])
|
self.update_position(data['gcode_move']['gcode_position'])
|
||||||
|
if "manual_probe" in data:
|
||||||
|
if data["manual_probe"]["is_active"]:
|
||||||
|
self.buttons_calibrating()
|
||||||
|
else:
|
||||||
|
self.buttons_not_calibrating()
|
||||||
elif action == "notify_gcode_response":
|
elif action == "notify_gcode_response":
|
||||||
data = data.lower()
|
if "out of range" in data.lower():
|
||||||
if "unknown" in data:
|
|
||||||
self.buttons_not_calibrating()
|
|
||||||
logging.info(data)
|
|
||||||
elif "save_config" in data:
|
|
||||||
self.buttons_not_calibrating()
|
|
||||||
elif "out of range" in data:
|
|
||||||
self._screen.show_popup_message(data)
|
self._screen.show_popup_message(data)
|
||||||
self.buttons_not_calibrating()
|
|
||||||
logging.info(data)
|
logging.info(data)
|
||||||
elif "fail" in data and "use testz" in data:
|
elif "fail" in data.lower() and "use testz" in data.lower():
|
||||||
self._screen.show_popup_message(_("Failed, adjust position first"))
|
self._screen.show_popup_message(_("Failed, adjust position first"))
|
||||||
self.buttons_not_calibrating()
|
|
||||||
logging.info(data)
|
logging.info(data)
|
||||||
elif "use testz" in data or "use abort" in data or "z position" in data:
|
|
||||||
self.buttons_calibrating()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def update_position(self, position):
|
def update_position(self, position):
|
||||||
@ -305,7 +305,3 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
self.buttons['complete'].get_style_context().remove_class('color3')
|
self.buttons['complete'].get_style_context().remove_class('color3')
|
||||||
self.buttons['cancel'].set_sensitive(False)
|
self.buttons['cancel'].set_sensitive(False)
|
||||||
self.buttons['cancel'].get_style_context().remove_class('color2')
|
self.buttons['cancel'].get_style_context().remove_class('color2')
|
||||||
|
|
||||||
def activate(self):
|
|
||||||
# This is only here because klipper doesn't provide a method to detect if it's calibrating
|
|
||||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.testz_move("+0.001"))
|
|
||||||
|
@ -46,6 +46,7 @@ PRINTER_BASE_STATUS_OBJECTS = [
|
|||||||
'motion_report',
|
'motion_report',
|
||||||
'firmware_retraction',
|
'firmware_retraction',
|
||||||
'exclude_object',
|
'exclude_object',
|
||||||
|
'manual_probe',
|
||||||
]
|
]
|
||||||
|
|
||||||
klipperscreendir = pathlib.Path(__file__).parent.resolve()
|
klipperscreendir = pathlib.Path(__file__).parent.resolve()
|
||||||
@ -240,7 +241,8 @@ class KlipperScreen(Gtk.Window):
|
|||||||
"webhooks": ["state", "state_message"],
|
"webhooks": ["state", "state_message"],
|
||||||
"firmware_retraction": ["retract_length", "retract_speed", "unretract_extra_length", "unretract_speed"],
|
"firmware_retraction": ["retract_length", "retract_speed", "unretract_extra_length", "unretract_speed"],
|
||||||
"motion_report": ["live_position", "live_velocity", "live_extruder_velocity"],
|
"motion_report": ["live_position", "live_velocity", "live_extruder_velocity"],
|
||||||
"exclude_object": ["current_object", "objects", "excluded_objects"]
|
"exclude_object": ["current_object", "objects", "excluded_objects"],
|
||||||
|
"manual_probe": ['is_active'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for extruder in self.printer.get_tools():
|
for extruder in self.printer.get_tools():
|
||||||
@ -724,6 +726,8 @@ class KlipperScreen(Gtk.Window):
|
|||||||
self.printer.process_update({'webhooks': {'state': "ready"}})
|
self.printer.process_update({'webhooks': {'state': "ready"}})
|
||||||
elif action == "notify_status_update" and self.printer.state != "shutdown":
|
elif action == "notify_status_update" and self.printer.state != "shutdown":
|
||||||
self.printer.process_update(data)
|
self.printer.process_update(data)
|
||||||
|
if 'manual_probe' in data and data['manual_probe']['is_active'] and 'zcalibrate' not in self._cur_panels:
|
||||||
|
self.show_panel('zoffset', "zcalibrate", None, 1, False)
|
||||||
elif action == "notify_filelist_changed":
|
elif action == "notify_filelist_changed":
|
||||||
if self.files is not None:
|
if self.files is not None:
|
||||||
self.files.process_update(data)
|
self.files.process_update(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user