aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-04-24 23:22:43 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-05 11:08:12 -0400
commit0197fec2025e45750a01922c9533e435e93ec7eb (patch)
treeb1738044cae2cb3f6fffffe636858af5efe1fc44
parentb24465976e70053c67cc2dfafa0e1fe0d07c288a (diff)
downloadkutter-0197fec2025e45750a01922c9533e435e93ec7eb.tar.gz
kutter-0197fec2025e45750a01922c9533e435e93ec7eb.tar.xz
kutter-0197fec2025e45750a01922c9533e435e93ec7eb.zip
delta_calibrate: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/extras/delta_calibrate.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/klippy/extras/delta_calibrate.py b/klippy/extras/delta_calibrate.py
index 79f11db6..abea7cc6 100644
--- a/klippy/extras/delta_calibrate.py
+++ b/klippy/extras/delta_calibrate.py
@@ -221,8 +221,8 @@ class DeltaCalibrate:
"The SAVE_CONFIG command will update the printer config file\n"
"with these parameters and restart the printer.")
cmd_DELTA_CALIBRATE_help = "Delta calibration script"
- def cmd_DELTA_CALIBRATE(self, params):
- self.probe_helper.start_probe(params)
+ def cmd_DELTA_CALIBRATE(self, gcmd):
+ self.probe_helper.start_probe(gcmd)
def add_manual_height(self, height):
# Determine current location of toolhead
toolhead = self.printer.lookup_object('toolhead')
@@ -256,9 +256,9 @@ class DeltaCalibrate:
# Perform analysis
self.calculate_params(self.last_probe_positions, distances)
cmd_DELTA_ANALYZE_help = "Extended delta calibration tool"
- def cmd_DELTA_ANALYZE(self, params):
+ def cmd_DELTA_ANALYZE(self, gcmd):
# Check for manual height entry
- mheight = self.gcode.get_float('MANUAL_HEIGHT', params, None)
+ mheight = gcmd.get_float('MANUAL_HEIGHT', None)
if mheight is not None:
self.add_manual_height(mheight)
return
@@ -266,25 +266,23 @@ class DeltaCalibrate:
args = {'CENTER_DISTS': 6, 'CENTER_PILLAR_WIDTHS': 3,
'OUTER_DISTS': 6, 'OUTER_PILLAR_WIDTHS': 6, 'SCALE': 1}
for name, count in args.items():
- if name not in params:
+ data = gcmd.get(name, None)
+ if data is None:
continue
- data = self.gcode.get_str(name, params)
try:
parts = map(float, data.split(','))
except:
- raise self.gcode.error("Unable to parse parameter '%s'" % (
- name,))
+ raise gcmd.error("Unable to parse parameter '%s'" % (name,))
if len(parts) != count:
- raise self.gcode.error("Parameter '%s' must have %d values" % (
- name, count))
+ raise gcmd.error("Parameter '%s' must have %d values"
+ % (name, count))
self.delta_analyze_entry[name] = parts
logging.info("DELTA_ANALYZE %s = %s", name, parts)
# Perform analysis if requested
- if 'CALIBRATE' in params:
- action = self.gcode.get_str('CALIBRATE', params)
- actions = {'extended': 1}
- if action not in actions:
- raise self.gcode.error("Unknown calibrate action")
+ action = gcmd.get('CALIBRATE', None)
+ if action is not None:
+ if action != 'extended':
+ raise gcmd.error("Unknown calibrate action")
self.do_extended_calibration()
def load_config(config):