tmtc faulty gyor cmd

This commit is contained in:
Markus Kranz 2023-02-27 18:22:57 +01:00
parent 9720fcddec
commit a13454851b

View File

@ -2,7 +2,10 @@ import enum
import logging
import struct
from spacepackets.ecss import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_201_fsfw_health import pack_set_health_cmd_data, FsfwHealth
from tmtccmd.pus.s201_fsfw_health import Subservice
import eive_tmtc.config.object_ids as obj_ids
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
@ -30,6 +33,7 @@ class OpCode:
OFF = "off"
CORE_HK = "core_hk"
CFG_HK = "cfg_hk"
SET_FAULTY = "set_faulty"
class AdisGyroSetId(enum.IntEnum):
@ -85,6 +89,15 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
q.add_pus_tc(
create_request_one_hk_command(make_sid(gyr_obj_id, AdisGyroSetId.CFG_HK))
)
elif op_code == OpCode.SET_FAULTY:
q.add_log_cmd(f"Gyro {gyr_info[0]} set faulty")
q.add_pus_tc(
PusTelecommand(
service=201,
subservice=Subservice.TC_SET_HEALTH,
app_data=pack_set_health_cmd_data(object_id=gyr_obj_id, health=FsfwHealth.FAULTY)
)
)
else:
logging.getLogger(__name__).warning(
f"invalid op code {op_code} for gyro command"
@ -177,4 +190,5 @@ def add_gyr_cmd_defs(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCode.CFG_HK, info="Request CFG HK")
oce.add(keys=OpCode.NML, info="Normal Mode")
oce.add(keys=OpCode.OFF, info="Off Mode")
oce.add(keys=OpCode.SET_FAULTY, info="Set Faulty")
defs.add_service(CustomServiceList.GYRO, info="Gyro", op_code_entry=oce)