mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-12 01:08:00 -06:00
mcu: Return time of trigger from home_wait()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
128a2f8cd6
commit
1dc2ab048f
3 changed files with 18 additions and 5 deletions
|
@ -136,6 +136,7 @@ class MCU_endstop:
|
|||
self._home_cmd = self._query_cmd = None
|
||||
self._mcu.register_config_callback(self._build_config)
|
||||
self._trigger_completion = None
|
||||
self._rest_ticks = 0
|
||||
ffi_main, ffi_lib = chelper.get_ffi()
|
||||
self._trdispatch = ffi_main.gc(ffi_lib.trdispatch_alloc(), ffi_lib.free)
|
||||
self._trsync = MCU_trsync(mcu, self._trdispatch)
|
||||
|
@ -169,6 +170,7 @@ class MCU_endstop:
|
|||
triggered=True):
|
||||
clock = self._mcu.print_time_to_clock(print_time)
|
||||
rest_ticks = self._mcu.print_time_to_clock(print_time+rest_time) - clock
|
||||
self._rest_ticks = rest_ticks
|
||||
reactor = self._mcu.get_printer().get_reactor()
|
||||
self._trigger_completion = reactor.completion()
|
||||
etrsync = self._trsync
|
||||
|
@ -190,7 +192,15 @@ class MCU_endstop:
|
|||
ffi_main, ffi_lib = chelper.get_ffi()
|
||||
ffi_lib.trdispatch_stop(self._trdispatch)
|
||||
res = etrsync.stop()
|
||||
return res == etrsync.REASON_ENDSTOP_HIT
|
||||
if res == etrsync.REASON_COMMS_TIMEOUT:
|
||||
return -1.
|
||||
if res != etrsync.REASON_ENDSTOP_HIT:
|
||||
return 0.
|
||||
if self._mcu.is_fileoutput():
|
||||
return home_end_time
|
||||
params = self._query_cmd.send([self._oid])
|
||||
next_clock = self._mcu.clock32_to_clock64(params['next_clock'])
|
||||
return self._mcu.clock_to_print_time(next_clock - self._rest_ticks)
|
||||
def query_endstop(self, print_time):
|
||||
clock = self._mcu.print_time_to_clock(print_time)
|
||||
if self._mcu.is_fileoutput():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue