Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
0efd9ca9c6 | |||
f21ee37a01 | |||
d8367f7e62 | |||
e862df4d06 | |||
fb851b93a0 | |||
5337ac4517 | |||
0ebb237787 | |||
de0ecb44e4 | |||
42c34b310e | |||
c274615aac | |||
e3e74c3f20 | |||
10362f7d30 | |||
21a3813643 | |||
ae2fd8bb37 | |||
ca5b2238bc | |||
d520a0e2f2 | |||
c99a0701d2 | |||
2c7ad5385e | |||
56630b05c2 | |||
64d0ca491a | |||
8d036bcd4f |
14
CHANGELOG.md
14
CHANGELOG.md
@ -10,6 +10,20 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
# [v2.19.0] 2023-03-14
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
- Import error for STR code
|
||||||
|
- STR HK bugfixes and length check
|
||||||
|
|
||||||
# [v2.18.1] 2023-03-11
|
# [v2.18.1] 2023-03-11
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
__version__ = "2.18.1"
|
__version__ = "2.19.0"
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SW_NAME = "eive-tmtc"
|
SW_NAME = "eive-tmtc"
|
||||||
VERSION_MAJOR = 2
|
VERSION_MAJOR = 2
|
||||||
VERSION_MINOR = 18
|
VERSION_MINOR = 19
|
||||||
VERSION_REVISION = 1
|
VERSION_REVISION = 0
|
||||||
|
|
||||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||||
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
# 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.power.plpcdu import handle_plpcdu_hk
|
||||||
from eive_tmtc.tmtc.payload.rad_sensor import handle_rad_sensor_data
|
from eive_tmtc.tmtc.payload.rad_sensor import handle_rad_sensor_data
|
||||||
from eive_tmtc.tmtc.acs.sus import handle_sus_hk
|
from eive_tmtc.tmtc.acs.sus import handle_sus_hk
|
||||||
@ -27,11 +29,6 @@ from eive_tmtc.tmtc.power.tm import (
|
|||||||
handle_pcdu_hk,
|
handle_pcdu_hk,
|
||||||
)
|
)
|
||||||
from eive_tmtc.tmtc.acs.imtq import (
|
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,
|
handle_imtq_hk,
|
||||||
)
|
)
|
||||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
||||||
@ -140,6 +137,8 @@ def handle_regular_hk_print(
|
|||||||
return handle_sus_hk(
|
return handle_sus_hk(
|
||||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
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:
|
elif objb == obj_ids.P60_DOCK_HANDLER:
|
||||||
return handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
return handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||||
elif objb in [
|
elif objb in [
|
||||||
|
@ -934,7 +934,7 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
|||||||
alt = [
|
alt = [
|
||||||
f"{val:8.3f}"
|
f"{val:8.3f}"
|
||||||
for val in struct.unpack(
|
for val in struct.unpack(
|
||||||
fmt_scalar, hk_data[current_idx: current_idx + inc_len_scalar]
|
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
current_idx += inc_len_scalar
|
current_idx += inc_len_scalar
|
||||||
@ -985,7 +985,11 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
current_idx = 0
|
current_idx = 0
|
||||||
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
|
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
|
||||||
current_idx += inc_len_quat
|
current_idx += inc_len_quat
|
||||||
rate = struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])*180/math.pi
|
rate = (
|
||||||
|
struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])
|
||||||
|
* 180
|
||||||
|
/ math.pi
|
||||||
|
)
|
||||||
current_idx += inc_len_vec
|
current_idx += inc_len_vec
|
||||||
status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0]
|
status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0]
|
||||||
current_idx += inc_len_sts
|
current_idx += inc_len_sts
|
||||||
|
@ -683,14 +683,14 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
|||||||
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
||||||
if set_id == SetId.SOLUTION:
|
if set_id == SetId.SOLUTION:
|
||||||
handle_solution_set(hk_data, pw)
|
handle_solution_set(hk_data, pw)
|
||||||
|
elif set_id == SetId.TEMPERATURE:
|
||||||
|
handle_temperature_set(hk_data, pw)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||||
|
|
||||||
|
|
||||||
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
|
||||||
pw.dlog("Received solution set")
|
|
||||||
ticks_time_fmt = "!IQ"
|
ticks_time_fmt = "!IQ"
|
||||||
current_idx = 0
|
|
||||||
fmt_len = struct.calcsize(ticks_time_fmt)
|
fmt_len = struct.calcsize(ticks_time_fmt)
|
||||||
(ticks, unix_time) = struct.unpack(
|
(ticks, unix_time) = struct.unpack(
|
||||||
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||||
@ -699,6 +699,34 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
||||||
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
|
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
|
||||||
current_idx += fmt_len
|
current_idx += fmt_len
|
||||||
|
return current_idx
|
||||||
|
|
||||||
|
|
||||||
|
def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
|
||||||
|
pw.dlog("Received temperature set")
|
||||||
|
if len(hk_data) < 24:
|
||||||
|
_LOGGER.warning(f"Temperature dataset HK with length {len(hk_data)} too short")
|
||||||
|
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||||
|
temps_fmt = "!fff"
|
||||||
|
fmt_len = struct.calcsize(temps_fmt)
|
||||||
|
(mcu_temp, cmos_temp, fpga_temp) = struct.unpack(
|
||||||
|
temps_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||||
|
)
|
||||||
|
pw.dlog(f"MCU Temperature: {mcu_temp}")
|
||||||
|
pw.dlog(f"CMOS Temperature: {cmos_temp}")
|
||||||
|
pw.dlog(f"FPGA Temperature: {fpga_temp}")
|
||||||
|
current_idx += fmt_len
|
||||||
|
pw.printer.print_validity_buffer(hk_data[current_idx:], 5)
|
||||||
|
|
||||||
|
|
||||||
|
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||||
|
pw.dlog("Received solution set")
|
||||||
|
if len(hk_data) < 78:
|
||||||
|
_LOGGER.warning(
|
||||||
|
f"Solution dataset HK data with length {len(hk_data)} too short"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||||
calib_quaternions_fmt = "!ffff"
|
calib_quaternions_fmt = "!ffff"
|
||||||
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
||||||
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
||||||
@ -732,7 +760,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
current_idx += 1
|
current_idx += 1
|
||||||
# Result of LISA: Lost in space algorithm
|
# Result of LISA: Lost in space algorithm
|
||||||
lisa_fmt = "!fffffB"
|
lisa_fmt = "!fffffB"
|
||||||
fmt_len = struct.calcsize(track_fmt)
|
fmt_len = struct.calcsize(lisa_fmt)
|
||||||
(
|
(
|
||||||
lisa_q_w,
|
lisa_q_w,
|
||||||
lisa_q_x,
|
lisa_q_x,
|
||||||
@ -753,7 +781,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
is_trusworthy = hk_data[current_idx]
|
is_trusworthy = hk_data[current_idx]
|
||||||
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])
|
stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||||
pw.dlog(f"Stable count: {stable_count}")
|
pw.dlog(f"Stable count: {stable_count}")
|
||||||
current_idx += 4
|
current_idx += 4
|
||||||
solution_strategy = hk_data[current_idx]
|
solution_strategy = hk_data[current_idx]
|
||||||
|
@ -284,7 +284,9 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
|||||||
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetId.HK)
|
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetId.HK)
|
||||||
q.add_pus_tc(generate_one_hk_command(sid))
|
q.add_pus_tc(generate_one_hk_command(sid))
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(f"Unknown operation code {op_code} for core controller commands")
|
_LOGGER.warning(
|
||||||
|
f"Unknown operation code {op_code} for core controller commands"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):
|
def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):
|
||||||
|
@ -66,6 +66,10 @@ class CommandId(enum.IntEnum):
|
|||||||
TC_MODE_IDLE = 18
|
TC_MODE_IDLE = 18
|
||||||
SET_UART_TX_TRISTATE = 20
|
SET_UART_TX_TRISTATE = 20
|
||||||
RELEASE_UART_TX = 21
|
RELEASE_UART_TX = 21
|
||||||
|
TC_CAM_TAKE_PIC = 22
|
||||||
|
TC_SIMPLEX_SEND_FILE = 23
|
||||||
|
TC_DOWNLINK_DATA_MODULATE = 24
|
||||||
|
TC_MODE_SNAPSHOT = 25
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
@ -78,6 +82,10 @@ class OpCode:
|
|||||||
REPLAY_WRITE_SEQ = ["replay_write"]
|
REPLAY_WRITE_SEQ = ["replay_write"]
|
||||||
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
||||||
REPLAY_START = ["replay_start"]
|
REPLAY_START = ["replay_start"]
|
||||||
|
CAM_TAKE_PIC = ["cam_take_pic"]
|
||||||
|
SIMPLEX_SEND_FILE = ["simplex_send_file"]
|
||||||
|
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
|
||||||
|
MODE_SNAPSHOT = ["mode_snapshot"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
@ -90,6 +98,10 @@ class Info:
|
|||||||
REPLAY_WRITE_SEQ = "Replay write sequence"
|
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||||
DOWNLINK_PWR_ON = "Downlink Power On"
|
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||||
REPLAY_START = "Replay Start"
|
REPLAY_START = "Replay Start"
|
||||||
|
CAM_TAKE_PIC = "Cam Take Picture"
|
||||||
|
SIMPLEX_SEND_FILE = "Simplex Send File"
|
||||||
|
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
|
||||||
|
MODE_SNAPSHOT = "Mode Snapshot"
|
||||||
|
|
||||||
|
|
||||||
class MemAddresses(enum.IntEnum):
|
class MemAddresses(enum.IntEnum):
|
||||||
@ -123,6 +135,10 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||||
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
||||||
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
||||||
|
oce.add(OpCode.CAM_TAKE_PIC, Info.CAM_TAKE_PIC)
|
||||||
|
oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
|
||||||
|
oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
|
||||||
|
oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
|
||||||
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
|
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
|
||||||
|
|
||||||
|
|
||||||
@ -231,6 +247,22 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
|
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
if op_code in OpCode.CAM_TAKE_PIC:
|
||||||
|
q.add_log_cmd("PLOC MPSoC: Cam take picture")
|
||||||
|
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
|
||||||
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
if op_code in OpCode.SIMPLEX_SEND_FILE:
|
||||||
|
q.add_log_cmd("PLOC MPSoC: Simplex send file")
|
||||||
|
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
|
||||||
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
if op_code in OpCode.DOWNLINK_DATA_MODULATE:
|
||||||
|
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
||||||
|
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
||||||
|
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)
|
||||||
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
|
||||||
|
|
||||||
def generate_write_mem_command(
|
def generate_write_mem_command(
|
||||||
@ -267,13 +299,13 @@ def prepare_mem_read_command(object_id: bytes) -> bytearray:
|
|||||||
|
|
||||||
|
|
||||||
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
||||||
obcFile = get_obc_file()
|
obc_file = get_obc_file()
|
||||||
mpsocFile = get_mpsoc_file()
|
mpsoc_file = get_mpsoc_file()
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
||||||
+ bytearray(obcFile, "utf-8")
|
+ bytearray(obc_file, "utf-8")
|
||||||
+ bytearray(mpsocFile, "utf-8")
|
+ bytearray(mpsoc_file, "utf-8")
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
@ -323,6 +355,69 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
|||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
||||||
|
selection = input("Use default parameter? (Y/N): ")
|
||||||
|
if selection is "Y" or selection is "y":
|
||||||
|
filename = "0:/test"
|
||||||
|
encoder_setting_y = 7
|
||||||
|
quantization_y = 0
|
||||||
|
encoder_setting_cb = 7
|
||||||
|
quantization_cb = 0
|
||||||
|
encoder_setting_cr = 7
|
||||||
|
quantization_cr = 0
|
||||||
|
bypass_compressor = 0
|
||||||
|
else:
|
||||||
|
filename = input("Specify filename: ")
|
||||||
|
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
|
||||||
|
quantization_y = int(input("Specify quantization_Y: "))
|
||||||
|
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
|
||||||
|
quantization_cb = int(input("Specify quantization_Cb: "))
|
||||||
|
encoder_setting_cr = int(input("Specify encoderSetting_Cr: "))
|
||||||
|
quantization_cr = int(input("Specify quantization_Cr: "))
|
||||||
|
bypass_compressor = int(input("Specify bypassCompressor: "))
|
||||||
|
command = (
|
||||||
|
object_id
|
||||||
|
+ 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)
|
||||||
|
)
|
||||||
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
|
||||||
|
filename = input("Specify filename: ")
|
||||||
|
command = (
|
||||||
|
object_id
|
||||||
|
+ struct.pack("!I", CommandId.TC_SIMPLEX_SEND_FILE)
|
||||||
|
+ bytearray(filename, "utf-8")
|
||||||
|
+ bytes([0])
|
||||||
|
)
|
||||||
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
|
||||||
|
format = int(input("Specify format: "))
|
||||||
|
src_mem_addr = int(input("Specify srcMemAddr: "))
|
||||||
|
src_mem_len = int(input("Specify srcMemLen: "))
|
||||||
|
dest_mem_addr = int(input("Specify destMemAddr: "))
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
def get_obc_file() -> str:
|
def get_obc_file() -> str:
|
||||||
_LOGGER.info("Specify OBC file ")
|
_LOGGER.info("Specify OBC file ")
|
||||||
input_helper = InputHelper(flash_write_file_dict)
|
input_helper = InputHelper(flash_write_file_dict)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import enum
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from spacepackets.ecss import PusTelecommand
|
from spacepackets.ecss import PusTelecommand
|
||||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
@ -11,6 +13,7 @@ from tmtccmd.util import ObjectIdU32
|
|||||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||||
import eive_tmtc.config.object_ids as oids
|
import eive_tmtc.config.object_ids as oids
|
||||||
from eive_tmtc.config.object_ids import get_object_ids
|
from eive_tmtc.config.object_ids import get_object_ids
|
||||||
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
RTD_IDS = [
|
RTD_IDS = [
|
||||||
oids.RTD_0_PLOC_HSPD,
|
oids.RTD_0_PLOC_HSPD,
|
||||||
@ -31,11 +34,53 @@ RTD_IDS = [
|
|||||||
oids.RTD_15_IMTQ,
|
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:
|
class CommandId:
|
||||||
WRITE_CONFIG = 6
|
WRITE_CONFIG = 6
|
||||||
|
|
||||||
|
|
||||||
|
class RtdId(enum.IntEnum):
|
||||||
|
RTD_0_PLOC_HSPC = 0
|
||||||
|
RTD_1_PLOC_MISSIONBRD = 1
|
||||||
|
RTD_2_4K_CAM = 2
|
||||||
|
RTD_3_DAC_HSPD = 3
|
||||||
|
RTD_4_STR = 4
|
||||||
|
RTD_5_RW1_MX_MY = 5
|
||||||
|
RTD_6_DRO = 6
|
||||||
|
RTD_7_SCEX = 7
|
||||||
|
RTD_8_X8 = 8
|
||||||
|
RTD_9_HPA = 9
|
||||||
|
RTD_10_PL_TX = 10
|
||||||
|
RTD_11_MPA = 11
|
||||||
|
RTD_12_ACU = 12
|
||||||
|
RTD_13_PLPCDU_HSPD = 13
|
||||||
|
RTD_14_TCS_BRD = 14
|
||||||
|
RTD_15_IMTQ = 15
|
||||||
|
|
||||||
|
|
||||||
|
class SetId(enum.IntEnum):
|
||||||
|
TEMPERATURE = 1
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
ON = ["0", "on"]
|
ON = ["0", "on"]
|
||||||
OFF = ["1", "off"]
|
OFF = ["1", "off"]
|
||||||
@ -102,6 +147,24 @@ def pack_rtd_commands(
|
|||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
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():
|
def prompt_rtd_idx():
|
||||||
while True:
|
while True:
|
||||||
rtd_idx = input("Please specify RTD index [0-15]: ")
|
rtd_idx = input("Please specify RTD index [0-15]: ")
|
||||||
|
Reference in New Issue
Block a user