40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
@file rad_sensor.py
|
|
@brief Tests for the radiation sensor handler
|
|
@author J. Meier
|
|
@date 01.07.2021
|
|
"""
|
|
from tmtccmd.config.definitions import QueueCommands
|
|
|
|
from tmtccmd.tc.packer import TcQueueT
|
|
from spacepackets.ecss.tc import PusTelecommand
|
|
from pus_tc.service_200_mode import pack_mode_data
|
|
|
|
|
|
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
|
tc_queue.appendleft(
|
|
(
|
|
QueueCommands.PRINT,
|
|
"Testing radiation sensor handler with object id: 0x" + object_id.hex(),
|
|
)
|
|
)
|
|
|
|
if op_code == "0":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode on"))
|
|
mode_data = pack_mode_data(object_id, 1, 0)
|
|
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if op_code == "1":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode normal"))
|
|
mode_data = pack_mode_data(object_id, 2, 0)
|
|
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if op_code == "2":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off"))
|
|
mode_data = pack_mode_data(object_id, 0, 0)
|
|
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|