47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
from tmtccmd.tc.definitions import TcQueueT
|
|
|
|
|
|
from .common import command_mode
|
|
import config.object_ids as obj_ids
|
|
|
|
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"]
|
|
|
|
|
|
class Info:
|
|
THERMAL_CONTROLLER = "Thermal controller"
|
|
CORE_CONTROLLER = "ACS controller"
|
|
|
|
|
|
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
|
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
|
|
"name": "Submode", "defaultValue": "0"}])
|
|
mode = int(parameters["Mode"])
|
|
if mode < 0 or mode > 2:
|
|
print("Invalid Mode, defaulting to OFF")
|
|
mode = 0
|
|
submode = int(parameters["Submode"])
|
|
command_mode(
|
|
object_id=get_object_from_op_code(op_code),
|
|
mode=mode,
|
|
submode=submode,
|
|
tc_queue=tc_queue,
|
|
info=op_code + " to " + str(mode) + "," + str(submode),
|
|
)
|
|
|
|
|
|
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
|