Improvements to Loop Mode and HK Parsing #73
@ -1058,14 +1058,14 @@ def add_system_cmds(cmd_dict: ServiceOpCodeDictT):
|
|||||||
op_code_dict = dict()
|
op_code_dict = dict()
|
||||||
add_op_code_entry(
|
add_op_code_entry(
|
||||||
op_code_dict=op_code_dict,
|
op_code_dict=op_code_dict,
|
||||||
keys=controllers.OpCodes.THERMAL_CONTROLLER_NORMAL,
|
keys=controllers.OpCodes.THERMAL_CONTROLLER,
|
||||||
info=controllers.Info.THERMAL_CONTROLLER_NORMAL,
|
info=controllers.Info.THERMAL_CONTROLLER,
|
||||||
options=default_opts,
|
options=default_opts,
|
||||||
)
|
)
|
||||||
add_op_code_entry(
|
add_op_code_entry(
|
||||||
op_code_dict=op_code_dict,
|
op_code_dict=op_code_dict,
|
||||||
keys=controllers.OpCodes.THERMAL_CONTROLLER_OFF,
|
keys=controllers.OpCodes.CORE_CONTROLLER,
|
||||||
info=controllers.Info.THERMAL_CONTROLLER_OFF,
|
info=controllers.Info.CORE_CONTROLLER,
|
||||||
options=default_opts,
|
options=default_opts,
|
||||||
)
|
)
|
||||||
add_service_op_code_entry(
|
add_service_op_code_entry(
|
||||||
|
@ -1,35 +1,44 @@
|
|||||||
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
|
from ast import Pass
|
||||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
from tmtccmd.tc.definitions import TcQueueT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from .common import command_mode
|
from .common import command_mode
|
||||||
import config.object_ids as obj_ids
|
import config.object_ids as obj_ids
|
||||||
|
|
||||||
|
|
||||||
class OpCodes:
|
class OpCodes:
|
||||||
THERMAL_CONTROLLER_NORMAL = ["0", "thermal-normal"]
|
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "thermal_controller"]
|
||||||
THERMAL_CONTROLLER_OFF = ["1", "thermal-off"]
|
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "core_controller"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
THERMAL_CONTROLLER_NORMAL = "Switching Thermal Controller into normal"
|
THERMAL_CONTROLLER = "Thermal controller"
|
||||||
THERMAL_CONTROLLER_OFF = "Switching Thermal Controller off"
|
CORE_CONTROLLER = "ACS controller"
|
||||||
|
|
||||||
|
|
||||||
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
||||||
if op_code in OpCodes.THERMAL_CONTROLLER_NORMAL:
|
mode = int(input("Specify mode: (OFF = 0; ON = 1; NORMAL = 2) [2] ") or "2")
|
||||||
|
print(mode)
|
||||||
|
if mode < 0 or mode > 2:
|
||||||
|
print("Invalid Mode, defaulting to OFF")
|
||||||
|
mode = 0
|
||||||
|
submode = int(input("Specify submode [0]: ") or "0")
|
||||||
command_mode(
|
command_mode(
|
||||||
object_id=obj_ids.THERMAL_CONTROLLER_ID,
|
object_id=get_object_from_op_code(op_code),
|
||||||
mode=Modes.NORMAL,
|
mode=mode,
|
||||||
submode=0,
|
submode=submode,
|
||||||
tc_queue=tc_queue,
|
tc_queue=tc_queue,
|
||||||
info=Info.THERMAL_CONTROLLER_NORMAL,
|
info=op_code + " to " + str(mode) + "," + str(submode),
|
||||||
)
|
|
||||||
if op_code in OpCodes.THERMAL_CONTROLLER_OFF:
|
|
||||||
command_mode(
|
|
||||||
object_id=obj_ids.THERMAL_CONTROLLER_ID,
|
|
||||||
mode=Modes.OFF,
|
|
||||||
submode=0,
|
|
||||||
tc_queue=tc_queue,
|
|
||||||
info=Info.THERMAL_CONTROLLER_OFF,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_object_from_op_code(op_code: str):
|
||||||
|
try:
|
||||||
|
return bytes.fromhex(op_code)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if op_code in OpCodes.THERMAL_CONTROLLER:
|
||||||
|
return obj_ids.THERMAL_CONTROLLER_ID
|
||||||
|
if op_code in OpCodes.CORE_CONTROLLER:
|
||||||
|
return obj_ids.CORE_CONTROLLER_ID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user