add set cfg and rst cfg
All checks were successful
EIVE/-/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-06-14 05:16:21 +02:00
parent 656e75052b
commit cf55b3630c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -35,10 +35,17 @@ class BpxActionId:
MAN_HEATER_OFF = 11
class BpxHeaterModeSelect(enum.IntEnum):
OFF = 0
AUTO = 1
class BpxOpCode:
HK = ["0", "hk"]
OFF = ["off"]
ON = ["on"]
RST_CFG = "reset_cfg"
SET_CFG = "set_cfg"
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
REQUEST_CFG = ["2", "cfg"]
REQUEST_CFG_HK = ["3", "cfg_hk"]
@ -52,6 +59,8 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
oce.add(keys=BpxOpCode.OFF, info="Off command")
oce.add(keys=BpxOpCode.HK, info="Request BPX HK")
oce.add(keys=BpxOpCode.RST_BOOT_CNT, info="Reset Boot Count")
oce.add(keys=BpxOpCode.RST_CFG, info="Reset Config")
oce.add(keys=BpxOpCode.SET_CFG, info="Set BPX configuration")
oce.add(keys=BpxOpCode.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
oce.add(
keys=BpxOpCode.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
@ -99,6 +108,31 @@ def pack_bpx_commands(p: ServiceProviderParams):
object_id=BPX_HANDLER_ID, action_id=BpxActionId.RESET_COUNTERS
)
)
if op_code == BpxOpCode.RST_CFG:
q.add_log_cmd("Reset BPX configuration")
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionId.CONFIG_CMD
)
)
if op_code == BpxOpCode.SET_CFG:
q.add_log_cmd("Setting BPX configuration")
user_data = bytearray()
batt_mode = BpxHeaterModeSelect(
int(input("BPX heater mode select, 0 for OFF 1 for AUTO: "))
)
user_data.append(batt_mode)
lower_limit = int(input("Lower heater limit (-2 default): "))
user_data.append(struct.pack("!b", lower_limit)[0])
upper_limit = int(input("Upper heater limit (3 default): "))
user_data.append(struct.pack("!b", upper_limit)[0])
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID,
action_id=BpxActionId.SET_CFG,
user_data=user_data,
)
)
if op_code in BpxOpCode.REQUEST_CFG:
q.add_log_cmd("Requesting configuration struct")
q.add_pus_tc(