eive-tmtc/pus_tc/pdu1.py

49 lines
2.0 KiB
Python
Raw Normal View History

2020-12-29 11:29:03 +01:00
# -*- coding: utf-8 -*-
"""
@file tmtcc_tc_pdu1.py
@brief PDU2 tests
@author J. Meier
@date 17.12.2020
"""
2021-03-19 17:39:52 +01:00
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.pus_tc.base import PusTelecommand
2020-12-29 11:29:03 +01:00
from gomspace.gomspace_common import *
2021-03-19 17:39:52 +01:00
from pus_tc.p60dock import P60DockConfigTable
2020-12-29 11:29:03 +01:00
from gomspace.gomspace_pdu_definitions import *
class PDU1TestProcedure:
"""
@brief Use this class to define the tests to perform for the PDU2.
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
2021-02-09 12:35:10 +01:00
all = False
2020-12-29 11:29:03 +01:00
reboot = False
ping = False
read_temperature = False
2021-02-06 16:35:53 +01:00
def pack_pdu1_test_into(pdu1_object_id: bytearray, p60dock_object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
2020-12-29 11:29:03 +01:00
tc_queue.appendleft(("print", "Testing PDU1"))
tc_queue.appendleft(("print", "P60 Dock: Enabling PDU1"))
2021-02-06 16:35:53 +01:00
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_1.parameter_address,
2020-12-29 11:29:03 +01:00
P60DockConfigTable.out_en_1.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft(("print", "PDU1: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
2021-02-06 16:35:53 +01:00
command = pack_ping_command(pdu1_object_id, ping_data)
2020-12-29 11:29:03 +01:00
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft(("print", "PDU1: Testing temperature reading"))
2021-02-06 16:35:53 +01:00
command = pack_get_param_command(pdu1_object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
2020-12-29 11:29:03 +01:00
PDUHkTable.temperature.parameter_size)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())