added BPX manual heater commands #201
@ -46,6 +46,8 @@ class BpxOpCode:
|
||||
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"]
|
||||
@ -61,6 +63,8 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
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.MAN_HEATER_ON, info="Manual heater on")
|
||||
oce.add(keys=BpxOpCode.MAN_HEATER_OFF, info="Manual heater off")
|
||||
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)"
|
||||
@ -74,7 +78,7 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.BPX_BATTERY.value)
|
||||
def pack_bpx_commands(p: ServiceProviderParams):
|
||||
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:
|
||||
@ -147,6 +151,25 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)
|
||||
)
|
||||
if op_code == BpxOpCode.MAN_HEATER_ON:
|
||||
q.add_log_cmd("BPX manual heater on with seconds burntime")
|
||||
burn_time = int(input("BPX heater burn time in seconds [1-65535]: "))
|
||||
if burn_time < 1 or burn_time > 65535:
|
||||
raise ValueError("Invalid burntime, smaller than 0 or larger than 65535")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID,
|
||||
action_id=BpxActionId.MAN_HEATER_ON,
|
||||
user_data=struct.pack("!H", burn_time),
|
||||
)
|
||||
)
|
||||
if op_code == BpxOpCode.MAN_HEATER_OFF:
|
||||
q.add_log_cmd("BPX manual heater off")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionId.MAN_HEATER_OFF
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
HEADER_LIST = [
|
||||
|
Loading…
Reference in New Issue
Block a user