add named pdu1/pdu2 cmds
This commit is contained in:
@ -17,24 +17,26 @@ from gomspace.gomspace_pdu_definitions import *
|
||||
from config.object_ids import PDU_2_HANDLER_ID
|
||||
|
||||
|
||||
class Pdu2OpCodes(enum.Enum):
|
||||
ACS_SIDE_B_ON = "1"
|
||||
ACS_SIDE_B_OFF = "2"
|
||||
SUS_REDUNDANT_ON = "3"
|
||||
SUS_REDUNDANT_OFF = "4"
|
||||
RW_ON = "5"
|
||||
RW_OFF = "6"
|
||||
PL_PCDU_VBAT_NOM_ON = "7"
|
||||
PL_PCDU_VBAT_NOM_OFF = "8"
|
||||
PL_PCDU_VBAT_RED_ON = "9"
|
||||
PL_PCDU_VBAT_RED_OFF = "10"
|
||||
TCS_HEATER_IN_ON = "11"
|
||||
TCS_HEATER_IN_OFF = "12"
|
||||
SOLAR_ARRAY_DEPL_ON = "13"
|
||||
SOLAR_ARRAY_DEPL_OFF = "14"
|
||||
PL_CAMERA_ON = "15"
|
||||
PL_CAMERA_OFF = "16"
|
||||
# There is not really a point of the on command, the SW can not be commanded if the OBC is off
|
||||
class Pdu2OpCodes:
|
||||
ACS_SIDE_B_ON = ["acs-b-on", "1"]
|
||||
ACS_SIDE_B_OFF = ["acs-b-off", "2"]
|
||||
SUS_REDUNDANT_ON = ["sus-red-on", "3"]
|
||||
SUS_REDUNDANT_OFF = ["sus-red-off", "4"]
|
||||
RW_ON = ["rw-on", "5"]
|
||||
RW_OFF = ["rw-off", "6"]
|
||||
PL_PCDU_VBAT_NOM_ON = ["plpcdu-vbat-nom-on", "7"]
|
||||
PL_PCDU_VBAT_NOM_OFF = ["plpcdu-vbat-nom-off", "8"]
|
||||
PL_PCDU_VBAT_RED_ON = ["plpcdu-vbat-red-on", "9"]
|
||||
PL_PCDU_VBAT_RED_OFF = ["plpcdu-vbt-red-off", "10"]
|
||||
TCS_HEATER_IN_ON = ["tcs-heater-in-on", "11"]
|
||||
TCS_HEATER_IN_OFF = ["tcs-heater-in-off", "12"]
|
||||
SOLAR_ARRAY_DEPL_ON = ["sa-depl-on", "13"]
|
||||
SOLAR_ARRAY_DEPL_OFF = ["sa-depl-off", "14"]
|
||||
PL_CAMERA_ON = ["pl-cam-on", "15"]
|
||||
PL_CAMERA_OFF = ["pl-cam-off", "16"]
|
||||
# There is not really a point of the on command, the SW can not be commanded if the OBC is off.
|
||||
# Actually, this command is dangerous and will probably be rejected by the OBC unless
|
||||
# specifically configured to not reject it.
|
||||
Q7S_OFF = "32"
|
||||
|
||||
|
||||
@ -68,173 +70,173 @@ class PDU2TestProcedure:
|
||||
def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
q.add_log_cmd("Testing PDU2")
|
||||
objb = object_id.as_bytes
|
||||
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
|
||||
if op_code in Pdu2OpCodes.ACS_SIDE_B_ON:
|
||||
q.add_log_cmd("PDU2: Turn ACS Side B on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
PduConfigTable.out_en_7.parameter_address,
|
||||
PduConfigTable.out_en_7.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value:
|
||||
if op_code in Pdu2OpCodes.ACS_SIDE_B_OFF:
|
||||
q.add_log_cmd("PDU2: Turn ACS Side B off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
PduConfigTable.out_en_7.parameter_address,
|
||||
PduConfigTable.out_en_7.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.Q7S_OFF.value:
|
||||
if op_code in Pdu2OpCodes.Q7S_OFF:
|
||||
q.add_log_cmd("Turning off Q7S OBC")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_0.parameter_size,
|
||||
PduConfigTable.out_en_0.parameter_address,
|
||||
PduConfigTable.out_en_0.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value:
|
||||
if op_code in Pdu2OpCodes.SUS_REDUNDANT_ON:
|
||||
q.add_log_cmd("PDU2: Turn SUS redundant on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
PduConfigTable.out_en_4.parameter_address,
|
||||
PduConfigTable.out_en_4.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
|
||||
if op_code in Pdu2OpCodes.SUS_REDUNDANT_OFF:
|
||||
q.add_log_cmd("PDU2: Turn SUS redundant off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
PduConfigTable.out_en_4.parameter_address,
|
||||
PduConfigTable.out_en_4.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.RW_ON.value:
|
||||
if op_code in Pdu2OpCodes.RW_ON:
|
||||
q.add_log_cmd("PDU2: Turn reaction wheels on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.RW_OFF.value:
|
||||
if op_code in Pdu2OpCodes.RW_OFF:
|
||||
q.add_log_cmd("PDU2: Turn reaction wheels off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value:
|
||||
if op_code in Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON:
|
||||
q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 1 on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size,
|
||||
PduConfigTable.out_en_1.parameter_address,
|
||||
PduConfigTable.out_en_1.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value:
|
||||
if op_code in Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF:
|
||||
q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 1 off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size,
|
||||
PduConfigTable.out_en_1.parameter_address,
|
||||
PduConfigTable.out_en_1.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value:
|
||||
if op_code in Pdu2OpCodes.PL_PCDU_VBAT_RED_ON:
|
||||
q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 6 on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_6.parameter_address,
|
||||
PDUConfigTable.out_en_6.parameter_size,
|
||||
PduConfigTable.out_en_6.parameter_address,
|
||||
PduConfigTable.out_en_6.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value:
|
||||
if op_code in Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF:
|
||||
q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 6 off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_6.parameter_address,
|
||||
PDUConfigTable.out_en_6.parameter_size,
|
||||
PduConfigTable.out_en_6.parameter_address,
|
||||
PduConfigTable.out_en_6.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value:
|
||||
if op_code in Pdu2OpCodes.TCS_HEATER_IN_ON:
|
||||
q.add_log_cmd("PDU2: Turn TCS Heater Input on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
PduConfigTable.out_en_3.parameter_address,
|
||||
PduConfigTable.out_en_3.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value:
|
||||
if op_code in Pdu2OpCodes.TCS_HEATER_IN_OFF:
|
||||
q.add_log_cmd("PDU2: Turn TCS Heater Input off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
PduConfigTable.out_en_3.parameter_address,
|
||||
PduConfigTable.out_en_3.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value:
|
||||
if op_code in Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON:
|
||||
q.add_log_cmd("PDU2: Turn Solar Array Deployment On")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_5.parameter_address,
|
||||
PDUConfigTable.out_en_5.parameter_size,
|
||||
PduConfigTable.out_en_5.parameter_address,
|
||||
PduConfigTable.out_en_5.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value:
|
||||
if op_code in Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF:
|
||||
q.add_log_cmd("PDU2: Turn Solar Array Deployment Off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_5.parameter_address,
|
||||
PDUConfigTable.out_en_5.parameter_size,
|
||||
PduConfigTable.out_en_5.parameter_address,
|
||||
PduConfigTable.out_en_5.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_CAMERA_ON.value:
|
||||
if op_code in Pdu2OpCodes.PL_CAMERA_ON:
|
||||
q.add_log_cmd("PDU2: Turn payload camera on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_8.parameter_address,
|
||||
PDUConfigTable.out_en_8.parameter_size,
|
||||
PduConfigTable.out_en_8.parameter_address,
|
||||
PduConfigTable.out_en_8.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code == Pdu2OpCodes.PL_CAMERA_OFF.value:
|
||||
if op_code in Pdu2OpCodes.PL_CAMERA_OFF:
|
||||
q.add_log_cmd("PDU2: Turn payload camera off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_8.parameter_address,
|
||||
PDUConfigTable.out_en_8.parameter_size,
|
||||
PduConfigTable.out_en_8.parameter_address,
|
||||
PduConfigTable.out_en_8.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
@ -269,8 +271,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
PDUHkTable.wdt_gnd_left.parameter_address,
|
||||
PDUHkTable.wdt_gnd_left.parameter_size,
|
||||
PduHkTable.wdt_gnd_left.parameter_address,
|
||||
PduHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
|
||||
@ -285,8 +287,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
@ -296,8 +298,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size,
|
||||
PduHkTable.temperature.parameter_address,
|
||||
PduHkTable.temperature.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
|
||||
@ -306,8 +308,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
|
||||
@ -316,8 +318,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_size,
|
||||
PduConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PduConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
|
||||
@ -325,8 +327,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user