Merge commit '3c4ef8151927e2cb6cd5b5a3d66b50823d74c85b' into release

This commit is contained in:
张开科 2025-06-21 14:14:20 +08:00
commit 809672db45
15 changed files with 352 additions and 178 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-03-29 17:34+0800\n"
"POT-Creation-Date: 2025-06-19 16:45+0800\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"
@ -73,15 +73,9 @@ msgstr ""
msgid "Activate"
msgstr ""
msgid "Adaptive Bed Leveling"
msgstr ""
msgid "Add"
msgstr ""
msgid "Add profile"
msgstr ""
msgid "Advanced"
msgstr ""
@ -138,7 +132,7 @@ msgstr ""
msgid "Auto"
msgstr ""
msgid "Auto Calibration"
msgid "Auto Bed Leveling"
msgstr ""
msgid "Auto Change Nozzle"
@ -159,6 +153,9 @@ msgstr ""
msgid "Auto-scroll"
msgstr ""
msgid "Automatic compensation based on the data of the bed mesh"
msgstr ""
msgid "Bed Level"
msgstr ""
@ -387,6 +384,9 @@ msgstr ""
msgid "Fan"
msgstr ""
msgid "Fast Calibration"
msgstr ""
msgid "Filament"
msgstr ""
@ -414,6 +414,9 @@ msgstr ""
msgid "Finding ADXL"
msgstr ""
msgid "Fine Calibration"
msgstr ""
msgid "Fine Tuning"
msgstr ""
@ -531,9 +534,6 @@ msgstr ""
msgid "Key:"
msgstr ""
msgid "Klipper Restart"
msgstr ""
msgid "Klipper has disconnected"
msgstr ""
@ -580,9 +580,6 @@ msgstr ""
msgid "Left:"
msgstr ""
msgid "Leveling only in the actual print area"
msgstr ""
msgid "License key"
msgstr ""
@ -853,9 +850,6 @@ msgstr ""
msgid "Probe Offset"
msgstr ""
msgid "Profile Name:"
msgstr ""
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr ""
@ -1055,12 +1049,6 @@ msgstr ""
msgid "System"
msgstr ""
msgid "System Restart"
msgstr ""
msgid "System Shutdown"
msgstr ""
msgid "System:"
msgstr ""

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-31 14:57+0800\n"
"POT-Creation-Date: 2025-06-19 14:30+0800\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -65,7 +65,10 @@ msgstr ""
msgid "Accept"
msgstr ""
msgid "Adaptive Bed Leveling"
msgid "Activate"
msgstr ""
msgid "Add"
msgstr ""
msgid "Add profile"
@ -127,7 +130,7 @@ msgstr ""
msgid "Auto"
msgstr ""
msgid "Auto Calibration"
msgid "Auto Bed Leveling"
msgstr ""
msgid "Auto Change Nozzle"
@ -148,6 +151,9 @@ msgstr ""
msgid "Auto-scroll"
msgstr ""
msgid "Automatic compensation based on the data of the bed mesh"
msgstr ""
msgid "Bed Level"
msgstr ""
@ -229,9 +235,6 @@ msgstr ""
msgid "Confirm factory reset?\n"
msgstr ""
msgid "Connected"
msgstr ""
msgid "Connecting"
msgstr ""
@ -287,6 +290,9 @@ msgstr ""
msgid "Disable for 12hs with am / pm"
msgstr ""
msgid "Disabled"
msgstr ""
msgid "Disconnect"
msgstr ""
@ -301,12 +307,21 @@ msgstr ""
msgid "Do you want to recover %s?"
msgstr ""
msgid "Door Open Protection Mode"
msgstr ""
msgid "Elapsed trial time:"
msgstr ""
msgid "Elapsed:"
msgstr ""
msgid "Emergency Stop"
msgstr ""
msgid "Enable Registration Code"
msgstr ""
msgid "Enable screen power management"
msgstr ""
@ -457,9 +472,6 @@ msgstr ""
msgid "Host"
msgstr ""
msgid "Hostname"
msgstr ""
msgid "ID"
msgstr ""
@ -502,7 +514,16 @@ msgstr ""
msgid "Job Status"
msgstr ""
msgid "Klipper Restart"
msgid "Key is empty"
msgstr ""
msgid "Key is invalid"
msgstr ""
msgid "Key is valid"
msgstr ""
msgid "Key:"
msgstr ""
msgid "Klipper has disconnected"
@ -551,7 +572,7 @@ msgstr ""
msgid "Left:"
msgstr ""
msgid "Leveling only in the actual print area"
msgid "License key"
msgstr ""
msgid "Limits"
@ -617,6 +638,9 @@ msgstr ""
msgid "Minimum:"
msgstr ""
msgid "Minus"
msgstr ""
msgid "Modified"
msgstr ""
@ -677,6 +701,9 @@ msgstr ""
msgid "Not Inserted"
msgstr ""
msgid "Not activated"
msgstr ""
msgid "Not all screens support this"
msgstr ""
@ -734,18 +761,30 @@ msgstr ""
msgid "Pause"
msgstr ""
msgid "Pause Print"
msgstr ""
msgid "Paused"
msgstr ""
msgid "Perform a full upgrade?"
msgstr ""
msgid "Permanent Activation"
msgstr ""
msgid "Pins"
msgstr ""
msgid "Please close the door and click Resume to proceed."
msgstr ""
msgid "Please ensure that the Probe Calibrate has been performed"
msgstr ""
msgid "Please enter a key to activate"
msgstr ""
msgid "Please enter a valid number"
msgstr ""
@ -788,6 +827,12 @@ msgstr ""
msgid "Printer Select"
msgstr ""
msgid "Printer door is opened. Please close the door and then start printing."
msgstr ""
msgid "Printer door is opening!"
msgstr ""
msgid "Printing"
msgstr ""
@ -830,6 +875,9 @@ msgstr ""
msgid "Refresh"
msgstr ""
msgid "Remaining Time:"
msgstr ""
msgid "Remove network"
msgstr ""
@ -848,10 +896,7 @@ msgstr ""
msgid "Restores your print job after a power outage"
msgstr ""
msgid "Restoring Left extruder temperature, this may take some time"
msgstr ""
msgid "Restoring Right extruder temperature, this may take some time"
msgid "Restoring activated extruder temperature, this may take some time."
msgstr ""
msgid "Resume"
@ -921,6 +966,9 @@ msgstr ""
msgid "Send"
msgstr ""
msgid "Serial Number:"
msgstr ""
msgid "Settings"
msgstr ""
@ -942,6 +990,9 @@ msgstr ""
msgid "Size"
msgstr ""
msgid "Skip"
msgstr ""
msgid "Slicer"
msgstr ""
@ -981,39 +1032,47 @@ msgstr ""
msgid "Start testing the Z offset value of the second nozzle?\n"
msgstr ""
msgid "Starting WiFi Association"
msgstr ""
msgid "Starting recovery for"
msgstr ""
msgid "Starting update for"
msgstr ""
msgid "State:"
msgstr ""
msgid "System"
msgstr ""
msgid "System Restart"
msgstr ""
msgid "System Shutdown"
msgstr ""
msgid "System:"
msgstr ""
msgid "Temperature"
msgstr ""
msgid "Test Mode"
msgstr ""
msgid "The last print job was not completed continue printing?"
msgstr ""
msgid "The new value is not within the valid range."
msgstr ""
msgid "The system doesn't meet the minimum requirement"
msgstr ""
msgid "The system will reboot!"
msgstr ""
msgid "This device is not activated and is available for trial use only"
msgstr ""
msgid ""
"This feature allows you to customize the printer's response when door "
"opening is detected"
msgstr ""
msgid "This operation is about to print the model"
msgstr ""
@ -1032,6 +1091,15 @@ msgstr ""
msgid "Total:"
msgstr ""
msgid "Trial"
msgstr ""
msgid "Trial Time:"
msgstr ""
msgid "Unknown"
msgstr ""
msgid "Unknown Heater"
msgstr ""
@ -1134,6 +1202,9 @@ msgid_plural "hours"
msgstr[0] ""
msgstr[1] ""
msgid "license"
msgstr ""
msgid "macros that use 'rename_existing' are hidden"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-03-29 17:34+0800\n"
"POT-Creation-Date: 2025-06-19 16:45+0800\n"
"PO-Revision-Date: 2024-06-03 19:09+0000\n"
"Last-Translator: wsj20050623 <2129426599@qq.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
@ -74,15 +74,9 @@ msgstr "确定"
msgid "Activate"
msgstr "激活"
msgid "Adaptive Bed Leveling"
msgstr "自适应床调平"
msgid "Add"
msgstr "加"
msgid "Add profile"
msgstr "添加配置文件"
msgid "Advanced"
msgstr "高级"
@ -139,8 +133,8 @@ msgstr "停止打印前需要额外确认"
msgid "Auto"
msgstr "自动"
msgid "Auto Calibration"
msgstr "自动校准"
msgid "Auto Bed Leveling"
msgstr "自动调平"
msgid "Auto Change Nozzle"
msgstr "断料自动切头"
@ -160,6 +154,9 @@ msgstr "暂停打印时自动打开挤出控制界面"
msgid "Auto-scroll"
msgstr "自动滚屏"
msgid "Automatic compensation based on the data of the bed mesh"
msgstr "基于床面网格数据的自动补偿"
msgid "Bed Level"
msgstr "热床调平"
@ -388,6 +385,9 @@ msgstr "失败,请先调整位置"
msgid "Fan"
msgstr "风扇"
msgid "Fast Calibration"
msgstr "快速校准"
msgid "Filament"
msgstr "耗材"
@ -415,6 +415,9 @@ msgstr "筛选"
msgid "Finding ADXL"
msgstr "查找加速度计中"
msgid "Fine Calibration"
msgstr "精细校准"
msgid "Fine Tuning"
msgstr "微调"
@ -532,9 +535,6 @@ msgstr "密钥有效"
msgid "Key:"
msgstr "密钥:"
msgid "Klipper Restart"
msgstr "重启Klipper"
msgid "Klipper has disconnected"
msgstr "Klipper已断开连接"
@ -581,9 +581,6 @@ msgstr "左挤出机温度不足,将重新加热后继续"
msgid "Left:"
msgstr "剩余时间:"
msgid "Leveling only in the actual print area"
msgstr "仅在实际打印区域进行床调平"
msgid "License key"
msgstr "许可证密钥"
@ -853,9 +850,6 @@ msgstr "探针偏移校准"
msgid "Probe Offset"
msgstr "探针偏移"
msgid "Profile Name:"
msgstr "配置文件名称:"
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr "寻求帮助的时候请提供KlipperScreen.log。\n"
@ -1055,12 +1049,6 @@ msgstr "状态:"
msgid "System"
msgstr "系统"
msgid "System Restart"
msgstr "重启系统"
msgid "System Shutdown"
msgstr "关闭系统"
msgid "System:"
msgstr "系统"
@ -1251,6 +1239,24 @@ msgid "second"
msgid_plural "seconds"
msgstr[0] "秒"
#~ msgid "Add profile"
#~ msgstr "添加配置文件"
#~ msgid "Profile Name:"
#~ msgstr "配置文件名称:"
#~ msgid "Klipper Restart"
#~ msgstr "重启Klipper"
#~ msgid "Leveling only in the actual print area"
#~ msgstr "仅在实际打印区域进行床调平"
#~ msgid "System Restart"
#~ msgstr "重启系统"
#~ msgid "System Shutdown"
#~ msgstr "关闭系统"
#~ msgid "Enabled successfully"
#~ msgstr "启用成功"
@ -1272,9 +1278,6 @@ msgstr[0] "秒"
#~ msgid "Restoring Left extruder temperature, this may take some time"
#~ msgstr "恢复左挤出机温度,这可能需要一些时间"
#~ msgid "Manual Calibration"
#~ msgstr "手动校准"
#~ msgid "NOTE: Edit your printer.cfg to save manual calibration changes."
#~ msgstr "请编辑您的 printer.cfg 文件以保存手动校准的更改"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-03-29 17:34+0800\n"
"POT-Creation-Date: 2025-06-19 16:45+0800\n"
"PO-Revision-Date: 2024-06-01 12:09+0000\n"
"Last-Translator: 峻瑜哥 <a728728728@gmail.com>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
@ -74,15 +74,9 @@ msgstr "接受"
msgid "Activate"
msgstr "激活"
msgid "Adaptive Bed Leveling"
msgstr "自適應床調平"
msgid "Add"
msgstr "加"
msgid "Add profile"
msgstr "新增設定檔案"
msgid "Advanced"
msgstr "高級"
@ -139,8 +133,8 @@ msgstr "停止前要求確認"
msgid "Auto"
msgstr "自動"
msgid "Auto Calibration"
msgstr "自動校準"
msgid "Auto Bed Leveling"
msgstr "自動調平"
msgid "Auto Change Nozzle"
msgstr "斷料自動切頭"
@ -160,6 +154,9 @@ msgstr "暫停時自動打開擠出"
msgid "Auto-scroll"
msgstr "自動滾屏"
msgid "Automatic compensation based on the data of the bed mesh"
msgstr "基於牀面網格數據的自動補償"
msgid "Bed Level"
msgstr "熱床調平"
@ -388,6 +385,9 @@ msgstr "失敗,請先調整位置"
msgid "Fan"
msgstr "風扇"
msgid "Fast Calibration"
msgstr "快速校準"
msgid "Filament"
msgstr "耗材"
@ -415,6 +415,9 @@ msgstr "過濾器"
msgid "Finding ADXL"
msgstr "查詢ADXL"
msgid "Fine Calibration"
msgstr "精細校準"
msgid "Fine Tuning"
msgstr "微調"
@ -532,9 +535,6 @@ msgstr "密鑰有效"
msgid "Key:"
msgstr "密鑰:"
msgid "Klipper Restart"
msgstr "重啟Klipper"
msgid "Klipper has disconnected"
msgstr "Klipper已斷開連線"
@ -581,9 +581,6 @@ msgstr "左擠出機溫度不足,將重新加熱後繼續"
msgid "Left:"
msgstr "剩餘時間:"
msgid "Leveling only in the actual print area"
msgstr "僅在實際打印區域進行床調平"
msgid "License key"
msgstr "許可證密鑰"
@ -853,9 +850,6 @@ msgstr "探針偏移校準"
msgid "Probe Offset"
msgstr "探針偏移"
msgid "Profile Name:"
msgstr "設定檔名稱:"
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr "尋求幫助的時候請提供KlipperScreen.log。\n"
@ -1055,12 +1049,6 @@ msgstr "狀態:"
msgid "System"
msgstr "系統"
msgid "System Restart"
msgstr "重啟系統"
msgid "System Shutdown"
msgstr "關閉系統"
msgid "System:"
msgstr "系統"
@ -1251,6 +1239,24 @@ msgid "second"
msgid_plural "seconds"
msgstr[0] "秒"
#~ msgid "Add profile"
#~ msgstr "新增設定檔案"
#~ msgid "Profile Name:"
#~ msgstr "設定檔名稱:"
#~ msgid "Klipper Restart"
#~ msgstr "重啟Klipper"
#~ msgid "Leveling only in the actual print area"
#~ msgstr "僅在實際打印區域進行床調平"
#~ msgid "System Restart"
#~ msgstr "重啟系統"
#~ msgid "System Shutdown"
#~ msgstr "關閉系統"
#~ msgid "Enabled successfully"
#~ msgstr "啟用成功"

