clean up batt cmds a bit

This commit is contained in:
Robin Müller 2023-06-14 07:45:03 +02:00
parent d1bd8f15d9
commit f9a61fa485
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -41,17 +41,17 @@ class BpxHeaterModeSelect(enum.IntEnum):
class BpxOpCode:
HK = ["0", "hk"]
OFF = ["off"]
ON = ["on"]
HK = "hk"
OFF = "off"
ON = "on"
RST_CFG = "reset_cfg"
SET_CFG = "set_cfg"
MAN_HEATER_ON = "man_heater_on"
MAN_HEATER_OFF = "man_heater_off"
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
REQUEST_CFG = ["2", "cfg"]
REQUEST_CFG_HK = ["3", "cfg_hk"]
REBOOT = ["4", "reboot"]
RST_BOOT_CNT = "rst_boot_cnt"
REQUEST_CFG = "cfg"
REQUEST_CFG_HK = "cfg_hk"
REBOOT = "reboot"
@tmtc_definitions_provider
@ -81,11 +81,11 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is okay here.
op_code = p.op_code
q = p.queue_helper
if op_code in BpxOpCode.HK:
if op_code == BpxOpCode.HK:
q.add_log_cmd("Requesting BPX battery HK set")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_HK_SET)
q.add_pus_tc(generate_one_hk_command(sid=sid))
if op_code in BpxOpCode.OFF:
if op_code == BpxOpCode.OFF:
q.add_log_cmd("Off mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.OFF, 0)
q.add_pus_tc(
@ -95,7 +95,7 @@ def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is oka
app_data=mode_cmd,
)
)
if op_code in BpxOpCode.ON:
if op_code == BpxOpCode.ON:
q.add_log_cmd("On mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.ON, 0)
q.add_pus_tc(
@ -105,7 +105,7 @@ def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is oka
app_data=mode_cmd,
)
)
if op_code in BpxOpCode.RST_BOOT_CNT:
if op_code == BpxOpCode.RST_BOOT_CNT:
q.add_log_cmd("Resetting reboot counters")
q.add_pus_tc(
create_action_cmd(
@ -137,16 +137,16 @@ def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is oka
user_data=user_data,
)
)
if op_code in BpxOpCode.REQUEST_CFG:
if op_code == BpxOpCode.REQUEST_CFG:
q.add_log_cmd("Requesting configuration struct")
q.add_pus_tc(
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.GET_CFG)
)
if op_code in BpxOpCode.REQUEST_CFG_HK:
if op_code == BpxOpCode.REQUEST_CFG_HK:
q.add_log_cmd("Requesting configuration struct HK")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_CFG_SET)
q.add_pus_tc(generate_one_hk_command(sid=sid))
if op_code in BpxOpCode.REBOOT:
if op_code == BpxOpCode.REBOOT:
q.add_log_cmd("Rebooting BPX battery")
q.add_pus_tc(
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)