Power Commands Update #108

Merged
meierj merged 7 commits from mueller/power-cmds-update into main 2022-08-25 14:48:42 +02:00
11 changed files with 48 additions and 45 deletions
Showing only changes of commit 71aa79528e - Show all commits

View File

@ -97,10 +97,10 @@ def pack_get_param_command(
else:
app_data += memory_address
app_data += struct.pack("!B", parameter_size)
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id,
action_id=GomspaceDeviceActionIds.PARAM_GET,
app_data=app_data,
user_data=app_data,
)
@ -173,10 +173,10 @@ def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand
@note The ping request sends the specified data to a gompsace device. These
data are simply copied by the device and then sent back.
"""
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id.as_bytes,
action_id=GomspaceDeviceActionIds.PING,
app_data=data,
user_data=data,
)
@ -184,7 +184,7 @@ def pack_gnd_wdt_reset_command(object_id: ObjectIdU32) -> PusTelecommand:
""" " Function to generate the command to reset the watchdog of a gomspace device.
@param object_id Object Id of the gomspace device handler.
"""
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.WDT_RESET
)
@ -193,7 +193,7 @@ def pack_reboot_command(object_id: ObjectIdU32) -> PusTelecommand:
"""Function to generate the command which triggers a reboot of a gomspace device
@param object_id The object id of the gomspace device handler.
"""
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REBOOT
)
@ -203,6 +203,6 @@ def pack_request_full_hk_table_command(object_id: ObjectIdU32) -> PusTelecommand
device.
@param object_id The object id of the gomspace device handler.
"""
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REQUEST_HK_TABLE
)

View File

@ -20,7 +20,7 @@ from gomspace.gomspace_common import GomspaceOpCodes
from gomspace.gomspace_common import GsInfo as GsInfo
from config.object_ids import ACU_HANDLER_ID
from pus_tc.devs.p60dock import P60DockConfigTable
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.util import ObjectIdU32
@ -85,7 +85,7 @@ def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("ACU: Print channel stats")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=object_id.as_bytes,
action_id=gs.GomspaceDeviceActionIds.PRINT_SWITCH_V_I,
)

View File

@ -3,7 +3,7 @@ from config.object_ids import BPX_HANDLER_ID
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
@ -38,14 +38,14 @@ def pack_bpx_commands(p: ServiceProviderParams):
if op_code in BpxOpCodes.RST_BOOT_CNT:
q.add_log_cmd("Resetting reboot counters")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
)
)
if op_code in BpxOpCodes.REQUEST_CFG:
q.add_log_cmd("Requesting configuration struct")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
)
)
@ -56,7 +56,7 @@ def pack_bpx_commands(p: ServiceProviderParams):
if op_code in BpxOpCodes.REBOOT:
q.add_log_cmd("Rebooting BPX battery")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.REBOOT
)
)

View File

@ -7,7 +7,8 @@ from gomspace.gomspace_common import (
Channel,
GomspaceOpCodes,
GsInfo,
SetIds, GomspaceDeviceActionIds,
SetIds,
GomspaceDeviceActionIds,
)
from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST
from pus_tm.defs import PrintWrapper

View File

@ -16,7 +16,7 @@ from tmtccmd.tc.pus_201_fsfw_health import (
FsfwHealth,
Subservices,
)
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from spacepackets.ecss.tc import PusTelecommand
@ -200,6 +200,6 @@ def pack_switch_heater_command(
command.append(switch_nr)
command.append(switch_action)
command.append(COMMAND_SOURCE_PARAM_EXTERNAL)
return generate_action_command(
return make_fsfw_action_cmd(
object_id=object_id, action_id=ActionIds.SWITCH_HEATER, app_data=command
)

View File

@ -22,7 +22,7 @@ from gomspace.gomspace_common import (
SetIds,
)
from config.object_ids import P60_DOCK_HANDLER
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.util import ObjectIdU32
@ -150,14 +150,14 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("P60 Dock: Print Switches, Voltages, Currents")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
)
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
q.add_log_cmd("P60 Dock: Print Latchups")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
)

View File

@ -42,14 +42,14 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("PDU1: Print Switches, Voltages, Currents")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
)
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
q.add_log_cmd("PDU1: Print Latchups")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
)
@ -113,4 +113,3 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
Channel.off,
)
)

View File

@ -46,14 +46,14 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd(f"PDU2: {GsInfo.PRINT_SWITCH_V_I}")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
)
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
q.add_log_cmd("PDU2: Print Latchups")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
)

View File

