remove fallback values

with an empty string re will not match
This commit is contained in:
alfrix
2024-01-07 17:27:43 -03:00
parent 2527a12d32
commit 05cd9a6d34
4 changed files with 5 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ If you need a custom location for the configuration file, you can add -c or --co
the location of your configuration file. the location of your configuration file.
At this point KlipperScreen should be working, if it doesn't start then go to the [troubleshooting page](Troubleshooting.md) At this point KlipperScreen should be working, if it doesn't start then go to the [troubleshooting page](Troubleshooting.md)
!!! warning
## Moonraker configuration ## Moonraker configuration

View File

@@ -20,12 +20,12 @@ class Panel(ScreenPanel):
self.speeds = ['1', '2', '5', '25'] self.speeds = ['1', '2', '5', '25']
self.distances = ['5', '10', '15', '25'] self.distances = ['5', '10', '15', '25']
if self.ks_printer_cfg is not None: if self.ks_printer_cfg is not None:
dis = self.ks_printer_cfg.get("extrude_distances", '5, 10, 15, 25') dis = self.ks_printer_cfg.get("extrude_distances", '')
if re.match(r'^[0-9,\s]+$', dis): if re.match(r'^[0-9,\s]+$', dis):
dis = [str(i.strip()) for i in dis.split(',')] dis = [str(i.strip()) for i in dis.split(',')]
if 1 < len(dis) < 5: if 1 < len(dis) < 5:
self.distances = dis self.distances = dis
vel = self.ks_printer_cfg.get("extrude_speeds", '1, 2, 5, 25') vel = self.ks_printer_cfg.get("extrude_speeds", '')
if re.match(r'^[0-9,\s]+$', vel): if re.match(r'^[0-9,\s]+$', vel):
vel = [str(i.strip()) for i in vel.split(',')] vel = [str(i.strip()) for i in vel.split(',')]
if 1 < len(vel) < 5: if 1 < len(vel) < 5:

View File

@@ -21,7 +21,7 @@ class Panel(ScreenPanel):
def __init__(self, screen, title): def __init__(self, screen, title):
super().__init__(screen, title) super().__init__(screen, title)
if self.ks_printer_cfg is not None: if self.ks_printer_cfg is not None:
bs = self.ks_printer_cfg.get("z_babystep_values", "0.01, 0.05") bs = self.ks_printer_cfg.get("z_babystep_values", "")
if re.match(r'^[0-9,\.\s]+$', bs): if re.match(r'^[0-9,\.\s]+$', bs):
bs = [str(i.strip()) for i in bs.split(',')] bs = [str(i.strip()) for i in bs.split(',')]
if 1 < len(bs) < 3: if 1 < len(bs) < 3:

View File

@@ -16,7 +16,7 @@ class Panel(ScreenPanel):
super().__init__(screen, title) super().__init__(screen, title)
if self.ks_printer_cfg is not None: if self.ks_printer_cfg is not None:
dis = self.ks_printer_cfg.get("move_distances", '0.1, 0.5, 1, 50, 10, 25, 50') dis = self.ks_printer_cfg.get("move_distances", '')
if re.match(r'^[0-9,\.\s]+$', dis): if re.match(r'^[0-9,\.\s]+$', dis):
dis = [str(i.strip()) for i in dis.split(',')] dis = [str(i.strip()) for i in dis.split(',')]
if 1 < len(dis) <= 7: if 1 < len(dis) <= 7: