some refactoring for PCDU cmds

This commit is contained in:
Robin Müller 2023-01-12 14:11:30 +01:00
parent 87607aa681
commit ecae444ee3
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 117 additions and 28 deletions

View File

@ -273,12 +273,14 @@ def generic_on_cmd(
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
):
q.add_log_cmd(info_str + " on")
q.add_pus_tc(
pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.on,
)
q.add_pus_tc(create_generic_on_cmd(object_id, out_idx))
def create_generic_on_cmd(object_id: bytes, out_idx: int):
return pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.on,
)
@ -286,12 +288,14 @@ def generic_off_cmd(
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
):
q.add_log_cmd(info_str + " off")
q.add_pus_tc(
pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.off,
)
q.add_pus_tc(create_generic_off_cmd(object_id, out_idx))
def create_generic_off_cmd(object_id: bytes, out_idx: int):
return pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.off,
)

View File

@ -12,6 +12,8 @@ from eive_tmtc.tmtc.power.common_power import (
generic_on_cmd,
generic_off_cmd,
add_gomspace_cmd_defs,
create_generic_on_cmd,
create_generic_off_cmd,
pack_common_power_cmds,
GomspaceOpCodes,
GsInfo,
@ -173,65 +175,148 @@ def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
)
PDU1_DICT = {
Pdu1ChIndex.TCS: Pdu1InfoBase.TCS,
Pdu1ChIndex.STR: Pdu1InfoBase.STR,
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
}
def pdu1_on_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
def pdu1_off_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
pdu1_on_cmd(Pdu1ChIndex.TCS, q)
def create_tcs_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
def tcs_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
pdu1_off_cmd(Pdu1ChIndex.TCS, q)
def create_tcs_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
def syrlinks_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
pdu1_on_cmd(Pdu1ChIndex.SYRLINKS, q)
def create_syrlinks_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
def syrlinks_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
pdu1_off_cmd(Pdu1ChIndex.SYRLINKS, q)
def create_syrlinks_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
def startracker_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
pdu1_on_cmd(Pdu1ChIndex.STR, q)
def create_startracker_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
def startracker_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
pdu1_on_cmd(Pdu1ChIndex.STR, q)
def create_startracker_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
def mgt_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
pdu1_on_cmd(Pdu1ChIndex.MGT, q)
def create_mgt_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
def mgt_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
pdu1_off_cmd(Pdu1ChIndex.MGT, q)
def create_mgt_off_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
pdu1_on_cmd(Pdu1ChIndex.SUS_N, q)
def create_sun_sensor_nominal_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
def sun_sensor_nominal_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
pdu1_off_cmd(Pdu1ChIndex.SUS_N, q)
def create_sun_sensor_nominal_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
def solar_cell_experiment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
pdu1_on_cmd(Pdu1ChIndex.SCEX, q)
def create_solar_cell_experiment_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
def solar_cell_experiment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
pdu1_off_cmd(Pdu1ChIndex.SCEX, q)
def create_solar_cell_experiment_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
def ploc_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
pdu1_on_cmd(Pdu1ChIndex.PLOC, q)
def create_ploc_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
def ploc_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
pdu1_off_cmd(Pdu1ChIndex.PLOC, q)
def create_ploc_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
def acs_board_a_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
pdu1_on_cmd(Pdu1ChIndex.ACS_A, q)
def create_acs_board_a_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)
def acs_board_a_off_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
pdu1_off_cmd(Pdu1ChIndex.ACS_A, q)
def create_acs_board_a_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)