fine_tune: Allow z babystep intervals to be configured

This commit is contained in:
Jordan Ruthe 2021-02-22 11:10:19 -05:00
parent a57ab7f9d5
commit 3f2ed97385
5 changed files with 25 additions and 0 deletions

View File

@ -45,6 +45,9 @@ moonraker_host: 127.0.0.1
moonraker_port: 7125
# Moonraker API key if this is not connecting from a trusted client IP
moonraker_api_key: False
# Define the z_babystep intervals in a CSV list. Currently only 2 are supported
z_babystep_values: 0.01, 0.05
```

View File

@ -1,6 +1,7 @@
## Changelog
#### 2021 02 22
* Add configurable z_babystep intervals
* Fixed cursor issue on startup
* Fixed font ratio for large, but short screens
* Re-vamped logging system

View File

@ -188,6 +188,14 @@ class KlipperScreenConfig:
return preheat_options
def get_printer_config(self, name):
if not name.startswith("printer "):
name = "printer %s" % name
if name not in self.config:
return None
return self.config[name]
def get_printer_power_name(self):
return self.config['settings'].get("printer_power_name", "printer")

View File

@ -1,5 +1,6 @@
import gi
import logging
import re
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
@ -30,6 +31,17 @@ class FineTunePanel(ScreenPanel):
grid.set_row_homogeneous(False)
logging.debug("FineTunePanel")
print_cfg = self._config.get_printer_config(self._screen.connected_printer)
if print_cfg is not None:
bs = print_cfg.get("z_babystep_values","0.01, 0.05")
if re.match(r'^[0-9,\.\s]+$', bs):
bs = [str(i.strip()) for i in bs.split(',')]
if len(bs) <= 2:
self.bs_deltas = bs
else:
self.bs_deltas = [bs[0], bs[-1]]
self.bs_delta = self.bs_deltas[0]
self.labels['z+'] = self._gtk.ButtonImage("move-z-", _("Z+"), "color1")
self.labels['z+'].connect("clicked", self.change_babystepping, "+")

View File

@ -126,6 +126,7 @@ class KlipperScreen(Gtk.Window):
if self.files is not None:
self.files.stop()
logging.info("Connecting to printer: %s" % name)
self.apiclient = KlippyRest(self._config.get_main_config_option("moonraker_host"),
self._config.get_main_config_option("moonraker_port"),
self._config.get_main_config_option("moonraker_api_key", False))