add command to load table

This commit is contained in:
Robin Müller 2022-09-01 17:31:24 +02:00
parent e162e5c51b
commit 6085c6543c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 32 additions and 0 deletions

View File

@ -26,6 +26,7 @@ class GomspaceDeviceActionIds(enum.IntEnum):
REQUEST_CONFIG_TABLE = 17 REQUEST_CONFIG_TABLE = 17
SAVE_TABLE = 18 SAVE_TABLE = 18
SAVE_TABLE_DEFAULT = 19 SAVE_TABLE_DEFAULT = 19
LOAD_TABLE = 20
PRINT_SWITCH_V_I = 32 PRINT_SWITCH_V_I = 32
PRINT_LATCHUPS = 33 PRINT_LATCHUPS = 33
@ -41,6 +42,7 @@ class GomspaceOpCodes:
SAVE_TABLE = ["save_table"] SAVE_TABLE = ["save_table"]
RESET_GND_WATCHDOG = ["reset_gnd_wdt"] RESET_GND_WATCHDOG = ["reset_gnd_wdt"]
SAVE_TABLE_DEFAULT = ["save_table_default"] SAVE_TABLE_DEFAULT = ["save_table_default"]
LOAD_TABLE = ["load_table"]
REQUEST_CONFIG_TABLE = ["cfg_table"] REQUEST_CONFIG_TABLE = ["cfg_table"]
@ -55,6 +57,7 @@ class GsInfo:
RESET_GND_WATCHDOG = "Reset GND watchdog" RESET_GND_WATCHDOG = "Reset GND watchdog"
SAVE_TABLE = "Save table non-volatile (file)" SAVE_TABLE = "Save table non-volatile (file)"
SAVE_TABLE_DEFAULT = "Save table non-volatile (default)" SAVE_TABLE_DEFAULT = "Save table non-volatile (default)"
LOAD_TABLE = "Load Table"
class SetIds: class SetIds:

View File

@ -142,6 +142,34 @@ def pack_gomspace_cmds(
user_data=bytes([source_table]), user_data=bytes([source_table]),
) )
) )
if op_code in GomspaceOpCodes.LOAD_TABLE:
target_table = int(
input(
"Target table ID [0: Board Config, 1: Module Config, 2: Calibration Parameter, "
"value + 4 for default table]: "
)
)
if target_table not in [0, 1, 2, 4]:
raise ValueError("Invalid source table index")
if target_table != 4:
source_table = int(
input(
"Source table (file or default) [0: Board Config, 1: Module Config, "
"2: Calibration Parameter, value + 4 for default table]: "
)
)
if source_table not in [0, 1, 2, 4, 5, 6]:
raise ValueError("Invalid source table index")
else:
# Will be ignored
source_table = 4
q.add_pus_tc(
make_fsfw_action_cmd(
object_id=object_id.as_bytes,
action_id=GomspaceDeviceActionIds.LOAD_TABLE,
user_data=bytes([source_table, target_table]),
)
)
if op_code in GomspaceOpCodes.RESET_GND_WATCHDOG: if op_code in GomspaceOpCodes.RESET_GND_WATCHDOG:
q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}") q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
q.add_pus_tc(pack_gnd_wdt_reset_command(object_id)) q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
@ -216,4 +244,5 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
oce.add(keys=GomspaceOpCodes.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE) 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, info=GsInfo.SAVE_TABLE)
oce.add(keys=GomspaceOpCodes.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT) oce.add(keys=GomspaceOpCodes.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT)
oce.add(keys=GomspaceOpCodes.LOAD_TABLE, info=GsInfo.LOAD_TABLE)
oce.add(keys=GomspaceOpCodes.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG) oce.add(keys=GomspaceOpCodes.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG)