aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/clocksync.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-05-28 11:38:04 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-05-29 10:57:29 -0400
commitb93fd5b1b569533d610fc684bc2a64166bad624c (patch)
tree61a14a16904cddd3d3fc0f557d09839ea405e39d /klippy/clocksync.py
parent879c45db191251af2a00e75bf6ba89ab876c2fad (diff)
downloadkutter-b93fd5b1b569533d610fc684bc2a64166bad624c.tar.gz
kutter-b93fd5b1b569533d610fc684bc2a64166bad624c.tar.xz
kutter-b93fd5b1b569533d610fc684bc2a64166bad624c.zip
basecmd: Rename get_status to get_clock
Change the get_status command to get_clock. Don't report the shutdown status in the new get_clock command. The primary purpose of this change is to force the host code to report a firmware version mismatch with older firmwares as recent changes (namely the ordering of message block acks) have subtle incompatibilities if different host/mcu code is used. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/clocksync.py')
-rw-r--r--klippy/clocksync.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/klippy/clocksync.py b/klippy/clocksync.py
index caea39dc..9c58e6fa 100644
--- a/klippy/clocksync.py
+++ b/klippy/clocksync.py
@@ -14,8 +14,8 @@ class ClockSync:
def __init__(self, reactor):
self.reactor = reactor
self.serial = None
- self.status_timer = self.reactor.register_timer(self._status_event)
- self.status_cmd = None
+ self.get_clock_timer = self.reactor.register_timer(self._get_clock_event)
+ self.get_clock_cmd = None
self.mcu_freq = 1.
self.last_clock = 0
self.clock_est = (0., 0., 0.)
@@ -38,14 +38,14 @@ class ClockSync:
self.time_avg = params['#sent_time']
self.clock_est = (self.time_avg, self.clock_avg, self.mcu_freq)
self.prediction_variance = (.001 * self.mcu_freq)**2
- # Enable periodic get_status timer
- self.status_cmd = serial.lookup_command('get_status')
+ # Enable periodic get_clock timer
+ self.get_clock_cmd = serial.lookup_command('get_clock')
for i in range(8):
- params = self.status_cmd.send_with_response(response='status')
- self._handle_status(params)
+ params = self.get_clock_cmd.send_with_response(response='clock')
+ self._handle_clock(params)
self.reactor.pause(0.100)
- serial.register_callback(self._handle_status, 'status')
- self.reactor.update_timer(self.status_timer, self.reactor.NOW)
+ serial.register_callback(self._handle_clock, 'clock')
+ self.reactor.update_timer(self.get_clock_timer, self.reactor.NOW)
def connect_file(self, serial, pace=False):
self.serial = serial
self.mcu_freq = serial.msgparser.get_constant_float('CLOCK_FREQ')
@@ -54,13 +54,13 @@ class ClockSync:
if pace:
freq = self.mcu_freq
serial.set_clock_est(freq, self.reactor.monotonic(), 0)
- # MCU clock querying (_handle_status is invoked from background thread)
- def _status_event(self, eventtime):
- self.status_cmd.send()
- # Use an unusual time for the next event so status messages
+ # MCU clock querying (_handle_clock is invoked from background thread)
+ def _get_clock_event(self, eventtime):
+ self.get_clock_cmd.send()
+ # Use an unusual time for the next event so clock messages
# don't resonate with other periodic events.
return eventtime + .9839
- def _handle_status(self, params):
+ def _handle_clock(self, params):
# Extend clock to 64bit
last_clock = self.last_clock
clock = (last_clock & ~0xffffffff) | params['clock']