@ -6,7 +6,7 @@ from tmtccmd import DefaultProcedureInfo, TcHandlerBase
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
from config.object_ids import SCEX_HANDLER_ID
@ -71,25 +71,23 @@ def pack_scex_cmds(p: ServiceProviderParams):
if op_code in OpCodes.PING:
q.add_log_cmd(Info.PING)
app_data = bytes([0])
q.add_pus_tc(generate_action_command(SCEX_HANDLER_ID, ActionIds.PING, app_data))
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.PING, app_data))
if op_code in OpCodes.ION_CMD:
q.add_log_cmd(Info.ION_CMD)
app_data = bytes([0])
q.add_pus_tc(
generate_action_command(SCEX_HANDLER_ID, ActionIds.ION_CMD, app_data)
)
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ION_CMD, app_data))
if op_code in OpCodes.TEMP_CMD:
q.add_log_cmd(Info.TEMP_CMD)
app_data = bytes([0])
q.add_pus_tc(
generate_action_command(SCEX_HANDLER_ID, ActionIds.TEMP_CMD, app_data)
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.TEMP_CMD, app_data)
)
if op_code in OpCodes.EXP_STATUS_CMD:
q.add_log_cmd(Info.EXP_STATUS_CMD)
app_data = bytes([0])
q.add_pus_tc(
generate_action_command(SCEX_HANDLER_ID, ActionIds.EXP_STATUS_CMD, app_data)
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.EXP_STATUS_CMD, app_data)
)
# one cell
@ -137,7 +135,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
app_data.append(dac_weight3[cn])
q.add_pus_tc(
generate_action_command(SCEX_HANDLER_ID, ActionIds.ONE_CELLS_CMD, app_data)
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ONE_CELLS_CMD, app_data)
)
if op_code in OpCodes.ALL_CELLS_CMD:
@ -169,13 +167,13 @@ def pack_scex_cmds(p: ServiceProviderParams):
app_data.append(dac_weight3[cn])
q.add_pus_tc(
generate_action_command(SCEX_HANDLER_ID, ActionIds.ALL_CELLS_CMD, app_data)
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ALL_CELLS_CMD, app_data)
)
if op_code in OpCodes.FRAM:
q.add_log_cmd(Info.FRAM)
app_data = bytes([0])
q.add_pus_tc(generate_action_command(SCEX_HANDLER_ID, ActionIds.FRAM, app_data))
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.FRAM, app_data))
def append_16_bit_val(packet: bytearray, val: int):

View File

@ -4,7 +4,7 @@ from config.definitions import CustomServiceList
from tmtccmd.config import TmtcDefinitionWrapper
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.logging import get_console_logger
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
@ -125,7 +125,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.REBOOT_FULL:
q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT
)
)
@ -156,7 +156,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Disabling reboot file handling")
app_data = bytearray([0])
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
@ -164,34 +164,34 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Enabling reboot file handling")
app_data = bytearray([1])
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
)
if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
q.add_log_cmd("Resetting all reboot counters")
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS
)
if op_code in OpCodes.RESET_REBOOT_COUNTER_00:
q.add_log_cmd("Resetting reboot counter 0 0")
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00
)
if op_code in OpCodes.RESET_REBOOT_COUNTER_01:
q.add_log_cmd("Resetting reboot counter 0 1")
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01
)
if op_code in OpCodes.RESET_REBOOT_COUNTER_10:
q.add_log_cmd("Resetting reboot counter 1 0")
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10
)
if op_code in OpCodes.RESET_REBOOT_COUNTER_11:
q.add_log_cmd("Resetting reboot counter 1 1")
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11
)
if op_code in OpCodes.GET_HK:
@ -247,7 +247,7 @@ def perform_reboot_cmd(
tc_data.append(copy)
q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
q.add_pus_tc(
generate_action_command(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.XSC_REBOOT,
app_data=tc_data,

View File

@ -38,7 +38,12 @@ def handle_action_reply(
return handle_supervisor_replies(action_id, printer, custom_data)
elif object_id.as_bytes == STAR_TRACKER_ID:
return handle_startracker_replies(action_id, printer, custom_data)
elif object_id.as_bytes in [ACU_HANDLER_ID, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, P60_DOCK_HANDLER]:
elif object_id.as_bytes in [
ACU_HANDLER_ID,
PDU_1_HANDLER_ID,
PDU_2_HANDLER_ID,
P60_DOCK_HANDLER,
]:
return handle_get_param_data_reply(action_id, pw, custom_data)
else:
pw.dlog(f"No dedicated action reply handler found for reply from {object_id}")