fsfw-example-tmtc-common/pus_tc/pus_200_mode.py

41 lines
1.7 KiB
Python
Raw Normal View History

2021-07-14 00:28:33 +02:00
# -*- coding: utf-8 -*-
2021-10-13 12:08:50 +02:00
from spacepackets.ecss.tc import PusTelecommand
2022-07-03 20:58:32 +02:00
from tmtccmd.tc import QueueHelper
2022-05-18 23:40:13 +02:00
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
2021-07-14 00:28:33 +02:00
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID, ASSEMBLY_ID
2021-07-14 00:28:33 +02:00
2022-07-03 20:58:32 +02:00
def pack_service_200_commands_into(q: QueueHelper, op_code: str):
2021-12-14 15:46:00 +01:00
if op_code == "test":
2022-07-03 20:58:32 +02:00
pack_service_200_test_into(q)
elif op_code == "asm_to_normal" or op_code == "0":
# Set Normal mode
2022-07-03 20:58:32 +02:00
q.add_log_cmd("Testing Service 200: Set Mode Normal")
# Command assembly to normal, submode 1 for dual mode,
mode_data = pack_mode_data(ASSEMBLY_ID, Modes.NORMAL, 1)
2022-07-03 20:58:32 +02:00
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
2021-07-14 00:28:33 +02:00
2022-07-03 20:58:32 +02:00
def pack_service_200_test_into(q: QueueHelper):
q.add_log_cmd("Testing Service 200")
2021-07-14 00:28:33 +02:00
# Object ID: DUMMY Device
object_id = TEST_DEVICE_0_ID
# Set On Mode
2022-07-03 20:58:32 +02:00
q.add_log_cmd("Testing Service 200: Set Mode On")
2021-10-13 12:08:50 +02:00
mode_data = pack_mode_data(object_id, Modes.ON, 0)
2022-07-03 20:58:32 +02:00
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
2021-07-14 00:28:33 +02:00
# Set Normal mode
2022-07-03 20:58:32 +02:00
q.add_log_cmd("Testing Service 200: Set Mode Normal")
2021-10-13 12:08:50 +02:00
mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
2022-07-03 20:58:32 +02:00
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
2021-07-14 00:28:33 +02:00
# Set Raw Mode
2022-07-03 20:58:32 +02:00
q.add_log_cmd("Testing Service 200: Set Mode Raw")
2021-10-13 12:08:50 +02:00
mode_data = pack_mode_data(object_id, Modes.RAW, 0)
2022-07-03 20:58:32 +02:00
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
2021-07-14 00:28:33 +02:00
# Set Off Mode
2022-07-03 20:58:32 +02:00
q.add_log_cmd("Testing Service 200: Set Mode Off")
2021-10-13 12:08:50 +02:00
mode_data = pack_mode_data(object_id, Modes.OFF, 0)
2022-07-03 20:58:32 +02:00
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))