aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorPiotr K <pkrysik@elka.pw.edu.pl>2014-08-07 23:04:43 +0200
committerPiotr K <pkrysik@elka.pw.edu.pl>2014-08-07 23:04:43 +0200
commit77f3b0694920ec2adfc5caeac4b61cbe7bed1857 (patch)
tree44f38effefcb55a24b0945f821036dd2bdfd9acd /python
parent966651a8759e53830f7b83815bc2f2652fb4d982 (diff)
Changed name of conditional_reset() to timed_reset(). Added line to stop timer if synchronization was achieved by the receiver.
Diffstat (limited to 'python')
-rw-r--r--python/clock_offset_control.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/clock_offset_control.py b/python/clock_offset_control.py
index db8f93b..0e3c621 100644
--- a/python/clock_offset_control.py
+++ b/python/clock_offset_control.py
@@ -43,7 +43,7 @@ class clock_offset_control(gr.basic_block):
self.first_measurement = True
self.counter = 0
self.last_state = ""
- self.timer = Timer(0.5, self.conditional_reset)
+ self.timer = Timer(0.5, self.timed_reset)
def process_measurement(self,msg):
if pmt.is_tuple(msg):
@@ -63,9 +63,10 @@ class clock_offset_control(gr.basic_block):
msg_ppm = pmt.from_double(ppm)
self.message_port_pub(pmt.intern("ppm"), msg_ppm)
self.timer.cancel()
- self.timer = Timer(0.5, self.conditional_reset)
+ self.timer = Timer(0.5, self.timed_reset)
self.timer.start()
elif state == "synchronized":
+ self.timer.cancel()
if self.first_measurement:
self.ppm_estimate = ppm
self.first_measurement = False
@@ -83,7 +84,7 @@ class clock_offset_control(gr.basic_block):
msg_ppm = pmt.from_double(0.0)
self.message_port_pub(pmt.intern("ppm"), msg_ppm)
- def conditional_reset(self):
+ def timed_reset(self):
if self.last_state != "synchronized":
# print "conditional reset"
self.reset()
@@ -94,3 +95,4 @@ class clock_offset_control(gr.basic_block):
self.ppm_estimate = -1e6
self.counter = 0
self.first_measurement = True
+