i am happy with this output format
This commit is contained in:
parent
0399b478f3
commit
ee38f83ec1
@ -29,6 +29,7 @@ class CustomServiceList(str, enum.Enum):
|
|||||||
value: str
|
value: str
|
||||||
|
|
||||||
TEST_DEVICE = "test"
|
TEST_DEVICE = "test"
|
||||||
|
HEALTH = "health"
|
||||||
P60DOCK = "p60dock"
|
P60DOCK = "p60dock"
|
||||||
PDU1 = "pdu1"
|
PDU1 = "pdu1"
|
||||||
PDU2 = "pdu2"
|
PDU2 = "pdu2"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
@ -9,6 +11,10 @@ class PrintWrapper:
|
|||||||
print(string)
|
print(string)
|
||||||
self.printer.file_logger.info(string)
|
self.printer.file_logger.info(string)
|
||||||
|
|
||||||
|
def ilog(self, logger: logging.Logger, string: str):
|
||||||
|
logger.info(string)
|
||||||
|
self.printer.file_logger.info(string)
|
||||||
|
|
||||||
|
|
||||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||||
print(string)
|
print(string)
|
||||||
|
@ -7,6 +7,7 @@ from eive_tmtc.pus_tm.defs import PrintWrapper
|
|||||||
from eive_tmtc.pus_tm.verification_handler import generic_retval_printout
|
from eive_tmtc.pus_tm.verification_handler import generic_retval_printout
|
||||||
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||||
|
from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth
|
||||||
|
|
||||||
from tmtccmd.tm import Service5Tm
|
from tmtccmd.tm import Service5Tm
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
@ -37,7 +38,7 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
pw.printer.file_logger.info(
|
pw.printer.file_logger.info(
|
||||||
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||||
)
|
)
|
||||||
_LOGGER.info(generic_event_string)
|
pw.ilog(_LOGGER, generic_event_string)
|
||||||
specific_handler = True
|
specific_handler = True
|
||||||
if info.name == "MODE_TRANSITION_FAILED":
|
if info.name == "MODE_TRANSITION_FAILED":
|
||||||
reason = generic_retval_printout(event_def.param1)
|
reason = generic_retval_printout(event_def.param1)
|
||||||
@ -88,6 +89,9 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
time = event_def.param1 + event_def.param2 / 1000.0
|
time = event_def.param1 + event_def.param2 / 1000.0
|
||||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||||
pw.dlog(f"Current time: {time_dt}")
|
pw.dlog(f"Current time: {time_dt}")
|
||||||
|
elif info.name == "HEALTH_INFO":
|
||||||
|
health = FsfwHealth(event_def.param1)
|
||||||
|
pw.dlog(f"{obj_name}: {health!r}")
|
||||||
else:
|
else:
|
||||||
specific_handler = False
|
specific_handler = False
|
||||||
if info.info != "":
|
if info.info != "":
|
||||||
|
@ -2,3 +2,4 @@ from .payload.subsystem import add_payload_subsystem_cmds
|
|||||||
from .solar_array_deployment import add_sa_depl_cmds
|
from .solar_array_deployment import add_sa_depl_cmds
|
||||||
from .test import add_test_defs
|
from .test import add_test_defs
|
||||||
from .time import add_time_cmds
|
from .time import add_time_cmds
|
||||||
|
from .health import add_health_cmd_defs
|
||||||
|
@ -10,7 +10,6 @@ from tmtccmd.config import TmtcDefinitionWrapper
|
|||||||
|
|
||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||||
from tmtccmd.logging import get_console_logger
|
|
||||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||||
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
||||||
|
43
eive_tmtc/tmtc/health.py
Normal file
43
eive_tmtc/tmtc/health.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
|
from spacepackets.ecss import PusTelecommand
|
||||||
|
from tmtccmd.config.tmtc import (
|
||||||
|
tmtc_definitions_provider,
|
||||||
|
TmtcDefinitionWrapper,
|
||||||
|
OpCodeEntry,
|
||||||
|
)
|
||||||
|
from tmtccmd.tc import service_provider
|
||||||
|
from tmtccmd.pus.s201_fsfw_health import Subservice
|
||||||
|
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||||
|
|
||||||
|
|
||||||
|
class OpCode:
|
||||||
|
ANNOUNCE_HEALTH_ALL = "read_health_all"
|
||||||
|
ANNOUNCE_HEALTH = "read_health"
|
||||||
|
|
||||||
|
|
||||||
|
class Info:
|
||||||
|
ANNOUNCE_HEALTH_ALL = "Read all health states"
|
||||||
|
ANNOUNCE_HEALTH = "Read health state of one object"
|
||||||
|
|
||||||
|
|
||||||
|
@service_provider(CustomServiceList.HEALTH)
|
||||||
|
def pack_test_command(p: ServiceProviderParams):
|
||||||
|
o = p.op_code
|
||||||
|
q = p.queue_helper
|
||||||
|
if o == OpCode.ANNOUNCE_HEALTH:
|
||||||
|
raise NotImplementedError()
|
||||||
|
elif o == OpCode.ANNOUNCE_HEALTH_ALL:
|
||||||
|
q.add_log_cmd(Info.ANNOUNCE_HEALTH_ALL)
|
||||||
|
q.add_pus_tc(
|
||||||
|
PusTelecommand(service=201, subservice=Subservice.TC_ANNOUNCE_HEALTH_ALL)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
raise ValueError(f"unknown op code {o} for service {CustomServiceList.HEALTH}")
|
||||||
|
|
||||||
|
|
||||||
|
@tmtc_definitions_provider
|
||||||
|
def add_health_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||||
|
oce = OpCodeEntry()
|
||||||
|
oce.add(OpCode.ANNOUNCE_HEALTH_ALL, Info.ANNOUNCE_HEALTH_ALL)
|
||||||
|
oce.add(OpCode.ANNOUNCE_HEALTH, Info.ANNOUNCE_HEALTH)
|
||||||
|
defs.add_service(CustomServiceList.HEALTH, info="Health Service", op_code_entry=oce)
|
@ -33,10 +33,10 @@ class Heater(enum.IntEnum):
|
|||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
HEATER_CMD = ["0", "switch-cmd"]
|
HEATER_CMD = ["switch_cmd"]
|
||||||
HEATER_EXT_CTRL = ["1", "set-ext-ctrl"]
|
HEATER_EXT_CTRL = ["set_ext_ctrl"]
|
||||||
HEATER_FAULTY_CMD = ["2", "set-faulty"]
|
HEATER_FAULTY_CMD = ["set_faulty"]
|
||||||
HEATER_HEALTHY_CMD = ["3", "set-healthy"]
|
HEATER_HEALTHY_CMD = ["set_healthy"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
|
Loading…
Reference in New Issue
Block a user