using new prompt in controllers
This commit is contained in:
parent
2cb801dc97
commit
77f77489c2
@ -1,11 +1,11 @@
|
|||||||
from ast import Pass
|
|
||||||
from tmtccmd.tc.definitions import TcQueueT
|
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
|
||||||
|
|
||||||
|
from pus_tc.prompt_parameters import prompt_parameters
|
||||||
|
|
||||||
|
|
||||||
class OpCodes:
|
class OpCodes:
|
||||||
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "thermal_controller"]
|
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "thermal_controller"]
|
||||||
@ -18,12 +18,11 @@ class Info:
|
|||||||
|
|
||||||
|
|
||||||
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
||||||
mode = int(input("Specify mode: (OFF = 0; ON = 1; NORMAL = 2) [2] ") or "2")
|
|
||||||
print(mode)
|
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
|
||||||
if mode < 0 or mode > 2:
|
"name": "Submode", "defaultValue": "0"}])
|
||||||
print("Invalid Mode, defaulting to OFF")
|
mode = int(parameters["Mode"])
|
||||||
mode = 0
|
submode = int(parameters["Submode"])
|
||||||
submode = int(input("Specify submode [0]: ") or "0")
|
|
||||||
command_mode(
|
command_mode(
|
||||||
object_id=get_object_from_op_code(op_code),
|
object_id=get_object_from_op_code(op_code),
|
||||||
mode=mode,
|
mode=mode,
|
||||||
@ -32,6 +31,7 @@ def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
|
|||||||
info=op_code + " to " + str(mode) + "," + str(submode),
|
info=op_code + " to " + str(mode) + "," + str(submode),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_object_from_op_code(op_code: str):
|
def get_object_from_op_code(op_code: str):
|
||||||
try:
|
try:
|
||||||
return bytes.fromhex(op_code)
|
return bytes.fromhex(op_code)
|
||||||
|
Loading…
Reference in New Issue
Block a user