diff --git a/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml b/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml index d91d2604e3a89f8b75b3032f9496770d701d75bf..b443130565f1120cc74f261a940059def5685f68 100644 --- a/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml +++ b/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml @@ -13,7 +13,7 @@ <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> - <option name="PARAMETERS" value="-m 3 -s Core -o 11 -c 1 -t 2.5" /> + <option name="PARAMETERS" value="-m 3 -s Core -o A11 -c 1 -t 2.5" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="true" /> <option name="MODULE_MODE" value="false" /> diff --git a/.idea/runConfigurations/tmtcclient_Reset_OBC.xml b/.idea/runConfigurations/tmtcclient_Reset_OBC.xml index ec4edabad600d1ae0d8f633c28ae97b4e0a9b600..3e529385b41396062e99870991fcde125cffd9be 100644 --- a/.idea/runConfigurations/tmtcclient_Reset_OBC.xml +++ b/.idea/runConfigurations/tmtcclient_Reset_OBC.xml @@ -13,7 +13,7 @@ <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> - <option name="PARAMETERS" value="-m 3 -s Core -o 10 -c 1 -t 2.5" /> + <option name="PARAMETERS" value="-m 3 -s Core -o A10 -c 1 -t 2.5" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="true" /> <option name="MODULE_MODE" value="false" /> diff --git a/tc/obsw_tc_core.py b/tc/obsw_tc_core.py index 700a5a2f889d431adc647271b407ecb8806e53df..be4a2fa3910f779bcdd995113cf4b6fff0a6287c 100644 --- a/tc/obsw_tc_core.py +++ b/tc/obsw_tc_core.py @@ -5,14 +5,34 @@ from tc.obsw_tc_service8 import make_action_id from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand -def pack_core_command(tc_queue: Deque, op_code: int, ssc: int = 0): - if op_code == 10: +def pack_core_command(tc_queue: Deque, op_code, ssc: int = 0): + if op_code.lower() == "a0": + tc_queue.appendleft(("print", "Generating OBC run time stats")) + command = generate_run_time_stats_generation_command(ssc=ssc) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code.lower() == "a10": tc_queue.appendleft(("print", "Resetting OBC.")) command = generate_reset_obc_command(ssc=ssc) tc_queue.appendleft(command.pack_command_tuple()) + if op_code.lower() == "a11": + tc_queue.appendleft(("print", "Power cycling OBC.")) + command = generate_power_cycle_obc_command(ssc=ssc) + tc_queue.appendleft(command.pack_command_tuple()) def generate_reset_obc_command(ssc: int, object_id: bytearray = CORE_CONTROLLER_ID): app_data = bytearray(object_id) app_data += make_action_id(10) return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=app_data) + + +def generate_power_cycle_obc_command(ssc: int, object_id: bytearray = CORE_CONTROLLER_ID): + app_data = bytearray(object_id) + app_data += make_action_id(11) + return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=app_data) + + +def generate_run_time_stats_generation_command(ssc: int, object_id: bytearray = CORE_CONTROLLER_ID): + app_data = bytearray(object_id) + app_data += make_action_id(0) + return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=app_data) diff --git a/utility/obsw_binary_uploader.py b/utility/obsw_binary_uploader.py index 412bcdcd36538fecfcb966d26431aadaa5f616be..996f29512ee3621f8559c60dac3fd66d6202807c 100644 --- a/utility/obsw_binary_uploader.py +++ b/utility/obsw_binary_uploader.py @@ -156,7 +156,8 @@ def perform_file_upload(com_if: CommunicationInterface, tmtc_printer: TmTcPrinte tmtc_printer.print_telecommand(tc_packet, tc_info) elif tc_packet == "print": LOGGER.info(tc_info) - remaining_time_string = "Remaining time: " + str(total_time - (idx - 2) * interval) + \ + remaining_time_string = "Remaining time: " + \ + str(round(total_time - (idx - 2) * interval, 2)) + \ " seconds" print_progress_bar(idx - 2, total_num_packets, print_end="\n", suffix=remaining_time_string) # sys.stdout.write("\033[F") # Cursor up one line