This commit is contained in:
Robin Müller 2022-05-23 18:33:35 +02:00
parent 623e1cc37e
commit c9f5a5652e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 42 additions and 32 deletions

View File

@ -1,5 +1,11 @@
from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QGroupBox, QGridLayout, QLineEdit
QDialog,
QDialogButtonBox,
QVBoxLayout,
QLabel,
QGroupBox,
QGridLayout,
QLineEdit,
)
from PyQt5 import QtCore
@ -22,6 +28,7 @@ class Parameter:
self.widget.setPlaceholderText(self.defaultValue)
self.widget.setText("")
class ParameterDialog(QDialog):
def __init__(self):
super().__init__()
@ -59,7 +66,6 @@ class ParameterDialog(QDialog):
self.parameters[name] = parameter
def _reset(self):
for value in self.parameters.values():
value.reset()
@ -80,14 +86,13 @@ class ParameterDialog(QDialog):
super().reject()
"""Prompt the user to specify additional Parameters
:param parameterList: array of dictionaries with name and defaultValue attributes
:return: dict with all names as key and user supplied input as value string
"""
def prompt_parameters(parameterList):
gui = get_global(CoreGlobalIds.GUI)
mode = get_global(CoreGlobalIds.MODE)
@ -98,6 +103,7 @@ def prompt_parameters(parameterList):
else:
return _cli_prompt(parameterList)
def _gui_prompt(parameterList):
dialog = ParameterDialog()
for parameter in parameterList:
@ -105,10 +111,13 @@ def _gui_prompt(parameterList):
dialog.exec_()
return dialog.getParameters()
def _cli_prompt(parameterList):
result = {}
for parameter in parameterList:
userInput = input("Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"]))
userInput = input(
"Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])
)
if userInput == "":
userInput = parameter["defaultValue"]
result[parameter["name"]] = userInput

View File

@ -18,8 +18,12 @@ class Info:
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
"name": "Submode", "defaultValue": "0"}])
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")

View File

@ -1,6 +1,7 @@
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import *
"""
from config.object_ids import (
BPX_HANDLER_ID,
@ -66,8 +67,6 @@ PROC_INFO_DICT = {
KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0],
KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0],
KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0],
}
@ -159,7 +158,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
# MGMs
# MGMs
sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -168,7 +167,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# Gyros
# Gyros
sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -181,7 +180,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# GNSS0
# GNSS0
sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -191,7 +190,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-b")
# MGMs
# MGMs
sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -200,7 +199,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# Gyros
# Gyros
sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -213,7 +212,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
#GNSS1
# GNSS1
sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -223,7 +222,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
# MGMs
# MGMs
sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -240,7 +239,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# Gyros
# Gyros
sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -265,7 +264,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# GNSS0+1
# GNSS0+1
sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -293,15 +292,13 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
# mgt 1: imtq und hk
# mgt 2.: imtq + dual side + dipole
# mgt 1: imtq und hk
# mgt 2.: imtq + dual side + dipole
if op_code in OpCodes.MGT_FT_DP:
key = KAI.MGT_FT[0]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -315,7 +312,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")

View File

@ -2,10 +2,11 @@
"""TMTC commander for EIVE"""
from tmtcc import tmtcc_post_args, tmtcc_pre_args
from tmtccmd.config.args import (
create_default_args_parser,
add_gui_tmtccmd_args,
parse_gui_input_arguments,
)
create_default_args_parser,
add_gui_tmtccmd_args,
parse_gui_input_arguments,
)
def main():
hook_obj = tmtcc_pre_args()