continuing node setup
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good

This commit is contained in:
2023-11-28 17:24:25 +01:00
parent d2fc53c1fa
commit 76fee820e9
6 changed files with 165 additions and 51 deletions

View File

@ -5,21 +5,21 @@
"""
import enum
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config import CmdTreeNode, OpCodeEntry, TmtcDefinitionWrapper
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
from tmtccmd.pus.s201_fsfw_health import (
FsfwHealth,
Subservice,
pack_set_health_cmd_data,
)
from tmtccmd.tmtc import DefaultPusQueueHelper
from tmtccmd.util.obj_id import ObjectIdU32
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import get_object_ids
from eive_tmtc.tmtc.tcs.defs import Heater
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tmtc import DefaultPusQueueHelper
from tmtccmd.util.obj_id import ObjectIdU32
from tmtccmd.pus.s201_fsfw_health import (
pack_set_health_cmd_data,
FsfwHealth,
Subservice,
)
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
from spacepackets.ecss.tc import PusTelecommand
HEATER_LOCATION = [
"PLOC Processing Board",
@ -34,10 +34,10 @@ HEATER_LOCATION = [
class OpCode:
HEATER_CMD = ["switch_cmd"]
HEATER_EXT_CTRL = ["set_ext_ctrl"]
HEATER_FAULTY_CMD = ["set_faulty"]
HEATER_HEALTHY_CMD = ["set_healthy"]
HEATER_CMD = "switch_cmd"
HEATER_EXT_CTRL = "set_ext_ctrl"
HEATER_FAULTY_CMD = "set_faulty"
HEATER_HEALTHY_CMD = "set_healthy"
class Info:
@ -55,6 +55,18 @@ class ActionIds(enum.IntEnum):
SWITCH_HEATER = 0
CTN = CmdTreeNode
def create_heater_node() -> CmdTreeNode:
node = CmdTreeNode("heater", "Heater Device", hide_children_which_are_leaves=True)
node.add_child(CTN(OpCode.HEATER_CMD, Info.HEATER_CMD))
node.add_child(CTN(OpCode.HEATER_HEALTHY_CMD, Info.HEATER_HEALTHY_CMD))
node.add_child(CTN(OpCode.HEATER_EXT_CTRL, Info.HEATER_EXT_CTRL))
node.add_child(CTN(OpCode.HEATER_FAULTY_CMD, Info.HEATER_FAULTY_CMD))
return node
@tmtc_definitions_provider
def add_heater_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
@ -70,7 +82,7 @@ def add_heater_cmds(defs: TmtcDefinitionWrapper):
def pack_heater_cmds(object_id: bytes, cmd_str: str, q: DefaultPusQueueHelper):
if cmd_str in OpCode.HEATER_CMD:
if cmd_str == OpCode.HEATER_CMD:
q.add_log_cmd("Heater Switching")
heater_number = prompt_heater()
while True:
@ -90,7 +102,7 @@ def pack_heater_cmds(object_id: bytes, cmd_str: str, q: DefaultPusQueueHelper):
debug_string = f"Switching heater {heater_number} {act_str}"
q.add_log_cmd(debug_string)
q.add_pus_tc(pack_switch_heater_command(object_id, heater_number, action))
if cmd_str in OpCode.HEATER_EXT_CTRL:
if cmd_str == OpCode.HEATER_EXT_CTRL:
heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number)
health_cmd(
@ -100,7 +112,7 @@ def pack_heater_cmds(object_id: bytes, cmd_str: str, q: DefaultPusQueueHelper):
health_str="External Control",
heater_idx=heater_number,
)
if cmd_str in OpCode.HEATER_FAULTY_CMD:
if cmd_str == OpCode.HEATER_FAULTY_CMD:
heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number)
health_cmd(
@ -110,7 +122,7 @@ def pack_heater_cmds(object_id: bytes, cmd_str: str, q: DefaultPusQueueHelper):
health_str="Faulty",
heater_idx=heater_number,
)
if cmd_str in OpCode.HEATER_HEALTHY_CMD:
if cmd_str == OpCode.HEATER_HEALTHY_CMD:
heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number)
health_cmd(