diff --git a/config/obsw_config.py b/config/obsw_config.py index c84c17ba927ee062ecadf962b66812beb4fa357b..9b47d40629bf8dbea1feadbcc9609421aab72ab4 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 4cfc48eba6b4266772ca1db8db9f2dbcb8781390..7091926f89b97db0d44c211181f0eaa4e34f98f8 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 23dbd25701c81f31e544a658d3a617df6f281a03..f1c2d68335aeb98fa854edd3e1bc79fef265f043 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 db6aaef2824f19cfc3687ae63ec5480aeb0e4cb2..440b94ce454f50d4078962806ef03942f56d466c 160000 --- a/tmtc_core +++ b/tmtc_core @@ -1 +1 @@ -Subproject commit db6aaef2824f19cfc3687ae63ec5480aeb0e4cb2 +Subproject commit 440b94ce454f50d4078962806ef03942f56d466c