diff --git a/klippy/extras/t5uid1/dgus_reloaded/routines.cfg b/klippy/extras/t5uid1/dgus_reloaded/routines.cfg index d3f0e9ca..b88c5ede 100644 --- a/klippy/extras/t5uid1/dgus_reloaded/routines.cfg +++ b/klippy/extras/t5uid1/dgus_reloaded/routines.cfg @@ -109,8 +109,8 @@ script: { abort_page_switch() } {% elif printer.toolhead.homed_axes == "xyz" %} {% set t5uid1 = printer.t5uid1 %} - {% set x = (t5uid1.limits.x_min + t5uid1.limits.x_max) / 2 %} - {% set y = (t5uid1.limits.y_min + t5uid1.limits.y_max) / 2 %} + {% set x = (t5uid1.limits.x_min + t5uid1.limits.x_max) / 2.0 %} + {% set y = (t5uid1.limits.y_min + t5uid1.limits.y_max) / 2.0 %} {% if printer.gcode_move.gcode_position.z < 10 %} G1 Z10 F600 {% endif %} @@ -136,8 +136,8 @@ script: { abort_page_switch() } {% elif printer.toolhead.homed_axes == "xyz" %} {% set t5uid1 = printer.t5uid1 %} - {% set x = (t5uid1.limits.x_min + t5uid1.limits.x_max) / 2 %} - {% set y = (t5uid1.limits.y_min + t5uid1.limits.y_max) / 2 %} + {% set x = (t5uid1.limits.x_min + t5uid1.limits.x_max) / 2.0 %} + {% set y = (t5uid1.limits.y_min + t5uid1.limits.y_max) / 2.0 %} {% if printer.gcode_move.gcode_position.z < 5 %} G1 Z5 F600 {% endif %} diff --git a/klippy/extras/t5uid1/dgus_reloaded/vars_in.cfg b/klippy/extras/t5uid1/dgus_reloaded/vars_in.cfg index 35067bd1..8dc88a37 100644 --- a/klippy/extras/t5uid1/dgus_reloaded/vars_in.cfg +++ b/klippy/extras/t5uid1/dgus_reloaded/vars_in.cfg @@ -102,7 +102,7 @@ script: {% if "z" not in printer.toolhead.homed_axes %} {% do set_message("Homing required") %} {% else %} - {% set offset = data|float / 10 ** 2 %} + {% set offset = data|float / 100 %} SET_GCODE_OFFSET Z={offset} MOVE=1 {% do start_routine("trigger_full_update") %} {% endif %} @@ -236,7 +236,7 @@ script: {% if "z" not in printer.toolhead.homed_axes %} {% do set_message("Homing required") %} {% else %} - {% set offset = data|float / 10 ** 2 %} + {% set offset = data|float / 100 %} SET_GCODE_OFFSET Z={offset} MOVE=1 {% do start_routine("trigger_full_update") %} {% endif %} @@ -289,8 +289,8 @@ script: {% set hop = 5 %} {% set t5uid1 = printer.t5uid1 %} {% if data == 1 %} - {% set x = (t5uid1.limits.x_max - t5uid1.limits.x_min + t5uid1.limits.x_min_inset - t5uid1.limits.x_max_inset) / 2 %} - {% set y = (t5uid1.limits.y_max - t5uid1.limits.y_min + t5uid1.limits.y_min_inset - t5uid1.limits.y_max_inset) / 2 %} + {% set x = (t5uid1.limits.x_max - t5uid1.limits.x_min + t5uid1.limits.x_min_inset - t5uid1.limits.x_max_inset) / 2.0 %} + {% set y = (t5uid1.limits.y_max - t5uid1.limits.y_min + t5uid1.limits.y_min_inset - t5uid1.limits.y_max_inset) / 2.0 %} {% elif data == 2 %} {% set x = t5uid1.limits.x_min + t5uid1.limits.x_min_inset %} {% set y = t5uid1.limits.y_min + t5uid1.limits.y_min_inset %} @@ -442,7 +442,7 @@ script: {% do set_message("Homing required") %} {% else %} {% set t5uid1 = printer.t5uid1 %} - {% set pos = data|float / 10 ** 1 %} + {% set pos = data|float / 10 %} {% if pos < t5uid1.limits.x_min %} {% set pos = t5uid1.limits.x_min %} {% elif pos > t5uid1.limits.x_max %} @@ -465,7 +465,7 @@ script: {% do set_message("Homing required") %} {% else %} {% set t5uid1 = printer.t5uid1 %} - {% set pos = data|float / 10 ** 1 %} + {% set pos = data|float / 10 %} {% if pos < t5uid1.limits.y_min %} {% set pos = t5uid1.limits.y_min %} {% elif pos > t5uid1.limits.y_max %} @@ -488,7 +488,7 @@ script: {% do set_message("Homing required") %} {% else %} {% set t5uid1 = printer.t5uid1 %} - {% set pos = data|float / 10 ** 1 %} + {% set pos = data|float / 10 %} {% if pos < t5uid1.limits.z_min %} {% set pos = t5uid1.limits.z_min %} {% elif pos > t5uid1.limits.z_max %} diff --git a/klippy/extras/t5uid1/t5uid1.py b/klippy/extras/t5uid1/t5uid1.py index 87ae04cc..afc73410 100644 --- a/klippy/extras/t5uid1/t5uid1.py +++ b/klippy/extras/t5uid1/t5uid1.py @@ -44,7 +44,7 @@ CONTROL_TYPES = { def map_value_range(x, in_min, in_max, out_min, out_max): return int(round((x - in_min) * (out_max - out_min) - / (in_max - in_min) + // (in_max - in_min) + out_min)) def get_duration(seconds): @@ -52,9 +52,9 @@ def get_duration(seconds): seconds = int(seconds) if seconds < 0: seconds = 0 - minutes = seconds / 60 - hours = minutes / 60 - days = hours / 24 + minutes = seconds // 60 + hours = minutes // 60 + days = hours // 24 days %= 365 hours %= 24 minutes %= 60 @@ -830,10 +830,10 @@ class T5UID1: and self._z_max < z_max and self._z_max > z_min): z_max = self._z_max - x_min_inset = min(self._x_min_inset, (x_max - x_min) / 2) - x_max_inset = min(self._x_max_inset, (x_max - x_min) / 2) - y_min_inset = min(self._y_min_inset, (y_max - y_min) / 2) - y_max_inset = min(self._y_max_inset, (y_max - y_min) / 2) + x_min_inset = min(self._x_min_inset, (x_max - x_min) / 2.0) + x_max_inset = min(self._x_max_inset, (x_max - x_min) / 2.0) + y_min_inset = min(self._y_min_inset, (y_max - y_min) / 2.0) + y_max_inset = min(self._y_max_inset, (y_max - y_min) / 2.0) return { 'x_min': x_min, 'x_max': x_max,