From bfff64a9c6cdd721abb451d5280f6446da0b203d Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Thu, 30 Apr 2020 15:35:40 +0200
Subject: [PATCH] SID, PID definitions moved to config

---
 config/obsw_config.py  |  8 ++++++++
 tc/obsw_tc_service3.py | 19 ++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/config/obsw_config.py b/config/obsw_config.py
index 83c2edd..735faf9 100644
--- a/config/obsw_config.py
+++ b/config/obsw_config.py
@@ -56,6 +56,14 @@ DUMMY_COMMAND_3 = bytearray([0xBA, 0xDE, 0xAF, 0xFE])
 # SIDs
 GPS0_SID = bytearray([0x00, 0x00, 0x1f, 0x00])
 GPS1_SID = bytearray([0x00, 0x00, 0x2f, 0x00])
+CUSTOM_SID_1 = bytearray([0x00, 0x00, 0x43, 0x00])
+CUSTOM_SID_2 = bytearray([0x00, 0x00, 0x44, 0x00])
+# Pool IDs
+TEST_ID_1 = bytearray([0x01, 0x01, 0x01, 0x02])
+TEST_ID_2 = bytearray([0x02, 0x02, 0x02, 0x04])
+TEST_ID_3 = bytearray([0x03, 0x03, 0x03, 0x06])
+TEST_ID_4 = bytearray([0x04, 0x04, 0x04, 0x08])
+TEST_ID_5 = bytearray([0x05, 0x05, 0x05, 0x10])
 
 """
 All global variables, set in main program with arg parser
diff --git a/tc/obsw_tc_service3.py b/tc/obsw_tc_service3.py
index deb81ca..5b46404 100644
--- a/tc/obsw_tc_service3.py
+++ b/tc/obsw_tc_service3.py
@@ -9,21 +9,22 @@ Description: PUS Custom Service 8: Device Access, Native low-level commanding
 import struct
 from typing import Deque
 from tc.obsw_pus_tc_base import PusTelecommand
+import config.obsw_config as g
 
 
 def pack_service3_test_into(tc_queue: Deque) -> Deque:
     tc_queue.appendleft(("print", "Testing Service 3"))
     # adding custom defintion to hk using test pool variables
-    sid1 = bytearray([0x00, 0x00, 0x43, 0x00])
-    sid2 = bytearray([0x00, 0x00, 0x44, 0x00])
-    sid_gps = bytearray([0x00, 0x00, 0x1f, 0x00])
+    sid1 = g.CUSTOM_SID_1
+    sid2 = g.CUSTOM_SID_2
+    sid_gps = g.GPS0_SID
     collection_interval = struct.pack('>f', 3)
-    number_of_parameters = struct.pack('B', 5)
-    p1 = bytearray([0x01, 0x01, 0x01, 0x01])
-    p2 = bytearray([0x02, 0x02, 0x02, 0x02])
-    p3 = bytearray([0x03, 0x03, 0x03, 0x03])
-    p4 = bytearray([0x04, 0x04, 0x04, 0x04])
-    p5 = bytearray([0x05, 0x05, 0x05, 0x05])
+    number_of_parameters = struct.pack('>B', 5)
+    p1 = g.TEST_ID_1
+    p2 = g.TEST_ID_2
+    p3 = g.TEST_ID_3
+    p4 = g.TEST_ID_4
+    p5 = g.TEST_ID_5
     hk_definition1 = sid1 + collection_interval + number_of_parameters + p1 + p2 + p3 + p4 + p5
     collection_interval = struct.pack('>f', 6)
     hk_definition2 = sid2 + collection_interval + number_of_parameters + p1 + p2 + p3 + p4 + p5
-- 
GitLab