Merge remote-tracking branch 'origin/main' into mueller/pus-15-tm-storage
This commit is contained in:
commit
d87361ae75
@ -15,6 +15,7 @@ tmtccmd version 4.0.0
|
||||
## Added
|
||||
|
||||
- Basic persistent TM store commanding
|
||||
- System and TCS system announce mode commands
|
||||
|
||||
## Changed
|
||||
|
||||
|
@ -7,18 +7,24 @@ from tmtccmd.config.tmtc import (
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from eive_tmtc.config.object_ids import EIVE_SYSTEM_ID
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import (
|
||||
create_mode_command,
|
||||
Mode,
|
||||
create_announce_mode_recursive_command,
|
||||
)
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
SAFE_MODE = "safe"
|
||||
IDLE_MODE = "idle"
|
||||
ANNOUNCE_MODES = "announce_modes"
|
||||
|
||||
|
||||
class Info:
|
||||
SAFE_MODE = "Command System into Safe Mode"
|
||||
IDLE_MODE = "Command System into Idle Pointing Mode"
|
||||
ANNOUNCE_MODES = "Announce mode recursively"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SYSTEM.value)
|
||||
@ -32,6 +38,9 @@ def build_system_cmds(p: ServiceProviderParams):
|
||||
elif o == OpCode.IDLE_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, AcsMode.IDLE, 0))
|
||||
elif o == OpCode.ANNOUNCE_MODES:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
@ -39,6 +48,7 @@ def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
|
||||
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
|
||||
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SYSTEM.value,
|
||||
info="EIVE system commands",
|
||||
|
@ -5,3 +5,4 @@ class CtrlSetId(enum.IntEnum):
|
||||
PRIMARY_SENSORS = 0
|
||||
DEVICE_SENSORS = 1
|
||||
SUS_TEMP_SENSORS = 2
|
||||
HEATER_INFO = 4
|
||||
|
@ -32,6 +32,18 @@ class Heater(enum.IntEnum):
|
||||
NUMBER_OF_SWITCHES = 8
|
||||
|
||||
|
||||
HEATER_LOCATION = [
|
||||
"OBC Board",
|
||||
"PLOC Processing Board",
|
||||
"ACS Board",
|
||||
"PCDU PDU",
|
||||
"Camera",
|
||||
"Startracker",
|
||||
"DRO",
|
||||
"HPA",
|
||||
]
|
||||
|
||||
|
||||
class OpCode:
|
||||
HEATER_CMD = ["switch_cmd"]
|
||||
HEATER_EXT_CTRL = ["set_ext_ctrl"]
|
||||
|
@ -9,8 +9,12 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_announce_mode_recursive_command
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_hk_command,
|
||||
create_request_one_diag_command,
|
||||
)
|
||||
|
||||
|
||||
class OpCodeSys:
|
||||
@ -19,6 +23,8 @@ class OpCodeSys:
|
||||
REQUEST_PRIMARY_TEMP_SET = ["temp"]
|
||||
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
|
||||
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
|
||||
REQUEST_HEATER_INFO = "heater_info"
|
||||
ANNOUNCE_MODES = "announce_modes"
|
||||
|
||||
|
||||
class InfoSys:
|
||||
@ -27,6 +33,8 @@ class InfoSys:
|
||||
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
||||
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
||||
REQUEST_HEATER_INFO = "Request heater information"
|
||||
ANNOUNCE_MODES = "Announce Modes recursively"
|
||||
|
||||
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
@ -46,12 +54,22 @@ def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
||||
)
|
||||
)
|
||||
if op_code == OpCodeSys.REQUEST_HEATER_INFO:
|
||||
q.add_log_cmd(InfoSys.REQUEST_HEATER_INFO)
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.HEATER_INFO)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodeSys.OFF:
|
||||
q.add_log_cmd(InfoSys.OFF)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
|
||||
if op_code in OpCodeSys.NML:
|
||||
q.add_log_cmd(InfoSys.NML)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
|
||||
if op_code == OpCodeSys.ANNOUNCE_MODES:
|
||||
q.add_log_cmd(InfoSys.ANNOUNCE_MODES)
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(TCS_SUBSYSTEM_ID))
|
||||
pack_tcs_ass_cmds(q, op_code)
|
||||
|
||||
|
||||
@ -67,6 +85,8 @@ def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
|
||||
)
|
||||
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
oce.add(keys=OpCodeSys.REQUEST_HEATER_INFO, info=InfoSys.REQUEST_HEATER_INFO)
|
||||
oce.add(keys=OpCodeSys.ANNOUNCE_MODES, info=InfoSys.ANNOUNCE_MODES)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS,
|
||||
info="TCS Board",
|
||||
|
@ -1,10 +1,16 @@
|
||||
import logging
|
||||
import pprint
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.fsfw import validity_buffer_list
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from .defs import CtrlSetId
|
||||
from .heater import HEATER_LOCATION
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_thermal_controller_hk_data(
|
||||
@ -22,7 +28,10 @@ def handle_thermal_controller_hk_data(
|
||||
pw.dlog("Received sensor temperature data")
|
||||
|
||||
# get all the floats
|
||||
tm_data = struct.unpack("!fffffffffffffffffffff", hk_data[: 21 * 4])
|
||||
fmt_str = "!fffffffffffffffffffff"
|
||||
fmt_len = struct.calcsize(fmt_str)
|
||||
tm_data = struct.unpack(fmt_str, hk_data[:fmt_len])
|
||||
valid_list = validity_buffer_list(hk_data[fmt_len:], 21)
|
||||
parsed_data = {
|
||||
"SENSOR_PLOC_HEATSPREADER": tm_data[0],
|
||||
"SENSOR_PLOC_MISSIONBOARD": tm_data[1],
|
||||
@ -46,9 +55,8 @@ def handle_thermal_controller_hk_data(
|
||||
"TMP1075 PL PCDU 1": tm_data[19],
|
||||
"TMP1075 IF BOARD": tm_data[20],
|
||||
}
|
||||
printer.file_logger.info(str(parsed_data))
|
||||
pp = pprint.PrettyPrinter(depth=4)
|
||||
pp.pprint(parsed_data)
|
||||
for idx, (k, v) in enumerate(parsed_data.items()):
|
||||
print(f"{str(k).ljust(30)}: Valid: {valid_list[idx]}, Value: {v}")
|
||||
elif set_id == CtrlSetId.DEVICE_SENSORS:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received device temperature data")
|
||||
@ -108,3 +116,13 @@ def handle_thermal_controller_hk_data(
|
||||
printer.file_logger.info(str(parsed_data))
|
||||
pp = pprint.PrettyPrinter(depth=4)
|
||||
pp.pprint(parsed_data)
|
||||
elif set_id == CtrlSetId.HEATER_INFO:
|
||||
print("Heater Switch States")
|
||||
for i in range(8):
|
||||
print(
|
||||
f"{HEATER_LOCATION[i].ljust(25)}: {'On' if hk_data[i] == 1 else 'Off'}"
|
||||
)
|
||||
current_draw = struct.unpack("!H", hk_data[8:10])[0]
|
||||
print(f"Heater Power Channel Current Draw: {current_draw} mA")
|
||||
else:
|
||||
_LOGGER.warning(f"Unimplemented set ID {set_id}")
|
||||
|
Loading…
Reference in New Issue
Block a user