From a0504cffb59f4456f8de88e269a4b3d4fe0d913a Mon Sep 17 00:00:00 2001
From: Marko Mecina <marko.mecina@univie.ac.at>
Date: Thu, 7 Sep 2023 16:58:09 +0200
Subject: [PATCH] add time tick packet script

---
 Ccs/scripts/time_updt.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Ccs/scripts/time_updt.py

diff --git a/Ccs/scripts/time_updt.py b/Ccs/scripts/time_updt.py
new file mode 100644
index 0000000..56810af
--- /dev/null
+++ b/Ccs/scripts/time_updt.py
@@ -0,0 +1,21 @@
+# Periodically send a PUS TC(9,128) time update packet in a background task
+
+import threading
+
+def timetick(period):
+    global t_updt
+    print('START TIMETICK')
+    while t_updt:
+        ObtTime = cfl.get_cuc_now()
+        cfl.Tcbuild('SASW TimeUpdt', ObtTime, pool_name='LIVE', ack=0, sleep=period)
+    print('STOP TIMETICK')
+
+
+PERIOD = 1  # time tick period in seconds
+
+t_updt = True
+t = threading.Thread(target=timetick, args=[PERIOD])
+t.start()
+
+#! CCS.BREAKPOINT
+t_updt = False
\ No newline at end of file
-- 
GitLab