syrlinks hk test wip

This commit is contained in:
Jakob Meier 2021-02-27 13:09:55 +01:00
parent 1d5fe4ebc7
commit 07381147f7
3 changed files with 61 additions and 2 deletions

View File

@ -21,6 +21,7 @@ class ObjectIds(enum.Enum):
TMP1075_2_HANDLER_ID = auto()
HEATER = auto()
SOLAR_ARRAY_DEPLOYMENT_HANDLER = auto()
SYRLINKS_HK_HANDLER = auto()
def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
@ -36,6 +37,7 @@ def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
o_ids.TMP1075_2_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x6]),
o_ids.HEATER: bytearray([0x54, 0x00, 0x00, 0x3]),
o_ids.SOLAR_ARRAY_DEPLOYMENT_HANDLER: bytearray([0x44, 0x00, 0x00, 0x8]),
o_ids.SYRLINKS_HK_HANDLER: bytearray([0x44, 0x00, 0x00, 0x9]),
o_ids.INVALID: bytearray([0xFF, 0xFF, 0xFF, 0xFF]),
}
)

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""
@file tmtcc_tc_p60dock.py
@brief P60 Dock tests
@author J. Meier
@date 13.12.2020
"""
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
from tmtc_core.pus_tc.tmtcc_tc_service_3_housekeeping import *
class SetIds:
RX_REGISTERS_DATASET = bytearray(0x0, 0x0, 0x0, 0x1)
RX_REGISTERS_DATASET = bytearray(0x0, 0x0, 0x0, 0x2)
def pack_syrlinks_hk_handler_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get RX Registers"))
sid = make_sid(object_id, SetIds.RX_REGISTERS_DATASET)
command = generate_one_hk_command(sid, 200)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get TX Registers"))
sid = make_sid(object_id, SetIds.TX_REGISTERS_DATASET)
command = generate_one_hk_command(sid, 201)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -4,10 +4,12 @@
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
import struct
from typing import Tuple
from tmtc_core.pus_tm.tmtcc_pus_service_3 import Service3Base
from tmtc_core.utility.tmtcc_logger import get_logger
from config.tmtcc_object_ids import ObjectIds
LOGGER = get_logger()
@ -22,5 +24,29 @@ def handle_user_hk_packet(
@param service3_packet:
@return:
"""
LOGGER.info("Service3TM: Parsing for this SID has not been implemented.")
return [], [], bytearray()
if object_id == ObjectIds.SYRLINKS_HK_HANDLER.value:
return handle_syrlinks_hk_data(hk_data)
else:
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
return [], [], bytearray(), 0
def handle_syrlinks_hk_data(hk_data: bytearray) -> Tuple[list, list, bytearray, int]:
hk_header = []
hk_content = []
validity_buffer = bytearray()
hk_header = ["RX Status", "RX Sensitivity", "RX Frequency Shift", "RX IQ Power", "RX AGC Value", "RX Demod Eb",
"RX Demod N0", "RX Datarate"]
rx_status = hk_data[0]
rx_sensitivity = struct.unpack('!I', hk_data[1:5])
rx_frequency_shift = struct.unpack('!I', hk_data[5:9])
rx_iq_power = struct.unpack('!H', hk_data[9:13])
rx_agc_value = struct.unpack('!H', hk_data[13:17])
rx_demod_eb = struct.unpack('!I', hk_data[17:21])
rx_demod_n0 = struct.unpack('!I', hk_data[21:25])
rx_data_rate = hk_data[25]
hk_content = [rx_status, rx_sensitivity, rx_frequency_shift, rx_iq_power, rx_agc_value, rx_demod_eb, rx_demod_n0,
rx_data_rate]
validity_buffer.append(hk_data[26:])
return hk_header, hk_content, validity_buffer, 8