update gomspace commands
This commit is contained in:
parent
abecbe4401
commit
e162e5c51b
24
.run/PDU1 Aux Info.run.xml
Normal file
24
.run/PDU1 Aux Info.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="PDU1 Aux Info" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s power -o info-aux -d 0.2" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s pdu1 -d 6" />
|
||||
<option name="PARAMETERS" value="-s pdu1 -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
24
.run/PDU1 Info.run.xml
Normal file
24
.run/PDU1 Info.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="PDU1 Info" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s power -o info -d 0.2" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s pdu2 -l -d 6" />
|
||||
<option name="PARAMETERS" value="-s pdu2 -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
24
.run/Power Info All.run.xml
Normal file
24
.run/Power Info All.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Power Info All" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s power -o info_all -d 0.2" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
.run/Power.run.xml
Normal file
24
.run/Power.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Power" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s power" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
.run/TCS Off.run.xml
Normal file
24
.run/TCS Off.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="TCS Off" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s pdu1 -o tcs-off -d 3" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
.run/TCS On.run.xml
Normal file
24
.run/TCS On.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="TCS On" type="PythonConfigurationType" factoryName="Python" folderName="Power">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s pdu1 -o tcs-on -d 3" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -37,7 +37,7 @@ class GomspaceOpCodes:
|
||||
PRINT_SWITCH_V_I = ["print_switch_vi"]
|
||||
PRINT_LATCHUPS = ["print_latchups"]
|
||||
GET_PARAM = ["get_param"]
|
||||
SET_PARAM = ["set_param"]
|
||||
SET_INTEGER_PARAM = ["set_int_param"]
|
||||
SAVE_TABLE = ["save_table"]
|
||||
RESET_GND_WATCHDOG = ["reset_gnd_wdt"]
|
||||
SAVE_TABLE_DEFAULT = ["save_table_default"]
|
||||
@ -50,7 +50,7 @@ class GsInfo:
|
||||
PRINT_SWITCH_V_I = "Print Switch V I Info"
|
||||
PRINT_LATCHUPS = "Print latchups"
|
||||
GET_PARAMETER = "Get parameter"
|
||||
SET_PARAMETER = "Set parameter"
|
||||
SET_PARAMETER = "Set integer parameter"
|
||||
REQUEST_CONFIG_TABLE = "Request Config Table"
|
||||
RESET_GND_WATCHDOG = "Reset GND watchdog"
|
||||
SAVE_TABLE = "Save table non-volatile (file)"
|
||||
@ -68,9 +68,20 @@ class SetIds:
|
||||
ACU_AUX = 8
|
||||
|
||||
|
||||
class ParamTypes(enum.Enum):
|
||||
U8 = 0
|
||||
U16 = 1
|
||||
U32 = 2
|
||||
I8 = 3
|
||||
I16 = 4
|
||||
I32 = 5
|
||||
FLOAT = 6
|
||||
STR = 7
|
||||
|
||||
|
||||
class TableIds:
|
||||
config = 1
|
||||
hk = 4
|
||||
CONFIG = 1
|
||||
HK = 4
|
||||
|
||||
|
||||
class TableEntry:
|
||||
@ -78,7 +89,7 @@ class TableEntry:
|
||||
uint16_size = 2
|
||||
uint32_size = 4
|
||||
|
||||
def __init__(self, parameter_address: bytearray, parameter_size):
|
||||
def __init__(self, parameter_address: bytes, parameter_size):
|
||||
self.parameter_address = parameter_address
|
||||
self.parameter_size = parameter_size
|
||||
|
||||
@ -121,34 +132,88 @@ def pack_get_param_command(
|
||||
)
|
||||
|
||||
|
||||
def pack_set_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter_size: int, parameter: int
|
||||
def pack_set_float_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: float
|
||||
) -> PusTelecommand:
|
||||
"""Function to generate a command to set a parameter
|
||||
:param object_id: The object id of the gomspace device handler.
|
||||
:param memory_address: Address offset within table of the value to set.
|
||||
:param parameter: The parameter value to set.
|
||||
:param parameter_size: Size of the value to set. There are uint8_t, uint16_t and uint32_t
|
||||
in the device tables.
|
||||
:return: The command as bytearray.
|
||||
"""
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(parameter_size)
|
||||
if parameter_size == 1:
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!f", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_u8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data.append(parameter)
|
||||
elif parameter_size == 2:
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_i8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data += struct.pack("!b", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_u16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!H", parameter)
|
||||
elif parameter_size == 4:
|
||||
byte_one = 0xFF000000 & parameter >> 24
|
||||
byte_two = 0xFF0000 & parameter >> 16
|
||||
byte_three = 0xFF00 & parameter >> 8
|
||||
byte_four = 0xFF & parameter
|
||||
app_data.append(byte_one)
|
||||
app_data.append(byte_two)
|
||||
app_data.append(byte_three)
|
||||
app_data.append(byte_four)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_i16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!h", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_u32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!I", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_i32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!i", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
@ -165,16 +230,27 @@ def prompt_and_pack_get_param_command(q: DefaultPusQueueHelper, object_id: Objec
|
||||
)
|
||||
|
||||
|
||||
def prompt_and_pack_set_param_command(q: DefaultPusQueueHelper, object_id: ObjectIdU32):
|
||||
def prompt_and_pack_set_integer_param_command(
|
||||
q: DefaultPusQueueHelper, object_id: ObjectIdU32, ptype: ParamTypes
|
||||
):
|
||||
memory_address = int(input("Specify memory address: 0x"), 16)
|
||||
memory_address = struct.pack("!H", memory_address)
|
||||
parameter_size = int(input("Specify parameter size: "))
|
||||
parameter = int(input("Specify parameter: "))
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
object_id.as_bytes, memory_address, parameter_size, parameter
|
||||
)
|
||||
)
|
||||
if ptype == ParamTypes.U8:
|
||||
cmd = pack_set_u8_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
elif ptype == ParamTypes.U16:
|
||||
cmd = pack_set_u16_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
elif ptype == ParamTypes.U32:
|
||||
cmd = pack_set_u16_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
elif ptype == ParamTypes.I8:
|
||||
cmd = pack_set_i8_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
elif ptype == ParamTypes.I16:
|
||||
cmd = pack_set_i16_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
elif ptype == ParamTypes.I32:
|
||||
cmd = pack_set_i32_param_command(object_id.as_bytes, memory_address, parameter)
|
||||
else:
|
||||
raise ValueError(f"Invalid parameter type {ptype} for this function")
|
||||
q.add_pus_tc(cmd)
|
||||
|
||||
|
||||
def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand:
|
||||
|
@ -2,20 +2,30 @@ from gomspace.gomspace_common import TableEntry
|
||||
|
||||
|
||||
class PduConfigTable:
|
||||
out_en_0 = TableEntry(bytearray([0x00, 0x48]), TableEntry.uint8_size)
|
||||
out_en_1 = TableEntry(bytearray([0x00, 0x49]), TableEntry.uint8_size)
|
||||
out_en_2 = TableEntry(bytearray([0x00, 0x4A]), TableEntry.uint8_size)
|
||||
out_en_3 = TableEntry(bytearray([0x00, 0x4B]), TableEntry.uint8_size)
|
||||
out_en_4 = TableEntry(bytearray([0x00, 0x4C]), TableEntry.uint8_size)
|
||||
out_en_5 = TableEntry(bytearray([0x00, 0x4D]), TableEntry.uint8_size)
|
||||
out_en_6 = TableEntry(bytearray([0x00, 0x4E]), TableEntry.uint8_size)
|
||||
out_en_7 = TableEntry(bytearray([0x00, 0x4F]), TableEntry.uint8_size)
|
||||
out_en_8 = TableEntry(bytearray([0x00, 0x50]), TableEntry.uint8_size)
|
||||
# When channel consumes more than cur_lu_lim, channel is turned of immediately
|
||||
out_en_0 = TableEntry(bytes([0x00, 0x48]), TableEntry.uint8_size)
|
||||
out_en_1 = TableEntry(bytes([0x00, 0x49]), TableEntry.uint8_size)
|
||||
out_en_2 = TableEntry(bytes([0x00, 0x4A]), TableEntry.uint8_size)
|
||||
out_en_3 = TableEntry(bytes([0x00, 0x4B]), TableEntry.uint8_size)
|
||||
out_en_4 = TableEntry(bytes([0x00, 0x4C]), TableEntry.uint8_size)
|
||||
out_en_5 = TableEntry(bytes([0x00, 0x4D]), TableEntry.uint8_size)
|
||||
out_en_6 = TableEntry(bytes([0x00, 0x4E]), TableEntry.uint8_size)
|
||||
out_en_7 = TableEntry(bytes([0x00, 0x4F]), TableEntry.uint8_size)
|
||||
out_en_8 = TableEntry(bytes([0x00, 0x50]), TableEntry.uint8_size)
|
||||
|
||||
# When channel consumes more than cur_lu_lim, channel is turned off immediately
|
||||
cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xB8]), TableEntry.uint16_size)
|
||||
INIT_OUT_SAFE_CH_0 = TableEntry(bytes([0x00, 0x80]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_1 = TableEntry(bytes([0x00, 0x80 + 1]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_2 = TableEntry(bytes([0x00, 0x80 + 2]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_3 = TableEntry(bytes([0x00, 0x80 + 3]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_4 = TableEntry(bytes([0x00, 0x80 + 4]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_5 = TableEntry(bytes([0x00, 0x80 + 5]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_6 = TableEntry(bytes([0x00, 0x80 + 6]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_7 = TableEntry(bytes([0x00, 0x80 + 7]), TableEntry.uint8_size)
|
||||
INIT_OUT_SAFE_CH_8 = TableEntry(bytes([0x00, 0x80 + 8]), TableEntry.uint8_size)
|
||||
|
||||
|
||||
PDU_CONFIG_LIST = [
|
||||
OUT_ENABLE_LIST = [
|
||||
PduConfigTable.out_en_0,
|
||||
PduConfigTable.out_en_1,
|
||||
PduConfigTable.out_en_2,
|
||||
|
@ -111,7 +111,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.hk,
|
||||
gs.TableIds.HK,
|
||||
ACUHkTable.wdt_gnd_left.parameter_address,
|
||||
ACUHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
@ -128,7 +128,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.hk,
|
||||
gs.TableIds.HK,
|
||||
ACUHkTable.temperature3.parameter_address,
|
||||
ACUHkTable.temperature3.parameter_size,
|
||||
)
|
||||
@ -138,7 +138,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.config,
|
||||
gs.TableIds.CONFIG,
|
||||
ACUConfigTable.vboost.parameter_address,
|
||||
ACUConfigTable.vboost.parameter_size,
|
||||
)
|
||||
@ -148,7 +148,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.config,
|
||||
gs.TableIds.CONFIG,
|
||||
ACUConfigTable.vbat_max_hi.parameter_address,
|
||||
ACUConfigTable.vbat_max_hi.parameter_size,
|
||||
)
|
||||
@ -158,7 +158,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.config,
|
||||
gs.TableIds.CONFIG,
|
||||
ACUConfigTable.vbat_max_lo.parameter_address,
|
||||
ACUConfigTable.vbat_max_lo.parameter_size,
|
||||
)
|
||||
@ -168,7 +168,7 @@ def pack_test_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper):
|
||||
q.add_pus_tc(
|
||||
gs.pack_get_param_command(
|
||||
object_id.as_bytes,
|
||||
gs.TableIds.config,
|
||||
gs.TableIds.CONFIG,
|
||||
ACUConfigTable.ov_mode.parameter_address,
|
||||
ACUConfigTable.ov_mode.parameter_size,
|
||||
)
|
||||
|
@ -1,15 +1,17 @@
|
||||
from gomspace.gomspace_common import (
|
||||
pack_set_param_command,
|
||||
pack_set_u8_param_command,
|
||||
Channel,
|
||||
GomspaceOpCodes,
|
||||
GsInfo,
|
||||
GomspaceDeviceActionIds,
|
||||
prompt_and_pack_set_param_command,
|
||||
prompt_and_pack_set_integer_param_command,
|
||||
prompt_and_pack_get_param_command,
|
||||
pack_request_config_command,
|
||||
pack_gnd_wdt_reset_command,
|
||||
ParamTypes,
|
||||
)
|
||||
from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST
|
||||
from gomspace.gomspace_pdu_definitions import OUT_ENABLE_LIST
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
@ -30,40 +32,40 @@ class PowerInfo:
|
||||
|
||||
class PowerOpCodes:
|
||||
# PDU 1
|
||||
TCS_ON = ["tcs-on"]
|
||||
TCS_OFF = ["tcs-off"]
|
||||
SYRLINKS_ON = ["syrlinks-on"]
|
||||
SYRLINKS_OFF = ["syrlinks-off"]
|
||||
STAR_TRACKER_ON = ["str-on"]
|
||||
STAR_TRACKER_OFF = ["str-off"]
|
||||
MGT_ON = ["mgt-on"]
|
||||
MGT_OFF = ["mgt-off"]
|
||||
SUS_N_ON = ["sus-nom-on"]
|
||||
SUS_N_OFF = ["sus-nom-off"]
|
||||
SCEX_ON = ["scex-on"]
|
||||
SCEX_OFF = ["scex-off"]
|
||||
PLOC_ON = ["ploc-on"]
|
||||
PLOC_OFF = ["ploc-off"]
|
||||
ACS_A_ON = ["acs-a-on"]
|
||||
ACS_A_OFF = ["acs-a-off"]
|
||||
TCS_ON = ["tcs_on"]
|
||||
TCS_OFF = ["tcs_off"]
|
||||
SYRLINKS_ON = ["syrlinks_on"]
|
||||
SYRLINKS_OFF = ["syrlinks_off"]
|
||||
STAR_TRACKER_ON = ["str_on"]
|
||||
STAR_TRACKER_OFF = ["str_off"]
|
||||
MGT_ON = ["mgt_on"]
|
||||
MGT_OFF = ["mgt_off"]
|
||||
SUS_N_ON = ["sus_nom_on"]
|
||||
SUS_N_OFF = ["sus_nom_off"]
|
||||
SCEX_ON = ["scex_on"]
|
||||
SCEX_OFF = ["scex_off"]
|
||||
PLOC_ON = ["ploc_on"]
|
||||
PLOC_OFF = ["ploc_off"]
|
||||
ACS_A_ON = ["acs_a_on"]
|
||||
ACS_A_OFF = ["acs_a_off"]
|
||||
|
||||
# PDU 2
|
||||
PL_PCDU_VBAT_NOM_ON = ["plpcdu-vbat-nom-on"]
|
||||
PL_PCDU_VBAT_NOM_OFF = ["plpcdu-vbat-nom-off"]
|
||||
RW_ON = ["rw-on"]
|
||||
RW_OFF = ["rw-off"]
|
||||
HEATER_ON = ["heater-on"]
|
||||
HEATER_OFF = ["heater-off"]
|
||||
SUS_R_ON = ["sus-red-on"]
|
||||
SUS_R_OFF = ["sus-red-off"]
|
||||
SOLAR_ARRAY_DEPL_ON = ["sa-depl-on"]
|
||||
SOLAR_ARRAY_DEPL_OFF = ["sa-depl-off"]
|
||||
PL_PCDU_VBAT_RED_ON = ["plpcdu-vbat-red-on"]
|
||||
PL_PCDU_VBAT_RED_OFF = ["plpcdu-vbat-red-off"]
|
||||
ACS_B_ON = ["acs-b-on"]
|
||||
ACS_B_OFF = ["acs-b-off"]
|
||||
PL_CAM_ON = ["cam-on"]
|
||||
PL_CAM_OFF = ["cam-off"]
|
||||
PL_PCDU_VBAT_NOM_ON = ["plpcdu_vbat_nom_on"]
|
||||
PL_PCDU_VBAT_NOM_OFF = ["plpcdu_vbat_nom_off"]
|
||||
RW_ON = ["rw_on"]
|
||||
RW_OFF = ["rw_off"]
|
||||
HEATER_ON = ["heater_on"]
|
||||
HEATER_OFF = ["heater_off"]
|
||||
SUS_R_ON = ["sus_red_on"]
|
||||
SUS_R_OFF = ["sus_red_off"]
|
||||
SOLAR_ARRAY_DEPL_ON = ["sa_depl_on"]
|
||||
SOLAR_ARRAY_DEPL_OFF = ["sa_depl_off"]
|
||||
PL_PCDU_VBAT_RED_ON = ["plpcdu_vbat_red_on"]
|
||||
PL_PCDU_VBAT_RED_OFF = ["plpcdu_vbat_red_off"]
|
||||
ACS_B_ON = ["acs_b_on"]
|
||||
ACS_B_OFF = ["acs_b_off"]
|
||||
PL_CAM_ON = ["cam_on"]
|
||||
PL_CAM_OFF = ["cam_off"]
|
||||
|
||||
INFO_CORE = ["info"]
|
||||
INFO_AUX = ["info_aux"]
|
||||
@ -89,9 +91,13 @@ def pack_gomspace_cmds(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.SET_PARAM:
|
||||
if op_code in GomspaceOpCodes.SET_INTEGER_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.SET_PARAMETER}")
|
||||
prompt_and_pack_set_param_command(q, object_id)
|
||||
print("Please specify the parameter type from index")
|
||||
for idx, v in enumerate(ParamTypes):
|
||||
print(f"{idx}: {v.name}")
|
||||
ptype = int(input("Index: "))
|
||||
prompt_and_pack_set_integer_param_command(q, object_id, ParamTypes(ptype))
|
||||
if op_code in GomspaceOpCodes.GET_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.GET_PARAMETER}")
|
||||
prompt_and_pack_get_param_command(q, object_id)
|
||||
@ -106,6 +112,8 @@ def pack_gomspace_cmds(
|
||||
"2: Calibration Parameter, 4: TM Data]: "
|
||||
)
|
||||
)
|
||||
if source_table not in [0, 1, 2, 4]:
|
||||
raise ValueError("Invalid source table index")
|
||||
# Not used for now
|
||||
"""
|
||||
target_table = int(input(
|
||||
@ -122,10 +130,11 @@ def pack_gomspace_cmds(
|
||||
if op_code in GomspaceOpCodes.SAVE_TABLE_DEFAULT:
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table [0: Board Config, 1: Module Config, "
|
||||
"2: Calibration Parameter, 4: TM Data]: "
|
||||
"Source table [0: Board Config, 1: Module Config, 2: Calibration Parameter]: "
|
||||
)
|
||||
)
|
||||
if source_table not in [0, 1, 2]:
|
||||
raise ValueError("Invalid source table index")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
@ -162,15 +171,18 @@ def req_hk_cmds(
|
||||
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
|
||||
|
||||
|
||||
def pack_pdu_disable_safe_off_cmd() -> PusTelecommand:
|
||||
pass
|
||||
|
||||
|
||||
def generic_on_cmd(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
|
||||
):
|
||||
q.add_log_cmd(info_str + " on")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
object_id,
|
||||
PDU_CONFIG_LIST[out_idx].parameter_address,
|
||||
PDU_CONFIG_LIST[out_idx].parameter_size,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
@ -181,10 +193,9 @@ def generic_off_cmd(
|
||||
):
|
||||
q.add_log_cmd(info_str + " off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
object_id,
|
||||
PDU_CONFIG_LIST[out_idx].parameter_address,
|
||||
PDU_CONFIG_LIST[out_idx].parameter_size,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
@ -201,7 +212,7 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
|
||||
)
|
||||
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info=GsInfo.PRINT_LATCHUPS)
|
||||
oce.add(keys=GomspaceOpCodes.SET_PARAM, info=GsInfo.SET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.SET_INTEGER_PARAM, info=GsInfo.SET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE, info=GsInfo.SAVE_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT)
|
||||
|
@ -10,12 +10,13 @@ from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from gomspace.gomspace_common import (
|
||||
TableEntry,
|
||||
Channel,
|
||||
pack_set_param_command,
|
||||
TableIds,
|
||||
pack_get_param_command,
|
||||
pack_gnd_wdt_reset_command,
|
||||
pack_ping_command,
|
||||
pack_reboot_command,
|
||||
pack_set_u8_param_command,
|
||||
pack_set_u16_param_command,
|
||||
SetIds,
|
||||
)
|
||||
from config.object_ids import P60_DOCK_HANDLER
|
||||
@ -100,40 +101,36 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
if op_code in P60OpCodes.STACK_3V3_ON:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_3V3_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_5V_ON:
|
||||
q.add_log_cmd(P60Info.STACK_5V_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_5V_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_5V_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
@ -145,7 +142,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
@ -161,10 +158,9 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_log_cmd("P60 Dock: Testing setting output channel 3 off")
|
||||
parameter = 0 # set channel off
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
@ -173,7 +169,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
@ -183,7 +179,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
TableIds.CONFIG,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
)
|
||||
@ -193,7 +189,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
TableIds.CONFIG,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
@ -202,10 +198,9 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_log_cmd("P60 Dock: Testing setting output channel 3 on")
|
||||
parameter = 1 # set channel on
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
@ -226,43 +221,15 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing invalid address handling in set param command")
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
parameter_size = 2
|
||||
parameter = 1
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(objb, invalid_address, parameter_size, parameter)
|
||||
)
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
|
||||
q.add_log_cmd(
|
||||
"P60 Dock: Testing handling of invalid parameter sizes in get-param command"
|
||||
)
|
||||
invalid_size = 5
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
invalid_size,
|
||||
)
|
||||
)
|
||||
q.add_log_cmd(
|
||||
"P60 Dock: Testing handling of invalid parameter size in set-param command"
|
||||
)
|
||||
parameter = 1
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
invalid_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
q.add_pus_tc(pack_set_u16_param_command(objb, invalid_address, parameter))
|
||||
|
||||
|
||||
def p60_dock_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
@ -71,51 +71,11 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
PduHkTable.temperature.parameter_address,
|
||||
PduHkTable.temperature.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
|
||||
q.add_log_cmd("PDU1: Turn channel 2 on (Star Tracker)")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
|
||||
q.add_log_cmd("PDU1: Turn channel 2 off (Star Tracker)")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
|
||||
q.add_log_cmd("PDU1: Turn channel 3 on (MTQ)")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_3.parameter_address,
|
||||
PduConfigTable.out_en_3.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
|
||||
q.add_log_cmd("PDU1: Turn channel 3 off (MTQ)")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_3.parameter_address,
|
||||
PduConfigTable.out_en_3.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def pdu1_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
@ -31,6 +31,7 @@ class Pdu2InfoBase:
|
||||
|
||||
|
||||
class Pdu2ChIndex(enum.IntEnum):
|
||||
OBC = 0
|
||||
PL_PCDU_BAT_NOM = 1
|
||||
RW = 2
|
||||
HEATER = 3
|
||||
@ -82,7 +83,7 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
PduHkTable.wdt_gnd_left.parameter_address,
|
||||
PduHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
@ -94,22 +95,12 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_log_cmd("PDU2: Ping Test")
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
q.add_pus_tc(pack_ping_command(object_id, ping_data))
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
|
||||
q.add_log_cmd("PDU2: Testing setting output channel 2 on (TCS Heater)")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
|
||||
q.add_log_cmd("PDU2: Testing temperature reading")
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
TableIds.HK,
|
||||
PduHkTable.temperature.parameter_address,
|
||||
PduHkTable.temperature.parameter_size,
|
||||
)
|
||||
@ -119,7 +110,7 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
TableIds.CONFIG,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
)
|
||||
@ -129,21 +120,11 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
TableIds.CONFIG,
|
||||
PduConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PduConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
|
||||
q.add_log_cmd("PDU2: Testing setting output channel 2 off")
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
PduConfigTable.out_en_2.parameter_address,
|
||||
PduConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
|
||||
q.add_log_cmd("PDU2: Requesting housekeeping table")
|
||||
q.add_pus_tc(pack_request_full_hk_table_command(object_id))
|
||||
|
@ -461,14 +461,22 @@ def handle_get_param_data_reply(
|
||||
elif action_id == GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE:
|
||||
print(f"Received config table with size {len(custom_data)} for object {obj_id}")
|
||||
if obj_id.as_bytes == PDU_1_HANDLER_ID or obj_id.as_bytes == PDU_2_HANDLER_ID:
|
||||
pdu_config_table_handler(pw, custom_data)
|
||||
pdu_config_table_handler(pw, custom_data, obj_id)
|
||||
elif obj_id.as_bytes == ACU_HANDLER_ID:
|
||||
acu_config_table_handler(pw, custom_data)
|
||||
elif obj_id.as_bytes == P60_DOCK_HANDLER:
|
||||
p60_dock_config_table_handler(pw, custom_data)
|
||||
|
||||
|
||||
def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
def pdu_config_table_handler(
|
||||
pw: PrintWrapper, custom_data: bytes, obj_id: ObjectIdBase
|
||||
):
|
||||
if obj_id.as_bytes == PDU_1_HANDLER_ID:
|
||||
pw.dlog("[tcs, syrlinks, str, mgt, sus-n, scex, ploc, acs-a, unused]")
|
||||
elif obj_id.as_bytes == PDU_2_HANDLER_ID:
|
||||
pw.dlog(
|
||||
"[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red, acs-b, pl-cam]"
|
||||
)
|
||||
out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H")
|
||||
out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H")
|
||||
init_out_norm = unpack_array_in_data(custom_data, 0x76, 1, 9, "B")
|
||||
@ -476,6 +484,11 @@ def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
init_on_dly = unpack_array_in_data(custom_data, 0x8A, 2, 9, "H")
|
||||
init_off_dly = unpack_array_in_data(custom_data, 0x9C, 2, 9, "H")
|
||||
safe_off_dly = unpack_array_in_data(custom_data, 0xAE, 1, 9, "B")
|
||||
cur_lu_lim = unpack_array_in_data(custom_data, 0xB8, 2, 9, "H")
|
||||
cur_lim = unpack_array_in_data(custom_data, 0xCA, 2, 9, "H")
|
||||
cur_ema = unpack_array_in_data(custom_data, 0xDC, 2, 9, "H")
|
||||
wdt_can_rst = custom_data[0x127]
|
||||
wdt_can = struct.unpack(f"{OBC_ENDIANNESS}I", custom_data[0x12C : 0x12C + 4])[0]
|
||||
batt_hwmax = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11C : 0x11C + 2])[0]
|
||||
batt_max = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11E : 0x11E + 2])[0]
|
||||
batt_norm = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x120 : 0x120 + 2])[0]
|
||||
@ -488,11 +501,16 @@ def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
pw.dlog(f"{'init_on_dly'.ljust(15)}: {init_on_dly}")
|
||||
pw.dlog(f"{'init_off_dly'.ljust(15)}: {init_off_dly}")
|
||||
pw.dlog(f"{'safe_off_dly'.ljust(15)}: {safe_off_dly}")
|
||||
pw.dlog(f"{'cur_lu_lim'.ljust(15)}: {cur_lu_lim}")
|
||||
pw.dlog(f"{'cur_lim'.ljust(15)}: {cur_lim}")
|
||||
pw.dlog(f"{'cur_ema'.ljust(15)}: {cur_ema}")
|
||||
pw.dlog(f"{'batt_hwmax'.ljust(15)}: {batt_hwmax}")
|
||||
pw.dlog(f"{'batt_max'.ljust(15)}: {batt_max}")
|
||||
pw.dlog(f"{'batt_norm'.ljust(15)}: {batt_norm}")
|
||||
pw.dlog(f"{'batt_safe'.ljust(15)}: {batt_safe}")
|
||||
pw.dlog(f"{'batt_crit'.ljust(15)}: {batt_crit}")
|
||||
pw.dlog(f"{'wdt_can_rst'.ljust(15)}: {wdt_can_rst}")
|
||||
pw.dlog(f"{'wdt_can'.ljust(15)}: {wdt_can}")
|
||||
|
||||
|
||||
def acu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
|
Loading…
Reference in New Issue
Block a user