2022-05-17 22:11:31 +02:00
|
|
|
from tmtccmd.tc.definitions import TcQueueT
|
2022-05-23 00:20:06 +02:00
|
|
|
from tmtccmd.config import QueueCommands
|
2022-05-17 22:11:31 +02:00
|
|
|
|
2022-05-17 10:41:45 +02:00
|
|
|
from .common import command_mode
|
|
|
|
import config.object_ids as obj_ids
|
|
|
|
|
2022-05-22 21:29:09 +02:00
|
|
|
from pus_tc.prompt_parameters import prompt_parameters
|
|
|
|
|
2022-05-17 10:41:45 +02:00
|
|
|
|
|
|
|
class OpCodes:
|
2022-05-17 22:11:31 +02:00
|
|
|
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "thermal_controller"]
|
|
|
|
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "core_controller"]
|
2022-05-17 10:41:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Info:
|
2022-05-17 22:11:31 +02:00
|
|
|
THERMAL_CONTROLLER = "Thermal controller"
|
|
|
|
CORE_CONTROLLER = "ACS controller"
|
2022-05-17 10:41:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
2022-05-22 21:29:09 +02:00
|
|
|
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
|
|
|
|
"name": "Submode", "defaultValue": "0"}])
|
|
|
|
mode = int(parameters["Mode"])
|
2022-05-19 13:20:22 +02:00
|
|
|
if mode < 0 or mode > 2:
|
2022-05-17 22:11:31 +02:00
|
|
|
print("Invalid Mode, defaulting to OFF")
|
|
|
|
mode = 0
|
2022-05-22 21:29:09 +02:00
|
|
|
submode = int(parameters["Submode"])
|
2022-05-17 22:11:31 +02:00
|
|
|
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),
|
|
|
|
)
|
|
|
|
|
2022-05-23 00:20:06 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.WAIT, 20))
|
|
|
|
|
|
|
|
command_mode(
|
|
|
|
object_id=get_object_from_op_code(op_code),
|
|
|
|
mode=0,
|
|
|
|
submode=0,
|
|
|
|
tc_queue=tc_queue,
|
|
|
|
info=op_code + " to 0,0",
|
|
|
|
)
|
|
|
|
|
2022-05-22 21:29:09 +02:00
|
|
|
|
2022-05-17 22:11:31 +02:00
|
|
|
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
|