aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/clocksync.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-09-18 22:53:12 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-19 17:25:43 -0400
commit008be18f41a0ff7c814edbe6f979d39ffeff6727 (patch)
tree1851a0caf684281170caab136675645fbb0b51b0 /klippy/clocksync.py
parent13812aa1c9f76c869f70de0e1934750c70914898 (diff)
downloadkutter-008be18f41a0ff7c814edbe6f979d39ffeff6727.tar.gz
kutter-008be18f41a0ff7c814edbe6f979d39ffeff6727.tar.xz
kutter-008be18f41a0ff7c814edbe6f979d39ffeff6727.zip
clocksync: Don't export get_last_clock()
Everywhere the data in get_last_clock() is used can be done just as easily with estimated_print_time(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/clocksync.py')
-rw-r--r--klippy/clocksync.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/klippy/clocksync.py b/klippy/clocksync.py
index 416648cb..fd1966ff 100644
--- a/klippy/clocksync.py
+++ b/klippy/clocksync.py
@@ -11,9 +11,10 @@ class ClockSync:
def __init__(self, reactor):
self.reactor = reactor
self.serial = None
- self.lock = threading.Lock()
+ self.queries_pending = 0
self.status_timer = self.reactor.register_timer(self._status_event)
self.status_cmd = None
+ self.lock = threading.Lock()
self.last_clock = 0
self.last_clock_time = self.last_clock_time_min = 0.
self.min_freq = self.max_freq = 0.
@@ -46,6 +47,8 @@ class ClockSync:
def stats(self, eventtime):
return "last_clock=%d last_clock_time=%.3f" % (
self.last_clock, self.last_clock_time)
+ def is_active(self, eventtime):
+ return self.queries_pending <= 4
def get_clock(self, eventtime):
with self.lock:
last_clock = self.last_clock
@@ -59,13 +62,12 @@ class ClockSync:
if clock_diff & 0x80000000:
return last_clock + 0x100000000 - clock_diff
return last_clock - clock_diff
- def get_last_clock(self):
- with self.lock:
- return self.last_clock, self.last_clock_time
def _status_event(self, eventtime):
+ self.queries_pending += 1
self.serial.send(self.status_cmd)
return eventtime + 1.0
def _handle_status(self, params):
+ self.queries_pending = 0
sent_time = params['#sent_time']
if not sent_time:
return