View File

@ -196,7 +196,7 @@ class ScreenPanel:
# if dev not in self.devices:
# new_label_text += "°"
if self._show_heater_power:
if self._show_heater_power and power:
if target != 0:
power_label_text = "0%"
if power != 0:

View File

@ -22,9 +22,9 @@ class Panel(ScreenPanel):
{
"adaptive_leveling": {
"section": "main",
"name": _("Adaptive Bed Leveling"),
"name": _("Auto Bed Leveling"),
"type": "binary",
"tooltip": _("Leveling only in the actual print area"),
"tooltip": _("Automatic compensation based on the data of the bed mesh"),
"value": "False",
"callback": self.set_adaptive_leveling,
}

View File

@ -1,6 +1,7 @@
import contextlib
import logging
import gi
import math
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango
@ -14,24 +15,23 @@ class Panel(ScreenPanel):
def __init__(self, screen, title):
title = title or _("Bed Mesh")
super().__init__(screen, title)
self.show_create = False
self.active_mesh = None
section = self._printer.get_config_section("bed_mesh")
self.mesh_radius = section['mesh_radius'] if 'mesh_radius' in section else None
self.profiles = {}
self.buttons = {
'add': self._gtk.Button("increase", " " + _("Add profile"), "color1", self.bts, Gtk.PositionType.LEFT, 1),
'calib': self._gtk.Button("refresh", " " + _("Calibrate"), "color3", self.bts, Gtk.PositionType.LEFT, 1),
'fine_calib': self._gtk.Button("refresh", " " + _("Fine Calibration"), "color1", self.bts, Gtk.PositionType.LEFT, 1),
'fast_calib': self._gtk.Button("refresh", " " + _("Fast Calibration"), "color3", self.bts, Gtk.PositionType.LEFT, 1),
'clear': self._gtk.Button("cancel", " " + _("Clear"), "color2", self.bts, Gtk.PositionType.LEFT, 1),
}
self.buttons['add'].connect("clicked", self.show_create_profile)
self.buttons['fine_calib'].connect("clicked", self.fine_calibrate_mesh)
self.buttons['clear'].connect("clicked", self.send_clear_mesh)
self.buttons['calib'].connect("clicked", self.calibrate_mesh)
self.buttons['fast_calib'].connect("clicked", self.calibrate_mesh)
topbar = Gtk.Box(spacing=5, hexpand=True, vexpand=False)
topbar.add(self.buttons['add'])
topbar.add(self.buttons['clear'])
topbar.add(self.buttons['calib'])
topbar.add(self.buttons['fine_calib'])
topbar.add(self.buttons['fast_calib'])
# Create a grid for all profiles
self.labels['profiles'] = Gtk.Grid(valign=Gtk.Align.CENTER)
@ -146,9 +146,6 @@ class Panel(ScreenPanel):
self.labels['profiles'].show_all()
def back(self):
if self.show_create is True:
self.remove_create()
return True
return False
def load_meshes(self):
@ -166,18 +163,6 @@ class Panel(ScreenPanel):
if 'bed_mesh' in data and 'profile_name' in data['bed_mesh']:
self.activate_mesh(data['bed_mesh']['profile_name'])
def remove_create(self):
if self.show_create is False:
return
self._screen.remove_keyboard()
for child in self.content.get_children():
self.content.remove(child)
self.show_create = False
self.content.add(self.labels['main_grid'])
self.content.show()
def remove_profile(self, profile):
if profile not in self.profiles:
return
@ -200,41 +185,65 @@ class Panel(ScreenPanel):
profiles = sorted(pl)
return profiles.index(profile) + 1 if profile != "default" else 0
def show_create_profile(self, widget):
def get_optimal_probe_count(self, mesh_min, mesh_max, original_probe_count="3,3", target_spacing=40):
for child in self.content.get_children():
self.content.remove(child)
try:
min_x, min_y = map(float, mesh_min.split(','))
max_x, max_y = map(float, mesh_max.split(','))
x_range = max_x - min_x
y_range = max_y - min_y
x_count = max(3, math.ceil(x_range / target_spacing) + 1)
y_count = max(3, math.ceil(y_range / target_spacing) + 1)
x_count = min(x_count, 25)
y_count = min(y_count, 25)
if "create_profile" not in self.labels:
pl = Gtk.Label(label=_("Profile Name:"), hexpand=False)
self.labels['profile_name'] = Gtk.Entry(hexpand=True, text='')
self.labels['profile_name'].connect("activate", self.create_profile)
self.labels['profile_name'].connect("focus-in-event", self._screen.show_keyboard)
return x_count, y_count
save = self._gtk.Button("complete", _("Save"), "color3")
save.set_hexpand(False)
save.connect("clicked", self.create_profile)
except Exception as e:
try:
original_x, original_y = map(int, original_probe_count.split(','))
return original_x, original_y
except:
return None
box = Gtk.Box()
box.pack_start(self.labels['profile_name'], True, True, 5)
box.pack_start(save, False, False, 5)
def generate_bed_mesh_command(self, config_dict, profile="default", target_spacing=40):
if not isinstance(config_dict, dict):
logging.warning(f"Error: config_dict is not a dict, but is {type(config_dict)}")
return None
self.labels['create_profile'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5,
valign=Gtk.Align.CENTER, hexpand=True, vexpand=True)
self.labels['create_profile'].pack_start(pl, True, True, 5)
self.labels['create_profile'].pack_start(box, True, True, 5)
if "mesh_min" not in config_dict or "mesh_max" not in config_dict:
logging.info("Missing required key: mesh_min or mesh_max")
return None
self.content.add(self.labels['create_profile'])
self.labels['profile_name'].grab_focus_without_selecting()
self.show_create = True
mesh_min = config_dict.get("mesh_min", "0,0")
mesh_max = config_dict.get("mesh_max", "200,200")
original_probe_count = config_dict.get("probe_count", "3,3")
def create_profile(self, widget):
name = self.labels['profile_name'].get_text()
if self.active_mesh is None:
self.calibrate_mesh(widget)
x_count, y_count = self.get_optimal_probe_count(mesh_min, mesh_max, original_probe_count, target_spacing)
auto_probe_count = f"{x_count},{y_count}"
command = f"BED_MESH_CALIBRATE PROFILE={profile} PROBE_COUNT={auto_probe_count}"
return command
def fine_calibrate_mesh(self, widget):
widget.set_sensitive(False)
self._screen.show_popup_message(_("Calibrating"), level=1)
if self._printer.get_stat("toolhead", "homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script("G28")
res = self._printer.get_config_section("bed_mesh")
cmd = self.generate_bed_mesh_command(res)
if cmd is None:
return
logging.info(f"Sending bed mesh calibration command: {cmd}")
self._screen._send_action(widget, "printer.gcode.script", {"script": cmd})
# Load zcalibrate to do a manual mesh
if not self._printer.get_probe():
self.menu_item_clicked(widget, {"name": _("Mesh calibrate"), "panel": "zcalibrate"})
self._screen._send_action(widget, "printer.gcode.script", {"script": f"BED_MESH_PROFILE SAVE={name}"})
self.remove_create()
def calibrate_mesh(self, widget):
widget.set_sensitive(False)

View File

@ -117,7 +117,19 @@ class Panel(ScreenPanel):
return
if "gcode_move" in data:
if "homing_origin" in data["gcode_move"]:
self.labels['zoffset'].set_label(f' {data["gcode_move"]["homing_origin"][2]:.3f}mm')
active_extruder = self._printer.get_stat("toolhead", "extruder")
if active_extruder == "extruder1":
variables = self._printer.get_stat("save_variables", "variables") or {}
nozzle2_offset = variables.get("nozzle_z_offset_val")
try:
nozzle2_offset = float(nozzle2_offset)
z_offset_val = round(data["gcode_move"]["homing_origin"][2] - nozzle2_offset, 3)
except (TypeError, ValueError):
z_offset_val = 0
z_offset_val = data["gcode_move"]["homing_origin"][2] - nozzle2_offset
self.labels['zoffset'].set_label(f' {z_offset_val:.3f}mm')
else:
self.labels['zoffset'].set_label(f' {data["gcode_move"]["homing_origin"][2]:.3f}mm')
self.z_offset = float(data["gcode_move"]["homing_origin"][2])
if "extrude_factor" in data["gcode_move"]:
self.extrusion = round(float(data["gcode_move"]["extrude_factor"]) * 100)
@ -129,13 +141,19 @@ class Panel(ScreenPanel):
def change_babystepping(self, widget, direction):
if direction == "reset":
self.labels['zoffset'].set_label(' 0.00mm')
self._screen._send_action(widget, "printer.gcode.script", {"script": "SET_GCODE_OFFSET Z=0 MOVE=1"})
active_extruder = self._printer.get_stat("toolhead", "extruder")
if active_extruder == "extruder1":
variables = self._printer.get_stat("save_variables", "variables") or {}
nozzle2_offset = variables.get("nozzle_z_offset_val")
self._screen._send_action(widget, "printer.gcode.script", {"script": f"SET_GCODE_OFFSET Z={nozzle2_offset} MOVE=1"})
else:
self._screen._send_action(widget, "printer.gcode.script", {"script": "SET_GCODE_OFFSET Z=0 MOVE=1"})
return
elif direction == "+":
self.z_offset += float(self.z_delta)
elif direction == "-":
self.z_offset -= float(self.z_delta)
self.labels['zoffset'].set_label(f' {self.z_offset:.3f}mm')
# self.labels['zoffset'].set_label(f' {self.z_offset:.3f}mm')
self._screen._send_action(widget, "printer.gcode.script",
{"script": f"SET_GCODE_OFFSET Z_ADJUST={direction}{self.z_delta} MOVE=1"})

View File

@ -19,7 +19,7 @@ class Panel(ScreenPanel):
title = title or _("Input Shaper")
super().__init__(screen, title)
self.freq_xy_adj = {}
self.freq_xy_combo = {}
self.shaper_buttons = {}
self.calibrate_btn = self._gtk.Button("move", _('Finding ADXL'), "color1", lines=1)
self.calibrate_btn.connect("clicked", self.on_popover_clicked)
self.calibrate_btn.set_sensitive(False)
@ -28,13 +28,21 @@ class Panel(ScreenPanel):
self.calibrating_axis = None
auto_calibration_label = Gtk.Label(hexpand=True)
auto_calibration_label.set_markup("<big><b>{}</b></big>".format(_("Auto Calibration")))
auto_calibration_label.set_markup('<big><b>Auto Calibration</b></big>')
auto_grid = Gtk.Grid()
auto_grid.attach(auto_calibration_label, 0, 0, 1, 1)
auto_grid.attach(self.calibrate_btn, 1, 0, 1, 1)
manual_calibration_label = Gtk.Label(vexpand=True)
manual_calibration_label.set_markup('<big><b>Manual Calibration</b></big>')
disclaimer = Gtk.Label(wrap=True, halign=Gtk.Align.CENTER)
disclaimer.set_markup('<small>NOTE: Edit your printer.cfg to save manual calibration changes.</small>')
input_grid = Gtk.Grid()
input_grid.attach(manual_calibration_label, 0, 0, 3, 1)
input_grid.attach(disclaimer, 0, 1, 3, 1)
for i, dim_freq in enumerate(XY_FREQ):
axis_lbl = Gtk.Label(hexpand=False, vexpand=True, halign=Gtk.Align.START, valign=Gtk.Align.CENTER,
@ -48,14 +56,23 @@ class Panel(ScreenPanel):
scale.connect("button-release-event", self.set_opt_value, dim_freq['config'])
shaper_slug = dim_freq['config'].replace('_freq_', '_type_')
self.freq_xy_combo[shaper_slug] = Gtk.ComboBoxText()
for shaper in SHAPERS:
self.freq_xy_combo[shaper_slug].append(shaper, shaper)
self.freq_xy_combo[shaper_slug].set_active(0)
menu_btn = Gtk.Button(label=SHAPERS[0])
menu_btn.set_name("compact-combo")
menu_btn.get_style_context().add_class("combo-button")
menu_btn.connect("clicked", self.on_shaper_menu_clicked, shaper_slug)
menu_btn.set_halign(Gtk.Align.CENTER)
menu_btn.set_valign(Gtk.Align.CENTER)
menu_btn.set_margin_end(5)
self.shaper_buttons[shaper_slug] = menu_btn
combo_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
combo_box.pack_start(menu_btn, True, True, 0)
arrow = Gtk.Arrow(arrow_type=Gtk.ArrowType.DOWN, shadow_type=Gtk.ShadowType.NONE)
combo_box.pack_start(arrow, False, False, 0)
input_grid.attach(axis_lbl, 0, i + 2, 1, 1)
input_grid.attach(scale, 1, i + 2, 1, 1)
input_grid.attach(self.freq_xy_combo[shaper_slug], 2, i + 2, 1, 1)
input_grid.attach(combo_box, 2, i + 2, 1, 1)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box.add(auto_grid)
@ -65,7 +82,6 @@ class Panel(ScreenPanel):
self.content.add(box)
pobox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
pobox.get_style_context().add_class("measure_button")
test_x = self._gtk.Button(label=_("Measure X"))
test_x.connect("clicked", self.start_calibration, "x")
pobox.pack_start(test_x, True, True, 5)
@ -79,6 +95,50 @@ class Panel(ScreenPanel):
self.labels['popover'].add(pobox)
self.labels['popover'].set_position(Gtk.PositionType.LEFT)
self.shaper_popovers = {}
for dim_freq in XY_FREQ:
shaper_slug = dim_freq['config'].replace('_freq_', '_type_')
popover = Gtk.Popover()
grid = Gtk.Grid(column_homogeneous=True, row_spacing=2, column_spacing=2)
columns = 2
for idx, shaper in enumerate(SHAPERS):
btn = Gtk.Button(label=shaper)
btn.set_name("compact-menu-item")
btn.get_style_context().add_class("menu-item")
btn.connect("clicked", self.on_shaper_selected, shaper_slug, shaper)
row = idx // columns
col = idx % columns
grid.attach(btn, col, row, 1, 1)
popover.add(grid)
self.shaper_popovers[shaper_slug] = popover
def on_shaper_menu_clicked(self, widget, shaper_slug):
popover = self.shaper_popovers[shaper_slug]
popover.set_relative_to(widget)
popover.show_all()
def on_shaper_selected(self, widget, shaper_slug, shaper):
self.shaper_buttons[shaper_slug].set_label(shaper)
self.shaper_popovers[shaper_slug].popdown()
self.set_input_shaper()
def set_input_shaper(self):
shaper_freq_x = self.freq_xy_adj['shaper_freq_x'].get_value()
shaper_freq_y = self.freq_xy_adj['shaper_freq_y'].get_value()
shaper_type_x = self.shaper_buttons['shaper_type_x'].get_label()
shaper_type_y = self.shaper_buttons['shaper_type_y'].get_label()
self._screen._ws.klippy.gcode_script(
f'SET_INPUT_SHAPER '
f'SHAPER_FREQ_X={shaper_freq_x} '
f'SHAPER_TYPE_X={shaper_type_x} '
f'SHAPER_FREQ_Y={shaper_freq_y} '
f'SHAPER_TYPE_Y={shaper_type_y}'
)
def on_popover_clicked(self, widget):
self.labels['popover'].set_relative_to(widget)
self.labels['popover'].show_all()
@ -97,18 +157,7 @@ class Panel(ScreenPanel):
self.calibrate_btn.set_label(_('Calibrating') + '...')
def set_opt_value(self, widget, opt, *args):
shaper_freq_x = self.freq_xy_adj['shaper_freq_x'].get_value()
shaper_freq_y = self.freq_xy_adj['shaper_freq_y'].get_value()
shaper_type_x = self.freq_xy_combo['shaper_type_x'].get_active_text()
shaper_type_y = self.freq_xy_combo['shaper_type_y'].get_active_text()
self._screen._ws.klippy.gcode_script(
f'SET_INPUT_SHAPER '
f'SHAPER_FREQ_X={shaper_freq_x} '
f'SHAPER_TYPE_X={shaper_type_x} '
f'SHAPER_FREQ_Y={shaper_freq_y} '
f'SHAPER_TYPE_Y={shaper_type_y}'
)
self.set_input_shaper()
def save_config(self):
@ -149,7 +198,7 @@ class Panel(ScreenPanel):
if results:
results.groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))
self.shaper_buttons['shaper_type_' + results['axis']].set_label(results['shaper_type'])
if self.calibrating_axis == results['axis'] or (self.calibrating_axis == "both" and results['axis'] == 'y'):
self.calibrate_btn.set_sensitive(True)
self.calibrate_btn.set_label(_('Calibrated'))
@ -163,4 +212,4 @@ class Panel(ScreenPanel):
):
results = results.groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))
self.shaper_buttons['shaper_type_' + results['axis']].set_label(results['shaper_type'])

