From 6d46ce004199c313df3b5c576f0bb91af616ae18 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Wed, 8 Jul 2020 03:35:21 +0200 Subject: [PATCH] semi ugly solution --- obsw_user_code.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/obsw_user_code.py b/obsw_user_code.py index c7e41a8..122dcfe 100644 --- a/obsw_user_code.py +++ b/obsw_user_code.py @@ -1,16 +1,25 @@ """ User defined code can be added here. """ -from typing import Tuple, Union -from tc.obsw_pus_tc_base import PusTcInfo, PusTelecommand +from typing import Union, Tuple +from tc.obsw_pus_tc_base import PusTcInfo +from enum import Enum + + +# Yeah, I did not have a better idea yet.. +class Developer(Enum): + Robin = 0 + + +Developer = Developer.Robin def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]: """ Can be used to pack user-defined commands. """ - command = PusTelecommand(service=17, subservice=1, ssc=20) - return command.pack_command_tuple() + if Developer == Developer.Robin: + return prepare_robins_commands() def global_setup_hook(): @@ -21,8 +30,19 @@ def global_setup_hook(): by using the handle. For example: config.obsw_config.G_SEND_ADDRESS = new_send_address """ + if Developer == Developer.Robin: + global_setup_hook_robin() + + +def prepare_robins_commands(): + from 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 # Static IP of board port_send = 7301 send_address_to_set = ("127.0.0.1", port_send) - config.obsw_config.G_SEND_ADDRESS = send_address_to_set + config.obsw_config.G_SEND_ADDRESS = send_address_to_set \ No newline at end of file -- GitLab