tmtc faulty gyor cmd #142

Merged
muellerr merged 2 commits from kranz_tmtc_faulty_gyro_cmd into main 2023-02-27 18:20:59 +01:00

View File

@ -2,7 +2,10 @@ import enum
import logging import logging
import struct import struct
from spacepackets.ecss import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper 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 import eive_tmtc.config.object_ids as obj_ids
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
@ -30,6 +33,7 @@ class OpCode:
OFF = "off" OFF = "off"
CORE_HK = "core_hk" CORE_HK = "core_hk"
CFG_HK = "cfg_hk" CFG_HK = "cfg_hk"
SET_FAULTY = "set_faulty"
class AdisGyroSetId(enum.IntEnum): class AdisGyroSetId(enum.IntEnum):
@ -85,6 +89,15 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
q.add_pus_tc( q.add_pus_tc(
create_request_one_hk_command(make_sid(gyr_obj_id, AdisGyroSetId.CFG_HK)) 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: else:
logging.getLogger(__name__).warning( logging.getLogger(__name__).warning(
f"invalid op code {op_code} for gyro command" 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.CFG_HK, info="Request CFG HK")
oce.add(keys=OpCode.NML, info="Normal Mode") oce.add(keys=OpCode.NML, info="Normal Mode")
oce.add(keys=OpCode.OFF, info="Off 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) defs.add_service(CustomServiceList.GYRO, info="Gyro", op_code_entry=oce)