finsihed first param cmd definition

This commit is contained in:
Robin Mueller 2022-03-01 17:31:36 +01:00
parent fd01098345
commit ec27380f16
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -3,10 +3,15 @@ import enum
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices
from tmtccmd.tc.service_20_parameter import pack_boolean_parameter_command
from tmtccmd.tc.service_20_parameter import (
pack_scalar_double_param_app_data,
pack_fsfw_load_param_cmd
)
from tmtccmd.utility.logger import get_console_logger
from spacepackets.ecss.tc import PusTelecommand
from config.object_ids import PL_PCDU_ID
LOGGER = get_console_logger()
class OpCodes:
SWITCH_ADC_ON = ["0", "switch-adc-on"]
@ -19,6 +24,10 @@ class Submodes(enum.IntEnum):
ALL_ON = 1
class ParamIds(enum.IntEnum):
DRO_TO_X8_WAIT_TIME = 17
def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.SWITCH_ADC_ON:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU ADC module on"))
@ -40,4 +49,23 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft(mode_cmd.pack_command_tuple())
if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT:
tc_queue.appendleft((QueueCommands.PRINT, "Updating DRO to X8 wait time"))
param_data =
while True:
wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel")
if wait_time.lower() == "x":
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(
object_id=PL_PCDU_ID,
domain_id=0,
unique_id=ParamIds.DRO_TO_X8_WAIT_TIME,
parameter=wait_time
)
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data)
tc_queue.appendleft(cmd.pack_command_tuple())