[PATCH] osmocom-bb[master]: fake_trx/clck_gen.py: send the first indication immediately

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:28 UTC 2018


Review at  https://gerrit.osmocom.org/6794

fake_trx/clck_gen.py: send the first indication immediately

Change-Id: I0132dd939b02db357d248abf65c9116d6a1802d0
---
M src/target/fake_trx/clck_gen.py
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/94/6794/1

diff --git a/src/target/fake_trx/clck_gen.py b/src/target/fake_trx/clck_gen.py
index 85dc00e..1eb970a 100755
--- a/src/target/fake_trx/clck_gen.py
+++ b/src/target/fake_trx/clck_gen.py
@@ -45,6 +45,9 @@
 	# Average loop back delay
 	LO_DELAY_US = 90.0
 
+	# State variables
+	timer = None
+
 	def __init__(self, clck_links, clck_start = 0, ind_period = 102):
 		self.clck_links = clck_links
 		self.ind_period = ind_period
@@ -55,15 +58,15 @@
 		self.ctr_interval /= self.SEC_DELAY_US
 		self.ctr_interval *= self.ind_period
 
-		# Create a timer manager
-		self.timer = Timer(self.ctr_interval, self.send_clck_ind)
-
 	def start(self):
-		# Schedule the first indication
-		self.timer.start()
+		# Send the first indication
+		self.send_clck_ind()
 
 	def stop(self):
-		self.timer.cancel()
+		# Stop pending timer
+		if self.timer is not None:
+			self.timer.cancel()
+			self.timer = None
 
 	def send_clck_ind(self):
 		# Keep clock cycle

-- 
To view, visit https://gerrit.osmocom.org/6794
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0132dd939b02db357d248abf65c9116d6a1802d0
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list