add RTD HK

This commit is contained in:
Robin Müller 2023-03-14 10:11:01 +01:00
parent d8367f7e62
commit f21ee37a01
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 56 additions and 20 deletions

View File

@ -10,13 +10,12 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v2.18.2] 2023-03-13
## Added
- Added RTD ID enum and Set ID enumeration in the RTD module.
- STR Temperature Set
- Added some more MPSoC commands
- RTD HK set
## Fixed

View File

@ -2,7 +2,8 @@
import logging
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
from eive_tmtc.tmtc.acs.acs_ctrl import handle_raw_mgm_data, handle_acs_ctrl_hk_data
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
from eive_tmtc.tmtc.payload.rad_sensor import handle_rad_sensor_data
@ -28,11 +29,6 @@ from eive_tmtc.tmtc.power.tm import (
handle_pcdu_hk,
)
from eive_tmtc.tmtc.acs.imtq import (
ImtqSetId,
handle_self_test_data,
handle_eng_set,
handle_calibrated_mtm_measurement,
handle_raw_mtm_measurement,
handle_imtq_hk,
)
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
@ -141,6 +137,8 @@ def handle_regular_hk_print(
return handle_sus_hk(
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
)
elif objb in RTD_NAMES.keys():
return handle_rtd_hk(object_id=objb, hk_data=hk_data, printer=printer)
elif objb == obj_ids.P60_DOCK_HANDLER:
return handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
elif objb in [

View File

@ -261,7 +261,7 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code in OpCode.MODE_SNAPSHOT:
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack('!I', CommandId.TC_MODE_SNAPSHOT)
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_SNAPSHOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@ -380,13 +380,13 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
+ struct.pack("!I", CommandId.TC_CAM_TAKE_PIC)
+ bytearray(filename, "utf-8")
+ bytes([0])
+ struct.pack('!B', encoder_setting_y)
+ struct.pack('!Q', quantization_y)
+ struct.pack('!B', encoder_setting_cb)
+ struct.pack('!Q', quantization_cb)
+ struct.pack('!B', encoder_setting_cr)
+ struct.pack('!Q', quantization_cr)
+ struct.pack('!B', bypass_compressor)
+ struct.pack("!B", encoder_setting_y)
+ struct.pack("!Q", quantization_y)
+ struct.pack("!B", encoder_setting_cb)
+ struct.pack("!Q", quantization_cb)
+ struct.pack("!B", encoder_setting_cr)
+ struct.pack("!Q", quantization_cr)
+ struct.pack("!B", bypass_compressor)
)
return bytearray(command)
@ -410,10 +410,10 @@ def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
command = (
object_id
+ struct.pack("!I", CommandId.TC_DOWNLINK_DATA_MODULATE)
+ struct.pack('!B', format)
+ struct.pack('!I', src_mem_addr)
+ struct.pack('!H', src_mem_len)
+ struct.pack('!I', dest_mem_addr)
+ struct.pack("!B", format)
+ struct.pack("!I", src_mem_addr)
+ struct.pack("!H", src_mem_len)
+ struct.pack("!I", dest_mem_addr)
)
return bytearray(command)

View File

@ -3,6 +3,7 @@ from typing import Optional
import struct
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.pus_tm.defs import PrintWrapper
from spacepackets.ecss import PusTelecommand
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from tmtccmd.config.tmtc import tmtc_definitions_provider
@ -12,6 +13,7 @@ from tmtccmd.util import ObjectIdU32
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
import eive_tmtc.config.object_ids as oids
from eive_tmtc.config.object_ids import get_object_ids
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
RTD_IDS = [
oids.RTD_0_PLOC_HSPD,
@ -32,6 +34,25 @@ RTD_IDS = [
oids.RTD_15_IMTQ,
]
RTD_NAMES = {
oids.RTD_0_PLOC_HSPD: "RTD 0 PLOC Heatspreader",
oids.RTD_1_PLOC_MISSIONBRD: "RTD 1 PLOC Missionboard",
oids.RTD_2_4K_CAM: "RTD 2 4K Camera",
oids.RTD_3_DAC_HSPD: "RTD 3 DAC HSPC",
oids.RTD_4_STR: "RTD 4 Startracker",
oids.RTD_5_RW1_MX_MY: "RTD 5 RW1 MX MY",
oids.RTD_6_DRO: "RTD 6 DRO",
oids.RTD_7_SCEX: "RTD 7 SCEX",
oids.RTD_8_X8: "RTD 8 X8",
oids.RTD_9_HPA: "RTD 9 HPA",
oids.RTD_10_PL_TX: "RTD 10 PL TX",
oids.RTD_11_MPA: "RTD 11 MPA",
oids.RTD_12_ACU: "RTD 12 ACU",
oids.RTD_13_PLPCDU_HSPD: "RTD 13 PL PCDU Heatspreader",
oids.RTD_14_TCS_BRD: "RTD 14 TCS Board",
oids.RTD_15_IMTQ: "RTD 15 iMTQ",
}
class CommandId:
WRITE_CONFIG = 6
@ -126,6 +147,24 @@ def pack_rtd_commands(
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
def handle_rtd_hk(object_id: bytes, hk_data: bytes, printer: FsfwTmTcPrinter):
pw = PrintWrapper(printer)
rtd_name = RTD_NAMES.get(object_id)
if rtd_name is None:
rtd_name = "unknown RTD device"
pw.dlog(f"Received RTD HK for RTD {rtd_name} with object ID {object_id}")
fmt_str = "!ffBB"
fmt_len = struct.calcsize(fmt_str)
(rtd_val, temp_celcius, last_err_byte, error_byte) = struct.unpack(
fmt_str, hk_data[0 : 0 + fmt_len]
)
pw.dlog(f"Temperature Celcius: {temp_celcius}")
pw.dlog(f"RTD Value: {rtd_val}")
pw.dlog(f"Error Byte: {error_byte}")
pw.dlog(f"Last Error Byte: {last_err_byte}")
pw.printer.print_validity_buffer(hk_data[fmt_len:], 4)
def prompt_rtd_idx():
while True:
rtd_idx = input("Please specify RTD index [0-15]: ")