add configuration option for manual leveling inset

This commit is contained in:
Desuuuu 2021-01-30 12:19:43 +01:00
parent d525ec2e5c
commit a8e13181a2
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
3 changed files with 42 additions and 16 deletions

View File

@ -18,9 +18,23 @@ firmware: dgus_reloaded
#notification_sound:
# The index of the sound to play when certain events happened. Defaults to
# being provided by the selected firmware.
#x_min_inset: 30.0
# The distance (in mm) from the minimum X position used by the manual leveling
# screen.
#x_max_inset: 30.0
# The distance (in mm) from the maximum X position used by the manual leveling
# screen.
#y_min_inset: 30.0
# The distance (in mm) from the minimum Y position used by the manual leveling
# screen.
#y_max_inset: 30.0
# The distance (in mm) from the maximum Y position used by the manual leveling
# screen.
#z_min:
# This can be used to provide a lower limit to Z moves. Movements will still
# be limited by your [stepper_z] configuration values.
# This can be used to provide a lower limit (in mm) to Z moves done using the
# touschreen. Movements will still be limited by your [stepper_z]
# configuration values.
#z_max:
# This can be used to provide an upper limit to Z moves. Movements will still
# be limited by your [stepper_z] configuration values.
# This can be used to provide an upper limit (in mm) to Z moves done using the
# touschreen. Movements will still be limited by your [stepper_z]
# configuration values.

View File

@ -274,24 +274,23 @@ script:
{% elif is_busy() %}
{% do set_message("Busy") %}
{% else %}
{% set inset = 30 %}
{% set hop = 5 %}
{% set t5uid1 = printer.t5uid1 %}
{% if data == 1 %}
{% set x = (t5uid1.limits.x_max - t5uid1.limits.x_min) / 2 %}
{% set y = (t5uid1.limits.y_max - t5uid1.limits.y_min) / 2 %}
{% 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 %}
{% elif data == 2 %}
{% set x = t5uid1.limits.x_min + inset %}
{% set y = t5uid1.limits.y_min + inset %}
{% set x = t5uid1.limits.x_min + t5uid1.limits.x_min_inset %}
{% set y = t5uid1.limits.y_min + t5uid1.limits.y_min_inset %}
{% elif data == 3 %}
{% set x = t5uid1.limits.x_max - inset %}
{% set y = t5uid1.limits.y_min + inset %}
{% set x = t5uid1.limits.x_max - t5uid1.limits.x_max_inset %}
{% set y = t5uid1.limits.y_min + t5uid1.limits.y_min_inset %}
{% elif data == 4 %}
{% set x = t5uid1.limits.x_max - inset %}
{% set y = t5uid1.limits.y_max - inset %}
{% set x = t5uid1.limits.x_max - t5uid1.limits.x_max_inset %}
{% set y = t5uid1.limits.y_max - t5uid1.limits.y_max_inset %}
{% elif data == 5 %}
{% set x = t5uid1.limits.x_min + inset %}
{% set y = t5uid1.limits.y_max - inset %}
{% set x = t5uid1.limits.x_min + t5uid1.limits.x_min_inset %}
{% set y = t5uid1.limits.y_max - t5uid1.limits.y_max_inset %}
{% endif %}
SAVE_GCODE_STATE NAME=state_level_manual_point
G90

View File

@ -15,6 +15,7 @@ T5UID1_firmware_cfg = {
DEFAULT_VOLUME = 75
DEFAULT_BRIGHTNESS = 100
DEFAULT_INSET = 30.0
T5UID1_CMD_WRITEVAR = 0x82
T5UID1_CMD_READVAR = 0x83
@ -133,6 +134,10 @@ class T5UID1:
self._notification_sound = config.getint('notification_sound',
firmware_cfg['notification_sound'], minval=-1, maxval=255)
self._x_min_inset = config.getfloat('x_min_inset', DEFAULT_INSET, minval=0.0)
self._x_max_inset = config.getfloat('x_max_inset', DEFAULT_INSET, minval=0.0)
self._y_min_inset = config.getfloat('y_min_inset', DEFAULT_INSET, minval=0.0)
self._y_max_inset = config.getfloat('y_max_inset', DEFAULT_INSET, minval=0.0)
self._z_min = config.getfloat('z_min', None)
self._z_max = config.getfloat('z_max', None)
@ -801,13 +806,21 @@ 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)
return {
'x_min': x_min,
'x_max': x_max,
'y_min': y_min,
'y_max': y_max,
'z_min': z_min,
'z_max': z_max
'z_max': z_max,
'x_min_inset': x_min_inset,
'x_max_inset': x_max_inset,
'y_min_inset': y_min_inset,
'y_max_inset': y_max_inset
}
def set_message(self, message):