can reads temp set now

This commit is contained in:
Robin Müller 2023-02-10 16:40:19 +01:00
parent 8d23f29f94
commit 8ec086f778
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -22,7 +22,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid, make_sid,
create_request_one_diag_command, create_request_one_diag_command,
create_enable_periodic_hk_command_with_interval, create_enable_periodic_hk_command_with_interval,
create_disable_periodic_hk_command, create_disable_periodic_hk_command, create_request_one_hk_command,
) )
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_mode_command from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_mode_command
@ -48,6 +48,7 @@ class OpCode:
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate" NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate" NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
HK_RX_REGS = "hk_rx_regs" HK_RX_REGS = "hk_rx_regs"
HK_TEMPS= "hk_temps"
ENABLE_HK_RX_REGS = "enable_hk_rx" ENABLE_HK_RX_REGS = "enable_hk_rx"
DISABLE_HK_RX_REGS = "disable_hk_rx" DISABLE_HK_RX_REGS = "disable_hk_rx"
ENABLE_HK_TX_REGS = "enable_hk_tx" ENABLE_HK_TX_REGS = "enable_hk_tx"
@ -67,6 +68,7 @@ class Info:
NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high datarate" NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high datarate"
HK_RX_REGS = "Request RX register set" HK_RX_REGS = "Request RX register set"
HK_TX_REGS = "Request TX register set" HK_TX_REGS = "Request TX register set"
HK_TEMPS = "Request Temperatures HK"
ENABLE_HK_RX_REGS = "Enable periodic RX register HK" ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
DISABLE_HK_RX_REGS = "Disable periodic RX register HK" DISABLE_HK_RX_REGS = "Disable periodic RX register HK"
ENABLE_HK_TX_REGS = "Enable periodic TX register HK" ENABLE_HK_TX_REGS = "Enable periodic TX register HK"
@ -125,6 +127,7 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.DISABLE_HK_RX_REGS, Info.DISABLE_HK_RX_REGS) oce.add(OpCode.DISABLE_HK_RX_REGS, Info.DISABLE_HK_RX_REGS)
oce.add(OpCode.ENABLE_HK_TX_REGS, Info.ENABLE_HK_TX_REGS) oce.add(OpCode.ENABLE_HK_TX_REGS, Info.ENABLE_HK_TX_REGS)
oce.add(OpCode.DISABLE_HK_TX_REGS, Info.DISABLE_HK_TX_REGS) oce.add(OpCode.DISABLE_HK_TX_REGS, Info.DISABLE_HK_TX_REGS)
oce.add(OpCode.HK_TEMPS, Info.HK_TEMPS)
oce.add("7", "Syrlinks Handler: Read TX waveform") oce.add("7", "Syrlinks Handler: Read TX waveform")
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte") oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte") oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
@ -178,6 +181,10 @@ def pack_syrlinks_command(
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}") q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET) sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
q.add_pus_tc(create_request_one_diag_command(sid)) q.add_pus_tc(create_request_one_diag_command(sid))
if op_code in OpCode.HK_TEMPS:
q.add_log_cmd(f"{prefix}: {Info.HK_TEMPS}")
sid = make_sid(obyt, SetId.TEMPERATURE_SET_ID)
q.add_pus_tc(create_request_one_hk_command(sid))
if op_code in OpCode.ENABLE_HK_RX_REGS: if op_code in OpCode.ENABLE_HK_RX_REGS:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}") q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}")
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET) sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
@ -259,11 +266,24 @@ def handle_syrlinks_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: byte
return handle_syrlinks_rx_registers_dataset(printer, hk_data) return handle_syrlinks_rx_registers_dataset(printer, hk_data)
elif set_id == SetId.TX_REGISTERS_DATASET: elif set_id == SetId.TX_REGISTERS_DATASET:
return handle_syrlinks_tx_registers_dataset(printer, hk_data) return handle_syrlinks_tx_registers_dataset(printer, hk_data)
elif set_id == SetId.TEMPERATURE_SET_ID:
return handle_syrlinks_temp_dataset(printer, hk_data)
else: else:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}") pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
def handle_syrlinks_temp_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
pw = PrintWrapper(printer)
if len(hk_data) < 8:
raise ValueError("expected at least 8 bytes of HK data")
temp_power_amplifier = struct.unpack("!f", hk_data[0:4])[0]
temp_baseband_board = struct.unpack("!f", hk_data[4:8])[0]
pw.dlog(f"Temperatur Power Amplifier [C]: {temp_power_amplifier}")
pw.dlog(f"Temperatur Baseband Board [C]: {temp_baseband_board}")
printer.print_validity_buffer(hk_data[8:], 2)
def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes): def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
header_list = [ header_list = [