Merge pull request 'Add more heater commands' (#200) from add-heater-cmd-ids into main
All checks were successful
EIVE/-/pipeline/head This commit looks good

Reviewed-on: #200
This commit is contained in:
Robin Müller 2023-06-14 06:06:58 +02:00
commit 8a87d83653

View File

@ -28,14 +28,24 @@ class BpxSetId(enum.IntEnum):
class BpxActionId:
REBOOT = 2
RESET_COUNTERS = 3
SET_CFG = 4
CONFIG_CMD = 4
GET_CFG = 5
SET_CFG = 6
MAN_HEATER_ON = 10
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"]
@ -49,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)"
@ -96,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(