eive-tmtc/eive_tmtc/tmtc/wdt.py

44 lines
1.1 KiB
Python
Raw Normal View History

2023-10-11 11:35:57 +02:00
import enum
from tmtccmd.config.tmtc import (
OpCodeEntry,
TmtcDefinitionWrapper,
tmtc_definitions_provider,
)
2023-11-10 19:23:06 +01:00
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
from tmtccmd.tmtc import DefaultPusQueueHelper
2023-10-11 11:35:57 +02:00
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import XIPHOS_WDT_ID
class OpCode:
ENABLE = "enable"
2023-10-11 11:38:45 +02:00
DISABLE = "disable"
2023-10-11 11:35:57 +02:00
class Info:
ENABLE = "Enable WDT"
DISABLE = "Disable WDT"
class ActionId(enum.IntEnum):
ENABLE = 0
DISABLE = 1
def pack_wdt_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code == OpCode.ENABLE:
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.ENABLE))
2023-10-11 11:38:45 +02:00
if op_code == OpCode.DISABLE:
2023-10-11 11:35:57 +02:00
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.DISABLE))
@tmtc_definitions_provider
2023-10-11 11:37:48 +02:00
def add_xiphos_wdt_defs(defs: TmtcDefinitionWrapper):
2023-10-11 11:35:57 +02:00
oce = OpCodeEntry()
oce.add(keys=OpCode.ENABLE, info=Info.ENABLE)
2023-10-11 11:38:45 +02:00
oce.add(keys=OpCode.DISABLE, info=Info.DISABLE)
2023-10-11 11:35:57 +02:00
defs.add_service(
CustomServiceList.XIPHOS_WDT, info="Xiphos Watchdog Timer", op_code_entry=oce
)