Zcal panel: Support for Z_ENDSTOP_CALIBRATE (#327)

* Zcal panel: Support for Z_ENDSTOP_CALIBRATE

* Suggested changes

* Change naming of Gcodes because it can be calibrating an endstop and not a probe

* Update translations
This commit is contained in:
Alfredo Monclus 2021-11-21 17:40:42 -03:00 committed by GitHub
parent 39804814f5
commit 4f61cedd6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 119 additions and 145 deletions

View File

@ -26,9 +26,10 @@ class KlippyGcodes:
SET_SPD_FACTOR = "M220"
PROBE_CALIBRATE = "PROBE_CALIBRATE"
PROBE_MOVE = "TESTZ Z="
PROBE_ABORT = "ABORT"
PROBE_ACCEPT = "ACCEPT"
Z_ENDSTOP_CALIBRATE = "Z_ENDSTOP_CALIBRATE"
TESTZ = "TESTZ Z="
ABORT = "ABORT"
ACCEPT = "ACCEPT"
SAVE_CONFIG = "SAVE_CONFIG"
RESTART = "RESTART"
@ -65,8 +66,8 @@ class KlippyGcodes:
return "%s S%s" % (KlippyGcodes.SET_SPD_FACTOR, rate)
@staticmethod
def probe_move(dist):
return KlippyGcodes.PROBE_MOVE + dist
def testz_move(dist):
return KlippyGcodes.TESTZ + dist
@staticmethod
def extrude(dist, speed=500):

View File

@ -138,7 +138,6 @@ enable: {{ printer.bed_mesh is defined }}
name: {{ gettext('Z Calibrate') }}
icon: z-farther
panel: zcalibrate
enable: {{ ((printer.bltouch != False) or (printer.probe != False)) }}
[menu __main config limits]
name: {{ gettext('Limits') }}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -87,9 +87,6 @@ msgstr ""
msgid "Close"
msgstr ""
msgid "Colorized"
msgstr ""
msgid "Complete"
msgstr ""
@ -448,6 +445,9 @@ msgstr ""
msgid "Square Corner Velocity"
msgstr ""
msgid "Start"
msgstr ""
msgid "Starting WiFi Re-association"
msgstr ""

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"PO-Revision-Date: 2021-11-02 23:22+0100\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:32-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
@ -467,6 +467,9 @@ msgstr "Geschwindigkeit -"
msgid "Square Corner Velocity"
msgstr "Eckgeschwindigkeit"
msgid "Start"
msgstr "Starten"
msgid "Starting WiFi Re-association"
msgstr "Starte WiFi Verbindung"
@ -572,26 +575,5 @@ msgstr "mm/s^2"
#~ msgid "Control"
#~ msgstr "Steuerung"
#~ msgid "Emergency Stop"
#~ msgstr "NOT-STOP"
#~ msgid "Fan Off"
#~ msgstr "Lüfter Aus"
#~ msgid "Fan On"
#~ msgstr "Lüfter An"
#~ msgid "Fast"
#~ msgstr "Schnell"
#~ msgid "File Estimation (default)"
#~ msgstr "Dateischätzung"
#~ msgid "Load Average"
#~ msgstr "Durchschnittslast"
#~ msgid "Set Speed"
#~ msgstr "Geschwindigkeit einstellen"
#~ msgid "Slow"
#~ msgstr "Langsam"

View File

@ -1,3 +1,6 @@
msgid ""
msgstr ""
#, python-format
msgid "%d Packages will be updated"
msgstr ""
@ -13,7 +16,7 @@ msgid "24 Hour Time"
msgstr ""
msgid "Abort"
msgstr "Abort"
msgstr ""
msgid "Accept"
msgstr ""
@ -68,9 +71,6 @@ msgstr ""
msgid "Close"
msgstr ""
msgid "Colorized"
msgstr ""
msgid "Complete"
msgstr ""
@ -429,6 +429,9 @@ msgstr ""
msgid "Square Corner Velocity"
msgstr ""
msgid "Start"
msgstr ""
msgid "Starting WiFi Re-association"
msgstr ""

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"PO-Revision-Date: 2021-09-29 10:52-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:33-0300\n"
"Last-Translator: alfrix\n"
"Language-Team: \n"
"Language: es\n"
@ -89,9 +89,6 @@ msgstr ""
msgid "Close"
msgstr "Cerrar"
msgid "Colorized"
msgstr "Colorized"
msgid "Complete"
msgstr "Completado"
@ -456,6 +453,9 @@ msgstr "Velocidad -"
msgid "Square Corner Velocity"
msgstr "Velocidad de esquina"
msgid "Start"
msgstr "Iniciar"
msgid "Starting WiFi Re-association"
msgstr "Comenzando re-asociación"
@ -549,9 +549,6 @@ msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (por defecto)"
#~ msgid "Medium (default)"
#~ msgstr "Medio (por defecto)"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-17 23:05-0300\n"
"PO-Revision-Date: 2021-11-17 23:05-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:33-0300\n"
"Last-Translator: Bahoue & alfrix\n"
"Language-Team: \n"
"Language: fr_FR\n"
@ -454,6 +454,9 @@ msgstr "Vitesse -"
msgid "Square Corner Velocity"
msgstr "Vélocité des angles droits"
msgid "Start"
msgstr "Démarrer"
msgid "Starting WiFi Re-association"
msgstr "Démarrage de la re-association WiFi"
@ -545,12 +548,6 @@ msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
#~ msgid "Colorized"
#~ msgstr "Colorisé"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (défaut)"
#~ msgid "Medium (default)"
#~ msgstr "Moyen (défaut)"
@ -599,10 +596,6 @@ msgstr "mm/s^2"
#~ msgid "Network Info"
#~ msgstr "Information réseau "
#, fuzzy
#~ msgid "Klipper"
#~ msgstr "Redémarrer klipper"
#~ msgid "Back"
#~ msgstr "Retour"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Klipperscreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"PO-Revision-Date: 2021-09-29 10:57-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:34-0300\n"
"Last-Translator: Emanuel Sharvit <manu7irl@gmail.com>\n"
"Language-Team: \n"
"Language: he_IL\n"
@ -92,9 +92,6 @@ msgstr ""
msgid "Close"
msgstr "סגור"
msgid "Colorized"
msgstr "Colorized"
msgid "Complete"
msgstr "לְהַשְׁלִים"
@ -457,6 +454,9 @@ msgstr "מהירות -"
msgid "Square Corner Velocity"
msgstr "מהירות פינה מרובעת"
msgid "Start"
msgstr "הַתחָלָה"
msgid "Starting WiFi Re-association"
msgstr "התחלת שיוך מחדש ל- WiFi"
@ -550,19 +550,12 @@ msgstr "מ\"מ/ש"
msgid "mm/s^2"
msgstr "mm/s^2"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (default)"
#~ msgid "Medium (default)"
#~ msgstr "בינוני (ברירת מחדל)"
#~ msgid "File Estimation (default)"
#~ msgstr "קובץ (ברירת מחדל)"
#, fuzzy
#~ msgid "Change Printer"
#~ msgstr "בטל הדפסה"
#~ msgid "Fan Off"
#~ msgstr "כבה מאוורר"
@ -599,10 +592,6 @@ msgstr "mm/s^2"
#~ msgid "Network Info"
#~ msgstr "מידע על הרשת"
#, fuzzy
#~ msgid "Klipper"
#~ msgstr "אתחול קליפר"
#~ msgid "Back"
#~ msgstr "חזור"

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: \n"
"Last-Translator: pappicio\n"
"Language-Team: \n"
@ -85,9 +85,6 @@ msgstr ""
msgid "Close"
msgstr "Chiudi"
msgid "Colorized"
msgstr "Colorato"
msgid "Complete"
msgstr "Completo"
@ -452,6 +449,9 @@ msgstr "Velocità-"
msgid "Square Corner Velocity"
msgstr "Velocità Square Corner"
msgid "Start"
msgstr "Iniziare"
msgid "Starting WiFi Re-association"
msgstr "Riassocia WiFi"
@ -545,9 +545,6 @@ msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (default)"
#~ msgid "Medium (default)"
#~ msgstr "Media (predef.)"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"PO-Revision-Date: 2021-09-29 11:33-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:36-0300\n"
"Last-Translator: Jakob Kais <schpuntik@freenet.de>\n"
"Language-Team: Russian <kde-i18n-de@kde.org>\n"
"Language: ru\n"
@ -91,9 +91,6 @@ msgstr ""
msgid "Close"
msgstr "Закрыть"
msgid "Colorized"
msgstr "Цветная"
msgid "Complete"
msgstr "Готово"
@ -458,6 +455,9 @@ msgstr "Скорость -"
msgid "Square Corner Velocity"
msgstr "Квадратная угловая скорость"
msgid "Start"
msgstr "Hачать"
msgid "Starting WiFi Re-association"
msgstr "WiFi реконенект"
@ -549,9 +549,6 @@ msgstr "мм/с"
msgid "mm/s^2"
msgstr "мм/с^2"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (default)"
#~ msgid "Medium (default)"
#~ msgstr "Средний (по умолчанию)"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-29 11:44-0300\n"
"PO-Revision-Date: 2021-09-29 11:35-0300\n"
"POT-Creation-Date: 2021-11-18 11:29-0300\n"
"PO-Revision-Date: 2021-11-18 11:36-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
@ -90,9 +90,6 @@ msgstr ""
msgid "Close"
msgstr "关闭"
msgid "Colorized"
msgstr "Colorized"
msgid "Complete"
msgstr "完成"
@ -455,6 +452,9 @@ msgstr "速度 -"
msgid "Square Corner Velocity"
msgstr "方角速度"
msgid "Start"
msgstr "開始"
msgid "Starting WiFi Re-association"
msgstr "启动 WiFi 重新关联"
@ -544,19 +544,12 @@ msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
#~ msgid "Z-bolt (default)"
#~ msgstr "Z-bolt (default)"
#~ msgid "Medium (default)"
#~ msgstr "中(默认"
#~ msgid "File Estimation (default)"
#~ msgstr "文件估计(默认)"
#, fuzzy
#~ msgid "Change Printer"
#~ msgstr "取消打印"
#~ msgid "Fan Off"
#~ msgstr "关闭风扇"

View File

@ -13,7 +13,7 @@ def create_panel(*args):
class ZCalibratePanel(ScreenPanel):
_screen = None
labels = {}
widgets = {}
distance = 1
distances = ['.01', '.05', '.1', '.5', '1', '5']
@ -25,26 +25,35 @@ class ZCalibratePanel(ScreenPanel):
grid = Gtk.Grid()
label = Gtk.Label(_("Z Offset") + ": \n")
self.labels['zposition'] = Gtk.Label(_("Homing"))
box = Gtk.VBox()
box.set_vexpand(False)
box.set_valign(Gtk.Align.CENTER)
self.widgets['zposition'] = Gtk.Label(_("Homing"))
pos = Gtk.VBox()
pos.set_vexpand(False)
pos.set_valign(Gtk.Align.CENTER)
pos.add(label)
pos.add(self.widgets['zposition'])
box.add(label)
box.add(self.labels['zposition'])
self.widgets['zpos'] = self._gtk.ButtonImage('z-farther', _("Raise Nozzle"))
self.widgets['zpos'].connect("clicked", self.move, "+")
self.widgets['zpos'].set_sensitive(False)
self.widgets['zneg'] = self._gtk.ButtonImage('z-closer', _("Lower Nozzle"))
self.widgets['zneg'].connect("clicked", self.move, "-")
self.widgets['zneg'].set_sensitive(False)
self.widgets['start'] = self._gtk.ButtonImage('resume', _("Start"), 'color3')
self.widgets['start'].connect("clicked", self.start_calibration)
zpos = self._gtk.ButtonImage('z-farther', _("Raise Nozzle"), 'color3')
zpos.connect("clicked", self.move, "+")
zneg = self._gtk.ButtonImage('z-closer', _("Lower Nozzle"), 'color2')
zneg.connect("clicked", self.move, "-")
self.widgets['complete'] = self._gtk.ButtonImage('complete', _('Accept'))
self.widgets['complete'].connect("clicked", self.accept)
self.widgets['complete'].set_sensitive(False)
cancel = self._gtk.ButtonImage('cancel', _('Abort'), 'color2')
cancel.connect("clicked", self.abort)
distgrid = Gtk.Grid()
j = 0
for i in self.distances:
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
self.widgets[i] = self._gtk.ToggleButton(i)
self.widgets[i].set_direction(Gtk.TextDirection.LTR)
self.widgets[i].connect("clicked", self.change_distance, i)
ctx = self.widgets[i].get_style_context()
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_top")
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances)-1):
@ -53,35 +62,28 @@ class ZCalibratePanel(ScreenPanel):
ctx.add_class("distbutton")
if i == "1":
ctx.add_class("distbutton_active")
distgrid.attach(self.labels[i], j, 0, 1, 1)
distgrid.attach(self.widgets[i], j, 0, 1, 1)
j += 1
self.labels["1"].set_active(True)
bottombox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.labels['move_dist'] = Gtk.Label(_("Move Distance (mm)"))
bottombox.pack_start(self.labels['move_dist'], True, True, 0)
bottombox.pack_start(distgrid, True, True, 0)
complete = self._gtk.ButtonImage('complete', _('Accept'), 'color4')
complete.connect("clicked", self.accept)
b = self._gtk.ButtonImage('cancel', _('Abort'), 'color1')
b.connect("clicked", self.abort)
self.widgets["1"].set_active(True)
distances = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.widgets['move_dist'] = Gtk.Label(_("Move Distance (mm)"))
distances.pack_start(self.widgets['move_dist'], True, True, 0)
distances.pack_start(distgrid, True, True, 0)
grid.set_column_homogeneous(True)
grid.attach(zpos, 0, 0, 1, 1)
grid.attach(box, 1, 0, 2, 2)
grid.attach(zneg, 0, 1, 1, 1)
grid.attach(complete, 3, 0, 1, 1)
grid.attach(bottombox, 0, 2, 4, 1)
grid.attach(b, 3, 1, 1, 1)
grid.attach(self.widgets['zpos'], 0, 0, 1, 1)
grid.attach(self.widgets['start'], 1, 0, 1, 1)
grid.attach(pos, 1, 1, 1, 1)
grid.attach(self.widgets['zneg'], 0, 1, 1, 1)
grid.attach(self.widgets['complete'], 2, 0, 1, 1)
grid.attach(distances, 0, 2, 3, 1)
grid.attach(cancel, 2, 1, 1, 1)
self.content.add(grid)
def activate(self):
def start_calibration(self, widget):
if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
@ -90,7 +92,19 @@ class ZCalibratePanel(ScreenPanel):
y_position = self._config.get_config()['z_calibrate_position'].getint("calibrate_y_position", 0)
if x_position > 0 and y_position > 0:
self._screen._ws.klippy.gcode_script('G0 X%d Y%d F3000' % (x_position, y_position))
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_CALIBRATE)
if (self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch")):
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_CALIBRATE)
else:
self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_ENDSTOP_CALIBRATE)
self.widgets['start'].get_style_context().remove_class('color3')
self.widgets['zpos'].set_sensitive(True)
self.widgets['zpos'].get_style_context().add_class('color4')
self.widgets['zneg'].set_sensitive(True)
self.widgets['zneg'].get_style_context().add_class('color1')
self.widgets['complete'].set_sensitive(True)
self.widgets['complete'].get_style_context().add_class('color3')
def process_update(self, action, data):
if action != "notify_status_update":
@ -100,34 +114,43 @@ class ZCalibratePanel(ScreenPanel):
self.updatePosition(data['toolhead']['position'])
def updatePosition(self, position):
self.labels['zposition'].set_text(str(round(position[2], 2)))
self.widgets['zposition'].set_text(str(round(position[2], 2)))
def change_distance(self, widget, distance):
if self.distance == distance:
return
ctx = self.labels[str(self.distance)].get_style_context()
ctx = self.widgets[str(self.distance)].get_style_context()
ctx.remove_class("distbutton_active")
self.distance = distance
ctx = self.labels[self.distance].get_style_context()
ctx = self.widgets[self.distance].get_style_context()
ctx.add_class("distbutton_active")
for i in self.distances:
if i == self.distance:
continue
self.labels[str(i)].set_active(False)
self.widgets[str(i)].set_active(False)
def move(self, widget, dir):
dist = str(self.distance) if dir == "+" else "-" + str(self.distance)
logging.info("# Moving %s", KlippyGcodes.probe_move(dist))
self._screen._ws.klippy.gcode_script(KlippyGcodes.probe_move(dist))
logging.info("# Moving %s", KlippyGcodes.testz_move(dist))
self._screen._ws.klippy.gcode_script(KlippyGcodes.testz_move(dist))
def abort(self, widget):
logging.info("Aborting Z calibrate")
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_ABORT)
self._screen._ws.klippy.gcode_script(KlippyGcodes.ABORT)
self.widgets['start'].get_style_context().add_class('color3')
self.widgets['zpos'].set_sensitive(False)
self.widgets['zpos'].get_style_context().remove_class('color4')
self.widgets['zneg'].set_sensitive(False)
self.widgets['zneg'].get_style_context().remove_class('color1')
self.widgets['complete'].set_sensitive(False)
self.widgets['complete'].get_style_context().remove_class('color3')
self.menu_return(widget)
def accept(self, widget):
logging.info("Accepting Z calibrate")
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_ACCEPT)
self._screen._ws.klippy.gcode_script(KlippyGcodes.ACCEPT)
self.menu_return(widget)