endstop_phase: wip
This commit is contained in:
parent
af7f27542f
commit
f2e4653ca4
|
@ -118,6 +118,7 @@ class EndstopPhases:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.tracking = {}
|
self.tracking = {}
|
||||||
|
self.last_home_info = {}
|
||||||
# Register handlers
|
# Register handlers
|
||||||
self.printer.register_event_handler("homing:home_rails_end",
|
self.printer.register_event_handler("homing:home_rails_end",
|
||||||
self.handle_home_rails_end)
|
self.handle_home_rails_end)
|
||||||
|
@ -149,6 +150,10 @@ class EndstopPhases:
|
||||||
return
|
return
|
||||||
phase = convert_phase(driver_phase, driver_phases, len(phase_history))
|
phase = convert_phase(driver_phase, driver_phases, len(phase_history))
|
||||||
phase_history[phase] += 1
|
phase_history[phase] += 1
|
||||||
|
self.last_home_info[stepper.get_name()] = {
|
||||||
|
'phase': phase, 'phases': len(phase_history),
|
||||||
|
'mcu_position': stepper.get_mcu_position()
|
||||||
|
}
|
||||||
def handle_home_rails_end(self, homing_state, rails):
|
def handle_home_rails_end(self, homing_state, rails):
|
||||||
for rail in rails:
|
for rail in rails:
|
||||||
stepper = rail.get_steppers()[0]
|
stepper = rail.get_steppers()[0]
|
||||||
|
@ -205,6 +210,8 @@ class EndstopPhases:
|
||||||
if info is None:
|
if info is None:
|
||||||
continue
|
continue
|
||||||
self.generate_stats(stepper_name, info)
|
self.generate_stats(stepper_name, info)
|
||||||
|
def get_status(self, eventtime):
|
||||||
|
return { 'last_home': self.last_home_info }
|
||||||
|
|
||||||
def load_config_prefix(config):
|
def load_config_prefix(config):
|
||||||
return EndstopPhase(config)
|
return EndstopPhase(config)
|
||||||
|
|
Loading…
Reference in New Issue