some improvements and updates

This commit is contained in:
2022-05-27 11:53:57 +02:00
parent f7d843131f
commit 851593a7bf
8 changed files with 170 additions and 83 deletions

View File

@ -1,5 +1,7 @@
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.config import QueueCommands
from tmtccmd.tc.pus_200_fsfw_modes import Modes
from tmtccmd.utility import ObjectId
from .common import command_mode
import config.object_ids as obj_ids
@ -8,8 +10,8 @@ from pus_tc.prompt_parameters import prompt_parameters
class OpCodes:
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "thermal_controller"]
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "core_controller"]
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "ctrl-th"]
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "ctrl-core"]
class Info:
@ -17,7 +19,7 @@ class Info:
CORE_CONTROLLER = "ACS controller"
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
def pack_cmd_ctrl_to_prompted_mode(tc_queue: TcQueueT, object_id: ObjectId):
parameters = prompt_parameters(
[
{"name": "Mode", "defaultValue": "2"},
@ -30,21 +32,41 @@ def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
mode = 0
submode = int(parameters["Submode"])
command_mode(
object_id=get_object_from_op_code(op_code),
object_id=object_id.as_bytes,
mode=mode,
submode=submode,
tc_queue=tc_queue,
info=op_code + " to " + str(mode) + "," + str(submode),
info=f"Commanding {object_id} to {mode}, {submode}",
)
tc_queue.appendleft((QueueCommands.WAIT, 20))
def pack_cmd_ctrl_to_off(tc_queue: TcQueueT, object_id: ObjectId):
command_mode(
object_id=get_object_from_op_code(op_code),
mode=0,
object_id=object_id.as_bytes,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info=op_code + " to 0,0",
info=f"Commanding {object_id} OFF",
)
def pack_cmd_ctrl_to_on(tc_queue: TcQueueT, object_id: ObjectId):
command_mode(
object_id=object_id.as_bytes,
mode=Modes.ON,
submode=0,
tc_queue=tc_queue,
info=f"Commanding {object_id} ON",
)
def pack_cmd_ctrl_to_nml(tc_queue: TcQueueT, object_id: ObjectId):
command_mode(
object_id=object_id.as_bytes,
mode=Modes.NORMAL,
submode=0,
tc_queue=tc_queue,
info=f"Commanding {object_id} NORMAL",
)