From feda85f7e96f91de6ec2541d37b18cdc1e3f7735 Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Sat, 28 Nov 2020 00:55:20 +0100
Subject: [PATCH] todo added

---
 config/obsw_config.py     | 16 ++++++++++++++++
 config/obsw_user_code.py  | 23 +++++++++++++----------
 tc/obsw_tc_service5_17.py |  2 +-
 tmtc_core                 |  2 +-
 4 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/config/obsw_config.py b/config/obsw_config.py
index c84c17b..9b47d40 100644
--- a/config/obsw_config.py
+++ b/config/obsw_config.py
@@ -183,3 +183,19 @@ def set_globals(args):
     from config.obsw_user_code import global_setup_hook
     global_setup_hook()
 
+def set_glob_apid(new_apid: int):
+    global G_APID
+    G_APID = new_apid
+
+def get_glob_apid():
+    global G_APID
+    return G_APID
+
+def set_glob_com_if(new_com_if: ComInterfaces):
+    global G_COM_IF
+    G_COM_IF = new_com_if
+
+def get_glob_com_if():
+    global G_COM_IF
+    return G_COM_IF
+
diff --git a/config/obsw_user_code.py b/config/obsw_user_code.py
index 4cfc48e..7091926 100644
--- a/config/obsw_user_code.py
+++ b/config/obsw_user_code.py
@@ -3,10 +3,13 @@ User defined code can be added here.
 """
 from typing import Union, Tuple
 from tmtc_core.tc.obsw_pus_tc_base import PusTcInfo
+from tmtc_core.tmtc_core_definitions import ComInterfaces
 from enum import Enum
 
 
-# Yeah, I did not have a better idea yet..
+# TODO: We really need that JSON file which will not be tracked by version control.
+#       In that JSON file, we could set the current developer, so that developers can
+#       hook into the config.
 class Developer(Enum):
     Robin = 0
 
@@ -22,24 +25,24 @@ def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]:
         return prepare_robins_commands()
 
 
+def prepare_robins_commands():
+    from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
+    command = PusTelecommand(service=17, subservice=1, ssc=20)
+    return command.pack_command_tuple()
+
 def global_setup_hook():
     """
     Can be used to alter the global variables in a custom defined way.
     For example, device specific com ports or ethernet ports can be set here.
     The global variables in the config.obsw_config file can be edited here
     by using the handle.
-    For example: config.obsw_config.G_ETHERNET_SEND_ADDRESS = new_send_address
     """
     if Developer == Developer.Robin:
         global_setup_hook_robin()
 
 
-def prepare_robins_commands():
-    from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
-    command = PusTelecommand(service=17, subservice=1, ssc=20)
-    return command.pack_command_tuple()
-
-
 def global_setup_hook_robin():
-    import config.obsw_config
-    pass
+    from config.obsw_config import get_glob_com_if, set_glob_apid
+    if get_glob_com_if() == ComInterfaces.Ethernet:
+        # Configure APID for FSFW example. Set this back to 0x73 for STM32!
+        set_glob_apid(0xEF)
diff --git a/tc/obsw_tc_service5_17.py b/tc/obsw_tc_service5_17.py
index 23dbd25..f1c2d68 100644
--- a/tc/obsw_tc_service5_17.py
+++ b/tc/obsw_tc_service5_17.py
@@ -6,7 +6,7 @@
 @author R. Mueller
 @date   02.05.2020
 """
-
+import config.obsw_config as g
 from tc.obsw_pus_tc_packer import TcQueueT, PusTelecommand
 
 
diff --git a/tmtc_core b/tmtc_core
index db6aaef..440b94c 160000
--- a/tmtc_core
+++ b/tmtc_core
@@ -1 +1 @@
-Subproject commit db6aaef2824f19cfc3687ae63ec5480aeb0e4cb2
+Subproject commit 440b94ce454f50d4078962806ef03942f56d466c
-- 
GitLab