Update TMTC commander #39
@ -1,4 +1,5 @@
|
|||||||
import enum
|
import enum
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from tmtccmd.config import QueueCommands
|
from tmtccmd.config import QueueCommands
|
||||||
from tmtccmd.tc.definitions import TcQueueT
|
from tmtccmd.tc.definitions import TcQueueT
|
||||||
@ -13,6 +14,7 @@ from config.object_ids import PL_PCDU_ID
|
|||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
class OpCodes:
|
class OpCodes:
|
||||||
SWITCH_ADC_ON = ["0", "switch-adc-on"]
|
SWITCH_ADC_ON = ["0", "switch-adc-on"]
|
||||||
SWITCH_ALL_ON = ["1", "switch-all-on"]
|
SWITCH_ALL_ON = ["1", "switch-all-on"]
|
||||||
@ -49,18 +51,9 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
|
|||||||
tc_queue.appendleft(mode_cmd.pack_command_tuple())
|
tc_queue.appendleft(mode_cmd.pack_command_tuple())
|
||||||
if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT:
|
if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT:
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "Updating DRO to X8 wait time"))
|
tc_queue.appendleft((QueueCommands.PRINT, "Updating DRO to X8 wait time"))
|
||||||
while True:
|
wait_time = request_wait_time()
|
||||||
wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel")
|
if wait_time is None:
|
||||||
if wait_time.lower() == "x":
|
|
||||||
return
|
return
|
||||||
if not wait_time.isnumeric():
|
|
||||||
LOGGER.warning("Invalid input")
|
|
||||||
continue
|
|
||||||
wait_time = float(wait_time)
|
|
||||||
if wait_time <= 0:
|
|
||||||
LOGGER.warning("Invalid input")
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
param_data = pack_scalar_double_param_app_data(
|
param_data = pack_scalar_double_param_app_data(
|
||||||
object_id=PL_PCDU_ID,
|
object_id=PL_PCDU_ID,
|
||||||
domain_id=0,
|
domain_id=0,
|
||||||
@ -69,3 +62,18 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
|
|||||||
)
|
)
|
||||||
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data)
|
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data)
|
||||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||||
|
|
||||||
|
|
||||||
|
def request_wait_time() -> Optional[float]:
|
||||||
|
while True:
|
||||||
|
wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel")
|
||||||
|
if wait_time.lower() == "x":
|
||||||
|
return None
|
||||||
|
if not wait_time.isnumeric():
|
||||||
|
LOGGER.warning("Invalid input")
|
||||||
|
continue
|
||||||
|
wait_time = float(wait_time)
|
||||||
|
if wait_time <= 0:
|
||||||
|
LOGGER.warning("Invalid input")
|
||||||
|
else:
|
||||||
|
return wait_time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user