Skip to content

Commit 4cbbb61

Browse files
committed
Allow more types of printers
1 parent 6a1c3c8 commit 4cbbb61

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

z_v2settling_probe.py

+22-23
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, config):
2121
mcu_probe = probe_obj.mcu_probe
2222
else:
2323
mcu_probe = probe.ProbeEndstopWrapper(config)
24-
24+
2525
#figure out a way to determine which type of printer we are running on
2626
#only call __init__ for z_v2settling_probe extension for the correct type of printer
2727
atypes = { 'none' : None, 'cartesian' : 'cartesian', 'corexy' : 'corexy',
@@ -30,9 +30,9 @@ def __init__(self, config):
3030
'polar' : 'polar', 'winch' : 'winch' }
3131
kinematics_config = config.getsection('printer')
3232
kinematics_choice = kinematics_config.getchoice('kinematics', atypes, 'none')
33-
if kinematics_choice in ['corexy','cartesian','corexz','hybrid_corexy','hybrid_corexz']:
33+
if kinematics_choice in ['corexy','cartesian','corexz','hybrid_corexy','hybrid_corexz', 'rotary_delta', 'delta', 'deltesian', 'polar']:
3434
logging.info("z_v2settling_probe ::INFO:: Printer has the following "
35-
"kinematics: %s" % (kinematics_choice))
35+
"kinematics: %s" % (kinematics_choice))
3636
else:
3737
logging.info("z_v2settling_probe ::ERROR:: Printer has the following "
3838
"kinematics:\n kinematics = %s\n"
@@ -69,7 +69,7 @@ def handle_ready(self):
6969
probe_obj = self.printer.objects.pop('probe', None)
7070
self.printer.objects['probe'] = self
7171
del probe_obj
72-
72+
7373
def _run_settling_probe(self, gcmd):
7474
gcmd.respond_info("Settling sample (ignored)...")
7575
speed = gcmd.get_float("PROBE_SPEED", self.speed, above=0.)
@@ -80,31 +80,31 @@ def _run_settling_probe(self, gcmd):
8080
pos[2] += sample_retract_dist
8181
self._move(pos, lift_speed)
8282

83-
def run_probe(self, gcmd):
83+
def run_probe(self, gcmd):
8484
# The following use self.run_probe : probe.PrinterProbe.cmd_PROBE; probe.PrinterProbe.cmd_PROBE_CALIBRATE;
8585
# and probe.ProbePointsHelper.start_probe
8686
if gcmd.get_int("SETTLING_SAMPLE", self.settling_sample):
8787
self._run_settling_probe(gcmd)
8888
return probe.PrinterProbe.run_probe(self, gcmd)
89-
89+
9090
def cmd_PROBE_ACCURACY(self, gcmd):
9191
# the probe.PrinterProbe.cmd_PROBE_ACCURACY calls self._probe(speed) not self.run_probe(gcmd)
9292
if gcmd.get_int("SETTLING_SAMPLE", self.settling_sample):
9393
self._run_settling_probe(gcmd)
9494
return probe.PrinterProbe.cmd_PROBE_ACCURACY(self, gcmd)
95-
95+
9696
class V2SettlingZCalibrationHelper(z_calibration.ZCalibrationHelper):
9797
def __init__(self, config):
9898
self.printer = config.get_printer()
9999
z_calibration_config = config.getsection('z_calibration')
100-
100+
101101
# Unregister any pre-existing z_calibration commands first.
102102
self.gcode = self.printer.lookup_object('gcode')
103103
self.gcode.register_command('CALIBRATE_Z', None)
104104
self.gcode.register_command('PROBE_Z_ACCURACY', None)
105105
z_calibration.ZCalibrationHelper.__init__(self, z_calibration_config)
106106
self.printer.register_event_handler("klippy:ready", self.handle_ready)
107-
107+
108108
def handle_ready(self):
109109
self.probe = self.printer.lookup_object('probe')
110110
self.settling_sample = self.probe.settling_sample
@@ -117,7 +117,7 @@ def handle_ready(self):
117117
z_calibration_obj = self.printer.objects.pop('z_calibration', None)
118118
self.printer.objects['z_calibration'] = self
119119
del z_calibration_obj
120-
120+
121121
def move_to_z_endstop(self, gcmd, lift_speed):
122122
if self.z_homing is None:
123123
raise gcmd.error("Must home axes first")
@@ -129,19 +129,19 @@ def move_to_z_endstop(self, gcmd, lift_speed):
129129
self._move(pos, lift_speed)
130130
# move to z-endstop position
131131
self._move(list(self.nozzle_site), self.speed)
132-
132+
133133
def _test_cmdline_param(self, gcmd):
134134
try:
135135
gcmd.get_int("SETTLING_SAMPLE")
136136
except:
137137
pass
138138
else:
139-
gcmd.respond_info("Ignoring parameter 'SETTLING_SAMPLE'")
140-
139+
gcmd.respond_info("Ignoring parameter 'SETTLING_SAMPLE'")
140+
141141
def _message_first_fast(self, gcmd):
142142
gcmd.respond_info("Settling sample (ignored)...for each probe location [endstop, switch body, and bed] ...")
143143
self._test_cmdline_param(gcmd)
144-
144+
145145
# cmd_CALIBRATE_Z will always discard the settling_sample as long as self.first_fast is set to true
146146
def cmd_CALIBRATE_Z(self, gcmd):
147147
global_first_fast = self.first_fast
@@ -157,17 +157,17 @@ def cmd_CALIBRATE_Z(self, gcmd):
157157
self.first_fast = False
158158
else:
159159
return z_calibration.ZCalibrationHelper.cmd_CALIBRATE_Z(self, gcmd)
160-
160+
161161
def cmd_PROBE_Z_ACCURACY(self, gcmd):
162162
speed = gcmd.get_float("PROBE_SPEED", self.second_speed, above=0.)
163-
lift_speed = gcmd.get_float("LIFT_SPEED", self.lift_speed, above=0.)
163+
lift_speed = gcmd.get_float("LIFT_SPEED", self.lift_speed, above=0.)
164164
if gcmd.get_int("SETTLING_SAMPLE", self.settling_sample):
165165
self.move_to_z_endstop(gcmd, lift_speed)
166-
gcmd.respond_info("Settling sample (ignored)...")
166+
gcmd.respond_info("Settling sample (ignored)...")
167167
#self._probe() does a probe and a retract
168-
pos = self._probe(self.z_endstop, self.position_min, speed)
169-
return z_calibration.ZCalibrationHelper.cmd_PROBE_Z_ACCURACY(self, gcmd)
170-
168+
pos = self._probe(self.z_endstop, self.position_min, speed)
169+
return z_calibration.ZCalibrationHelper.cmd_PROBE_Z_ACCURACY(self, gcmd)
170+
171171
def load_config(config):
172172
try:
173173
z_calibration_obj = config.get_printer().lookup_object('z_calibration')
@@ -176,8 +176,7 @@ def load_config(config):
176176
" command will not be available!\n"
177177
"CALIBRATE_Z command will not be available!\n"
178178
"This printer does not use the Klipper plugin for "
179-
"the self calibrating Z offset!")
179+
"the self calibrating Z offset!")
180180
return V2SettlingProbe(config)
181181
else:
182-
return V2SettlingProbe(config), V2SettlingZCalibrationHelper(config)
183-
182+
return V2SettlingProbe(config), V2SettlingZCalibrationHelper(config)

0 commit comments

Comments
 (0)