diff --git a/.run/Info All.run.xml b/.run/Info All.run.xml
new file mode 100644
index 0000000..3fac8b8
--- /dev/null
+++ b/.run/Info All.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/P60_Dock_Commanding.run.xml b/.run/P60_Dock_Commanding.run.xml
index ffe2539..0d85bea 100644
--- a/.run/P60_Dock_Commanding.run.xml
+++ b/.run/P60_Dock_Commanding.run.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/.run/PDU1_Commanding.run.xml b/.run/PDU1_Commanding.run.xml
index 0611495..977af79 100644
--- a/.run/PDU1_Commanding.run.xml
+++ b/.run/PDU1_Commanding.run.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/.run/PDU2_Commanding.run.xml b/.run/PDU2_Commanding.run.xml
index 4615b19..246d576 100644
--- a/.run/PDU2_Commanding.run.xml
+++ b/.run/PDU2_Commanding.run.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/.run/Reset GND WDTs.run.xml b/.run/Reset GND WDTs.run.xml
new file mode 100644
index 0000000..d0b97e2
--- /dev/null
+++ b/.run/Reset GND WDTs.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/Set Current Time.run.xml b/.run/Set Current Time.run.xml
new file mode 100644
index 0000000..4b2011c
--- /dev/null
+++ b/.run/Set Current Time.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py
index 571e28f..25360b4 100644
--- a/gomspace/gomspace_common.py
+++ b/gomspace/gomspace_common.py
@@ -13,7 +13,7 @@ from typing import Union
from spacepackets.ecss import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
-from tmtccmd.util import ObjectIdU32
+from tmtccmd.util import ObjectIdU32, ObjectIdBase
class GomspaceDeviceActionIds(enum.IntEnum):
@@ -24,6 +24,8 @@ class GomspaceDeviceActionIds(enum.IntEnum):
WDT_RESET = 9
REQUEST_HK_TABLE = 16
REQUEST_CONFIG_TABLE = 17
+ SAVE_TABLE = 18
+ SAVE_TABLE_DEFAULT = 19
PRINT_SWITCH_V_I = 32
PRINT_LATCHUPS = 33
@@ -36,6 +38,9 @@ class GomspaceOpCodes:
PRINT_LATCHUPS = ["print_latchups"]
GET_PARAM = ["get_param"]
SET_PARAM = ["set_param"]
+ SAVE_TABLE = ["save_table"]
+ RESET_GND_WATCHDOG = ["reset_gnd_wdt"]
+ SAVE_TABLE_DEFAULT = ["save_table_default"]
REQUEST_CONFIG_TABLE = ["cfg_table"]
@@ -47,6 +52,9 @@ class GsInfo:
GET_PARAMETER = "Get parameter"
SET_PARAMETER = "Set parameter"
REQUEST_CONFIG_TABLE = "Request Config Table"
+ RESET_GND_WATCHDOG = "Reset GND watchdog"
+ SAVE_TABLE = "Save table non-volatile (file)"
+ SAVE_TABLE_DEFAULT = "Save table non-volatile (default)"
class SetIds:
@@ -184,7 +192,7 @@ def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand
)
-def pack_gnd_wdt_reset_command(object_id: ObjectIdU32) -> PusTelecommand:
+def pack_gnd_wdt_reset_command(object_id: ObjectIdBase) -> PusTelecommand:
""" " Function to generate the command to reset the watchdog of a gomspace device.
@param object_id Object Id of the gomspace device handler.
"""
diff --git a/tmtc/power/acu.py b/tmtc/power/acu.py
index 12fe28b..5dce54e 100644
--- a/tmtc/power/acu.py
+++ b/tmtc/power/acu.py
@@ -6,7 +6,7 @@
from config.definitions import CustomServiceList
from tmtc.power.common_power import (
- add_gomspace_cmds,
+ pack_gomspace_cmds,
add_gomspace_cmd_defs,
req_hk_cmds,
)
@@ -68,7 +68,7 @@ def add_acu_cmds(defs: TmtcDefinitionWrapper):
def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
q.add_log_cmd("Handling ACU command")
- add_gomspace_cmds("ACU", object_id, q, op_code)
+ pack_gomspace_cmds("ACU", object_id, q, op_code)
acu_req_hk_cmds(q, op_code)
pack_test_cmds(object_id=object_id, q=q)
diff --git a/tmtc/power/common_power.py b/tmtc/power/common_power.py
index bb4db5e..93b522e 100644
--- a/tmtc/power/common_power.py
+++ b/tmtc/power/common_power.py
@@ -7,6 +7,7 @@ from gomspace.gomspace_common import (
prompt_and_pack_set_param_command,
prompt_and_pack_get_param_command,
pack_request_config_command,
+ pack_gnd_wdt_reset_command,
)
from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST
from tmtccmd.config import OpCodeEntry
@@ -17,13 +18,14 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
)
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
-from tmtccmd.util import ObjectIdU32
+from tmtccmd.util import ObjectIdU32, ObjectIdBase
class PowerInfo:
INFO_CORE = "Core Information"
INFO_AUX = "Auxiliary Information"
INFO_ALL = "All Information"
+ RESET_ALL_GND_WDTS = "Reset all Ground Watchdogs"
class PowerOpCodes:
@@ -66,9 +68,10 @@ class PowerOpCodes:
INFO_CORE = ["info"]
INFO_AUX = ["info_aux"]
INFO_ALL = ["info_all"]
+ RESET_ALL_GND_WDTS = ["reset_gnd_wdts"]
-def add_gomspace_cmds(
+def pack_gomspace_cmds(
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
):
objb = object_id.as_bytes
@@ -95,6 +98,51 @@ def add_gomspace_cmds(
if op_code in GomspaceOpCodes.REQUEST_CONFIG_TABLE:
q.add_log_cmd(f"{prefix}: {GsInfo.REQUEST_CONFIG_TABLE}")
q.add_pus_tc(pack_request_config_command(object_id.as_bytes))
+ if op_code in GomspaceOpCodes.SAVE_TABLE:
+ q.add_log_cmd(f"{prefix}: {GsInfo.SAVE_TABLE}")
+ source_table = int(
+ input(
+ "Source table [0: Board Config, 1: Module Config, "
+ "2: Calibration Parameter, 4: TM Data]: "
+ )
+ )
+ # Not used for now
+ """
+ target_table = int(input(
+ "Target table. [Default: Source table]: "
+ ))
+ """
+ q.add_pus_tc(
+ make_fsfw_action_cmd(
+ object_id=object_id.as_bytes,
+ action_id=GomspaceDeviceActionIds.SAVE_TABLE,
+ user_data=bytes([source_table]),
+ )
+ )
+ 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]: "
+ )
+ )
+ q.add_pus_tc(
+ make_fsfw_action_cmd(
+ object_id=object_id.as_bytes,
+ action_id=GomspaceDeviceActionIds.SAVE_TABLE_DEFAULT,
+ user_data=bytes([source_table]),
+ )
+ )
+ if op_code in GomspaceOpCodes.RESET_GND_WATCHDOG:
+ q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
+ q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
+
+
+def pack_reset_gnd_wdt_cmd(
+ q: DefaultPusQueueHelper, prefix: str, object_id: ObjectIdBase
+):
+ q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
+ q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
def req_hk_cmds(
@@ -155,3 +203,6 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info=GsInfo.PRINT_LATCHUPS)
oce.add(keys=GomspaceOpCodes.SET_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)
+ oce.add(keys=GomspaceOpCodes.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG)
diff --git a/tmtc/power/p60dock.py b/tmtc/power/p60dock.py
index d4bcc01..df6a91e 100644
--- a/tmtc/power/p60dock.py
+++ b/tmtc/power/p60dock.py
@@ -5,7 +5,7 @@
@author J. Meier
@date 13.12.2020
"""
-from tmtc.power.common_power import add_gomspace_cmds, req_hk_cmds
+from tmtc.power.common_power import pack_gomspace_cmds, req_hk_cmds
from tmtccmd.tc import DefaultPusQueueHelper
from gomspace.gomspace_common import (
TableEntry,
@@ -95,7 +95,7 @@ class P60DockHkTable:
def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
objb = object_id.as_bytes
- add_gomspace_cmds("P60 Dock", object_id, q, op_code)
+ pack_gomspace_cmds("P60 Dock", object_id, q, op_code)
p60_dock_req_hk_cmds(q, op_code)
if op_code in P60OpCodes.STACK_3V3_ON:
q.add_log_cmd(P60Info.STACK_3V3_ON)
diff --git a/tmtc/power/pdu1.py b/tmtc/power/pdu1.py
index c846a1c..1f84643 100644
--- a/tmtc/power/pdu1.py
+++ b/tmtc/power/pdu1.py
@@ -5,7 +5,7 @@
"""
from config.object_ids import PDU_1_HANDLER_ID
from tmtc.power.common_power import (
- add_gomspace_cmds,
+ pack_gomspace_cmds,
req_hk_cmds,
PowerOpCodes,
generic_on_cmd,
@@ -61,7 +61,7 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
objb = object_id.as_bytes
pdu1_cmds(q, op_code)
pdu1_req_hk_cmds(q, op_code)
- add_gomspace_cmds("PDU1", object_id, q, op_code)
+ pack_gomspace_cmds("PDU1", object_id, q, op_code)
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
q.add_log_cmd("PDU1: Ping Test")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
diff --git a/tmtc/power/pdu2.py b/tmtc/power/pdu2.py
index ef90352..01a2366 100644
--- a/tmtc/power/pdu2.py
+++ b/tmtc/power/pdu2.py
@@ -8,7 +8,7 @@
"""
from config.object_ids import PDU_2_HANDLER_ID
from tmtc.power.common_power import (
- add_gomspace_cmds,
+ pack_gomspace_cmds,
req_hk_cmds,
PowerOpCodes,
generic_on_cmd,
@@ -73,7 +73,7 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
objb = object_id.as_bytes
pdu2_cmds(q, op_code)
pdu2_req_hk_cmds(q, op_code)
- add_gomspace_cmds("PDU2", object_id, q, op_code)
+ pack_gomspace_cmds("PDU2", object_id, q, op_code)
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
q.add_log_cmd("PDU2: Reboot")
q.add_pus_tc(pack_reboot_command(object_id))
diff --git a/tmtc/power/power.py b/tmtc/power/power.py
index 9a2b1bd..7391fbc 100644
--- a/tmtc/power/power.py
+++ b/tmtc/power/power.py
@@ -3,8 +3,16 @@ from tmtc.power.common_power import (
PowerOpCodes,
PowerInfo,
add_gomspace_cmd_defs,
+ pack_reset_gnd_wdt_cmd,
)
from config.definitions import CustomServiceList
+from config.object_ids import (
+ P60_DOCK_HANDLER,
+ ACU_HANDLER_ID,
+ PDU_1_HANDLER_ID,
+ PDU_2_HANDLER_ID,
+ get_object_ids,
+)
from tmtc.power.pdu1 import pdu1_req_hk_cmds, pdu1_cmds, add_pdu1_common_defs
from tmtc.power.pdu2 import pdu2_req_hk_cmds, add_pdu2_common_defs, pdu2_cmds
from tmtccmd import get_console_logger
@@ -44,6 +52,13 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
acu_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
acu_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
q.add_wait_seconds(8.0)
+ elif op_code in PowerOpCodes.RESET_ALL_GND_WDTS:
+ oids = get_object_ids()
+ pack_reset_gnd_wdt_cmd(q, "P60 Dock", oids[P60_DOCK_HANDLER])
+ pack_reset_gnd_wdt_cmd(q, "ACU", oids[ACU_HANDLER_ID])
+ pack_reset_gnd_wdt_cmd(q, "PDU1", oids[PDU_1_HANDLER_ID])
+ pack_reset_gnd_wdt_cmd(q, "PDU2", oids[PDU_2_HANDLER_ID])
+ q.add_wait_seconds(5.0)
if q.empty():
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
@@ -70,6 +85,7 @@ def add_power_cmd_defs(defs: TmtcDefinitionWrapper):
oce.add(keys=PowerOpCodes.INFO_ALL, info=PowerInfo.INFO_ALL)
oce.add(keys=PowerOpCodes.INFO_CORE, info=PowerInfo.INFO_CORE)
oce.add(keys=PowerOpCodes.INFO_AUX, info=PowerInfo.INFO_AUX)
+ oce.add(keys=PowerOpCodes.RESET_ALL_GND_WDTS, info=PowerInfo.RESET_ALL_GND_WDTS)
defs.add_service(
name=CustomServiceList.POWER.value,
info="Power Subsystem",