View File

@ -493,8 +493,16 @@ class Panel(ScreenPanel):
for x in self._printer.get_temp_devices():
if x in data:
temp = round(self._printer.get_stat(x, "temperature"))
temp_target = round(self._printer.get_stat(x, "target"))
power = round(self._printer.get_stat(x, "power") * 100)
if (target := self._printer.get_stat(x, "target")):
temp_target = round(target)
else:
temp_target = 0
if (target := self._printer.get_stat(x, "power")):
power = round(target * 100)
else:
power = 0
temp_state = f"{temp}°/{temp_target}° {'{:3.0f}%'.format(power) if self._show_heater_power else ''}".strip()
if x in self.buttons['extruder']:
self.buttons['extruder'][x].set_label(temp_state)

View File

@ -19,6 +19,7 @@ class Panel(ScreenPanel):
self.mesh_radius = None
self.mesh_origin = [0, 0]
self.zero_ref = []
self.probe_z_offset = None
self.z_hop_speed = 15.0
self.z_hop = 5.0
self.probe = self._printer.get_probe()
@ -249,6 +250,8 @@ class Panel(ScreenPanel):
def activate(self):
if self._printer.get_stat("manual_probe", "is_active"):
self.buttons_calibrating()
self.probe_z_offset = None
self.widgets['zoffset'].set_text("?")
else:
self.buttons_not_calibrating()
@ -261,7 +264,10 @@ class Panel(ScreenPanel):
if "manual_probe" in data:
if data["manual_probe"]["is_active"]:
self.buttons_calibrating()
if self._printer.get_stat('manual_probe', 'z_position_upper') is None:
self.probe_z_offset = self._printer.data['gcode_move']['gcode_position'][2] - 5
else:
self.probe_z_offset = None
self.buttons_not_calibrating()
elif action == "notify_gcode_response":
if "out of range" in data.lower():
@ -274,7 +280,10 @@ class Panel(ScreenPanel):
def update_position(self, position):
self.widgets['zposition'].set_text(f"Z: {position[2]:.3f}")
self.widgets['zoffset'].set_text(f"{abs(position[2] - self.z_offset):.3f}")
if self.probe_z_offset is not None:
self.widgets['zoffset'].set_text(f"{(self.probe_z_offset - position[2]):.3f}")
else:
self.widgets['zoffset'].set_text("?")
def change_distance(self, widget, distance):
logging.info(f"### Distance {distance}")

View File

@ -367,4 +367,11 @@ textview .time {
.dialog-primary {
border-bottom-color: @orange-opa-100;
}
popover,
popover button {
background-color: @pale-cyan-opa-100;
border-color: @white-opa-20;
opacity: 1;
}

View File

@ -417,4 +417,10 @@ textview .time {
.dialog-primary {
background-color: @color1;
border-bottom-color: @color1;
}
popover,
popover button {
background-color: @color4;
border-color: @solarized-base03;
}