mirror of https://github.com/Desuuuu/klipper.git
serialhdl: Make sure to calculate est_clock before connect() finishes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
3cafcc2bc7
commit
1fbb36fa87
|
@ -96,15 +96,21 @@ class SerialReader:
|
||||||
baud_adjust = self.BITS_PER_BYTE / mcu_baud
|
baud_adjust = self.BITS_PER_BYTE / mcu_baud
|
||||||
self.ffi_lib.serialqueue_set_baud_adjust(
|
self.ffi_lib.serialqueue_set_baud_adjust(
|
||||||
self.serialqueue, baud_adjust)
|
self.serialqueue, baud_adjust)
|
||||||
|
# Enable periodic get_status timer
|
||||||
|
get_status = msgparser.lookup_command('get_status')
|
||||||
|
self.status_cmd = get_status.encode()
|
||||||
|
self.reactor.update_timer(self.status_timer, self.reactor.NOW)
|
||||||
# Load initial last_ack_clock/last_ack_time
|
# Load initial last_ack_clock/last_ack_time
|
||||||
uptime_msg = msgparser.create_command('get_uptime')
|
uptime_msg = msgparser.create_command('get_uptime')
|
||||||
params = self.send_with_response(uptime_msg, 'uptime')
|
params = self.send_with_response(uptime_msg, 'uptime')
|
||||||
self.last_ack_clock = (params['high'] << 32) | params['clock']
|
self.last_ack_clock = (params['high'] << 32) | params['clock']
|
||||||
self.last_ack_time = params['#receive_time']
|
self.last_ack_time = params['#receive_time']
|
||||||
# Enable periodic get_status timer
|
# Make sure est_clock is calculated
|
||||||
get_status = msgparser.lookup_command('get_status')
|
starttime = eventtime = self.reactor.monotonic()
|
||||||
self.status_cmd = get_status.encode()
|
while not self.est_clock:
|
||||||
self.reactor.update_timer(self.status_timer, self.reactor.NOW)
|
if eventtime > starttime + 5.:
|
||||||
|
raise error("timeout on est_clock calculation")
|
||||||
|
eventtime = self.reactor.pause(eventtime + 0.010)
|
||||||
def connect_file(self, debugoutput, dictionary, pace=False):
|
def connect_file(self, debugoutput, dictionary, pace=False):
|
||||||
self.ser = debugoutput
|
self.ser = debugoutput
|
||||||
self.msgparser.process_identify(dictionary, decompress=False)
|
self.msgparser.process_identify(dictionary, decompress=False)
|
||||||
|
|
Loading…
Reference in New Issue