Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Jan 30, 2024
1 parent 7155c5c commit 436c2e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions panels/extrude.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def __init__(self, screen, title):
self.load_filament = any("LOAD_FILAMENT" in macro.upper() for macro in macros)
self.unload_filament = any("UNLOAD_FILAMENT" in macro.upper() for macro in macros)

self.speeds = ['1', '2', '5', '25']
self.distances = ['5', '10', '15', '25']
self.speeds = screen.extrude_speeds
self.distances = screen.extrude_distances
if self.ks_printer_cfg is not None:
dis = self.ks_printer_cfg.get("extrude_distances", '')
if re.match(r'^[0-9,\s]+$', dis):
Expand Down
25 changes: 25 additions & 0 deletions screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def __init__(self, args):

self.z_calibrate_panel = None
self.lighting_output_pins = None
self.extrude_speeds = None
self.extrude_distances = None
self.log_notification("KlipperScreen Started", 1)
self.initial_connection()
if sys.version_info == (3, 7):
Expand Down Expand Up @@ -922,6 +924,8 @@ def init_printer(self):
if printer_config is None:
self.z_calibrate_panel = "zcalibrate"
self.lighting_output_pins = {"caselight": 1.0}
self.extrude_speeds = ['1', '2', '5', '25']
self.extrude_distances = ['5', '10', '15', '25']
else:
self.z_calibrate_panel = (printer_config
.get("z_calibrate_panel", "zcalibrate"))
Expand Down Expand Up @@ -949,6 +953,27 @@ def init_printer(self):
# for element in printer_config
# .get("lighting_output_pins",
# "caselight: 100").split(',')))

self.extrude_speeds = ['1', '1', '1', '1']
i = 0
for element in printer_config.get("extrude_speeds", "1, 2, 5, 25").split(','):
self.extrude_speeds.insert(i, element.strip())
i += 1
if len(self.extrude_speeds) > 4:
logging.error(f"extrude_speeds can have a maximum of 4 values.")
self.extrude_speeds = ['1', '2', '5', '25']
self.extrude_speeds.sort()

self.extrude_distances = ['1', '1', '1', '1']
i = 0
for element in printer_config.get("extrude_distances", "1, 2, 5, 25").split(','):
self.extrude_distances.insert(i, element.strip())
i += 1
if len(self.extrude_distances) > 4:
logging.error(f"extrude_distances can have a maximum of 4 values.")
self.extrude_distances = ['5', '10', '15', '25']
self.extrude_distances.sort()

if printer_config.getboolean("enable_home_full", False):
logging.info("home_full")
self.printer.enable_home_full()
Expand Down

0 comments on commit 436c2e9

Please sign in to comment.