clocksync: Change timer frequency to avoid resonating with other timers
If the clock querying messages occur at a similar frequency to other events on the micro-controller or host, then it's possible for the load created by those other events to skew the clock synchronization. In particular, the 500ms lcd screen update could resonate with the 1 second clock query. Use an unusual clock querying frequency to avoid this issue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
cd9e21e3aa
commit
640ff1ad56
|
@ -54,10 +54,12 @@ class ClockSync:
|
|||
if pace:
|
||||
freq = self.mcu_freq
|
||||
serial.set_clock_est(freq, self.reactor.monotonic(), 0)
|
||||
# MCU clock querying (status callback invoked from background thread)
|
||||
# MCU clock querying (_handle_status is invoked from background thread)
|
||||
def _status_event(self, eventtime):
|
||||
self.status_cmd.send()
|
||||
return eventtime + 1.0
|
||||
# Use an unusual time for the next event so status messages
|
||||
# don't resonate with other periodic events.
|
||||
return eventtime + .9839
|
||||
def _handle_status(self, params):
|
||||
# Extend clock to 64bit
|
||||
last_clock = self.last_clock
|
||||
|
|
Loading…
Reference in New Issue