allow the t5uid1 code to work even with [display_status] defined

This commit is contained in:
Desuuuu 2021-01-30 10:52:50 +01:00
parent 25f8e79590
commit 9813600ef4
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
1 changed files with 19 additions and 2 deletions

View File

@ -154,6 +154,9 @@ class T5UID1:
self._t5uid1_ping_cmd = self._t5uid1_write_cmd = None
self._is_connected = False
self._original_M73 = None
self._original_M117 = None
global_context = {
'get_variable': self.get_variable,
'set_variable': self.set_variable,
@ -234,8 +237,6 @@ class T5UID1:
'DGUS_PRINT_START', self.cmd_DGUS_PRINT_START)
self.gcode.register_command(
'DGUS_PRINT_END', self.cmd_DGUS_PRINT_END)
self.gcode.register_command('M73', self.cmd_M73)
self.gcode.register_command('M117', self.cmd_M117)
self.gcode.register_command('M300', self.cmd_M300)
self.printer.register_event_handler("klippy:ready",
@ -360,6 +361,18 @@ class T5UID1:
except self.printer.config_error:
pass
if self._original_M73 is None:
original_M73 = self.gcode.register_command('M73', None)
if original_M73 != self.cmd_M73:
self._original_M73 = original_M73
self.gcode.register_command('M73', self.cmd_M73)
if self._original_M117 is None:
original_M117 = self.gcode.register_command('M117', None)
if original_M117 != self.cmd_M117:
self._original_M117 = original_M117
self.gcode.register_command('M117', self.cmd_M117)
self._status_data.update({
'limits': self.limits(),
'has_bltouch': has_bltouch
@ -861,6 +874,8 @@ class T5UID1:
def cmd_M73(self, gcmd):
progress = gcmd.get_int('P', 0)
self._print_progress = min(100, max(0, progress))
if self._original_M73 is not None:
self._original_M73(gcmd)
def cmd_M117(self, gcmd):
msg = gcmd.get_commandline()
@ -873,6 +888,8 @@ class T5UID1:
self.set_message(msg[5:])
else:
self.set_message("")
if self._original_M117 is not None:
self._original_M117(gcmd)
def cmd_M300(self, gcmd):
if self._notification_sound >= 0: