mirror of https://github.com/Desuuuu/klipper.git
probe: Call add_stepper() earlier in boot process
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ecbfa76242
commit
f3bd4e6acf
|
@ -28,6 +28,8 @@ class BLTouchEndstopWrapper:
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.printer.register_event_handler("klippy:connect",
|
self.printer.register_event_handler("klippy:connect",
|
||||||
self.handle_connect)
|
self.handle_connect)
|
||||||
|
self.printer.register_event_handler('klippy:mcu_identify',
|
||||||
|
self.handle_mcu_identify)
|
||||||
self.position_endstop = config.getfloat('z_offset')
|
self.position_endstop = config.getfloat('z_offset')
|
||||||
self.stow_on_each_sample = config.getboolean('stow_on_each_sample',
|
self.stow_on_each_sample = config.getboolean('stow_on_each_sample',
|
||||||
True)
|
True)
|
||||||
|
@ -45,7 +47,6 @@ class BLTouchEndstopWrapper:
|
||||||
pin = config.get('sensor_pin')
|
pin = config.get('sensor_pin')
|
||||||
pin_params = ppins.lookup_pin(pin, can_invert=True, can_pullup=True)
|
pin_params = ppins.lookup_pin(pin, can_invert=True, can_pullup=True)
|
||||||
mcu = pin_params['chip']
|
mcu = pin_params['chip']
|
||||||
mcu.register_config_callback(self._build_config)
|
|
||||||
self.mcu_endstop = mcu.setup_pin('endstop', pin_params)
|
self.mcu_endstop = mcu.setup_pin('endstop', pin_params)
|
||||||
# output mode
|
# output mode
|
||||||
omodes = {'5V': '5V', 'OD': 'OD', None: None}
|
omodes = {'5V': '5V', 'OD': 'OD', None: None}
|
||||||
|
@ -72,7 +73,7 @@ class BLTouchEndstopWrapper:
|
||||||
desc=self.cmd_BLTOUCH_STORE_help)
|
desc=self.cmd_BLTOUCH_STORE_help)
|
||||||
# multi probes state
|
# multi probes state
|
||||||
self.multi = 'OFF'
|
self.multi = 'OFF'
|
||||||
def _build_config(self):
|
def handle_mcu_identify(self):
|
||||||
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
||||||
for stepper in kin.get_steppers():
|
for stepper in kin.get_steppers():
|
||||||
if stepper.is_active_axis('z'):
|
if stepper.is_active_axis('z'):
|
||||||
|
|
|
@ -280,8 +280,9 @@ class ProbeEndstopWrapper:
|
||||||
pin = config.get('pin')
|
pin = config.get('pin')
|
||||||
pin_params = ppins.lookup_pin(pin, can_invert=True, can_pullup=True)
|
pin_params = ppins.lookup_pin(pin, can_invert=True, can_pullup=True)
|
||||||
mcu = pin_params['chip']
|
mcu = pin_params['chip']
|
||||||
mcu.register_config_callback(self._build_config)
|
|
||||||
self.mcu_endstop = mcu.setup_pin('endstop', pin_params)
|
self.mcu_endstop = mcu.setup_pin('endstop', pin_params)
|
||||||
|
self.printer.register_event_handler('klippy:mcu_identify',
|
||||||
|
self._handle_mcu_identify)
|
||||||
# Wrappers
|
# Wrappers
|
||||||
self.get_mcu = self.mcu_endstop.get_mcu
|
self.get_mcu = self.mcu_endstop.get_mcu
|
||||||
self.add_stepper = self.mcu_endstop.add_stepper
|
self.add_stepper = self.mcu_endstop.add_stepper
|
||||||
|
@ -291,7 +292,7 @@ class ProbeEndstopWrapper:
|
||||||
self.query_endstop = self.mcu_endstop.query_endstop
|
self.query_endstop = self.mcu_endstop.query_endstop
|
||||||
# multi probes state
|
# multi probes state
|
||||||
self.multi = 'OFF'
|
self.multi = 'OFF'
|
||||||
def _build_config(self):
|
def _handle_mcu_identify(self):
|
||||||
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
||||||
for stepper in kin.get_steppers():
|
for stepper in kin.get_steppers():
|
||||||
if stepper.is_active_axis('z'):
|
if stepper.is_active_axis('z'):
|
||||||
|
|
Loading…
Reference in New Issue