config: deprecate old configs

This commit is contained in:
alfrix 2023-10-08 11:51:48 -03:00
parent f3cacafd53
commit b6199a4f24
3 changed files with 7 additions and 17 deletions

View File

@ -173,7 +173,7 @@ class KlipperScreenConfig:
strs = (
'moonraker_api_key', 'moonraker_host', 'titlebar_name_type',
'screw_positions', 'power_devices', 'titlebar_items', 'z_babystep_values',
'extrude_distances', "extrude_speeds", "camera_url", "spoolman",
'extrude_distances', "extrude_speeds",
)
numbers = (
'moonraker_port', 'move_speed_xy', 'move_speed_z',
@ -184,17 +184,10 @@ class KlipperScreenConfig:
numbers = [f'{option}' for option in config[section] if option != 'gcode']
elif section.startswith('menu '):
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style')
elif section == 'bed_screws':
# This section may be deprecated in favor of moving this options under the printer section
numbers = ('rotation', '')
strs = ('screw_positions', '')
elif section.startswith('graph')\
or section.startswith('displayed_macros')\
or section.startswith('spoolman'):
bools = [f'{option}' for option in config[section]]
elif section.startswith('z_calibrate_position'):
# This section may be deprecated in favor of moving this options under the printer section
numbers = ('calibrate_x_position', 'calibrate_y_position')
else:
self.errors.append(f'Section [{section}] not recognized')
@ -202,8 +195,11 @@ class KlipperScreenConfig:
if key not in bools and key not in strs and key not in numbers:
msg = f'Option "{key}" not recognized for section "[{section}]"'
if key == "camera_url":
msg = "camera_url has been deprecated in favor of moonraker cameras"
msg += "\n\n https://moonraker.readthedocs.io/en/latest/configuration/#webcam"
msg = (
"camera_url has been deprecated in favor of moonraker cameras\n\n"
+ "https://moonraker.readthedocs.io/en/latest/configuration/#webcam\n\n"
+ "remove camera_url from KlipperScreen config file"
)
if remove:
# This should only be called for the auto-generated section
self.config.remove_option(section, key)

View File

@ -80,9 +80,7 @@ class Panel(ScreenPanel):
self.screws = new_screws
logging.info(f"screws with offset: {self.screws}")
elif "bed_screws" in self._printer.get_config_section_list():
self.screws = self._get_screws("bed_screws")
logging.info(f"bed_screws: {self.screws}")
nscrews = len(self.screws)
# KS config
valid_positions = True

View File

@ -147,10 +147,6 @@ class Panel(ScreenPanel):
if self.ks_printer_cfg is not None:
x_position = self.ks_printer_cfg.getfloat("calibrate_x_position", None)
y_position = self.ks_printer_cfg.getfloat("calibrate_y_position", None)
elif 'z_calibrate_position' in self._config.get_config():
# OLD global way, this should be deprecated
x_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_x_position", None)
y_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_y_position", None)
if self.probe:
if "sample_retract_dist" in self.probe: