Major dependency update #102

Merged
meierj merged 10 commits from mueller/major-dependency-update into main 2022-07-08 16:30:41 +02:00
113 changed files with 2852 additions and 3952 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ log
/gps_log.txt /gps_log.txt
/config/*.json /config/*.json
tmtc_conf.json tmtc_conf.json
/seqcnt.txt

4
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "tmtccmd"] [submodule "tmtccmd"]
path = tmtccmd path = deps/tmtccmd
url = https://github.com/robamu-org/tmtccmd.git url = https://github.com/robamu-org/tmtccmd.git
[submodule "spacepackets"] [submodule "spacepackets"]
path = spacepackets path = deps/spacepackets
url = https://github.com/robamu-org/py-spacepackets.git url = https://github.com/robamu-org/py-spacepackets.git

View File

@ -6,13 +6,13 @@
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="C:\Users\jakob\AppData\Local\Programs\Python\Python39\python.exe" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s acu -l -t 6" /> <option name="PARAMETERS" value="-s acu -l -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s bpx -t 6 --hk" /> <option name="PARAMETERS" value="-s bpx -t 6 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s bpx -o hk -t 6 --hk" /> <option name="PARAMETERS" value="-s bpx -o hk -t 6 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s bpx -o rst_boot_cnt -t 6" /> <option name="PARAMETERS" value="-s bpx -o rst_boot_cnt -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s gps0 -l" /> <option name="PARAMETERS" value="-s gps0 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s gps1 -l" /> <option name="PARAMETERS" value="-s gps1 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s heater -o 0 -l" /> <option name="PARAMETERS" value="-s heater -o 0 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 8 -l -t 4 --hk" /> <option name="PARAMETERS" value="-c udp -s imtq -o 8 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s imtq -o 2 -l -t 4 --hk" /> <option name="PARAMETERS" value="-s imtq -o 2 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 4 -l -t 4 --hk" /> <option name="PARAMETERS" value="-s imtq -o 4 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 6 -l -t 4 --hk" /> <option name="PARAMETERS" value="-s imtq -o 6 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 1 -l -t 4 --hk" /> <option name="PARAMETERS" value="-s imtq -o 1 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 3 -l -t 4 --hk" /> <option name="PARAMETERS" value="-s imtq -o 3 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 5 -l -t 4 --hk" /> <option name="PARAMETERS" value="-c udp -s imtq -o 5 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-m seqcmd -c udp -s imtq -l -t 4" /> <option name="PARAMETERS" value="-m seqcmd -c udp -s imtq -l -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s p60dock -l" /> <option name="PARAMETERS" value="-s p60dock -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s pdu1 -t 6" /> <option name="PARAMETERS" value="-s pdu1 -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s pdu2 -l -t 6" /> <option name="PARAMETERS" value="-s pdu2 -l -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s ploc_mpsoc -t 6" /> <option name="PARAMETERS" value="-s ploc_mpsoc -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s ploc_supv -t 6" /> <option name="PARAMETERS" value="-s ploc_supv -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 17 -o 0 -t 3" /> <option name="PARAMETERS" value="-s 17 -o 0 -t 3" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -1,17 +1,16 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Unittests in tmtccmd" type="tests" factoryName="Unittests"> <configuration default="false" name="Python tests in tmtccmd" type="tests" factoryName="Autodetect">
<module name="tmtc" /> <module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/tmtccmd/src/tests" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/deps/tmtccmd/tests" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" /> <option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;$PROJECT_DIR$/tmtccmd/src/tests&quot;" /> <option name="_new_target" value="&quot;$PROJECT_DIR$/deps/tmtccmd/tests&quot;" />
<option name="_new_targetType" value="&quot;PATH&quot;" /> <option name="_new_targetType" value="&quot;PATH&quot;" />
<method v="2" /> <method v="2" />
</configuration> </configuration>

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s reaction_wheel_1 -l -t 8 --hk" /> <option name="PARAMETERS" value="-s reaction_wheel_1 -l -t 8 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s reaction_wheel_2 -l -t 6 --hk" /> <option name="PARAMETERS" value="-s reaction_wheel_2 -l -t 6 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s reaction_wheel_3 -l -t 6 --hk" /> <option name="PARAMETERS" value="-s reaction_wheel_3 -l -t 6 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s reaction_wheel_4 -l -t 12 --hk" /> <option name="PARAMETERS" value="-s reaction_wheel_4 -l -t 12 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s core -o reboot_0_1 -t 4" /> <option name="PARAMETERS" value="-s core -o reboot_0_1 -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s core -o reboot_1_0 -t 4" /> <option name="PARAMETERS" value="-s core -o reboot_1_0 -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s core -o reboot_1_1 -t 4" /> <option name="PARAMETERS" value="-s core -o reboot_1_1 -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s core -o reboot -t 4" /> <option name="PARAMETERS" value="-s core -o reboot -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s core -o reboot_self -t 4" /> <option name="PARAMETERS" value="-s core -o reboot_self -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s sa_depl -o 0 -l" /> <option name="PARAMETERS" value="-s sa_depl -o 0 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 17" /> <option name="PARAMETERS" value="-s 17" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s star_tracker -l -t 6" /> <option name="PARAMETERS" value="-s star_tracker -l -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s syrlinks -t 6" /> <option name="PARAMETERS" value="-s syrlinks -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-m 3 -c 2 -s SYRLINKS -l --hk" /> <option name="PARAMETERS" value="-m 3 -c 2 -s SYRLINKS -l --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-m 3 -c 2 -s TMP1075_1 -l" /> <option name="PARAMETERS" value="-m 3 -c 2 -s TMP1075_1 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-m 1 -c 2 -s TMP1075_2 -l" /> <option name="PARAMETERS" value="-m 1 -c 2 -s TMP1075_2 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s proc" /> <option name="PARAMETERS" value="-s proc" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -1,18 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Unittests in spacepackets" type="tests" factoryName="Unittests">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/spacepackets/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;$PROJECT_DIR$/spacepackets/tests&quot;" />
<option name="_new_targetType" value="&quot;PATH&quot;" />
<method v="2" />
</configuration>
</component>

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-c udp -s imtq -o 7 -l -t 4 --hk" /> <option name="PARAMETERS" value="-c udp -s imtq -o 7 -l -t 4 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s ccsds_handler -l -t 8 --hk" /> <option name="PARAMETERS" value="-s ccsds_handler -l -t 8 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_cli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s pdec_handler -l -t 8 --hk" /> <option name="PARAMETERS" value="-s pdec_handler -l -t 8 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 17 -l" /> <option name="PARAMETERS" value="-s 17 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 2 -t 4" /> <option name="PARAMETERS" value="-s 2 -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 200 -o 0 -t 4" /> <option name="PARAMETERS" value="-s 200 -o 0 -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 3 --hk" /> <option name="PARAMETERS" value="-s 3 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s 8 -t 8" /> <option name="PARAMETERS" value="-s 8 -t 8" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-h" /> <option name="PARAMETERS" value="-h" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-m listener --hk" /> <option name="PARAMETERS" value="-m listener --hk" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcgui.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="-g" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -10,7 +10,12 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
# [v1.12.0] # [v1.13.0]
- Major Update for `tmtccmd` and `spacepackets` dependencies which improves user API significantly.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/102
# [v1.12.0] 05.07.2022
- Update GPS HK Parsing - Update GPS HK Parsing
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/86 PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/86

View File

@ -1,14 +0,0 @@
"""
@brief This file exposes hook functions to the user.
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
from spacepackets.ecss.tc import PusTelecommand
def command_preparation_hook() -> PusTelecommand:
"""
Can be used to pack user-defined commands by generating and returning a PusTelecommand
class instance
"""
return PusTelecommand(service=17, subservice=1, ssc=20)

View File

@ -5,7 +5,7 @@
""" """
import enum import enum
from tmtccmd.core.backend import TmTcHandler from tmtccmd import CcsdsTmtcBackend
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -15,5 +15,5 @@ class CustomModeList(enum.IntEnum):
pass pass
def custom_mode_operation(tmtc_backend: TmTcHandler, mode: int): def custom_mode_operation(_tmtc_backend: CcsdsTmtcBackend, _mode: int):
pass pass

View File

@ -1,30 +1,24 @@
from typing import Union from typing import Optional
from config.definitions import SPACE_PACKET_IDS from config.definitions import SPACE_PACKET_IDS
from tmtccmd.config.definitions import ( from tmtccmd import TmTcCfgHookBase, CcsdsTmtcBackend
ServiceOpCodeDictT, from tmtccmd.com_if import ComInterface
) from tmtccmd.config import TmTcDefWrapper
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.utility.retval import RetvalDictT from tmtccmd.utility.retval import RetvalDictT
from tmtccmd.utility.obj_id import ObjectIdDictT from tmtccmd.utility.obj_id import ObjectIdDictT
from tmtccmd.com_if.com_interface_base import CommunicationInterface
from tmtccmd.core.backend import TmTcHandler
from tmtccmd.config.hook import TmTcHookBase
from config.retvals import get_retval_dict from config.retvals import get_retval_dict
from pus_tc.cmd_definitions import get_eive_service_op_code_dict from pus_tc.cmd_definitions import get_eive_service_op_code_dict
class EiveHookObject(TmTcHookBase): class EiveHookObject(TmTcCfgHookBase):
def __init__(self, json_cfg_path: str): def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path) super().__init__(json_cfg_path=json_cfg_path)
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT: def get_tmtc_definitions(self) -> TmTcDefWrapper:
return get_eive_service_op_code_dict() return get_eive_service_op_code_dict()
def assign_communication_interface( def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
self, com_if_key: str
) -> Union[CommunicationInterface, None]:
from tmtccmd.config.com_if import create_communication_interface_default from tmtccmd.config.com_if import create_communication_interface_default
return create_communication_interface_default( return create_communication_interface_default(
@ -33,17 +27,10 @@ class EiveHookObject(TmTcHookBase):
space_packet_ids=SPACE_PACKET_IDS, space_packet_ids=SPACE_PACKET_IDS,
) )
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int):
from config.custom_mode_op import custom_mode_operation from config.custom_mode_op import custom_mode_operation
custom_mode_operation(mode=mode, tmtc_backend=tmtc_backend) custom_mode_operation(tmtc_backend, mode)
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
from pus_tc.tc_packer_hook import pack_service_queue_user
pack_service_queue_user(
service=service, op_code=op_code, service_queue=service_queue
)
def get_object_ids(self) -> ObjectIdDictT: def get_object_ids(self) -> ObjectIdDictT:
from config.object_ids import get_object_ids from config.object_ids import get_object_ids

1
deps/spacepackets vendored Submodule

@ -0,0 +1 @@
Subproject commit 5317f4c384321b5b5d8832f51c530fa91d3b2ae5

1
deps/tmtccmd vendored Submodule

@ -0,0 +1 @@
Subproject commit a0afee42dd743888a3cb38952f45c0678a0fbcf3

View File

@ -8,10 +8,11 @@
""" """
import enum import enum
import struct import struct
from typing import Union
from spacepackets.ecss import PusTelecommand
from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.definitions import PusTelecommand from tmtccmd.utility import ObjectIdU32
from tmtccmd.utility import ObjectId
class GomspaceDeviceActionIds(enum.IntEnum): class GomspaceDeviceActionIds(enum.IntEnum):
@ -74,7 +75,10 @@ class Channel:
def pack_get_param_command( def pack_get_param_command(
object_id: bytes, table_id: int, memory_address: bytearray, parameter_size: int object_id: bytes,
table_id: int,
memory_address: Union[int, bytes],
parameter_size: int,
) -> PusTelecommand: ) -> PusTelecommand:
"""Function to generate a command to retrieve parameters like the temperature from a gomspace device. """Function to generate a command to retrieve parameters like the temperature from a gomspace device.
@param object_id: The object id of the gomspace device handler. @param object_id: The object id of the gomspace device handler.
@ -83,9 +87,12 @@ def pack_get_param_command(
@param parameter_size: Size of the value to read. E.g. temperature is uint16_t and thus parameter_size is 2 @param parameter_size: Size of the value to read. E.g. temperature is uint16_t and thus parameter_size is 2
@return: The command as bytearray. @return: The command as bytearray.
""" """
app_data = struct.pack('!B', table_id) app_data = struct.pack("!B", table_id)
app_data += struct.pack('!H', memory_address) if isinstance(memory_address, int):
app_data += struct.pack('!B', parameter_size) app_data += struct.pack("!H", memory_address)
else:
app_data += memory_address
app_data += struct.pack("!B", parameter_size)
return generate_action_command( return generate_action_command(
object_id=object_id, object_id=object_id,
action_id=GomspaceDeviceActionIds.PARAM_GET, action_id=GomspaceDeviceActionIds.PARAM_GET,
@ -95,7 +102,7 @@ def pack_get_param_command(
def pack_set_param_command( def pack_set_param_command(
object_id: bytes, object_id: bytes,
memory_address: bytearray, memory_address: bytes,
parameter_size: int, parameter_size: int,
parameter: int, parameter: int,
ssc: int = 0, ssc: int = 0,
@ -116,7 +123,7 @@ def pack_set_param_command(
if parameter_size == 1: if parameter_size == 1:
app_data.append(parameter) app_data.append(parameter)
elif parameter_size == 2: elif parameter_size == 2:
app_data += struct.pack('!H', parameter) app_data += struct.pack("!H", parameter)
elif parameter_size == 4: elif parameter_size == 4:
byte_one = 0xFF000000 & parameter >> 24 byte_one = 0xFF000000 & parameter >> 24
byte_two = 0xFF0000 & parameter >> 16 byte_two = 0xFF0000 & parameter >> 16
@ -131,7 +138,7 @@ def pack_set_param_command(
) )
def pack_ping_command(object_id: ObjectId, data: bytearray) -> PusTelecommand: def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand:
""" " Function to generate the command to ping a gomspace device """ " Function to generate the command to ping a gomspace device
@param object_id Object Id of the gomspace device handler. @param object_id Object Id of the gomspace device handler.
@param data Bytearray containing the bytes to send to the gomspace device. For now the on board software @param data Bytearray containing the bytes to send to the gomspace device. For now the on board software
@ -146,7 +153,7 @@ def pack_ping_command(object_id: ObjectId, data: bytearray) -> PusTelecommand:
) )
def pack_gnd_wdt_reset_command(object_id: ObjectId) -> PusTelecommand: def pack_gnd_wdt_reset_command(object_id: ObjectIdU32) -> PusTelecommand:
""" " Function to generate the command to reset the watchdog of a gomspace device. """ " Function to generate the command to reset the watchdog of a gomspace device.
@param object_id Object Id of the gomspace device handler. @param object_id Object Id of the gomspace device handler.
""" """
@ -155,7 +162,7 @@ def pack_gnd_wdt_reset_command(object_id: ObjectId) -> PusTelecommand:
) )
def pack_reboot_command(object_id: ObjectId) -> PusTelecommand: def pack_reboot_command(object_id: ObjectIdU32) -> PusTelecommand:
"""Function to generate the command which triggers a reboot of a gomspace device """Function to generate the command which triggers a reboot of a gomspace device
@param object_id The object id of the gomspace device handler. @param object_id The object id of the gomspace device handler.
""" """
@ -164,7 +171,7 @@ def pack_reboot_command(object_id: ObjectId) -> PusTelecommand:
) )
def pack_request_full_hk_table_command(object_id: ObjectId) -> PusTelecommand: def pack_request_full_hk_table_command(object_id: ObjectIdU32) -> PusTelecommand:
"""Function to generate the command to request the full housekeeping table from a gomspace """Function to generate the command to request the full housekeeping table from a gomspace
device. device.
@param object_id The object id of the gomspace device handler. @param object_id The object id of the gomspace device handler.

View File

@ -1,12 +1,4 @@
from pus_tc.system.proc import add_proc_cmds from pus_tc.system.proc import add_proc_cmds
from tmtccmd.config import (
add_op_code_entry,
add_service_op_code_entry,
generate_op_code_options,
ServiceOpCodeDictT,
OpCodeDictKeys,
)
from tmtccmd.config.globals import get_default_service_op_code_dict
from pus_tc.devs.gps import add_gps_cmds from pus_tc.devs.gps import add_gps_cmds
from pus_tc.devs.pcdu import add_pcdu_cmds from pus_tc.devs.pcdu import add_pcdu_cmds
@ -19,595 +11,364 @@ from pus_tc.devs.reaction_wheels import add_rw_cmds
from pus_tc.devs.bpx_batt import BpxOpCodes from pus_tc.devs.bpx_batt import BpxOpCodes
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.config.globals import get_default_tmtc_defs
def get_eive_service_op_code_dict() -> ServiceOpCodeDictT: def get_eive_service_op_code_dict() -> TmTcDefWrapper:
service_op_code_dict = get_default_service_op_code_dict() def_wrapper = get_default_tmtc_defs()
add_bpx_cmd_definitions(cmd_dict=service_op_code_dict) add_bpx_cmd_definitions(defs=def_wrapper)
add_core_controller_definitions(cmd_dict=service_op_code_dict) add_core_controller_definitions(defs=def_wrapper)
add_pl_pcdu_cmds(cmd_dict=service_op_code_dict) add_pl_pcdu_cmds(defs=def_wrapper)
add_pcdu_cmds(cmd_dict=service_op_code_dict) add_pcdu_cmds(defs=def_wrapper)
specify_rtd_cmds(cmd_dict=service_op_code_dict) specify_rtd_cmds(defs=def_wrapper)
add_imtq_cmds(cmd_dict=service_op_code_dict) add_imtq_cmds(defs=def_wrapper)
add_rad_sens_cmds(cmd_dict=service_op_code_dict) add_rad_sens_cmds(defs=def_wrapper)
add_rw_cmds(cmd_dict=service_op_code_dict) add_rw_cmds(defs=def_wrapper)
add_ploc_mpsoc_cmds(cmd_dict=service_op_code_dict) add_ploc_mpsoc_cmds(defs=def_wrapper)
add_ploc_supv_cmds(cmd_dict=service_op_code_dict) add_ploc_supv_cmds(defs=def_wrapper)
add_system_cmds(cmd_dict=service_op_code_dict) add_system_cmds(defs=def_wrapper)
add_time_cmds(cmd_dict=service_op_code_dict) add_time_cmds(defs=def_wrapper)
add_syrlinks_cmds(cmd_dict=service_op_code_dict) add_syrlinks_cmds(defs=def_wrapper)
add_gps_cmds(cmd_dict=service_op_code_dict) add_gps_cmds(defs=def_wrapper)
add_str_cmds(cmd_dict=service_op_code_dict) add_str_cmds(defs=def_wrapper)
add_ccsds_cmds(cmd_dict=service_op_code_dict) add_ccsds_cmds(defs=def_wrapper)
add_pdec_cmds(cmd_dict=service_op_code_dict) add_pdec_cmds(defs=def_wrapper)
add_heater_cmds(cmd_dict=service_op_code_dict) add_heater_cmds(defs=def_wrapper)
add_tmp_sens_cmds(cmd_dict=service_op_code_dict) add_tmp_sens_cmds(defs=def_wrapper)
add_proc_cmds(cmd_dict=service_op_code_dict) add_proc_cmds(defs=def_wrapper)
return service_op_code_dict return def_wrapper
def add_tmp_sens_cmds(cmd_dict: ServiceOpCodeDictT): def add_tmp_sens_cmds(defs: TmTcDefWrapper):
op_code_dict = { oce = OpCodeEntry()
"0": ("TMP1075 Tests", {OpCodeDictKeys.TIMEOUT: 2.2}), oce.add("0", "TMP1075 Tests")
} defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce)
service_tuple = ("TMP1075 1", op_code_dict) defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce)
cmd_dict[CustomServiceList.TMP1075_1.value] = service_tuple
service_tuple = ("TMP1075 2", op_code_dict)
cmd_dict[CustomServiceList.TMP1075_2.value] = service_tuple
def add_pdec_cmds(cmd_dict: ServiceOpCodeDictT): def add_pdec_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_pdec_handler = { oce = OpCodeEntry()
"0": ("PDEC Handler: Print CLCW", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "PDEC Handler: Print CLCW")
"1": ("PDEC Handler: Print PDEC monitor", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("1", "PDEC Handler: Print PDEC monitor")
} defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
service_pdec_handler_tuple = ("PDEC Handler", op_code_dict_srv_pdec_handler)
cmd_dict[CustomServiceList.PDEC_HANDLER.value] = service_pdec_handler_tuple
def add_ccsds_cmds(cmd_dict: ServiceOpCodeDictT): def add_ccsds_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_ccsds_handler = { oce = OpCodeEntry()
"0": ("CCSDS Handler: Set low rate", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "CCSDS Handler: Set low rate")
"1": ("CCSDS Handler: Set high rate", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("1", "CCSDS Handler: Set high rate")
"2": ("CCSDS Handler: Enable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("2", "CCSDS Handler: Enable transmitter")
"3": ("CCSDS Handler: Disable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("3", "CCSDS Handler: Disable transmitter")
"4": ("CCSDS Handler: Set arbitrary bitrate", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
"5": ( oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
"CCSDS Handler: Enable tx clock manipulator", oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("7", "CCSDS Handler: Update tx data on rising edge")
), oce.add("8", "CCSDS Handler: Update tx data on falling edge")
"6": ( defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)
"CCSDS Handler: Disable tx clock manipulator",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"7": (
"CCSDS Handler: Update tx data on rising edge",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"8": (
"CCSDS Handler: Update tx data on falling edge",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
}
service_ccsds_handler_tuple = ("CCSDS Handler", op_code_dict_srv_ccsds_handler)
cmd_dict[CustomServiceList.CCSDS_HANDLER.value] = service_ccsds_handler_tuple
def add_str_cmds(cmd_dict: ServiceOpCodeDictT): def add_str_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_star_tracker = { oce = OpCodeEntry()
"0": ( oce.add("0", "Star Tracker: Mode On, Submode Bootloader")
"Star Tracker: Mode On, Submode Bootloader", oce.add("1", "Star Tracker: Mode On, Submode Firmware")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("2", "Star Tracker: Mode Normal")
), oce.add("3", "Star Tracker: Mode Off")
"1": ("Star Tracker: Mode On, Submode Firmware", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("4", "Star Tracker: Mode Raw")
"2": ("Star Tracker: Mode Normal", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("5", "Star Tracker: Ping")
"3": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("6", "Star Tracker: Switch to bootloader program")
"4": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("7", "Star Tracker: Request temperature")
"5": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 5.0}), oce.add("8", "Star Tracker: Request version")
"6": ( oce.add("9", "Star Tracker: Request interface")
"Star Tracker: Switch to bootloader program", oce.add("10", "Star Tracker: Request power")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("11", "Star Tracker: Set subscription parameters")
), oce.add("12", "Star Tracker: Boot image (requires bootloader mode)")
"7": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("13", "Star Tracker: Request time")
"8": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("14", "Star Tracker: Request solution")
"9": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("15", "Star Tracker: Upload image")
"10": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("16", "Star Tracker: Download image")
"11": ( oce.add("17", "Star Tracker: Set limit parameters")
"Star Tracker: Set subscription parameters", oce.add("17", "Star Tracker: Set limit parameters")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("18", "Star Tracker: Set tracking parameters")
), oce.add("19", "Star Tracker: Set mounting parameters")
"12": ( oce.add("20", "Star Tracker: Set camera parameters")
"Star Tracker: Boot image (requires bootloader mode)", oce.add("22", "Star Tracker: Set centroiding parameters")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("23", "Star Tracker: Set LISA parameters")
), oce.add("24", "Star Tracker: Set matching parameters")
"13": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("25", "Star Tracker: Set validation parameters")
"14": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("26", "Star Tracker: Set algo parameters")
"15": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("27", "Star Tracker: Take image")
"16": ("Star Tracker: Download image", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("28", "Star Tracker: Stop str helper")
"17": ("Star Tracker: Set limit parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("30", "Star Tracker: Set name of download image")
"18": ("Star Tracker: Set tracking parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("31", "Star Tracker: Request histogram")
"19": ("Star Tracker: Set mounting parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("32", "Star Tracker: Request contrast")
"20": ("Star Tracker: Set camera parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("33", "Star Tracker: Set json filename")
"22": ( oce.add("35", "Star Tracker: Flash read")
"Star Tracker: Set centroiding parameters", oce.add("36", "Star Tracker: Set flash read filename")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("37", "Star Tracker: Get checksum")
), oce.add("49", "Star Tracker: Request camera parameter")
"23": ("Star Tracker: Set LISA parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("50", "Star Tracker: Request limits")
"24": ("Star Tracker: Set matching parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("51", "Star Tracker: Set image processor parameters")
"25": ( oce.add("52", "Star Tracker: (EGSE only) Load camera ground config")
"Star Tracker: Set validation parameters", oce.add("53", "Star Tracker: (EGSE only) Load camera flight config")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("54", "Star Tracker: Request log level parameters")
), oce.add("55", "Star Tracker: Request mounting parameters")
"26": ("Star Tracker: Set algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("56", "Star Tracker: Request image processor parameters")
"27": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("57", "Star Tracker: Request centroiding parameters")
"28": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("58", "Star Tracker: Request lisa parameters")
"30": ( oce.add("59", "Star Tracker: Request matching parameters")
"Star Tracker: Set name of download image", oce.add("60", "Star Tracker: Request tracking parameters")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("61", "Star Tracker: Request validation parameters")
), oce.add("62", "Star Tracker: Request algo parameters")
"31": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("63", "Star Tracker: Request subscription parameters")
"32": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("64", "Star Tracker: Request log subscription parameters")
"33": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("65", "Star Tracker: Request debug camera parameters")
"35": ("Star Tracker: Flash read", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("66", "Star Tracker: Set log level parameters")
"36": ("Star Tracker: Set flash read filename", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("67", "Star Tracker: Set log subscription parameters")
"37": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("68", "Star Tracker: Set debug camera parameters")
"49": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("69", "Star Tracker: Firmware update")
"50": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("70", "Star Tracker: Disable timestamp generation")
"51": ( oce.add("71", "Star Tracker: Enable timestamp generation")
"Star Tracker: Set image processor parameters", defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"52": (
"Star Tracker: (EGSE only) Load camera ground config ",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"53": (
"Star Tracker: (EGSE only) Load camera flight config",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"54": (
"Star Tracker: Request log level parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"55": (
"Star Tracker: Request mounting parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"56": (
"Star Tracker: Request image processor parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"57": (
"Star Tracker: Request centroiding parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"58": ("Star Tracker: Request lisa parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
"59": (
"Star Tracker: Request matching parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"60": (
"Star Tracker: Request tracking parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"61": (
"Star Tracker: Request validation parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"62": ("Star Tracker: Request algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
"63": (
"Star Tracker: Request subscription parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"64": (
"Star Tracker: Request log subscription parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"65": (
"Star Tracker: Request debug camera parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"66": ("Star Tracker: Set log level parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
"67": (
"Star Tracker: Set log subscription parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"68": (
"Star Tracker: Set debug camera parameters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"69": ("Star Tracker: Firmware update", {OpCodeDictKeys.TIMEOUT: 2.0}),
"70": (
"Star Tracker: Disable timestamp generation",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"71": (
"Star Tracker: Enable timestamp generation",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
}
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
cmd_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
def add_syrlinks_cmds(cmd_dict: ServiceOpCodeDictT): def add_syrlinks_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_syrlinks_handler = { oce = OpCodeEntry()
"0": ("Syrlinks Handler: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "Syrlinks Handler: Set mode off")
"1": ("Syrlinks Handler: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("1", "Syrlinks Handler: Set mode on")
"2": ("Syrlinks Handler: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("2", "Syrlinks Handler: Set mode normal")
"3": ("Syrlinks Handler: Set TX standby", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("3", "Syrlinks Handler: Set TX standby")
"4": ("Syrlinks Handler: Set TX modulation", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("4", "Syrlinks Handler: Set TX modulation")
"5": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("5", "Syrlinks Handler: Set TX carrier wave")
"6": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("6", "Syrlinks Handler: Read TX status")
"7": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("7", "Syrlinks Handler: Read TX waveform")
"8": ( oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
"Syrlinks Handler: Read TX AGC value high byte ", oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("12", "Syrlinks Handler: Write LCL config")
), oce.add("13", "Syrlinks Handler: Read RX status registers")
"9": ( oce.add("14", "Syrlinks Handler: Read LCL config register")
"Syrlinks Handler: Read TX AGC value low byte ", oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("16", "Syrlinks Handler: Set waveform BPSK")
), oce.add("17", "Syrlinks Handler: Set second config")
"12": ( oce.add("18", "Syrlinks Handler: Enable debug output")
"Syrlinks Handler: Write LCL config", oce.add("19", "Syrlinks Handler: Disable debug output")
{OpCodeDictKeys.TIMEOUT: 2.0}, defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce)
),
"13": (
"Syrlinks Handler: Read RX status registers", def add_bpx_cmd_definitions(defs: TmTcDefWrapper):
{OpCodeDictKeys.TIMEOUT: 2.0}, oce = OpCodeEntry()
), oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
"14": ( oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
"Syrlinks Handler: Read LCL config register", oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add(
), keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
"15": (
"Syrlinks Handler: Set waveform OQPSK",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"16": (
"Syrlinks Handler: Set waveform BPSK",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"17": (
"Syrlinks Handler: Set second config",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"18": (
"Syrlinks Handler: Enable debug output",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"19": (
"Syrlinks Handler: Disable debug output",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
}
service_syrlinks_handler_tuple = (
"Syrlinks Handler",
op_code_dict_srv_syrlinks_handler,
) )
cmd_dict[CustomServiceList.SYRLINKS.value] = service_syrlinks_handler_tuple oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
defs.add_service(
def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict, keys=BpxOpCodes.HK, info="Request BPX HK"
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count"
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=BpxOpCodes.REQUEST_CFG,
info="Request Configuration Struct (Step 1)",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=BpxOpCodes.REQUEST_CFG_HK,
info="Request Configuration Struct HK (Step 2)",
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=BpxOpCodes.REBOOT, info="Reboot Command"
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.BPX_BATTERY.value, name=CustomServiceList.BPX_BATTERY.value,
info="BPX Battery Handler", info="BPX Battery Handler",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def add_time_cmds(cmd_dict: ServiceOpCodeDictT): def add_time_cmds(defs: TmTcDefWrapper):
from pus_tc.system.time import OpCodes, Info from pus_tc.system.time import OpCodes, Info
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=OpCodes.SET_CURRENT_TIME, keys=OpCodes.SET_CURRENT_TIME,
info=Info.SET_CURRENT_TIME, info=Info.SET_CURRENT_TIME,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.TIME.value, name=CustomServiceList.TIME.value,
info="Time Service", info="Time Service",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT): def add_imtq_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_imtq = { oce = OpCodeEntry()
"0": ("Mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "Mode Off")
"1": ("Mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("1", "Mode On")
"2": ("Mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("2", "Mode Normal")
"3": ("IMTQ perform pos X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("3", "IMTQ perform pos X self test")
"4": ("IMTQ perform neg X self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("4", "IMTQ perform neg X self test")
"5": ("IMTQ perform pos Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("5", "IMTQ perform pos Y self test")
"6": ("IMTQ perform neg Y self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("6", "IMTQ perform neg Y self test")
"7": ("IMTQ perform pos Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("7", "IMTQ perform pos Z self test")
"8": ("IMTQ perform neg Z self test", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("8", "IMTQ perform neg Z self test")
"9": ("IMTQ command dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("9", "IMTQ command dipole")
"10": ("IMTQ get commanded dipole", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("10", "IMTQ get commanded dipole")
"11": ("IMTQ get engineering hk set", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("11", "IMTQ get engineering hk set")
"12": ( oce.add("12", "IMTQ get calibrated MTM measurement one shot")
"IMTQ get calibrated MTM measurement one shot", oce.add("13", "IMTQ get raw MTM measurement one shot")
{OpCodeDictKeys.TIMEOUT: 2.0}, defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
),
"13": ("IMTQ get raw MTM measurement one shot", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq)
cmd_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT): def add_ploc_mpsoc_cmds(defs: TmTcDefWrapper):
op_code_dict_srv_ploc_mpsoc = { oce = OpCodeEntry()
"0": ("Ploc MPSoC: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "Ploc MPSoC: Set mode off")
"1": ("Ploc MPSoC: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("1", "Ploc MPSoC: Set mode on")
"2": ("Ploc MPSoC: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("2", "Ploc MPSoC: Set mode normal")
"3": ("Ploc MPSoC: Memory write", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("3", "Ploc MPSoC: Memory write")
"4": ("Ploc MPSoC: Memory read", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("4", "Ploc MPSoC: Memory read")
"5": ("Ploc MPSoC: Flash write", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("5", "Ploc MPSoC: Flash write")
"6": ("Ploc MPSoC: Flash delete", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("6", "Ploc MPSoC: Flash delete")
"7": ("Ploc MPSoC: Replay start", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("7", "Ploc MPSoC: Replay start")
"8": ("Ploc MPSoC: Replay stop", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("8", "Ploc MPSoC: Replay stop")
"9": ("Ploc MPSoC: Downlink pwr on", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("9", "Ploc MPSoC: Downlink pwr on")
"10": ("Ploc MPSoC: Downlink pwr off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("10", "Ploc MPSoC: Downlink pwr off")
"11": ("Ploc MPSoC: Replay write sequence", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("11", "Ploc MPSoC: Replay write sequence")
"12": ("Ploc MPSoC: OBSW reset sequence count", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
"13": ("Ploc MPSoC: Read DEADBEEF address", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
"14": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("14", "Ploc MPSoC: Mode replay")
"15": ("Ploc MPSoC: Mode idle", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("15", "Ploc MPSoC: Mode idle")
"16": ("Ploc MPSoC: Tc cam command send", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("16", "Ploc MPSoC: Tc cam command send")
"17": ("Ploc MPSoC: Set UART TX tristate", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("17", "Ploc MPSoC: Set UART TX tristate")
"18": ("Ploc MPSoC: Relesase UART TX", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("18", "Ploc MPSoC: Relesase UART TX")
} defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
service_ploc_mpsoc_tuple = ("Ploc MPSoC", op_code_dict_srv_ploc_mpsoc)
cmd_dict[CustomServiceList.PLOC_MPSOC.value] = service_ploc_mpsoc_tuple
def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT): def add_ploc_supv_cmds(defs: TmTcDefWrapper):
op_code_dict_ploc_mem_dumper = { oce = OpCodeEntry()
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("0", "PLOC Memory Dumper: MRAM dump")
} defs.add_service(
service_ploc_memory_dumper_tuple = ( CustomServiceList.PLOC_MEMORY_DUMPER.value, "PLOC Memory Dumper", oce
"PLOC Memory Dumper",
op_code_dict_ploc_mem_dumper,
) )
oce = OpCodeEntry()
op_code_dict_srv_ploc_supv = { oce.add("1", "PLOC Supervisor: Set mode off")
"0": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("2", "PLOC Supervisor: Set mode normal")
"1": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("3", "PLOC Supervisor: Get HK Report")
"2": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("5", "PLOC Supervisor: Start MPSoC")
"3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("6", "PLOC Supervisor: Shutdown MPSoC")
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("7", "PLOC Supervisor: Select MPSoC boot image")
"6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("8", "PLOC Supervisor: Set max restart tries")
"7": ( oce.add("9", "PLOC Supervisor: Reset MPSoC")
"PLOC Supervisor: Select MPSoC boot image", oce.add("10", "PLOC Supervisor: Set time reference")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("11", "PLOC Supervisor: Set boot timeout")
), oce.add("12", "PLOC Supervisor: Disable Hk")
"8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("13", "PLOC Supervisor: Request boot status report")
"9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("17", "PLOC Supervisor: Enable latchup alert")
"10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("18", "PLOC Supervisor: Disable latchup alert")
"11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("20", "PLOC Supervisor: Set alert limit")
"12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("23", "PLOC Supervisor: Set ADC enabled channels")
"13": ( oce.add("24", "PLOC Supervisor: Set ADC window and stride")
"PLOC Supervisor: Request boot status report", oce.add("25", "PLOC Supervisor: Set ADC threshold")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("26", "PLOC Supervisor: Request latchup status report")
), oce.add("27", "PLOC Supervisor: Copy ADC data to MRAM")
"17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("30", "PLOC Supervisor: Run auto EM tests")
"18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("31", "PLOC Supervisor: MRAM Wipe")
"20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("35", "PLOC Supervisor: Set GPIO")
"23": ( oce.add("36", "PLOC Supervisor: Read GPIO")
"PLOC Supervisor: Set ADC enabled channels", oce.add("37", "PLOC Supervisor: Restart supervisor")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("38", "PLOC Supervisor: Factory reset clear all")
), oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
"24": ( oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
"PLOC Supervisor: Set ADC window and stride", oce.add("42", "PLOC Supervisor: Perform update")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("43", "PLOC Supervisor: Terminate supervisor process")
), oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
"25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("45", "PLOC Supervisor: Set shutdown timeout")
"26": ( oce.add("46", "PLOC Supervisor: Factory flash")
"PLOC Supervisor: Request latchup status report", oce.add("47", "PLOC Supervisor: Enable auto TM")
{OpCodeDictKeys.TIMEOUT: 2.0}, oce.add("48", "PLOC Supervisor: Disable auto TM")
), oce.add("51", "PLOC Supervisor: Logging request event buffers")
"27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("52", "PLOC Supervisor: Logging clear counters")
"30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("53", "PLOC Supervisor: Logging set topic")
"31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("54", "PLOC Supervisor: Logging request counters")
"35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("55", "PLOC Supervisor: Request ADC Report")
"36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("56", "PLOC Supervisor: Reset PL")
"37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}), oce.add("57", "PLOC Supervisor: Enable NVMs")
"38": ( oce.add("58", "PLOC Supervisor: Continue update")
"PLOC Supervisor: Factory reset clear all", defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"39": (
"PLOC Supervisor: Factory reset clear mirror entries",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"40": (
"PLOC Supervisor: Factory reset clear circular entries",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"42": ("PLOC Supervisor: Perform update", {OpCodeDictKeys.TIMEOUT: 2.0}),
"43": (
"PLOC Supervisor: Terminate supervisor process",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"44": ("PLOC Supervisor: Start MPSoC quiet", {OpCodeDictKeys.TIMEOUT: 2.0}),
"45": ("PLOC Supervisor: Set shutdown timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
"46": ("PLOC Supervisor: Factory flash", {OpCodeDictKeys.TIMEOUT: 2.0}),
"47": ("PLOC Supervisor: Enable auto TM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"48": ("PLOC Supervisor: Disable auto TM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"51": (
"PLOC Supervisor: Logging request event buffers",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"52": (
"PLOC Supervisor: Logging clear counters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"53": ("PLOC Supervisor: Logging set topic", {OpCodeDictKeys.TIMEOUT: 2.0}),
"54": (
"PLOC Supervisor: Logging request counters",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"55": ("PLOC Supervisor: Request ADC Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
"56": ("PLOC Supervisor: Reset PL", {OpCodeDictKeys.TIMEOUT: 2.0}),
"57": ("PLOC Supervisor: Enable NVMs", {OpCodeDictKeys.TIMEOUT: 2.0}),
"58": ("PLOC Supervisor: Continue update", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)
cmd_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
cmd_dict[
CustomServiceList.PLOC_MEMORY_DUMPER.value
] = service_ploc_memory_dumper_tuple
def add_system_cmds(cmd_dict: ServiceOpCodeDictT): def add_system_cmds(defs: TmTcDefWrapper):
from pus_tc.system.acs import AcsOpCodes, SusOpCodes from pus_tc.system.acs import AcsOpCodes, SusOpCodes
import pus_tc.system.tcs as tcs import pus_tc.system.tcs as tcs
import pus_tc.system.controllers as controllers import pus_tc.system.controllers as controllers
default_opts = generate_op_code_options( oce = OpCodeEntry()
enter_listener_mode=False, custom_timeout=8.0 oce.add(
)
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_A_SIDE, keys=AcsOpCodes.ACS_ASS_A_SIDE,
info="Switch to ACS board A side", info="Switch to ACS board A side",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_B_SIDE, keys=AcsOpCodes.ACS_ASS_B_SIDE,
info="Switch to ACS board B side", info="Switch to ACS board B side",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_DUAL_MODE, keys=AcsOpCodes.ACS_ASS_DUAL_MODE,
info="Switch to ACS board dual mode", info="Switch to ACS board dual mode",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_A_ON, keys=AcsOpCodes.ACS_ASS_A_ON,
info="Switch ACS board A side on", info="Switch ACS board A side on",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_B_ON, keys=AcsOpCodes.ACS_ASS_B_ON,
info="Switch ACS board B side on", info="Switch ACS board B side on",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_DUAL_ON, keys=AcsOpCodes.ACS_ASS_DUAL_ON,
info="Switch ACS board dual mode on", info="Switch ACS board dual mode on",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_OFF, keys=AcsOpCodes.ACS_ASS_OFF,
info="Switch off ACS board", info="Switch off ACS board",
options=default_opts,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict, name=CustomServiceList.ACS_ASS.value, info="ACS Assemblies", op_code_entry=oce
name=CustomServiceList.ACS_ASS.value,
info="ACS Assemblies",
op_code_entry=op_code_dict,
) )
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_NOM_SIDE, keys=SusOpCodes.SUS_ASS_NOM_SIDE,
info="Switch SUS board to nominal side", info="Switch SUS board to nominal side",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_RED_SIDE, keys=SusOpCodes.SUS_ASS_RED_SIDE,
info="Switch SUS board to redundant side", info="Switch SUS board to redundant side",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_OFF, keys=SusOpCodes.SUS_ASS_OFF,
info="Switch off SUS board", info="Switch off SUS board",
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_DUAL_MODE, keys=SusOpCodes.SUS_ASS_DUAL_MODE,
info="Switch SUS board to dual mode", info="Switch SUS board to dual mode",
options=default_opts,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.SUS_ASS.value, name=CustomServiceList.SUS_ASS.value,
info="SUS Assembly", info="SUS Assembly",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=tcs.OpCodes.TCS_BOARD_ASS_NORMAL, keys=tcs.OpCodes.TCS_BOARD_ASS_NORMAL,
info=tcs.Info.TCS_BOARD_ASS_NORMAL, info=tcs.Info.TCS_BOARD_ASS_NORMAL,
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=tcs.OpCodes.TCS_BOARD_ASS_OFF, keys=tcs.OpCodes.TCS_BOARD_ASS_OFF,
info=tcs.Info.TCS_BOARD_ASS_OFF, info=tcs.Info.TCS_BOARD_ASS_OFF,
options=default_opts,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.TCS_ASS.value, name=CustomServiceList.TCS_ASS.value,
info="TCS Board Assembly", info="TCS Board Assembly",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=controllers.OpCodes.THERMAL_CONTROLLER, keys=controllers.OpCodes.THERMAL_CONTROLLER,
info=controllers.Info.THERMAL_CONTROLLER, info=controllers.Info.THERMAL_CONTROLLER,
options=default_opts,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=controllers.OpCodes.CORE_CONTROLLER, keys=controllers.OpCodes.CORE_CONTROLLER,
info=controllers.Info.CORE_CONTROLLER, info=controllers.Info.CORE_CONTROLLER,
options=default_opts,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CONTROLLERS.value, name=CustomServiceList.CONTROLLERS.value,
info="Controllers", info="Controllers",
op_code_entry=op_code_dict, op_code_entry=oce,
) )

View File

@ -6,9 +6,9 @@
import struct import struct
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid, make_sid,
generate_one_diag_command, generate_one_diag_command,
@ -20,7 +20,7 @@ from gomspace.gomspace_common import Info as GsInfo
from config.object_ids import ACU_HANDLER_ID from config.object_ids import ACU_HANDLER_ID
from pus_tc.devs.p60dock import P60DockConfigTable from pus_tc.devs.p60dock import P60DockConfigTable
from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectIdU32
class ACUConfigTable: class ACUConfigTable:
@ -48,89 +48,76 @@ class Info:
TEST = "ACU Test" TEST = "ACU Test"
def add_acu_cmds(cmd_dict: ServiceOpCodeDictT): def add_acu_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.GET_PARAM, keys=GomspaceOpCodes.GET_PARAM,
info=GsInfo.GET_PARAMETER, info=GsInfo.GET_PARAMETER,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.SET_PARAM, keys=GomspaceOpCodes.SET_PARAM,
info=GsInfo.SET_PARAMETER, info=GsInfo.SET_PARAMETER,
) )
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.TEST, info=Info.TEST) oce.add(keys=OpCodes.TEST, info=Info.TEST)
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict,
name=CustomServiceList.ACU.value, name=CustomServiceList.ACU.value,
info="ACU Device", info="ACU Device",
op_code_entry=oce,
) )
def pack_acu_commands( def pack_acu_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: ObjectId, tc_queue: TcQueueT, op_code: str q.add_log_cmd("Handling ACU command")
) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Handling ACU command"))
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I: if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Print channel stats")) q.add_log_cmd("ACU: Print channel stats")
command = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=object_id.as_bytes, object_id=object_id.as_bytes,
action_id=gs.GomspaceDeviceActionIds.PRINT_SWITCH_V_I, action_id=gs.GomspaceDeviceActionIds.PRINT_SWITCH_V_I,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
tc_queue.appendleft( q.add_log_cmd(f"PDU1: {GsInfo.REQUEST_CORE_HK_ONCE}")
(QueueCommands.PRINT, f"PDU1: {GsInfo.REQUEST_CORE_HK_ONCE}")
)
hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_CORE) hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_CORE)
command = generate_one_diag_command(sid=hk_sid, ssc=0) q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
tc_queue.appendleft( q.add_log_cmd(f"PDU1: {GsInfo.REQUEST_AUX_HK_ONCE}")
(QueueCommands.PRINT, f"PDU1: {GsInfo.REQUEST_AUX_HK_ONCE}")
)
hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_AUX) hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_AUX)
command = generate_one_hk_command(sid=hk_sid, ssc=0) q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.GET_PARAM: if op_code in GomspaceOpCodes.GET_PARAM:
tc_queue.appendleft( q.add_log_cmd(f"PDU1: {GsInfo.GET_PARAMETER}")
(QueueCommands.PRINT, f"PDU1: {GsInfo.GET_PARAMETER}")
)
table_id = int(input("Specify table ID: ")) table_id = int(input("Specify table ID: "))
memory_address = int(input("Specify memory address: 0x"), 16) memory_address = int(input("Specify memory address: 0x"), 16)
parameter_size = int(input("Specify parameter size: ")) parameter_size = int(input("Specify parameter size: "))
command = gs.pack_get_param_command(object_id.as_bytes, table_id, memory_address, parameter_size) q.add_pus_tc(
tc_queue.appendleft(command.pack_command_tuple()) gs.pack_get_param_command(
if op_code in GomspaceOpCodes.SET_PARAM: object_id.as_bytes, table_id, memory_address, parameter_size
tc_queue.appendleft(
(QueueCommands.PRINT, f"PDU1: {GsInfo.SET_PARAMETER}")
) )
)
if op_code in GomspaceOpCodes.SET_PARAM:
q.add_log_cmd(f"PDU1: {GsInfo.SET_PARAMETER}")
memory_address = int(input("Specify memory address: 0x"), 16) memory_address = int(input("Specify memory address: 0x"), 16)
memory_address = struct.pack('!H', memory_address) memory_address = struct.pack("!H", memory_address)
parameter_size = int(input("Specify parameter size: ")) parameter_size = int(input("Specify parameter size: "))
parameter = int(input("Specify parameter: ")) parameter = int(input("Specify parameter: "))
command = gs.pack_set_param_command(object_id.as_bytes, memory_address, parameter_size, parameter) q.add_pus_tc(
tc_queue.appendleft(command.pack_command_tuple()) gs.pack_set_param_command(
pack_test_cmds(object_id=object_id, tc_queue=tc_queue) object_id.as_bytes, memory_address, parameter_size, parameter
)
return tc_queue )
pack_test_cmds(object_id=object_id, q=q)
class ACUTestProcedure: class ACUTestProcedure:
@ -156,91 +143,84 @@ class ACUTestProcedure:
off = False off = False
def pack_test_cmds(object_id: ObjectId, tc_queue: TcQueueT): def pack_test_cmds(object_id: ObjectIdU32, q: QueueHelper):
if ACUTestProcedure.all or ACUTestProcedure.reboot: if ACUTestProcedure.all or ACUTestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reboot")) q.add_log_cmd("ACU: Reboot")
command = gs.pack_reboot_command(object_id) q.add_pus_tc(gs.pack_reboot_command(object_id))
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt: if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt:
tc_queue.appendleft( q.add_log_cmd("ACU: Reading ground watchdog timer value")
(QueueCommands.PRINT, "ACU: Reading ground watchdog timer value") q.add_pus_tc(
) gs.pack_get_param_command(
command = gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.hk, gs.TableIds.hk,
ACUHkTable.wdt_gnd_left.parameter_address, ACUHkTable.wdt_gnd_left.parameter_address,
ACUHkTable.wdt_gnd_left.parameter_size, ACUHkTable.wdt_gnd_left.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.gnd_wdt_reset: if ACUTestProcedure.all or ACUTestProcedure.gnd_wdt_reset:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Testing ground watchdog reset")) q.add_log_cmd("ACU: Testing ground watchdog reset")
command = gs.pack_gnd_wdt_reset_command(object_id) q.add_pus_tc(gs.pack_gnd_wdt_reset_command(object_id))
# command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.ping: if ACUTestProcedure.all or ACUTestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Ping Test")) q.add_log_cmd("ACU: Ping Test")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = gs.pack_ping_command(object_id, ping_data) q.add_pus_tc(gs.pack_ping_command(object_id, ping_data))
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_temperature3: if ACUTestProcedure.all or ACUTestProcedure.read_temperature3:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3")) q.add_log_cmd("ACU: Reading temperature 3")
command = gs.pack_get_param_command( q.add_pus_tc(
gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.hk, gs.TableIds.hk,
ACUHkTable.temperature3.parameter_address, ACUHkTable.temperature3.parameter_address,
ACUHkTable.temperature3.parameter_size, ACUHkTable.temperature3.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vboost: if ACUTestProcedure.all or ACUTestProcedure.read_vboost:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value")) q.add_log_cmd("ACU: Reading vboost value")
command = gs.pack_get_param_command( q.add_pus_tc(
gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.config, gs.TableIds.config,
ACUConfigTable.vboost.parameter_address, ACUConfigTable.vboost.parameter_address,
ACUConfigTable.vboost.parameter_size, ACUConfigTable.vboost.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi: if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_hi")) q.add_log_cmd("ACU: Reading vbat_max_hi")
command = gs.pack_get_param_command( q.add_pus_tc(
gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.config, gs.TableIds.config,
ACUConfigTable.vbat_max_hi.parameter_address, ACUConfigTable.vbat_max_hi.parameter_address,
ACUConfigTable.vbat_max_hi.parameter_size, ACUConfigTable.vbat_max_hi.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo: if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_lo")) q.add_log_cmd("ACU: Reading vbat_max_lo")
command = gs.pack_get_param_command( q.add_pus_tc(
gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.config, gs.TableIds.config,
ACUConfigTable.vbat_max_lo.parameter_address, ACUConfigTable.vbat_max_lo.parameter_address,
ACUConfigTable.vbat_max_lo.parameter_size, ACUConfigTable.vbat_max_lo.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode: if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ov_mode")) q.add_log_cmd("ACU: Reading ov_mode")
command = gs.pack_get_param_command( q.add_pus_tc(
gs.pack_get_param_command(
object_id.as_bytes, object_id.as_bytes,
gs.TableIds.config, gs.TableIds.config,
ACUConfigTable.ov_mode.parameter_address, ACUConfigTable.ov_mode.parameter_address,
ACUConfigTable.ov_mode.parameter_size, ACUConfigTable.ov_mode.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.off: if ACUTestProcedure.all or ACUTestProcedure.off:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU")) q.add_log_cmd("P60 Dock: Turning off ACU")
command = gs.pack_set_param_command( q.add_pus_tc(
gs.pack_set_param_command(
ACU_HANDLER_ID, ACU_HANDLER_ID,
P60DockConfigTable.out_en_0.parameter_address, P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size, P60DockConfigTable.out_en_0.parameter_size,
gs.Channel.off, gs.Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )

View File

@ -1,5 +1,5 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from config.object_ids import BPX_HANDLER_ID from config.object_ids import BPX_HANDLER_ID
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
@ -24,33 +24,33 @@ class BpxOpCodes:
REBOOT = ["4", "reboot"] REBOOT = ["4", "reboot"]
def pack_bpx_commands(tc_queue: TcQueueT, op_code: str): def pack_bpx_commands(q: QueueHelper, op_code: str):
if op_code in BpxOpCodes.HK: if op_code in BpxOpCodes.HK:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting BPX battery HK set")) q.add_log_cmd("Requesting BPX battery HK set")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET) sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
cmd = generate_one_hk_command(sid=sid, ssc=0) q.add_pus_tc(generate_one_hk_command(sid=sid))
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in BpxOpCodes.RST_BOOT_CNT: if op_code in BpxOpCodes.RST_BOOT_CNT:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counters")) q.add_log_cmd("Resetting reboot counters")
cmd = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in BpxOpCodes.REQUEST_CFG: if op_code in BpxOpCodes.REQUEST_CFG:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting configuration struct")) q.add_log_cmd("Requesting configuration struct")
cmd = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in BpxOpCodes.REQUEST_CFG_HK: if op_code in BpxOpCodes.REQUEST_CFG_HK:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting configuration struct HK")) q.add_log_cmd("Requesting configuration struct HK")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET) sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET)
cmd = generate_one_hk_command(sid=sid, ssc=0) q.add_pus_tc(generate_one_hk_command(sid=sid))
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in BpxOpCodes.REBOOT: if op_code in BpxOpCodes.REBOOT:
tc_queue.appendleft((QueueCommands.PRINT, "Rebooting BPX battery")) q.add_log_cmd("Rebooting BPX battery")
cmd = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.REBOOT object_id=BPX_HANDLER_ID, action_id=BpxActionIds.REBOOT
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
pass

View File

@ -7,9 +7,9 @@
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.utility import ObjectIdU32
class CommandIds: class CommandIds:
@ -32,84 +32,47 @@ class CommandIds:
UPDATE_ON_FALLING_EDGE = 8 UPDATE_ON_FALLING_EDGE = 8
def pack_ccsds_handler_test( def pack_ccsds_handler_test(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str obyt = object_id.as_bytes
) -> TcQueueT: q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing CCSDS handler with object id: 0x" + object_id.hex(),
)
)
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Set low rate")) q.add_log_cmd("CCSDS Handler: Set low rate")
command = object_id + struct.pack("!I", CommandIds.SET_LOW_RATE) command = obyt + struct.pack("!I", CommandIds.SET_LOW_RATE)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Set high rate")) q.add_log_cmd("CCSDS Handler: Set high rate")
command = object_id + struct.pack("!I", CommandIds.SET_HIGH_RATE) command = obyt + struct.pack("!I", CommandIds.SET_HIGH_RATE)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Enables the transmitter")
(QueueCommands.PRINT, "CCSDS Handler: Enables the transmitter") command = obyt + struct.pack("!I", CommandIds.EN_TRANSMITTER)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.EN_TRANSMITTER)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Disables the transmitter")
(QueueCommands.PRINT, "CCSDS Handler: Disables the transmitter") command = obyt + struct.pack("!I", CommandIds.DIS_TRANSMITTER)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.DIS_TRANSMITTER)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
(QueueCommands.PRINT, "CCSDS Handler: Set arbitrary bitrate")
)
bitrate = int(input("Specify bit rate (bps): ")) bitrate = int(input("Specify bit rate (bps): "))
command = ( command = (
object_id obyt
+ struct.pack("!I", CommandIds.ARBITRARY_BITRATE) + struct.pack("!I", CommandIds.ARBITRARY_BITRATE)
+ struct.pack("!I", bitrate) + struct.pack("!I", bitrate)
) )
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Enable tx clock manipulator")
(QueueCommands.PRINT, "CCSDS Handler: Enable tx clock manipulator") command = obyt + struct.pack("!I", CommandIds.ENABLE_TX_CLK_MANIPULATOR)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.ENABLE_TX_CLK_MANIPULATOR)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Disable tx clock manipulator")
(QueueCommands.PRINT, "CCSDS Handler: Disable tx clock manipulator") command = obyt + struct.pack("!I", CommandIds.DISABLE_TX_CLK_MANIPULATOR)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.DISABLE_TX_CLK_MANIPULATOR)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Update tx data on rising edge of tx clock")
( command = obyt + struct.pack("!I", CommandIds.UPDATE_ON_RISING_EDGE)
QueueCommands.PRINT, q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
"CCSDS Handler: Update tx data on rising edge of tx clock",
)
)
command = object_id + struct.pack("!I", CommandIds.UPDATE_ON_RISING_EDGE)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft( q.add_log_cmd("CCSDS Handler: Update tx data on falling edge of tx clock")
( command = obyt + struct.pack("!I", CommandIds.UPDATE_ON_FALLING_EDGE)
QueueCommands.PRINT, q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
"CCSDS Handler: Update tx data on falling edge of tx clock",
)
)
command = object_id + struct.pack("!I", CommandIds.UPDATE_ON_FALLING_EDGE)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -1,12 +1,10 @@
import enum import enum
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_8_funccmd import generate_action_command
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -26,29 +24,23 @@ class SetIds:
HK = 0 HK = 0
def add_gps_cmds(cmd_dict: ServiceOpCodeDictT): def add_gps_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS)
op_code_dict=op_code_dict, keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
) defs.add_service(
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict,
name=CustomServiceList.GPS_CTRL.value, name=CustomServiceList.GPS_CTRL.value,
info="GPS/GNSS Controller", info="GPS/GNSS Controller",
op_code_entry=oce,
) )
def pack_gps_command(object_id: bytes, tc_queue: TcQueueT, op_code: str): def pack_gps_command(object_id: bytes, q: QueueHelper, op_code: str):
if op_code in OpCodes.RESET_GNSS: if op_code in OpCodes.RESET_GNSS:
# TODO: This needs to be re-implemented # TODO: This needs to be re-implemented
LOGGER.warning("Reset pin handling needs to be re-implemented") LOGGER.warning("Reset pin handling needs to be re-implemented")
if op_code in OpCodes.REQ_OS_HK: if op_code in OpCodes.REQ_OS_HK:
tc_queue.appendleft((QueueCommands.PRINT, f"GMSS: {Info.REQ_OS_HK}")) q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
cmd = generate_one_hk_command( q.add_pus_tc(
sid=make_sid(object_id=object_id, set_id=SetIds.HK), ssc=0 generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetIds.HK))
) )
tc_queue.appendleft(cmd.pack_command_tuple())

View File

@ -7,16 +7,15 @@ import enum
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import get_object_ids from config.object_ids import get_object_ids
from tmtccmd.utility.obj_id import ObjectId from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT from tmtccmd.tc import QueueHelper
from tmtccmd.utility.obj_id import ObjectIdU32
from tmtccmd.tc.pus_201_fsfw_health import ( from tmtccmd.tc.pus_201_fsfw_health import (
pack_set_health_cmd_data, pack_set_health_cmd_data,
FsfwHealth, FsfwHealth,
Subservices, Subservices,
) )
from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.config.globals import add_service_op_code_entry, add_op_code_entry
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
@ -54,37 +53,22 @@ class ActionIds(enum.IntEnum):
SWITCH_HEATER = 0 SWITCH_HEATER = 0
def add_heater_cmds(cmd_dict: ServiceOpCodeDictT): def add_heater_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(keys=OpCodes.HEATER_CMD, info=Info.HEATER_CMD)
op_code_dict=op_code_dict, keys=OpCodes.HEATER_CMD, info=Info.HEATER_CMD oce.add(keys=OpCodes.HEATER_HEALTHY_CMD, info=Info.HEATER_HEALTHY_CMD)
) oce.add(keys=OpCodes.HEATER_EXT_CTRL, info=Info.HEATER_EXT_CTRL)
add_op_code_entry( oce.add(keys=OpCodes.HEATER_FAULTY_CMD, info=Info.HEATER_FAULTY_CMD)
op_code_dict=op_code_dict, defs.add_service(
keys=OpCodes.HEATER_HEALTHY_CMD,
info=Info.HEATER_HEALTHY_CMD,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.HEATER_EXT_CTRL,
info=Info.HEATER_EXT_CTRL,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.HEATER_FAULTY_CMD,
info=Info.HEATER_FAULTY_CMD,
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.HEATER.value, name=CustomServiceList.HEATER.value,
info="Heater Device", info="Heater Device",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT): def pack_heater_cmds(object_id: bytearray, op_code: str, q: QueueHelper):
if op_code in OpCodes.HEATER_CMD: if op_code in OpCodes.HEATER_CMD:
tc_queue.appendleft((QueueCommands.PRINT, "Heater Switching")) q.add_log_cmd("Heater Switching")
heater_number = prompt_heater() heater_number = prompt_heater()
while True: while True:
action = input("Turn switch on or off? (0 - off, 1 - on): ") action = input("Turn switch on or off? (0 - off, 1 - on): ")
@ -101,14 +85,13 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT):
else: else:
act_str = "off" act_str = "off"
debug_string = f"Switching heater {heater_number} {act_str}" debug_string = f"Switching heater {heater_number} {act_str}"
tc_queue.appendleft((QueueCommands.PRINT, debug_string)) q.add_log_cmd(debug_string)
command = pack_switch_heater_command(object_id, heater_number, action) q.add_pus_tc(pack_switch_heater_command(object_id, heater_number, action))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodes.HEATER_EXT_CTRL: if op_code in OpCodes.HEATER_EXT_CTRL:
heater_number = prompt_heater() heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number) obj_id = heater_idx_to_obj(heater_number)
health_cmd( health_cmd(
tc_queue=tc_queue, q=q,
object_id=obj_id, object_id=obj_id,
health=FsfwHealth.EXTERNAL_CTRL, health=FsfwHealth.EXTERNAL_CTRL,
health_str="External Control", health_str="External Control",
@ -118,7 +101,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT):
heater_number = prompt_heater() heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number) obj_id = heater_idx_to_obj(heater_number)
health_cmd( health_cmd(
tc_queue=tc_queue, q=q,
object_id=obj_id, object_id=obj_id,
health=FsfwHealth.FAULTY, health=FsfwHealth.FAULTY,
health_str="Faulty", health_str="Faulty",
@ -128,7 +111,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT):
heater_number = prompt_heater() heater_number = prompt_heater()
obj_id = heater_idx_to_obj(heater_number) obj_id = heater_idx_to_obj(heater_number)
health_cmd( health_cmd(
tc_queue=tc_queue, q=q,
object_id=obj_id, object_id=obj_id,
health=FsfwHealth.HEALTHY, health=FsfwHealth.HEALTHY,
health_str="Healthy", health_str="Healthy",
@ -136,7 +119,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT):
) )
def heater_idx_to_obj(heater: int) -> ObjectId: def heater_idx_to_obj(heater: int) -> ObjectIdU32:
from config.object_ids import ( from config.object_ids import (
HEATER_0_OBC_BRD, HEATER_0_OBC_BRD,
HEATER_1_PLOC_PROC_BRD, HEATER_1_PLOC_PROC_BRD,
@ -161,7 +144,7 @@ def heater_idx_to_obj(heater: int) -> ObjectId:
obj_dict = get_object_ids() obj_dict = get_object_ids()
obj_id_obj = obj_dict.get(obj_id_array[heater]) obj_id_obj = obj_dict.get(obj_id_array[heater])
if obj_id_obj is None: if obj_id_obj is None:
return ObjectId.from_bytes(obj_id_array[heater]) return ObjectIdU32.from_bytes(obj_id_array[heater])
return obj_id_obj return obj_id_obj
@ -188,23 +171,19 @@ def prompt_heater() -> int:
def health_cmd( def health_cmd(
tc_queue: TcQueueT, q: QueueHelper,
heater_idx: int, heater_idx: int,
object_id: ObjectId, object_id: ObjectIdU32,
health: FsfwHealth, health: FsfwHealth,
health_str: str, health_str: str,
): ):
tc_queue.appendleft( q.add_log_cmd(f"Setting Heater {heater_idx} {object_id} to {health_str}")
(
QueueCommands.PRINT,
f"Setting Heater {heater_idx} {object_id} to {health_str}",
)
)
app_data = pack_set_health_cmd_data(object_id=object_id.as_bytes, health=health) app_data = pack_set_health_cmd_data(object_id=object_id.as_bytes, health=health)
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=201, subservice=Subservices.TC_SET_HEALTH, app_data=app_data service=201, subservice=Subservices.TC_SET_HEALTH, app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
def pack_switch_heater_command( def pack_switch_heater_command(

View File

@ -7,16 +7,15 @@
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid, make_sid,
generate_one_diag_command, generate_one_diag_command,
generate_one_hk_command, generate_one_hk_command,
) )
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from tmtccmd.utility import ObjectIdU32
class ImtqSetIds: class ImtqSetIds:
@ -40,233 +39,149 @@ class ImtqActionIds:
perform_negative_y_test = bytearray([0x0, 0x0, 0x0, 0x0A]) perform_negative_y_test = bytearray([0x0, 0x0, 0x0, 0x0A])
perform_positive_z_test = bytearray([0x0, 0x0, 0x0, 0x0B]) perform_positive_z_test = bytearray([0x0, 0x0, 0x0, 0x0B])
perform_negative_z_test = bytearray([0x0, 0x0, 0x0, 0x0C]) perform_negative_z_test = bytearray([0x0, 0x0, 0x0, 0x0C])
# Initiates the reading of the last performed self test. After sending this command the results can be downlinked # Initiates the reading of the last performed self test. After sending this command the results
# via the housekeeping service by using the appropriate set ids listed above. # can be downlinked via the housekeeping service by using the appropriate set ids listed above.
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D]) read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
def pack_imtq_test_into( def pack_imtq_test_into(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str q.add_log_cmd(
) -> TcQueueT: f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing ISIS IMTQ handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Set mode off")) q.add_log_cmd("IMTQ: Set mode off")
command = pack_mode_data(object_id, Modes.OFF, 0) command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Set mode on")) q.add_log_cmd("IMTQ: Set mode on")
command = pack_mode_data(object_id, Modes.ON, 0) command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Mode Normal")) q.add_log_cmd("IMTQ: Mode Normal")
command = pack_mode_data(object_id, Modes.NORMAL, 0) command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive x self test")) q.add_log_cmd("IMTQ: Perform positive x self test")
command = object_id + ImtqActionIds.perform_positive_x_test command = object_id.as_bytes + ImtqActionIds.perform_positive_x_test
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Initiate reading of positive x self test results")
( command = object_id.as_bytes + ImtqActionIds.read_self_test_results
QueueCommands.PRINT, q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
"IMTQ: Initiate reading of positive x self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Request dataset with positive x self test results")
( sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_X_TEST)
QueueCommands.PRINT, q.add_pus_tc(generate_one_hk_command(sid))
"IMTQ: Request dataset with positive x self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_X_TEST)
command = generate_one_hk_command(sid, 24)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative x self test")) q.add_log_cmd("IMTQ: Perform negative x self test")
command = object_id + ImtqActionIds.perform_negative_x_test command = object_id.as_bytes + ImtqActionIds.perform_negative_x_test
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("IMTQ: Initiate reading of negative x self test results")
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
( q.add_log_cmd("IMTQ: Request dataset with negative x self test results")
QueueCommands.PRINT, sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_X_TEST)
"IMTQ: Initiate reading of negative x self test results", q.add_pus_tc(generate_one_hk_command(sid))
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with negative x self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_X_TEST)
command = generate_one_hk_command(sid, 27)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive y self test")) q.add_log_cmd("IMTQ: Perform positive y self test")
command = object_id + ImtqActionIds.perform_positive_y_test command = object_id.as_bytes + ImtqActionIds.perform_positive_y_test
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("IMTQ: Initiate reading of positive y self test results")
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft( q.add_log_cmd("IMTQ: Request dataset with positive y self test results")
( sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_Y_TEST)
QueueCommands.PRINT, q.add_pus_tc(generate_one_hk_command(sid))
"IMTQ: Initiate reading of positive y self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with positive y self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
command = generate_one_hk_command(sid, 30)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative y self test")) q.add_log_cmd("IMTQ: Perform negative y self test")
command = object_id + ImtqActionIds.perform_negative_y_test command = object_id.as_bytes + ImtqActionIds.perform_negative_y_test
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Initiate reading of negative y self test results")
( command = object_id.as_bytes + ImtqActionIds.read_self_test_results
QueueCommands.PRINT, q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
"IMTQ: Initiate reading of negative y self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Request dataset with negative y self test results")
( sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_Y_TEST)
QueueCommands.PRINT, q.add_pus_tc(generate_one_hk_command(sid))
"IMTQ: Request dataset with negative y self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Y_TEST)
command = generate_one_hk_command(sid, 33)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform positive z self test")) q.add_log_cmd("IMTQ: Perform positive z self test")
command = object_id + ImtqActionIds.perform_positive_z_test command = object_id.as_bytes + ImtqActionIds.perform_positive_z_test
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Initiate reading of positive z self test results")
( command = object_id.as_bytes + ImtqActionIds.read_self_test_results
QueueCommands.PRINT, q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
"IMTQ: Initiate reading of positive z self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( q.add_log_cmd("IMTQ: Request dataset with positive z self test results")
( sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_Y_TEST)
QueueCommands.PRINT, q.add_pus_tc(generate_one_hk_command(sid))
"IMTQ: Request dataset with positive z self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
command = generate_one_hk_command(sid, 36)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Perform negative z self test")) q.add_log_cmd("IMTQ: Perform negative z self test")
command = object_id + ImtqActionIds.perform_negative_z_test command = object_id.as_bytes + ImtqActionIds.perform_negative_z_test
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("IMTQ: Initiate reading of negative z self test results")
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
( q.add_log_cmd("IMTQ: Request dataset with negative z self test results")
QueueCommands.PRINT, sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_Z_TEST)
"IMTQ: Initiate reading of negative z self test results", q.add_pus_tc(generate_one_hk_command(sid))
)
)
command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with negative z self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Z_TEST)
command = generate_one_hk_command(sid, 37)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9": if op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole")) q.add_log_cmd("IMTQ: Commanding dipole")
x_dipole = 0 x_dipole = 0
y_dipole = 0 y_dipole = 0
z_dipole = 0 z_dipole = 0
duration = 0 # ms duration = 0 # ms
command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration) q.add_pus_tc(
tc_queue.appendleft(command.pack_command_tuple()) pack_dipole_command(
object_id.as_bytes, x_dipole, y_dipole, z_dipole, duration
)
)
if op_code == "10": if op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get commanded dipole")) q.add_log_cmd("IMTQ: Get commanded dipole")
command = object_id + ImtqActionIds.get_commanded_dipole command = object_id.as_bytes + ImtqActionIds.get_commanded_dipole
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11": if op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get engineering hk set")) q.add_log_cmd("IMTQ: Get engineering hk set")
command = generate_one_diag_command( q.add_pus_tc(
sid=make_sid(object_id=object_id, set_id=ImtqSetIds.ENG_HK_SET), ssc=0 generate_one_diag_command(
sid=make_sid(object_id=object_id.as_bytes, set_id=ImtqSetIds.ENG_HK_SET)
)
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12": if op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get calibrated MTM hk set")) q.add_log_cmd("IMTQ: Get calibrated MTM hk set")
command = generate_one_diag_command( q.add_pus_tc(
sid=make_sid(object_id=object_id, set_id=ImtqSetIds.CAL_MTM_SET), ssc=0 generate_one_diag_command(
sid=make_sid(
object_id=object_id.as_bytes, set_id=ImtqSetIds.CAL_MTM_SET
)
)
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13": if op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Get raw MTM hk set")) q.add_log_cmd("IMTQ: Get raw MTM hk set")
command = generate_one_diag_command( q.add_pus_tc(
sid=make_sid(object_id=object_id, set_id=ImtqSetIds.RAW_MTM_SET), ssc=0 generate_one_diag_command(
sid=make_sid(
object_id=object_id.as_bytes, set_id=ImtqSetIds.RAW_MTM_SET
)
)
) )
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_dipole_command( def pack_dipole_command(
object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int object_id: bytes, x_dipole: int, y_dipole: int, z_dipole: int, duration: int
) -> PusTelecommand: ) -> PusTelecommand:
"""This function packs the command causing the ISIS IMTQ to generate a dipole. """This function packs the command causing the ISIS IMTQ to generate a dipole.
@param object_id The object id of the IMTQ handler. @param object_id The object id of the IMTQ handler.
@ -279,9 +194,9 @@ def pack_dipole_command(
""" """
action_id = ImtqActionIds.start_actuation_dipole action_id = ImtqActionIds.start_actuation_dipole
command = object_id + action_id command = object_id + action_id
command += struct.pack('!h', x_dipole) command += struct.pack("!h", x_dipole)
command += struct.pack('!h', y_dipole) command += struct.pack("!h", y_dipole)
command += struct.pack('!h', z_dipole) command += struct.pack("!h", z_dipole)
command += struct.pack('!h', duration) command += struct.pack("!h", duration)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, app_data=command)
return command return command

View File

@ -5,13 +5,8 @@
@author J. Meier @author J. Meier
@date 13.12.2020 @date 13.12.2020
""" """
from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc import QueueHelper
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
make_sid,
generate_one_diag_command,
)
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from config.object_ids import P60_DOCK_HANDLER from config.object_ids import P60_DOCK_HANDLER
@ -87,240 +82,193 @@ class P60DockHkTable:
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size) wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
def pack_p60dock_cmds(object_id: ObjectId, tc_queue: TcQueueT, op_code: str): def pack_p60dock_cmds(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
objb = object_id.as_bytes objb = object_id.as_bytes
if op_code in P60OpCodes.STACK_3V3_ON: if op_code in P60OpCodes.STACK_3V3_ON:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_ON)) q.add_log_cmd(Info.STACK_3V3_ON)
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_9.parameter_address, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, P60DockConfigTable.out_en_9.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in P60OpCodes.STACK_3V3_OFF: if op_code in P60OpCodes.STACK_3V3_OFF:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_OFF)) q.add_log_cmd(Info.STACK_3V3_OFF)
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_9.parameter_address, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, P60DockConfigTable.out_en_9.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in P60OpCodes.STACK_5V_ON: if op_code in P60OpCodes.STACK_5V_ON:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_ON)) q.add_log_cmd(Info.STACK_5V_ON)
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_10.parameter_address, P60DockConfigTable.out_en_10.parameter_address,
P60DockConfigTable.out_en_10.parameter_size, P60DockConfigTable.out_en_10.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in P60OpCodes.STACK_5V_OFF: if op_code in P60OpCodes.STACK_5V_OFF:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_OFF)) q.add_log_cmd(Info.STACK_5V_OFF)
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_10.parameter_address, P60DockConfigTable.out_en_10.parameter_address,
P60DockConfigTable.out_en_10.parameter_size, P60DockConfigTable.out_en_10.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Requesting HK Core HK Once")
(QueueCommands.PRINT, "P60 Dock: Requesting HK Core HK Once")
)
hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_CORE) hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_CORE)
command = generate_one_hk_command(sid=hk_sid, ssc=0) q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Requesting HK Aux HK Once")
(QueueCommands.PRINT, "P60 Dock: Requesting HK Aux HK Once")
)
hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_AUX) hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_AUX)
command = generate_one_hk_command(sid=hk_sid, ssc=0) q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I: if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Print Switches, Voltages, Currents")
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents") q.add_pus_tc(
) generate_action_command(
command = generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in GomspaceOpCodes.PRINT_LATCHUPS: if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Latchups")) q.add_log_cmd("P60 Dock: Print Latchups")
command = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
) )
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot"))
command = pack_reboot_command(object_id)
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")
) )
command = pack_get_param_command( if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
q.add_log_cmd("P60 Dock: Reboot")
q.add_pus_tc(pack_reboot_command(object_id))
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
q.add_log_cmd("P60 Dock: Reading ground watchdog timer value")
q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
P60DockHkTable.wdt_gnd_left.parameter_address, P60DockHkTable.wdt_gnd_left.parameter_address,
P60DockHkTable.wdt_gnd_left.parameter_size, P60DockHkTable.wdt_gnd_left.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset: if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Testing ground watchdog reset")
(QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset") q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
)
command = pack_gnd_wdt_reset_command(object_id)
# command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.ping: if P60DockTestProcedure.all or P60DockTestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Ping")) q.add_log_cmd("P60 Dock: Ping")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(object_id, ping_data) q.add_pus_tc(pack_ping_command(object_id, ping_data))
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off: if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Testing setting output channel 3 off")
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")
)
parameter = 0 # set channel off parameter = 0 # set channel off
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size, P60DockConfigTable.out_en_3.parameter_size,
parameter, parameter,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing temperature reading")
) )
command = pack_get_param_command( if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
q.add_log_cmd("P60 Dock: Testing temperature reading")
q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
P60DockHkTable.temperature1.parameter_address, P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size, P60DockHkTable.temperature1.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing Output Channel 3 state (PDU2)")
) )
command = pack_get_param_command( if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
q.add_log_cmd("P60 Dock: Testing Output Channel 3 state (PDU2)")
q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.config, TableIds.config,
P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size, P60DockConfigTable.out_en_3.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0: if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Reading current limit value of output channel 0")
( q.add_pus_tc(
QueueCommands.PRINT, pack_get_param_command(
"P60 Dock: Reading current limit value of output channel 0",
)
)
command = pack_get_param_command(
objb, objb,
TableIds.config, TableIds.config,
P60DockConfigTable.cur_lu_lim_0.parameter_address, P60DockConfigTable.cur_lu_lim_0.parameter_address,
P60DockConfigTable.cur_lu_lim_0.parameter_size, P60DockConfigTable.cur_lu_lim_0.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")
) )
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
q.add_log_cmd("P60 Dock: Testing setting output channel 3 on")
parameter = 1 # set channel on parameter = 1 # set channel on
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size, P60DockConfigTable.out_en_3.parameter_size,
parameter, parameter,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")
) )
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
q.add_log_cmd("P60 Dock: Testing invalid table id handling")
table_id_invalid = 5 table_id_invalid = 5
command = pack_get_param_command( q.add_pus_tc(
pack_get_param_command(
objb, objb,
table_id_invalid, table_id_invalid,
P60DockHkTable.temperature1.parameter_address, P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size, P60DockHkTable.temperature1.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test: if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
tc_queue.appendleft( q.add_log_cmd("P60 Dock: Testing invalid address handling in get param command")
(
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in get param command",
)
)
invalid_address = bytearray([0x01, 0xF4]) invalid_address = bytearray([0x01, 0xF4])
command = pack_get_param_command( q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
invalid_address, invalid_address,
P60DockHkTable.temperature1.parameter_size, P60DockHkTable.temperature1.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(
(
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in set param command",
)
) )
q.add_log_cmd("P60 Dock: Testing invalid address handling in set param command")
invalid_address = bytearray([0x01, 0xF4]) invalid_address = bytearray([0x01, 0xF4])
parameter_size = 2 parameter_size = 2
parameter = 1 parameter = 1
command = pack_set_param_command( q.add_pus_tc(
objb, invalid_address, parameter_size, parameter pack_set_param_command(objb, invalid_address, parameter_size, parameter)
) )
# command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test: if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
tc_queue.appendleft( q.add_log_cmd(
( "P60 Dock: Testing handling of invalid parameter sizes in get-param command"
QueueCommands.PRINT,
"P60 Dock: Testing handling of invalid parameter sizes in get-param command",
)
) )
invalid_size = 5 invalid_size = 5
command = pack_get_param_command( q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
P60DockHkTable.temperature1.parameter_address, P60DockHkTable.temperature1.parameter_address,
invalid_size, invalid_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(
(
QueueCommands.PRINT,
"P60 Dock: Testing handling of invalid parameter size in set-param command",
) )
q.add_log_cmd(
"P60 Dock: Testing handling of invalid parameter size in set-param command"
) )
parameter = 1 parameter = 1
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
P60DockConfigTable.out_en_3.parameter_address, P60DockConfigTable.out_en_3.parameter_address,
invalid_size, invalid_size,
parameter, parameter,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) )
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -1,10 +1,5 @@
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import ( from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
ServiceOpCodeDictT,
add_op_code_entry,
add_service_op_code_entry,
OpCodeDictKeys,
)
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info
from pus_tc.devs.pdu1 import Pdu1OpCodes from pus_tc.devs.pdu1 import Pdu1OpCodes
@ -13,288 +8,137 @@ from pus_tc.devs.acu import add_acu_cmds
from gomspace.gomspace_common import Info as GsInfo from gomspace.gomspace_common import Info as GsInfo
def add_p60_cmds(cmd_dict: ServiceOpCodeDictT): def add_p60_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(keys=P60OpCodes.STACK_3V3_ON, info=Info.STACK_3V3_ON)
op_code_dict=op_code_dict, oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=Info.STACK_3V3_OFF)
keys=P60OpCodes.STACK_3V3_ON, oce.add(keys=P60OpCodes.STACK_5V_ON, info=Info.STACK_5V_ON)
info=Info.STACK_3V3_ON, oce.add(keys=P60OpCodes.STACK_5V_OFF, info=Info.STACK_5V_OFF)
) oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE)
add_op_code_entry( oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE)
op_code_dict=op_code_dict, oce.add(
keys=P60OpCodes.STACK_3V3_OFF,
info=Info.STACK_3V3_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_ON,
info=Info.STACK_5V_ON,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_OFF,
info=Info.STACK_5V_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I, keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="P60 Dock: Print Switches, Voltages, Currents", info="P60 Dock: Print Switches, Voltages, Currents",
) )
add_op_code_entry( oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="P60 Dock: Print Latchups")
op_code_dict=op_code_dict, oce.add(keys=P60OpCodes.TEST, info="P60 Tests")
keys=GomspaceOpCodes.PRINT_LATCHUPS, defs.add_service(
info="P60 Dock: Print Latchups", name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce
)
add_op_code_entry(op_code_dict=op_code_dict, keys=P60OpCodes.TEST, info="P60 Tests")
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.P60DOCK.value,
info="P60 Device",
op_code_entry=op_code_dict,
) )
def add_pdu1_cmds(cmd_dict: ServiceOpCodeDictT): def add_pdu1_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(keys=Pdu1OpCodes.TCS_BOARD_OFF.value, info="PDU1: Turn TCS board off")
op_code_dict=op_code_dict, oce.add(keys=Pdu1OpCodes.STAR_TRACKER_ON.value, info="PDU1: Turn star tracker on")
keys=Pdu1OpCodes.TCS_BOARD_OFF.value, oce.add(keys=Pdu1OpCodes.STAR_TRACKER_OFF.value, info="PDU1: Turn star tracker off")
info="PDU1: Turn TCS board off", oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_ON.value, info="PDU1: Turn SUS nominal on")
oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_OFF.value, info="PDU1: Turn SUS nominal off")
oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_ON.value, info="PDU1: Turn ACS A side on")
oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_OFF.value, info="PDU1: Turn ACS A side off")
oce.add(keys=Pdu1OpCodes.SYRLINKS_ON.value, info="PDU1: Turn Syrlinks on")
oce.add(keys=Pdu1OpCodes.SYRLINKS_OFF.value, info="PDU1: Turn Syrlinks off")
oce.add(keys=Pdu1OpCodes.MGT_ON.value, info="PDU1: Turn MGT on")
oce.add(keys=Pdu1OpCodes.MGT_OFF.value, info="PDU1: Turn MGT off")
oce.add(keys=Pdu1OpCodes.PLOC_ON.value, info="PDU1: Turn PLOC on")
oce.add(keys=Pdu1OpCodes.PLOC_OFF.value, info="PDU1: Turn PLOC off")
oce.add(keys=Pdu1OpCodes.SCEX_ON.value, info="PDU1: Turn Solar Cell Experiment on")
oce.add(
keys=Pdu1OpCodes.SCEX_OFF.value, info="PDU1: Turn Solar Cell Experiment off"
) )
add_op_code_entry( oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE)
op_code_dict=op_code_dict, oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE)
keys=Pdu1OpCodes.STAR_TRACKER_ON.value, oce.add(
info="PDU1: Turn star tracker on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.STAR_TRACKER_OFF.value,
info="PDU1: Turn star tracker off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_ON.value,
info="PDU1: Turn SUS nominal on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_OFF.value,
info="PDU1: Turn SUS nominal off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_ON.value,
info="PDU1: Turn ACS A side on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_OFF.value,
info="PDU1: Turn ACS A side off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_ON.value,
info="PDU1: Turn Syrlinks on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_OFF.value,
info="PDU1: Turn Syrlinks off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_ON.value,
info="PDU1: Turn MGT on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_OFF.value,
info="PDU1: Turn MGT off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_ON.value,
info="PDU1: Turn PLOC on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_OFF.value,
info="PDU1: Turn PLOC off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_ON.value,
info="PDU1: Turn Solar Cell Experiment on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_OFF.value,
info="PDU1: Turn Solar Cell Experiment off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I, keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU1: Print Switches, Voltages, Currents", info="PDU1: Print Switches, Voltages, Currents",
) )
add_op_code_entry( oce.add(keys=Pdu1OpCodes.TCS_BOARD_ON.value, info="PDU1: Turn TCS board on")
op_code_dict=op_code_dict, oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="PDU1: Print Latchups")
keys=Pdu1OpCodes.TCS_BOARD_ON.value, oce.add(keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests")
info="PDU1: Turn TCS board on", oce.add(keys=GomspaceOpCodes.SET_PARAM, info="Set parameter")
) defs.add_service(
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU1: Print Latchups",
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests"
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=GomspaceOpCodes.SET_PARAM, info="Set parameter"
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.PDU1.value, name=CustomServiceList.PDU1.value,
info="PDU1 Device", info="PDU1 Device",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def add_pdu2_cmds(cmd_dict: ServiceOpCodeDictT): def add_pdu2_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU2 Tests") oce.add(keys="0", info="PDU2 Tests")
add_op_code_entry( oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_ON.value, info="PDU2: Turn ACS Side B on")
op_code_dict=op_code_dict, oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value, info="PDU2: Turn ACS Side B off")
keys=Pdu2OpCodes.ACS_SIDE_B_ON.value, oce.add(keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value, info="PDU2: Turn SUS redundant on")
info="PDU2: Turn ACS Side B on", oce.add(
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value, info="PDU2: Turn SUS redundant off"
) )
add_op_code_entry( oce.add(keys=Pdu2OpCodes.RW_ON.value, info="PDU2: Turn reaction wheels on")
op_code_dict=op_code_dict, oce.add(keys=Pdu2OpCodes.RW_OFF.value, info="PDU2: Turn reaction wheels off")
keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value, oce.add(
info="PDU2: Turn ACS Side B off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
info="PDU2: Turn SUS redundant on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
info="PDU2: Turn SUS redundant off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_ON.value,
info="PDU2: Turn reaction wheels on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_OFF.value,
info="PDU2: Turn reaction wheels off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value, keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) on", info="PDU2: PL PCDU Switch Channel Nominal (1) on",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value, keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) off", info="PDU2: PL PCDU Switch Channel Nominal (1) off",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value, keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) on", info="PDU2: PL PCDU Switch Channel Redundant (1) on",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value, keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) off", info="PDU2: PL PCDU Switch Channel Redundant (1) off",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value, keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value,
info="PDU2: Switch TCS Heater Input on", info="PDU2: Switch TCS Heater Input on",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value, keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value,
info="PDU2: Switch TCS Heater Input off", info="PDU2: Switch TCS Heater Input off",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value, keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value,
info="PDU2: Switch Solar Array Deployment On", info="PDU2: Switch Solar Array Deployment On",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value, keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value,
info="PDU2: Switch Solar Array Deployment Off", info="PDU2: Switch Solar Array Deployment Off",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_ON.value, keys=Pdu2OpCodes.PL_CAMERA_ON.value,
info="PDU2: Turn payload camera on", info="PDU2: Turn payload camera on",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_OFF.value, keys=Pdu2OpCodes.PL_CAMERA_OFF.value,
info="PDU2: Turn payload camera off", info="PDU2: Turn payload camera off",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE,
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I, keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU2: Print Switches, Voltages, Currents", info="PDU2: Print Switches, Voltages, Currents",
options={OpCodeDictKeys.TIMEOUT: 2.0},
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS, keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU2: Print Latchups", info="PDU2: Print Latchups",
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name="pdu2", name="pdu2",
info="PDU2 Device", info="PDU2 Device",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): def add_pcdu_cmds(defs: TmTcDefWrapper):
add_p60_cmds(cmd_dict) add_p60_cmds(defs)
add_pdu1_cmds(cmd_dict) add_pdu1_cmds(defs)
add_pdu2_cmds(cmd_dict) add_pdu2_cmds(defs)
add_acu_cmds(cmd_dict) add_acu_cmds(defs)

View File

@ -5,9 +5,8 @@
@author J. Meier @author J. Meier
@date 22.11.2021 @date 22.11.2021
""" """
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
class CommandIds: class CommandIds:
@ -17,24 +16,13 @@ class CommandIds:
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1]) PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str): def pack_pdec_handler_test(object_id: bytearray, q: QueueHelper, op_code: str):
tc_queue.appendleft( q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
(
QueueCommands.PRINT,
"Testing PDEC handler with object id: 0x" + object_id.hex(),
)
)
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PDEC Handler: Print CLCW")) q.add_log_cmd("PDEC Handler: Print CLCW")
command = object_id + CommandIds.PRINT_CLCW command = object_id + CommandIds.PRINT_CLCW
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft( q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
(QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register")
)
command = object_id + CommandIds.PRINT_PDEC_MON command = object_id + CommandIds.PRINT_PDEC_MON
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -4,8 +4,8 @@
@date 17.12.2020 @date 17.12.2020
""" """
import gomspace.gomspace_common as gs import gomspace.gomspace_common as gs
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command, generate_one_hk_command,
make_sid, make_sid,
@ -55,251 +55,263 @@ class PDU1TestProcedure:
turn_channel_3_off = False turn_channel_3_off = False
def pack_pdu1_commands(object_id: ObjectId, tc_queue: TcQueueT, op_code: str): def pack_pdu1_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1")) q.add_log_cmd("Commanding PDU1")
objb = object_id.as_bytes objb = object_id.as_bytes
if op_code == Pdu1OpCodes.TCS_BOARD_ON.value: if op_code == Pdu1OpCodes.TCS_BOARD_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board on")) q.add_log_cmd("PDU1: Turn TCS board on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_0.parameter_address, PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size, PDUConfigTable.out_en_0.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value: if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board off")) q.add_log_cmd("PDU1: Turn TCS board off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_0.parameter_address, PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size, PDUConfigTable.out_en_0.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value: if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on")) q.add_log_cmd("PDU1: Turn star tracker on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value: if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off")) q.add_log_cmd("PDU1: Turn star tracker off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on")) q.add_log_cmd("PDU1: Turn SUS nominal on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, PDUConfigTable.out_en_4.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off")) q.add_log_cmd("PDU1: Turn SUS nominal off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, PDUConfigTable.out_en_4.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value: if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on")) q.add_log_cmd("PDU1: Turn ACS Side A on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_7.parameter_address, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, PDUConfigTable.out_en_7.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value: if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off")) q.add_log_cmd("PDU1: Turn ACS Side A off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_7.parameter_address, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, PDUConfigTable.out_en_7.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off")) q.add_log_cmd("PDU1: Turn SUS nominal off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, PDUConfigTable.out_en_4.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SCEX_ON.value: if op_code == Pdu1OpCodes.SCEX_ON.value:
tc_queue.appendleft( q.add_log_cmd("PDU1: Turn Solar Cell Experiment on")
(QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment on") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_5.parameter_address, PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size, PDUConfigTable.out_en_5.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SCEX_OFF.value: if op_code == Pdu1OpCodes.SCEX_OFF.value:
tc_queue.appendleft( q.add_log_cmd("PDU1: Turn Solar Cell Experiment off")
(QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment off") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_5.parameter_address, PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size, PDUConfigTable.out_en_5.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SYRLINKS_ON.value: if op_code == Pdu1OpCodes.SYRLINKS_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on")) q.add_log_cmd("PDU1: Turn Syrlinks on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_1.parameter_address, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, PDUConfigTable.out_en_1.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.SYRLINKS_OFF.value: if op_code == Pdu1OpCodes.SYRLINKS_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off")) q.add_log_cmd("PDU1: Turn Syrlinks off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_1.parameter_address, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, PDUConfigTable.out_en_1.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.MGT_ON.value: if op_code == Pdu1OpCodes.MGT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT on")) q.add_log_cmd("PDU1: Turn MGT on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.MGT_OFF.value: if op_code == Pdu1OpCodes.MGT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT off")) q.add_log_cmd("PDU1: Turn MGT off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.PLOC_ON.value: if op_code == Pdu1OpCodes.PLOC_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn PLOC on")) q.add_log_cmd("PDU1: Turn PLOC on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_6.parameter_address, PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size, PDUConfigTable.out_en_6.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu1OpCodes.PLOC_OFF.value: if op_code == Pdu1OpCodes.PLOC_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn PLOC off")) q.add_log_cmd("PDU1: Turn PLOC off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_6.parameter_address, PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size, PDUConfigTable.out_en_6.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"PDU1: {Info.REQUEST_CORE_HK_ONCE}"))
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_CORE)
command = generate_one_diag_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"PDU1: {Info.REQUEST_AUX_HK_ONCE}"))
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_AUX)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
) )
command = generate_action_command( if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
q.add_log_cmd(f"PDU1: {Info.REQUEST_CORE_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_CORE)
q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
q.add_log_cmd(f"PDU1: {Info.REQUEST_AUX_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_AUX)
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("PDU1: Print Switches, Voltages, Currents")
q.add_pus_tc(
generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in GomspaceOpCodes.PRINT_LATCHUPS: if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Latchups")) q.add_log_cmd("PDU1: Print Latchups")
command = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU1TestProcedure.all or PDU1TestProcedure.ping: if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) q.add_log_cmd("PDU1: Ping Test")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(object_id, ping_data) q.add_pus_tc(pack_ping_command(object_id, ping_data))
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature: if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading")) q.add_log_cmd("PDU1: Testing temperature reading")
command = pack_get_param_command( q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
PDUHkTable.temperature.parameter_address, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size, PDUHkTable.temperature.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
tc_queue.appendleft( q.add_log_cmd("PDU1: Turn channel 2 on (Star Tracker)")
(QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
tc_queue.appendleft( q.add_log_cmd("PDU1: Turn channel 2 off (Star Tracker)")
(QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)")) q.add_log_cmd("PDU1: Turn channel 3 on (MTQ)")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)")) q.add_log_cmd("PDU1: Turn channel 3 off (MTQ)")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.SET_PARAM:
tc_queue.appendleft(
(QueueCommands.PRINT, f"PDU1: {Info.SET_PARAMETER}")
) )
if op_code in GomspaceOpCodes.SET_PARAM:
q.add_log_cmd(f"PDU1: {Info.SET_PARAMETER}")
memory_address = int(input("Specify memory address: 0x"), 16) memory_address = int(input("Specify memory address: 0x"), 16)
memory_address = struct.pack('!H', memory_address) memory_address = struct.pack("!H", memory_address)
parameter_size = int(input("Specify parameter size: ")) parameter_size = int(input("Specify parameter size: "))
parameter = int(input("Specify parameter: ")) parameter = int(input("Specify parameter: "))
command = gs.pack_set_param_command(object_id.as_bytes, memory_address, parameter_size, parameter) q.add_pus_tc(
tc_queue.appendleft(command.pack_command_tuple()) gs.pack_set_param_command(
object_id.as_bytes, memory_address, parameter_size, parameter
)
)

View File

@ -6,8 +6,7 @@
@author J. Meier @author J. Meier
@date 17.12.2020 @date 17.12.2020
""" """
from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc import QueueHelper
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command, generate_one_hk_command,
generate_one_diag_command, generate_one_diag_command,
@ -66,288 +65,271 @@ class PDU2TestProcedure:
request_hk_table = False request_hk_table = False
def pack_pdu2_commands(object_id: ObjectId, tc_queue: TcQueueT, op_code: str): def pack_pdu2_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2")) q.add_log_cmd("Testing PDU2")
objb = object_id.as_bytes objb = object_id.as_bytes
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value: if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on")) q.add_log_cmd("PDU2: Turn ACS Side B on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_7.parameter_address, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, PDUConfigTable.out_en_7.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
return tc_queue
if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value: if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off")) q.add_log_cmd("PDU2: Turn ACS Side B off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_7.parameter_address, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, PDUConfigTable.out_en_7.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
return tc_queue
if op_code == Pdu2OpCodes.Q7S_OFF.value: if op_code == Pdu2OpCodes.Q7S_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "Turning off Q7S OBC")) q.add_log_cmd("Turning off Q7S OBC")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_0.parameter_address, PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size, PDUConfigTable.out_en_0.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value: if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on")) q.add_log_cmd("PDU2: Turn SUS redundant on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, PDUConfigTable.out_en_4.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value: if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off")) q.add_log_cmd("PDU2: Turn SUS redundant off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_4.parameter_address, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, PDUConfigTable.out_en_4.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.RW_ON.value: if op_code == Pdu2OpCodes.RW_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on")) q.add_log_cmd("PDU2: Turn reaction wheels on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.RW_OFF.value: if op_code == Pdu2OpCodes.RW_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off")) q.add_log_cmd("PDU2: Turn reaction wheels off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value: if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 1 on")
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 on") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_1.parameter_address, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, PDUConfigTable.out_en_1.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value: if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 1 off")
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 off") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_1.parameter_address, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, PDUConfigTable.out_en_1.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value: if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 6 on")
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 on") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_6.parameter_address, PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size, PDUConfigTable.out_en_6.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value: if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn PDU2 PL PCDU Channel 6 off")
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 off") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_6.parameter_address, PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size, PDUConfigTable.out_en_6.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value: if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input on")) q.add_log_cmd("PDU2: Turn TCS Heater Input on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value: if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input off")) q.add_log_cmd("PDU2: Turn TCS Heater Input off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_3.parameter_address, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, PDUConfigTable.out_en_3.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value: if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn Solar Array Deployment On")
(QueueCommands.PRINT, "PDU2: Turn Solar Array Deployment On") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_5.parameter_address, PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size, PDUConfigTable.out_en_5.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value: if op_code == Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value:
tc_queue.appendleft( q.add_log_cmd("PDU2: Turn Solar Array Deployment Off")
(QueueCommands.PRINT, "PDU2: Turn Solar Array Deployment Off") q.add_pus_tc(
) pack_set_param_command(
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_5.parameter_address, PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size, PDUConfigTable.out_en_5.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_CAMERA_ON.value: if op_code == Pdu2OpCodes.PL_CAMERA_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera on")) q.add_log_cmd("PDU2: Turn payload camera on")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_8.parameter_address, PDUConfigTable.out_en_8.parameter_address,
PDUConfigTable.out_en_8.parameter_size, PDUConfigTable.out_en_8.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code == Pdu2OpCodes.PL_CAMERA_OFF.value: if op_code == Pdu2OpCodes.PL_CAMERA_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera off")) q.add_log_cmd("PDU2: Turn payload camera off")
command = pack_set_param_command( q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_8.parameter_address, PDUConfigTable.out_en_8.parameter_address,
PDUConfigTable.out_en_8.parameter_size, PDUConfigTable.out_en_8.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"PDU2: {Info.REQUEST_CORE_HK_ONCE}"))
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_CORE)
command = generate_one_diag_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"PDU2: {Info.REQUEST_AUX_HK_ONCE}"))
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_AUX)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")
) )
command = generate_action_command( if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
q.add_log_cmd(f"PDU2: {Info.REQUEST_CORE_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_CORE)
q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
q.add_log_cmd(f"PDU2: {Info.REQUEST_AUX_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_AUX)
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("PDU2: Print Switches, Currents, Voltahes")
q.add_pus_tc(
generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if op_code in GomspaceOpCodes.PRINT_LATCHUPS: if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Latchups")) q.add_log_cmd("PDU2: Print Latchups")
command = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
) )
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reboot"))
command = pack_reboot_command(object_id)
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")
) )
command = pack_get_param_command( if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
q.add_log_cmd("PDU2: Reboot")
q.add_pus_tc(pack_reboot_command(object_id))
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
q.add_log_cmd("PDU2: Reading ground watchdog timer value")
q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
PDUHkTable.wdt_gnd_left.parameter_address, PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size, PDUHkTable.wdt_gnd_left.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset: if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
tc_queue.appendleft( q.add_log_cmd("PDU2: Testing ground watchdog reset")
(QueueCommands.PRINT, "PDU2: Testing ground watchdog reset") q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
)
command = pack_gnd_wdt_reset_command(object_id)
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.ping: if PDU2TestProcedure.all or PDU2TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Ping Test")) q.add_log_cmd("PDU2: Ping Test")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(object_id, ping_data) q.add_pus_tc(pack_ping_command(object_id, ping_data))
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on: if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
tc_queue.appendleft( q.add_log_cmd("PDU2: Testing setting output channel 2 on (TCS Heater)")
( q.add_pus_tc(
QueueCommands.PRINT, pack_set_param_command(
"PDU2: Testing setting output channel 2 on (TCS Heater)",
)
)
command = pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.on, Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature: if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading")) q.add_log_cmd("PDU2: Testing temperature reading")
command = pack_get_param_command( q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.hk, TableIds.hk,
PDUHkTable.temperature.parameter_address, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size, PDUHkTable.temperature.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)")
) )
command = pack_get_param_command( if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
q.add_log_cmd("PDU2: Reading output channel 2 state (TCS Heater)")
q.add_pus_tc(
pack_get_param_command(
objb, objb,
TableIds.config, TableIds.config,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0: if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft( q.add_log_cmd("PDU2: Reading current limit value of output channel 0 (OBC)")
( q.add_pus_tc(
QueueCommands.PRINT, pack_get_param_command(
"PDU2: Reading current limit value of output channel 0 (OBC)",
)
)
command = pack_get_param_command(
objb, objb,
TableIds.config, TableIds.config,
PDUConfigTable.cur_lu_lim_0.parameter_address, PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size, PDUConfigTable.cur_lu_lim_0.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")
) )
command = pack_set_param_command( if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
q.add_log_cmd("PDU2: Testing setting output channel 2 off")
q.add_pus_tc(
pack_set_param_command(
objb, objb,
PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, PDUConfigTable.out_en_2.parameter_size,
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Requesting housekeeping table")
) )
command = pack_request_full_hk_table_command(object_id) if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PDU2: Requesting housekeeping table")
q.add_pus_tc(pack_request_full_hk_table_command(object_id))

View File

@ -8,36 +8,30 @@
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.utility import ObjectIdU32
class ActionIds: class ActionIds:
DUMP_MRAM = 1 DUMP_MRAM = 1
def pack_ploc_memory_dumper_cmd(object_id: bytearray, tc_queue: TcQueueT, op_code: str): def pack_ploc_memory_dumper_cmd(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
tc_queue.appendleft( q.add_log_cmd(
( f"Testing PLOC memory dumper with object id: {object_id.as_hex_string}"
QueueCommands.PRINT,
"Testing PLOC memory dumper with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Dump MRAM")) q.add_log_cmd("PLOC Supervisor: Dump MRAM")
command = pack_mram_dump_cmd(object_id) command = pack_mram_dump_cmd(object_id.as_bytes)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
def pack_mram_dump_cmd(object_id: bytearray) -> bytearray: def pack_mram_dump_cmd(object_id: bytes) -> bytearray:
start = int(input("Start address: 0x"), 16) start = int(input("Start address: 0x"), 16)
end = int(input("End address: 0x"), 16) end = int(input("End address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM) command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM)
command = command + struct.pack("!I", start) command = command + struct.pack("!I", start)
command = command + struct.pack("!I", end) command = command + struct.pack("!I", end)
return command return bytearray(command)

View File

@ -9,10 +9,10 @@
import struct import struct
import enum import enum
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.utility import ObjectIdU32
from utility.input_helper import InputHelper from utility.input_helper import InputHelper
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
@ -66,143 +66,118 @@ class PlocReplyIds(enum.IntEnum):
TM_CAM_CMD_RPT = 19 TM_CAM_CMD_RPT = 19
def pack_ploc_mpsoc_commands( def pack_ploc_mpsoc_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str q.add_log_cmd(
) -> TcQueueT: f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Generate command for PLOC MPSoC with object id: 0x" + object_id.hex(),
) )
) obyt = object_id.as_bytes
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set mode off")) q.add_log_cmd("PLOC MPSoC: Set mode off")
command = pack_mode_data(object_id, Modes.OFF, 0) command = pack_mode_data(obyt, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set mode on")) q.add_log_cmd("PLOC MPSoC: Set mode on")
command = pack_mode_data(object_id, Modes.ON, 0) data = pack_mode_data(obyt, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Mode Normal")) q.add_log_cmd("PLOC MPSoC: Mode Normal")
command = pack_mode_data(object_id, Modes.NORMAL, 0) data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem write test")) q.add_log_cmd("PLOC MPSoC: TC mem write test")
memory_address = int( memory_address = int(
input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16 input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16
) )
memory_data = int(input("PLOC MPSoC: Tc Mem Write: Type memory data: 0x"), 16) memory_data = int(input("PLOC MPSoC: Tc Mem Write: Type memory data: 0x"), 16)
# TODO: implement variable length mem write command # TODO: implement variable length mem write command
mem_len = 1 # 1 32-bit word mem_len = 1 # 1 32-bit word
command = generate_write_mem_command( data = generate_write_mem_command(
object_id, memory_address, memory_data, mem_len object_id.as_bytes, memory_address, memory_data, mem_len
) )
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "4":
elif op_code == "4": q.add_log_cmd("PLOC MPSoC: TC mem read test")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem read test")) data = prepare_mem_read_command(object_id=object_id.as_bytes)
command = prepare_mem_read_command(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) if op_code == "5":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC MPSoC: Flash write")
elif op_code == "5": data = prepare_flash_write_cmd(object_id.as_bytes)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Flash write")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = prepare_flash_write_cmd(object_id) if op_code == "6":
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) q.add_log_cmd("PLOC MPSoC: Flash delete")
tc_queue.appendleft(command.pack_command_tuple()) data = prepare_flash_delete_cmd(object_id.as_bytes)
elif op_code == "6": q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Flash delete")) if op_code == "7":
command = prepare_flash_delete_cmd(object_id) q.add_log_cmd("PLOC MPSoC: Replay start")
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) data = prepare_replay_start_cmd(object_id.as_bytes)
tc_queue.appendleft(command.pack_command_tuple()) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
elif op_code == "7": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay start")) q.add_log_cmd("PLOC MPSoC: Replay stop")
command = prepare_replay_start_cmd(object_id) data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_REPLAY_STOP)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "9":
elif op_code == "8": q.add_log_cmd("PLOC MPSoC: Downlink pwr on")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay stop")) data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
command = object_id + struct.pack("!I", CommandIds.TC_REPLAY_STOP) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) if op_code == "10":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
elif op_code == "9": data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Downlink pwr on")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = prepare_downlink_pwr_on_cmd(object_id) if op_code == "11":
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) q.add_log_cmd("PLOC MPSoC: Replay write sequence")
tc_queue.appendleft(command.pack_command_tuple()) data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
elif op_code == "10": q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Downlink pwr off")) if op_code == "12":
command = object_id + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF) q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) data = object_id.as_bytes + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
tc_queue.appendleft(command.pack_command_tuple()) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
elif op_code == "11": if op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay write sequence"))
command = prepare_replay_write_sequence_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "12":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC MPSoC: Reset OBSW sequence count")
)
command = object_id + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "13":
num_words = 1 num_words = 1
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Read DEADBEEF address")) q.add_log_cmd("PLOC MPSoC: Read DEADBEEF address")
command = ( data = (
object_id object_id.as_bytes
+ struct.pack("!I", CommandIds.TC_MEM_READ) + struct.pack("!I", CommandIds.TC_MEM_READ)
+ struct.pack("!I", MemAddresses.DEADBEEF) + struct.pack("!I", MemAddresses.DEADBEEF)
+ struct.pack("!H", num_words) + struct.pack("!H", num_words)
) )
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "14":
elif op_code == "14": q.add_log_cmd("PLOC MPSoC: Tc mode replay")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode replay")) data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_REPLAY)
command = object_id + struct.pack("!I", CommandIds.TC_MODE_REPLAY) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) if op_code == "15":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC MPSoC: Tc mode idle")
elif op_code == "15": data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_IDLE)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode idle")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", CommandIds.TC_MODE_IDLE) if op_code == "16":
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) q.add_log_cmd("PLOC MPSoC: Tc cam command send")
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc cam command send"))
cam_cmd = input("Specify cam command string: ") cam_cmd = input("Specify cam command string: ")
command = ( data = (
object_id object_id.as_bytes
+ struct.pack("!I", CommandIds.TC_CAM_CMD_SEND) + struct.pack("!I", CommandIds.TC_CAM_CMD_SEND)
+ bytearray(cam_cmd, "utf-8") + bytearray(cam_cmd, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "17":
elif op_code == "17": q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set UART TX tristate")) data = object_id.as_bytes + struct.pack("!I", CommandIds.SET_UART_TX_TRISTATE)
command = object_id + struct.pack("!I", CommandIds.SET_UART_TX_TRISTATE) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) if op_code == "18":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC MPSoC: Release UART TX")
elif op_code == "18": data = object_id.as_bytes + struct.pack("!I", CommandIds.RELEASE_UART_TX)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Release UART TX")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", CommandIds.RELEASE_UART_TX)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def generate_write_mem_command( def generate_write_mem_command(
object_id: bytearray, memory_address: int, memory_data: int, mem_len: int object_id: bytes, memory_address: int, memory_data: int, mem_len: int
) -> bytearray: ) -> bytearray:
"""This function generates the command to write to a memory address within the PLOC """This function generates the command to write to a memory address within the PLOC.
@param object_id The object id of the PlocHandler
@param memory_address The PLOC memory address where to write to. :param object_id: The object id of the PlocHandler
@param memory_data The data to write to the memory address specified by the bytearray memory_address. :param memory_address: The PLOC memory address where to write to.
:param memory_data: The data to write to the memory address specified by the
bytearray memory_address.
:param mem_len:
""" """
command = ( command = (
object_id object_id
@ -211,10 +186,10 @@ def generate_write_mem_command(
+ struct.pack("!H", mem_len) + struct.pack("!H", mem_len)
+ struct.pack("!I", memory_data) + struct.pack("!I", memory_data)
) )
return command return bytearray(command)
def prepare_mem_read_command(object_id: bytearray) -> bytearray: def prepare_mem_read_command(object_id: bytes) -> bytearray:
memory_address = int(input("PLOC MPSoC Tc Mem Read: Type memory address: 0x"), 16) memory_address = int(input("PLOC MPSoC Tc Mem Read: Type memory address: 0x"), 16)
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: ")) num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
command = ( command = (
@ -223,10 +198,10 @@ def prepare_mem_read_command(object_id: bytearray) -> bytearray:
+ struct.pack("!I", memory_address) + struct.pack("!I", memory_address)
+ struct.pack("!H", num_words) + struct.pack("!H", num_words)
) )
return command return bytearray(command)
def prepare_flash_write_cmd(object_id: bytearray) -> bytearray: def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
obcFile = get_obc_file() obcFile = get_obc_file()
mpsocFile = get_mpsoc_file() mpsocFile = get_mpsoc_file()
command = ( command = (
@ -235,30 +210,30 @@ def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
+ bytearray(obcFile, "utf-8") + bytearray(obcFile, "utf-8")
+ bytearray(mpsocFile, "utf-8") + bytearray(mpsocFile, "utf-8")
) )
return command return bytearray(command)
def prepare_flash_delete_cmd(object_id: bytearray) -> bytearray: def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
file = get_mpsoc_file() file = get_mpsoc_file()
command = ( command = (
object_id object_id
+ struct.pack("!I", CommandIds.TC_FLASH_DELETE) + struct.pack("!I", CommandIds.TC_FLASH_DELETE)
+ bytearray(file, "utf-8") + bytearray(file, "utf-8")
) )
return command return bytearray(command)
def prepare_replay_start_cmd(object_id: bytearray) -> bytearray: def prepare_replay_start_cmd(object_id: bytes) -> bytearray:
replay = int(input("Specify replay mode (0 - once, 1 - repeated): ")) replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
command = ( command = (
object_id object_id
+ struct.pack("!I", CommandIds.TC_REPLAY_START) + struct.pack("!I", CommandIds.TC_REPLAY_START)
+ struct.pack("!B", replay) + struct.pack("!B", replay)
) )
return command return bytearray(command)
def prepare_downlink_pwr_on_cmd(object_id: bytearray) -> bytearray: def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
mode = int(input("Specify JESD mode (0 - 5): ")) mode = int(input("Specify JESD mode (0 - 5): "))
lane_rate = int(input("Specify lane rate (0 - 9): ")) lane_rate = int(input("Specify lane rate (0 - 9): "))
command = ( command = (
@ -267,10 +242,10 @@ def prepare_downlink_pwr_on_cmd(object_id: bytearray) -> bytearray:
+ struct.pack("!B", mode) + struct.pack("!B", mode)
+ struct.pack("!B", lane_rate) + struct.pack("!B", lane_rate)
) )
return command return bytearray(command)
def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray: def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
null_terminator = 0 null_terminator = 0
use_decoding = int(input("Use decoding (set to 1): ")) use_decoding = int(input("Use decoding (set to 1): "))
file = get_sequence_file() file = get_sequence_file()
@ -280,7 +255,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray:
+ struct.pack("!B", use_decoding) + struct.pack("!B", use_decoding)
+ bytearray(file, "utf-8") + bytearray(file, "utf-8")
) )
return command return bytearray(command)
def get_obc_file() -> str: def get_obc_file() -> str:

View File

@ -9,10 +9,10 @@
import struct import struct
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from tmtccmd.utility import ObjectIdU32
from utility.input_helper import InputHelper from utility.input_helper import InputHelper
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -106,309 +106,234 @@ class SupvHkIds:
BOOT_STATUS_REPORT = 53 BOOT_STATUS_REPORT = 53
def pack_ploc_supv_commands( def pack_ploc_supv_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str q.add_log_cmd(f"Testing PLOC Supervisor with object id: {object_id.as_hex_string}")
) -> TcQueueT: obyt = object_id.as_bytes
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing PLOC Supervisor with object id: 0x" + object_id.hex(),
)
)
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set mode off")) q.add_log_cmd("PLOC Supervisor: Set mode off")
command = pack_mode_data(object_id, Modes.OFF, 0) command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set mode on")) q.add_log_cmd("PLOC Supervisor: Set mode on")
command = pack_mode_data(object_id, Modes.ON, 0) command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Mode Normal")) q.add_log_cmd("PLOC Supervisor: Mode Normal")
command = pack_mode_data(object_id, Modes.NORMAL, 0) command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report")) q.add_log_cmd("PLOC Supervisor: TC Get Hk Report")
command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT) command = obyt + struct.pack("!I", SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5": elif op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC")) q.add_log_cmd("PLOC Supervisor: Start MPSoC")
command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC) command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "6":
elif op_code == "6": q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Shutdown MPSoC")) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
command = object_id + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) if op_code == "7":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
elif op_code == "7":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image")
)
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): ")) mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
bp0 = int(input("BP0 (0 or 1): ")) bp0 = int(input("BP0 (0 or 1): "))
bp1 = int(input("BP1 (0 or 1): ")) bp1 = int(input("BP1 (0 or 1): "))
bp2 = int(input("BP2 (0 or 1): ")) bp2 = int(input("BP2 (0 or 1): "))
command = pack_sel_boot_image_cmd(object_id, mem, bp0, bp1, bp2) command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "8":
elif op_code == "8": q.add_log_cmd("PLOC Supervisor: Set max restart tries")
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries")
)
restart_tries = int(input("Specify maximum restart tries: ")) restart_tries = int(input("Specify maximum restart tries: "))
command = ( command = (
object_id object_id.as_bytes
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES) + struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
+ struct.pack("!B", restart_tries) + struct.pack("!B", restart_tries)
) )
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "9":
elif op_code == "9": q.add_log_cmd("PLOC Supervisor: Reset MPSoC")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset MPSoC")) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_MPSOC)
command = object_id + struct.pack("!I", SupvActionIds.RESET_MPSOC) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) if op_code == "10":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Set time reference")
elif op_code == "10": command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SET_TIME_REF)
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
(QueueCommands.PRINT, "PLOC Supervisor: Set time reference") if op_code == "11":
) q.add_log_cmd("PLOC Supervisor: Set boot timeout")
command = object_id + struct.pack("!I", SupvActionIds.SET_TIME_REF)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
boot_timeout = int(input("Specify boot timeout [ms]: ")) boot_timeout = int(input("Specify boot timeout [ms]: "))
command = ( command = (
object_id object_id.as_bytes
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT) + struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
+ struct.pack("!I", boot_timeout) + struct.pack("!I", boot_timeout)
) )
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "12":
elif op_code == "12": q.add_log_cmd("PLOC Supervisor: Disable HK")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable HK")) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_HK)
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_HK) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) if op_code == "13":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Request boot status report")
elif op_code == "13": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft( "!I", SupvActionIds.GET_BOOT_STATUS_REPORT
(QueueCommands.PRINT, "PLOC Supervisor: Request boot status report")
) )
command = object_id + struct.pack("!I", SupvActionIds.GET_BOOT_STATUS_REPORT) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) if op_code == "17":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Enable latchup alert")
elif op_code == "17": command = pack_lachtup_alert_cmd(object_id.as_bytes, True)
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
(QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert") if op_code == "18":
q.add_log_cmd("PLOC Supervisor: Disable latchup alert")
command = pack_lachtup_alert_cmd(object_id.as_bytes, False)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "20":
q.add_log_cmd("PLOC Supervisor: Set alert limit")
command = pack_set_alert_limit_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "23":
q.add_log_cmd("PLOC Supervisor: Set ADC enabled channels")
command = pack_set_adc_enabled_channels_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "24":
q.add_log_cmd("PLOC Supervisor: Set ADC window and stride")
command = pack_set_adc_window_and_stride_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "25":
q.add_log_cmd("PLOC Supervisor: Set ADC threshold")
command = pack_set_adc_threshold_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "26":
q.add_log_cmd("PLOC Supervisor: Request latchup status report")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.GET_LATCHUP_STATUS_REPORT
) )
command = pack_lachtup_alert_cmd(object_id, True) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) if op_code == "27":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Copy ADC data to MRAM")
elif op_code == "18": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft( "!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM
(QueueCommands.PRINT, "PLOC Supervisor: Disable latchup alert")
) )
command = pack_lachtup_alert_cmd(object_id, False) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) if op_code == "30":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Run auto EM tests")
elif op_code == "20": command = pack_auto_em_tests_cmd(object_id.as_bytes)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set alert limit")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = pack_set_alert_limit_cmd(object_id) if op_code == "31":
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command) q.add_log_cmd("PLOC Supervisor: Wipe MRAM")
tc_queue.appendleft(command.pack_command_tuple()) command = pack_mram_wipe_cmd(object_id.as_bytes)
elif op_code == "23": q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft( if op_code == "35":
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels") q.add_log_cmd("PLOC Supervisor: Set GPIO command")
command = pack_set_gpio_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "36":
q.add_log_cmd("PLOC Supervisor: Read GPIO command")
command = pack_read_gpio_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "37":
q.add_log_cmd("PLOC Supervisor: Restart supervisor")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.RESTART_SUPERVISOR
) )
command = pack_set_adc_enabled_channels_cmd(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) if op_code == "38":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Factory reset clear all")
elif op_code == "24": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft( "!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC window and stride")
) )
command = pack_set_adc_window_and_stride_cmd(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) if op_code == "39":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Factory reset clear mirror entries")
elif op_code == "25": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC threshold"))
command = pack_set_adc_threshold_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "26":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report")
)
command = object_id + struct.pack("!I", SupvActionIds.GET_LATCHUP_STATUS_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "27":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM")
)
command = object_id + struct.pack("!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "30":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Run auto EM tests"))
command = pack_auto_em_tests_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "31":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Wipe MRAM"))
command = pack_mram_wipe_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "35":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set GPIO command"))
command = pack_set_gpio_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "36":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Read GPIO command"))
command = pack_read_gpio_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "37":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")
)
command = object_id + struct.pack("!I", SupvActionIds.RESTART_SUPERVISOR)
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "38":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")
)
command = object_id + struct.pack("!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "39":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries")
)
command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR "!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
) )
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "40":
elif op_code == "40": q.add_log_cmd("PLOC Supervisor: Factory reset clear circular entries")
tc_queue.appendleft( command = object_id.as_bytes + struct.pack(
(
QueueCommands.PRINT,
"PLOC Supervisor: Factory reset clear circular entries",
)
)
command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR "!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
) )
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "42":
elif op_code == "42": q.add_log_cmd("PLOC Supervisor: Perform update")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Perform update")) command = pack_update_command(object_id.as_bytes)
command = pack_update_command(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command) if op_code == "43":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Terminate supervisor process")
elif op_code == "43": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft( "!I", SupvActionIds.TERMINATE_SUPV_HELPER
(QueueCommands.PRINT, "PLOC Supervisor: Terminate supervisor process")
) )
command = object_id + struct.pack("!I", SupvActionIds.TERMINATE_SUPV_HELPER) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=58, app_data=command) if op_code == "44":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Start MPSoC quiet")
elif op_code == "44": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC quiet")) "!I", SupvActionIds.START_MPSOC_QUIET
command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC_QUIET)
command = PusTelecommand(service=8, subservice=128, ssc=59, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "45":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set shutdown timeout")
) )
command = pack_set_shutdown_timeout_command(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command) if op_code == "45":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
elif op_code == "46": command = pack_set_shutdown_timeout_command(object_id.as_bytes)
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory flash")) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", SupvActionIds.FACTORY_FLASH) if op_code == "46":
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command) q.add_log_cmd("PLOC Supervisor: Factory flash")
tc_queue.appendleft(command.pack_command_tuple()) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.FACTORY_FLASH)
elif op_code == "47": q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable auto TM")) if op_code == "47":
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_AUTO_TM) q.add_log_cmd("PLOC Supervisor: Enable auto TM")
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.ENABLE_AUTO_TM)
tc_queue.appendleft(command.pack_command_tuple()) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
elif op_code == "48": if op_code == "48":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable auto TM")) q.add_log_cmd("PLOC Supervisor: Disable auto TM")
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_AUTO_TM) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_AUTO_TM)
command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "51":
elif op_code == "51": q.add_log_cmd("PLOC Supervisor: Logging request event buffers")
tc_queue.appendleft( command = pack_logging_buffer_request(object_id.as_bytes)
(QueueCommands.PRINT, "PLOC Supervisor: Logging request event buffers") q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "52":
q.add_log_cmd("PLOC Supervisor: Logging clear counters")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.LOGGING_CLEAR_COUNTERS
) )
command = pack_logging_buffer_request(object_id) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command) if op_code == "53":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Logging set topic")
elif op_code == "52": command = pack_logging_set_topic(object_id.as_bytes)
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
(QueueCommands.PRINT, "PLOC Supervisor: Logging clear counters") if op_code == "54":
q.add_log_cmd("PLOC Supervisor: Logging request counters")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.LOGGING_REQUEST_COUNTERS
) )
command = object_id + struct.pack("!I", SupvActionIds.LOGGING_CLEAR_COUNTERS) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command) if op_code == "55":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Request ADC report")
elif op_code == "53": command = object_id.as_bytes + struct.pack(
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging set topic")) "!I", SupvActionIds.REQUEST_ADC_REPORT
command = pack_logging_set_topic(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "54":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Logging request counters")
) )
command = object_id + struct.pack("!I", SupvActionIds.LOGGING_REQUEST_COUNTERS) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command) if op_code == "56":
tc_queue.appendleft(command.pack_command_tuple()) q.add_log_cmd("PLOC Supervisor: Reset PL")
elif op_code == "55": command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_PL)
tc_queue.appendleft( q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
(QueueCommands.PRINT, "PLOC Supervisor: Request ADC report") if op_code == "57":
) q.add_log_cmd("PLOC Supervisor: Enable NVMs")
command = object_id + struct.pack("!I", SupvActionIds.REQUEST_ADC_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "56":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset PL"))
command = object_id + struct.pack("!I", SupvActionIds.RESET_PL)
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "57":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable NVMs"))
nvm01 = int(input("Enable (1) or disable(0) NVM 0 and 1: ")) nvm01 = int(input("Enable (1) or disable(0) NVM 0 and 1: "))
nvm3 = int(input("Enable (1) or disable(0) NVM 3: ")) nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
command = ( command = (
object_id object_id.as_bytes
+ struct.pack("!I", SupvActionIds.ENABLE_NVMS) + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
+ struct.pack("B", nvm01) + struct.pack("B", nvm01)
+ struct.pack("B", nvm3) + struct.pack("B", nvm3)
) )
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple()) if op_code == "58":
elif op_code == "58": q.add_log_cmd("PLOC Supervisor: Continue update")
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Continue update")) command = object_id.as_bytes + struct.pack("!I", SupvActionIds.CONTINUE_UPDATE)
command = object_id + struct.pack("!I", SupvActionIds.CONTINUE_UPDATE) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = PusTelecommand(service=8, subservice=128, ssc=73, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_sel_boot_image_cmd( def pack_sel_boot_image_cmd(
object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
) -> bytearray: ) -> bytearray:
"""This function can be used to generate the command to select the image from which the MPSoC will boot """This function can be used to generate the command to select the image from which the MPSoC will boot
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -422,10 +347,10 @@ def pack_sel_boot_image_cmd(
command = command + struct.pack("!B", bp0) command = command + struct.pack("!B", bp0)
command = command + struct.pack("!B", bp1) command = command + struct.pack("!B", bp1)
command = command + struct.pack("!B", bp2) command = command + struct.pack("!B", bp2)
return command return bytearray(command)
def pack_update_available_cmd(object_id: bytearray) -> bytearray: def pack_update_available_cmd(object_id: bytes) -> bytearray:
""" """
@brief This function packs the udpate availabe command. @brief This function packs the udpate availabe command.
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -441,10 +366,10 @@ def pack_update_available_cmd(object_id: bytearray) -> bytearray:
command = command + struct.pack("!I", image_size) command = command + struct.pack("!I", image_size)
command = command + struct.pack("!I", image_crc) command = command + struct.pack("!I", image_crc)
command = command + struct.pack("!I", number_of_packets) command = command + struct.pack("!I", number_of_packets)
return command return bytearray(command)
def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray: def pack_watchdogs_enable_cmd(object_id: bytes) -> bytearray:
""" """
@brief This function packs the command to enable or disable watchdogs on the PLOC. @brief This function packs the command to enable or disable watchdogs on the PLOC.
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -458,7 +383,7 @@ def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray:
command = command + struct.pack("!B", watchdog_ps) command = command + struct.pack("!B", watchdog_ps)
command = command + struct.pack("!B", watchdog_pl) command = command + struct.pack("!B", watchdog_pl)
command = command + struct.pack("!B", watchdog_int) command = command + struct.pack("!B", watchdog_int)
return command return bytearray(command)
def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray: def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray:
@ -475,7 +400,7 @@ def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray:
return command return command
def pack_lachtup_alert_cmd(object_id: bytearray, state: bool) -> bytearray: def pack_lachtup_alert_cmd(object_id: bytes, state: bool) -> bytearray:
""" """
@brief This function packs the command to enable or disable a certain latchup alerts. @brief This function packs the command to enable or disable a certain latchup alerts.
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -488,7 +413,7 @@ def pack_lachtup_alert_cmd(object_id: bytearray, state: bool) -> bytearray:
else: else:
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT) command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
command = command + struct.pack("!B", latchup_id) command = command + struct.pack("!B", latchup_id)
return command return bytearray(command)
def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray: def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
@ -521,7 +446,7 @@ def get_latchup_id() -> int:
return int(input("Specify latchup ID: ")) return int(input("Specify latchup ID: "))
def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray: def pack_set_alert_limit_cmd(object_id: bytes) -> bytearray:
""" """
@brief This function packs the command to set the limit of a latchup alert. @brief This function packs the command to set the limit of a latchup alert.
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -532,10 +457,10 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT) command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
command = command + struct.pack("!B", latchup_id) command = command + struct.pack("!B", latchup_id)
command = command + struct.pack("!I", dutycycle) command = command + struct.pack("!I", dutycycle)
return command return bytearray(command)
def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray: def pack_set_adc_enabled_channels_cmd(object_id: bytes) -> bytearray:
""" """
@brief This function packs the command to enable or disable channels of the ADC. @brief This function packs the command to enable or disable channels of the ADC.
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@ -543,54 +468,49 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray:
ch = int(input("Specify ch: 0x"), 16) ch = int(input("Specify ch: 0x"), 16)
cmd = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS) cmd = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
cmd = cmd + struct.pack("!H", ch) cmd = cmd + struct.pack("!H", ch)
return cmd return bytearray(cmd)
def pack_set_adc_window_and_stride_cmd(object_id: bytearray) -> bytearray: def pack_set_adc_window_and_stride_cmd(object_id: bytes) -> bytearray:
window_size = int(input("Specify window size: ")) window_size = int(input("Specify window size: "))
striding_step_size = int(input("Specify striding step size: ")) striding_step_size = int(input("Specify striding step size: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
command = command + struct.pack("!H", window_size) command = command + struct.pack("!H", window_size)
command = command + struct.pack("!H", striding_step_size) command = command + struct.pack("!H", striding_step_size)
return command return bytearray(command)
def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray: def pack_set_adc_threshold_cmd(object_id: bytes) -> bytearray:
threshold = int(input("Specify threshold: ")) threshold = int(input("Specify threshold: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
command = command + struct.pack("!I", threshold) command = command + struct.pack("!I", threshold)
return command return bytearray(command)
def pack_select_nvm_cmd(object_id: bytearray) -> bytearray: def pack_select_nvm_cmd(object_id: bytes) -> bytearray:
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1): ")) mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1): "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM) command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
command = command + struct.pack("!B", mem) command = command + struct.pack("!B", mem)
return command return bytearray(command)
def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray: def pack_auto_em_tests_cmd(object_id: bytes) -> bytearray:
test = int(input("Specify test (1 - complete, 2 - short): ")) test = int(input("Specify test (1 - complete, 2 - short): "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS) command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
command = command + struct.pack("!B", test) command = command + struct.pack("!B", test)
return command return bytearray(command)
def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray: def pack_mram_wipe_cmd(object_id: bytes) -> bytearray:
start = int(input("Start address: 0x"), 16) start = int(input("Start address: 0x"), 16)
stop = int(input("Stop address: 0x"), 16) stop = int(input("Stop address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM) command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
command = command + struct.pack("!I", start) command = command + struct.pack("!I", start)
command = command + struct.pack("!I", stop) command = command + struct.pack("!I", stop)
return command return bytearray(command)
def pack_update_command(object_id: bytearray) -> bytearray: def pack_update_command(object_id: bytes) -> bytearray:
command = bytearray() command = bytearray()
memory_id = int(input("Specify memory ID: ")) memory_id = int(input("Specify memory ID: "))
start_address = int(input("Specify start address: 0x"), 16) start_address = int(input("Specify start address: 0x"), 16)
@ -602,10 +522,10 @@ def pack_update_command(object_id: bytearray) -> bytearray:
command += struct.pack("!B", 0) command += struct.pack("!B", 0)
command += struct.pack("!B", memory_id) command += struct.pack("!B", memory_id)
command += struct.pack("!I", start_address) command += struct.pack("!I", start_address)
return command return bytearray(command)
def pack_set_shutdown_timeout_command(object_id: bytearray) -> bytearray: def pack_set_shutdown_timeout_command(object_id: bytes) -> bytearray:
command = bytearray() command = bytearray()
command += object_id command += object_id
command += struct.pack("!I", SupvActionIds.SET_SHUTDOWN_TIMEOUT) command += struct.pack("!I", SupvActionIds.SET_SHUTDOWN_TIMEOUT)
@ -614,7 +534,7 @@ def pack_set_shutdown_timeout_command(object_id: bytearray) -> bytearray:
return command return command
def pack_logging_buffer_request(object_id: bytearray) -> bytearray: def pack_logging_buffer_request(object_id: bytes) -> bytearray:
command = bytearray() command = bytearray()
command += object_id command += object_id
command += struct.pack("!I", SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS) command += struct.pack("!I", SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
@ -623,7 +543,7 @@ def pack_logging_buffer_request(object_id: bytearray) -> bytearray:
return command return command
def pack_set_gpio_cmd(object_id: bytearray) -> bytearray: def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
port = int(input("Specify port: 0x"), 16) port = int(input("Specify port: 0x"), 16)
pin = int(input("Specify pin: 0x"), 16) pin = int(input("Specify pin: 0x"), 16)
val = int(input("Specify val: 0x"), 16) val = int(input("Specify val: 0x"), 16)
@ -631,23 +551,23 @@ def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
command = command + struct.pack("!B", port) command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin) command = command + struct.pack("!B", pin)
command = command + struct.pack("!B", val) command = command + struct.pack("!B", val)
return command return bytearray(command)
def pack_read_gpio_cmd(object_id: bytearray) -> bytearray: def pack_read_gpio_cmd(object_id: bytes) -> bytearray:
port = int(input("Specify port: 0x"), 16) port = int(input("Specify port: 0x"), 16)
pin = int(input("Specify pin: 0x"), 16) pin = int(input("Specify pin: 0x"), 16)
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO) command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
command = command + struct.pack("!B", port) command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin) command = command + struct.pack("!B", pin)
return command return bytearray(command)
def pack_logging_set_topic(objetc_id: bytearray) -> bytearray: def pack_logging_set_topic(object_id: bytes) -> bytearray:
command = objetc_id + struct.pack("!I", SupvActionIds.LOGGING_SET_TOPIC) command = object_id + struct.pack("!I", SupvActionIds.LOGGING_SET_TOPIC)
tpc = int(input("Specify logging topic: ")) tpc = int(input("Specify logging topic: "))
command += struct.pack("!B", tpc) command += struct.pack("!B", tpc)
return command return bytearray(command)
def get_update_file() -> str: def get_update_file() -> str:

View File

@ -4,15 +4,11 @@ import time
from typing import Optional from typing import Optional
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import ( from tmtccmd.config import TmTcDefWrapper
QueueCommands,
ServiceOpCodeDictT, from tmtccmd.config.tmtc import OpCodeEntry
add_op_code_entry, from tmtccmd.tc import QueueHelper
add_service_op_code_entry,
)
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
make_sid, make_sid,
generate_one_diag_command, generate_one_diag_command,
) )
@ -118,97 +114,49 @@ class ParamIds(enum.IntEnum):
INJECT_ALL_ON_FAILURE = 35 INJECT_ALL_ON_FAILURE = 35
def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): def add_pl_pcdu_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
) oce.add(keys=OpCodes.NORMAL_SSR, info=Info.NORMAL_SSR)
add_op_code_entry( oce.add(keys=OpCodes.NORMAL_DRO, info=Info.NORMAL_DRO)
op_code_dict=op_code_dict, keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF oce.add(keys=OpCodes.NORMAL_X8, info=Info.NORMAL_X8)
) oce.add(keys=OpCodes.NORMAL_TX, info=Info.NORMAL_TX)
add_op_code_entry( oce.add(keys=OpCodes.NORMAL_MPA, info=Info.NORMAL_MPA)
op_code_dict=op_code_dict, oce.add(keys=OpCodes.NORMAL_HPA, info=Info.NORMAL_HPA)
keys=OpCodes.NORMAL_SSR, oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
info=Info.NORMAL_SSR, oce.add(
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL_DRO,
info=Info.NORMAL_DRO,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL_X8,
info=Info.NORMAL_X8,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL_TX,
info=Info.NORMAL_TX,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL_MPA,
info=Info.NORMAL_MPA,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL_HPA,
info=Info.NORMAL_HPA,
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.INJECT_SSR_TO_DRO_FAILURE, keys=OpCodes.INJECT_SSR_TO_DRO_FAILURE,
info="Inject failure SSR to DRO transition", info="Inject failure SSR to DRO transition",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=OpCodes.INJECT_DRO_TO_X8_FAILURE, keys=OpCodes.INJECT_DRO_TO_X8_FAILURE,
info="Inject failure in DRO to X8 transition", info="Inject failure in DRO to X8 transition",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=OpCodes.INJECT_X8_TO_TX_FAILURE, keys=OpCodes.INJECT_X8_TO_TX_FAILURE,
info="Inject failure in X8 to TX transition", info="Inject failure in X8 to TX transition",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=OpCodes.INJECT_TX_TO_MPA_FAILURE, keys=OpCodes.INJECT_TX_TO_MPA_FAILURE,
info="Inject failure in TX to MPA transition", info="Inject failure in TX to MPA transition",
) )
add_op_code_entry( oce.add(
op_code_dict=op_code_dict,
keys=OpCodes.INJECT_MPA_TO_HPA_FAILURE, keys=OpCodes.INJECT_MPA_TO_HPA_FAILURE,
info="Inject failure in MPA to HPA transition", info="Inject failure in MPA to HPA transition",
) )
add_op_code_entry( oce.add(keys=OpCodes.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
op_code_dict=op_code_dict, defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
keys=OpCodes.INJECT_ALL_ON_FAILURE,
info="Inject failure in all on mode",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.PL_PCDU.value,
info="PL PCDU",
op_code_entry=op_code_dict,
)
def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): def pack_pl_pcdu_commands(q: QueueHelper, op_code: str):
if op_code in OpCodes.SWITCH_ON: if op_code in OpCodes.SWITCH_ON:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Modes.ON, submode=0)
tc_queue=tc_queue, info=Info.SWITCH_ON, mode=Modes.ON, submode=0
)
if op_code in OpCodes.SWITCH_OFF: if op_code in OpCodes.SWITCH_OFF:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_OFF, mode=Modes.OFF, submode=0)
tc_queue=tc_queue, info=Info.SWITCH_OFF, mode=Modes.OFF, submode=0
)
if op_code in OpCodes.NORMAL_SSR: if op_code in OpCodes.NORMAL_SSR:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_SSR, info=Info.NORMAL_SSR,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode( submode=submode_mask_to_submode(
@ -217,64 +165,63 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
) )
if op_code in OpCodes.NORMAL_DRO: if op_code in OpCodes.NORMAL_DRO:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_DRO, info=Info.NORMAL_DRO,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON), submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
) )
if op_code in OpCodes.NORMAL_X8: if op_code in OpCodes.NORMAL_X8:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_X8, info=Info.NORMAL_X8,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON), submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
) )
if op_code in OpCodes.NORMAL_TX: if op_code in OpCodes.NORMAL_TX:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_TX, info=Info.NORMAL_TX,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON), submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
) )
if op_code in OpCodes.NORMAL_MPA: if op_code in OpCodes.NORMAL_MPA:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_MPA, info=Info.NORMAL_MPA,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON), submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
) )
if op_code in OpCodes.NORMAL_HPA: if op_code in OpCodes.NORMAL_HPA:
pack_pl_pcdu_mode_cmd( pack_pl_pcdu_mode_cmd(
tc_queue=tc_queue, q=q,
info=Info.NORMAL_HPA, info=Info.NORMAL_HPA,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON), submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
) )
if op_code in OpCodes.REQ_OS_HK: if op_code in OpCodes.REQ_OS_HK:
tc_queue.appendleft((QueueCommands.PRINT, f"PL PCDU: {Info.REQ_OS_HK}")) q.add_log_cmd(f"PL PCDU: {Info.REQ_OS_HK}")
cmd = generate_one_diag_command( q.add_pus_tc(
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetIds.ADC), ssc=0 generate_one_diag_command(
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetIds.ADC)
)
) )
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.SWITCH_HPA_ON_PROC: if op_code in OpCodes.SWITCH_HPA_ON_PROC:
hpa_on_procedure(tc_queue) hpa_on_procedure(q)
if op_code in OpCodes.INJECT_ALL_ON_FAILURE: if op_code in OpCodes.INJECT_ALL_ON_FAILURE:
pack_failure_injection_cmd( pack_failure_injection_cmd(
tc_queue=tc_queue, q=q,
param_id=ParamIds.INJECT_ALL_ON_FAILURE, param_id=ParamIds.INJECT_ALL_ON_FAILURE,
print_str="All On", print_str="All On",
) )
def hpa_on_procedure(tc_queue: TcQueueT): def hpa_on_procedure(q: QueueHelper):
delay_dro_to_x8 = request_wait_time() delay_dro_to_x8 = request_wait_time()
if delay_dro_to_x8 is None: if delay_dro_to_x8 is None:
delay_dro_to_x8 = 900 delay_dro_to_x8 = 900
tc_queue.appendleft( q.add_log_cmd(
( f"Starting procedure to switch on PL PCDU HPA with DRO to X8 "
QueueCommands.PRINT, f"delay of {delay_dro_to_x8} seconds"
f"Starting procedure to switch on PL PCDU HPA with DRO to X8 delay of {delay_dro_to_x8} seconds",
)
) )
pl_pcdu_on = PusTelecommand( pl_pcdu_on = PusTelecommand(
service=200, service=200,
@ -339,54 +286,52 @@ def hpa_on_procedure(tc_queue: TcQueueT):
) )
current_time = time.time() current_time = time.time()
enb_sched = generate_enable_tc_sched_cmd(ssc=0) enb_sched = generate_enable_tc_sched_cmd()
sched_time = current_time + 10 sched_time = current_time + 10
tc_queue.appendleft(enb_sched.pack_command_tuple()) q.add_pus_tc(enb_sched)
tagged_on_cmd = generate_time_tagged_cmd( tagged_on_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), release_time=struct.pack("!I", sched_time),
tc_to_insert=pl_pcdu_on, tc_to_insert=pl_pcdu_on,
ssc=1,
) )
tc_queue.appendleft(tagged_on_cmd.pack_command_tuple()) q.add_pus_tc(tagged_on_cmd)
sched_time += 5 sched_time += 5
tagged_ssr_cmd = generate_time_tagged_cmd( tagged_ssr_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), release_time=struct.pack("!I", sched_time),
tc_to_insert=ssr_on, tc_to_insert=ssr_on,
ssc=2,
) )
tc_queue.appendleft(tagged_ssr_cmd.pack_command_tuple()) q.add_pus_tc(tagged_ssr_cmd)
sched_time += 5 sched_time += 5
tagged_dro_cmd = generate_time_tagged_cmd( tagged_dro_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), tc_to_insert=dro_on, ssc=3 release_time=struct.pack("!I", sched_time), tc_to_insert=dro_on
) )
tc_queue.appendleft(tagged_dro_cmd.pack_command_tuple()) q.add_pus_tc(tagged_dro_cmd)
sched_time += delay_dro_to_x8 sched_time += delay_dro_to_x8
tagged_x8_cmd = generate_time_tagged_cmd( tagged_x8_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), tc_to_insert=x8_on, ssc=4 release_time=struct.pack("!I", sched_time), tc_to_insert=x8_on
) )
tc_queue.appendleft(tagged_x8_cmd.pack_command_tuple()) q.add_pus_tc(tagged_x8_cmd)
sched_time += 5 sched_time += 5
tagged_tx_cmd = generate_time_tagged_cmd( tagged_tx_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), tc_to_insert=tx_on, ssc=5 release_time=struct.pack("!I", sched_time), tc_to_insert=tx_on
) )
tc_queue.appendleft(tagged_tx_cmd.pack_command_tuple()) q.add_pus_tc(tagged_tx_cmd)
sched_time += 5 sched_time += 5
tagged_mpa_cmd = generate_time_tagged_cmd( tagged_mpa_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), tc_to_insert=mpa_on, ssc=6 release_time=struct.pack("!I", sched_time), tc_to_insert=mpa_on
) )
tc_queue.appendleft(tagged_mpa_cmd.pack_command_tuple()) q.add_pus_tc(tagged_mpa_cmd)
sched_time += 5 sched_time += 5
tagged_hpa_cmd = generate_time_tagged_cmd( tagged_hpa_cmd = generate_time_tagged_cmd(
release_time=struct.pack("!I", sched_time), tc_to_insert=hpa_on, ssc=7 release_time=struct.pack("!I", sched_time), tc_to_insert=hpa_on
) )
tc_queue.appendleft(tagged_hpa_cmd.pack_command_tuple()) q.add_pus_tc(tagged_hpa_cmd)
def request_wait_time() -> Optional[float]: def request_wait_time() -> Optional[float]:
@ -444,11 +389,9 @@ def submode_mask_to_submode(on_tgt: NormalSubmodesMask) -> int:
) )
def pack_wait_time_cmd(tc_queue: TcQueueT, param_id: int, print_str: str): def pack_wait_time_cmd(q: QueueHelper, param_id: int, print_str: str):
wait_time = request_wait_time() wait_time = request_wait_time()
tc_queue.appendleft( q.add_log_cmd(f"Updating {print_str} wait time to {wait_time}")
(QueueCommands.PRINT, f"Updating {print_str} wait time to {wait_time}")
)
if wait_time is None: if wait_time is None:
return return
param_data = pack_scalar_double_param_app_data( param_data = pack_scalar_double_param_app_data(
@ -457,28 +400,22 @@ def pack_wait_time_cmd(tc_queue: TcQueueT, param_id: int, print_str: str):
unique_id=param_id, unique_id=param_id,
parameter=wait_time, parameter=wait_time,
) )
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) q.add_pus_tc(pack_fsfw_load_param_cmd(app_data=param_data))
tc_queue.appendleft(cmd.pack_command_tuple())
def pack_failure_injection_cmd(tc_queue: TcQueueT, param_id: int, print_str: str): def pack_failure_injection_cmd(q: QueueHelper, param_id: int, print_str: str):
tc_queue.appendleft((QueueCommands.PRINT, f"Inserting {print_str} error")) q.add_log_cmd(f"Inserting {print_str} error")
param_data = pack_boolean_parameter_app_data( param_data = pack_boolean_parameter_app_data(
object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True
) )
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data) q.add_pus_tc(pack_fsfw_load_param_cmd(app_data=param_data))
tc_queue.appendleft(cmd.pack_command_tuple())
def pack_pl_pcdu_mode_cmd(tc_queue: TcQueueT, info: str, mode: Modes, submode: int): def pack_pl_pcdu_mode_cmd(q: QueueHelper, info: str, mode: Modes, submode: int):
tc_queue.appendleft( q.add_log_cmd(info)
(
QueueCommands.PRINT,
info,
)
)
mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=mode, submode=submode) mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=mode, submode=submode)
mode_cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
) )
tc_queue.appendleft(mode_cmd.pack_command_tuple()) )

View File

@ -8,14 +8,13 @@
import struct import struct
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT, OpCodeDictKeys
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data, Modes from pus_tc.service_200_mode import pack_mode_data, Modes
from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectIdU32
class SetIds: class SetIds:
@ -47,64 +46,48 @@ class CommandIds:
DISABLE_DEBUG_OUTPUT = 5 DISABLE_DEBUG_OUTPUT = 5
def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT): def add_rad_sens_cmds(defs: TmTcDefWrapper):
oce = OpCodeEntry()
op_code_dict = dict() oce.add(info=Info.ON, keys=OpCodes.ON)
add_op_code_entry(op_code_dict=op_code_dict, info=Info.ON, keys=OpCodes.ON) oce.add(info=Info.OFF, keys=OpCodes.OFF)
add_op_code_entry(op_code_dict=op_code_dict, info=Info.OFF, keys=OpCodes.OFF) oce.add(info=Info.NORMAL, keys=OpCodes.NORMAL)
add_op_code_entry(op_code_dict=op_code_dict, info=Info.NORMAL, keys=OpCodes.NORMAL) oce.add(info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE)
add_op_code_entry( oce.add(info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON)
op_code_dict=op_code_dict, info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE oce.add(info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF)
) defs.add_service(
add_op_code_entry(
op_code_dict=op_code_dict, info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON
)
add_op_code_entry(
op_code_dict=op_code_dict, info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.RAD_SENSOR.value, name=CustomServiceList.RAD_SENSOR.value,
info="Radiation Sensor", info="Radiation Sensor",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def pack_rad_sensor_test_into(object_id: ObjectId, tc_queue: TcQueueT, op_code: str): def pack_rad_sensor_test_into(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
tc_queue.appendleft( q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
(QueueCommands.PRINT, f"Commanding Radiation sensor handler {object_id}")
)
if op_code in OpCodes.ON: if op_code in OpCodes.ON:
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, tc_queue) rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, q)
if op_code in OpCodes.NORMAL: if op_code in OpCodes.NORMAL:
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, tc_queue) rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, q)
if op_code in OpCodes.OFF: if op_code in OpCodes.OFF:
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, tc_queue) rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, q)
if op_code in OpCodes.REQ_HK_ONCE: if op_code in OpCodes.REQ_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.REQ_OS_HK}")) q.add_log_cmd(f"Rad sensor: {Info.REQ_OS_HK}")
cmd = generate_one_hk_command( q.add_pus_tc(
sid=make_sid(object_id.as_bytes, set_id=SetIds.HK), ssc=0 generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetIds.HK))
) )
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.DEBUG_ON: if op_code in OpCodes.DEBUG_ON:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_ON}")) q.add_log_cmd(f"Rad sensor: {Info.DEBUG_ON}")
command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT) command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodes.DEBUG_OFF: if op_code in OpCodes.DEBUG_OFF:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_OFF}")) q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
command = object_id.as_bytes + struct.pack( command = object_id.as_bytes + struct.pack(
"!I", CommandIds.DISABLE_DEBUG_OUTPUT "!I", CommandIds.DISABLE_DEBUG_OUTPUT
) )
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
def rad_sensor_mode_cmd( def rad_sensor_mode_cmd(object_id: ObjectIdU32, mode: Modes, info: str, q: QueueHelper):
object_id: ObjectId, mode: Modes, info: str, tc_queue: TcQueueT q.add_log_cmd(f"Rad sensor: {info}")
):
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {info}"))
mode_data = pack_mode_data(object_id.as_bytes, mode, 0) mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -5,14 +5,14 @@
@date 20.06.2021 @date 20.06.2021
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command, generate_one_hk_command,
generate_one_diag_command, generate_one_diag_command,
make_sid, make_sid,
) )
from tmtccmd.config.globals import add_op_code_entry, add_service_op_code_entry
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
@ -75,128 +75,111 @@ class RampTime:
MS_1000 = 1000 MS_1000 = 1000
def add_rw_cmds(cmd_dict: ServiceOpCodeDictT): def add_rw_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry( oce.add(info=InfoDevs.SPEED, keys=OpCodesDevs.SPEED)
op_code_dict=op_code_dict, info=InfoDevs.SPEED, keys=OpCodesDevs.SPEED oce.add(info=InfoDevs.ON, keys=OpCodesDevs.ON)
) oce.add(info=InfoDevs.OFF, keys=OpCodesDevs.OFF)
add_op_code_entry(op_code_dict=op_code_dict, info=InfoDevs.ON, keys=OpCodesDevs.ON) oce.add(info=InfoDevs.NML, keys=OpCodesDevs.NML)
add_op_code_entry( oce.add(info=InfoDevs.GET_STATUS, keys=OpCodesDevs.GET_STATUS)
op_code_dict=op_code_dict, info=InfoDevs.OFF, keys=OpCodesDevs.OFF oce.add(info=InfoDevs.GET_TM, keys=OpCodesDevs.GET_TM)
) defs.add_service(
add_op_code_entry(
op_code_dict=op_code_dict, info=InfoDevs.NML, keys=OpCodesDevs.NML
)
add_op_code_entry(
op_code_dict=op_code_dict, info=InfoDevs.GET_STATUS, keys=OpCodesDevs.GET_STATUS
)
add_op_code_entry(
op_code_dict=op_code_dict, info=InfoDevs.GET_TM, keys=OpCodesDevs.GET_TM
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.REACTION_WHEEL_1.value, name=CustomServiceList.REACTION_WHEEL_1.value,
op_code_entry=op_code_dict,
info="Reaction Wheel 1", info="Reaction Wheel 1",
op_code_entry=oce,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.REACTION_WHEEL_2.value, name=CustomServiceList.REACTION_WHEEL_2.value,
op_code_entry=op_code_dict,
info="Reaction Wheel 2", info="Reaction Wheel 2",
op_code_entry=oce,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.REACTION_WHEEL_3.value, name=CustomServiceList.REACTION_WHEEL_3.value,
op_code_entry=op_code_dict,
info="Reaction Wheel 3", info="Reaction Wheel 3",
op_code_entry=oce,
) )
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.REACTION_WHEEL_4.value, name=CustomServiceList.REACTION_WHEEL_4.value,
op_code_entry=op_code_dict,
info="Reaction Wheel 4", info="Reaction Wheel 4",
op_code_entry=oce,
) )
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.ON, keys=OpCodesAss.ON) oce.add(info=InfoAss.ON, keys=OpCodesAss.ON)
add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.NML, keys=OpCodesAss.NML) oce.add(info=InfoAss.NML, keys=OpCodesAss.NML)
add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.OFF, keys=OpCodesAss.OFF) oce.add(info=InfoAss.OFF, keys=OpCodesAss.OFF)
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.RW_ASSEMBLY.value, name=CustomServiceList.RW_ASSEMBLY.value,
op_code_entry=op_code_dict,
info="Reaction Wheel Assembly", info="Reaction Wheel Assembly",
op_code_entry=oce,
) )
def pack_single_rw_test_into( def pack_single_rw_test_into(
object_id: bytes, rw_idx: int, tc_queue: TcQueueT, op_code: str object_id: bytes, rw_idx: int, q: QueueHelper, op_code: str
) -> TcQueueT: ):
if op_code in OpCodesDevs.SPEED: if op_code in OpCodesDevs.SPEED:
speed = int(input("Specify speed [0.1 RPM]: ")) speed = int(input("Specify speed [0.1 RPM]: "))
ramp_time = int(input("Specify ramp time [ms]: ")) ramp_time = int(input("Specify ramp time [ms]: "))
tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.SPEED}")) q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.SPEED}")
command = pack_set_speed_command(object_id, speed, ramp_time, 40) q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodesDevs.ON: if op_code in OpCodesDevs.ON:
tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.ON}")) q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.ON}")
mode_data = pack_mode_data(object_id, Modes.ON, 0) mode_data = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodesDevs.NML: if op_code in OpCodesDevs.NML:
tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.NML}")) q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.NML}")
mode_data = pack_mode_data(object_id, Modes.NORMAL, 0) mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodesDevs.OFF: if op_code in OpCodesDevs.OFF:
tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.OFF}")) q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.OFF}")
mode_data = pack_mode_data(object_id, Modes.OFF, 0) mode_data = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=43, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodesDevs.GET_TM: if op_code in OpCodesDevs.GET_TM:
tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.GET_TM}")) q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.GET_TM}")
command = generate_one_hk_command( q.add_pus_tc(
sid=make_sid(object_id=object_id, set_id=RwSetIds.TM_SET), ssc=0 generate_one_hk_command(
sid=make_sid(object_id=object_id, set_id=RwSetIds.TM_SET)
)
) )
tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodesDevs.GET_STATUS: if op_code in OpCodesDevs.GET_STATUS:
tc_queue.appendleft( q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.GET_STATUS}")
(QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.GET_STATUS}") q.add_pus_tc(
generate_one_diag_command(
sid=make_sid(object_id=object_id, set_id=RwSetIds.STATUS_SET_ID)
) )
command = generate_one_diag_command(
sid=make_sid(object_id=object_id, set_id=RwSetIds.STATUS_SET_ID), ssc=0
) )
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_rw_ass_cmds(tc_queue: TcQueueT, object_id: bytes, op_code: str): def pack_rw_ass_cmds(q: QueueHelper, object_id: bytes, op_code: str):
if op_code in OpCodesAss.OFF: if op_code in OpCodesAss.OFF:
data = pack_mode_data(object_id=object_id, mode=Modes.OFF, submode=0) data = pack_mode_data(object_id=object_id, mode=Modes.OFF, submode=0)
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodesAss.ON: if op_code in OpCodesAss.ON:
data = pack_mode_data(object_id=object_id, mode=Modes.ON, submode=0) data = pack_mode_data(object_id=object_id, mode=Modes.ON, submode=0)
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodesAss.NML: if op_code in OpCodesAss.NML:
data = pack_mode_data(object_id=object_id, mode=Modes.NORMAL, submode=0) data = pack_mode_data(object_id=object_id, mode=Modes.NORMAL, submode=0)
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
def pack_set_speed_command( def pack_set_speed_command(
object_id: bytes, speed: int, ramp_time_ms: int, ssc: int object_id: bytes, speed: int, ramp_time_ms: int
) -> PusTelecommand: ) -> PusTelecommand:
"""With this function a command is packed to set the speed of a reaction wheel """With this function a command is packed to set the speed of a reaction wheel
:param object_id: The object id of the reaction wheel handler. :param object_id: The object id of the reaction wheel handler.
@ -204,7 +187,6 @@ def pack_set_speed_command(
specified in 0.1 * RPM specified in 0.1 * RPM
:param ramp_time_ms: The time after which the reaction wheel will reach the commanded speed. :param ramp_time_ms: The time after which the reaction wheel will reach the commanded speed.
Valid times are 10 - 10000 ms Valid times are 10 - 10000 ms
:param ssc: Source sequence count
""" """
if speed > 0: if speed > 0:
if speed < 1000 or speed > 65000: if speed < 1000 or speed > 65000:
@ -231,5 +213,5 @@ def pack_set_speed_command(
command += object_id + command_id command += object_id + command_id
command = command + struct.pack("!i", speed) command = command + struct.pack("!i", speed)
command = command + ramp_time_ms.to_bytes(length=2, byteorder="big") command = command + ramp_time_ms.to_bytes(length=2, byteorder="big")
command = PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=command) command = PusTelecommand(service=8, subservice=128, app_data=command)
return command return command

View File

@ -1,14 +1,12 @@
from typing import Optional from typing import Optional
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from pus_tc.devs.pdec_handler import CommandIds
from spacepackets.ecss import PusTelecommand from spacepackets.ecss import PusTelecommand
from tmtccmd.config import ( from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
ServiceOpCodeDictT,
add_op_code_entry, from tmtccmd.tc import QueueHelper
add_service_op_code_entry, from tmtccmd.utility import ObjectIdU32
)
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.utility import ObjectId
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
import config.object_ids as oids import config.object_ids as oids
from config.object_ids import get_object_ids from config.object_ids import get_object_ids
@ -47,20 +45,17 @@ class Info:
WIRTE_CONFIG = "Write config" WIRTE_CONFIG = "Write config"
def specify_rtd_cmds(cmd_dict: ServiceOpCodeDictT): def specify_rtd_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.ON, info=Info.ON) oce.add(keys=OpCodes.ON, info=Info.ON)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.NORMAL, info=Info.NORMAL) oce.add(keys=OpCodes.NORMAL, info=Info.NORMAL)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.OFF, info=Info.OFF) oce.add(keys=OpCodes.OFF, info=Info.OFF)
add_service_op_code_entry( defs.add_service(
srv_op_code_dict=cmd_dict, name=CustomServiceList.RTD.value, info="RTD commands", op_code_entry=oce
op_code_entry=op_code_dict,
name=CustomServiceList.RTD.value,
info="RTD commands",
) )
def pack_rtd_commands(op_code: str, object_id: Optional[ObjectId], tc_queue: TcQueueT): def pack_rtd_commands(op_code: str, object_id: Optional[ObjectIdU32], q: QueueHelper):
if object_id is not None and object_id not in RTD_IDS: if object_id is not None and object_id not in RTD_IDS:
print("Specified object ID not a valid RTD ID") print("Specified object ID not a valid RTD ID")
object_id = None object_id = None
@ -72,30 +67,32 @@ def pack_rtd_commands(op_code: str, object_id: Optional[ObjectId], tc_queue: TcQ
app_data = pack_mode_data( app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.ON, submode=0 object_id=object_id.as_bytes, mode=Modes.ON, submode=0
) )
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodes.NORMAL: if op_code in OpCodes.NORMAL:
app_data = pack_mode_data( app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0 object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0
) )
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodes.OFF: if op_code in OpCodes.OFF:
app_data = pack_mode_data( app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.OFF, submode=0 object_id=object_id.as_bytes, mode=Modes.OFF, submode=0
) )
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodes.CONFIG_CMD: if op_code in OpCodes.CONFIG_CMD:
command = object_id + CommandIds.PRINT_CLCW command = object_id.as_bytes + CommandIds.PRINT_CLCW
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
def prompt_rtd_idx(): def prompt_rtd_idx():

View File

@ -5,18 +5,16 @@
@author J. Meier @author J. Meier
@date 15.02.2021 @date 15.02.2021
""" """
from tmtccmd.config.definitions import QueueCommands from spacepackets.ecss import PusTelecommand
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc import QueueHelper
from tmtccmd.tc.packer import PusTelecommand
class ActionIds: class ActionIds:
DEPLOY_SOLAR_ARRAYS = bytearray([0x0, 0x0, 0x0, 0x5]) DEPLOY_SOLAR_ARRAYS = bytearray([0x0, 0x0, 0x0, 0x5])
def pack_solar_array_deployment_test_into(object_id: bytearray, tc_queue: TcQueueT): def pack_solar_array_deployment_test_into(object_id: bytearray, q: QueueHelper):
tc_queue.appendleft((QueueCommands.PRINT, "Testing S/A Deployment")) q.add_log_cmd("Testing S/A Deployment")
command = object_id + ActionIds.DEPLOY_SOLAR_ARRAYS command = object_id + ActionIds.DEPLOY_SOLAR_ARRAYS
command = PusTelecommand(service=8, subservice=128, ssc=200, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -7,12 +7,12 @@
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc import QueueHelper
from tmtccmd.utility import ObjectIdU32
from utility.input_helper import InputHelper from utility.input_helper import InputHelper
@ -150,623 +150,483 @@ class Submode:
FIRMWARE = 2 FIRMWARE = 2
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): def pack_star_tracker_commands(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
tc_queue.appendleft( q.add_log_cmd(
( f"Generate command for star tracker with object id: {object_id.as_hex_string}"
QueueCommands.PRINT,
"Generate command for star tracker with object id: 0x" + object_id.hex(),
) )
) obyt = object_id.as_bytes
if op_code == "0": if op_code == "0":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Mode On, Submode Bootloader")
(QueueCommands.PRINT, "Star tracker: Mode On, Submode Bootloader") data = pack_mode_data(obyt, Modes.ON, Submode.BOOTLOADER)
) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
command = pack_mode_data(object_id, Modes.ON, Submode.BOOTLOADER)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Mode On, Submode Firmware")
(QueueCommands.PRINT, "Star tracker: Mode On, Submode Firmware") data = pack_mode_data(obyt, Modes.ON, Submode.FIRMWARE)
) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
command = pack_mode_data(object_id, Modes.ON, Submode.FIRMWARE)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Normal")) q.add_log_cmd("Star tracker: Mode Normal")
command = pack_mode_data(object_id, Modes.NORMAL, 0) data = pack_mode_data(obyt, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Off")) q.add_log_cmd("Star tracker: Mode Off")
command = pack_mode_data(object_id, Modes.OFF, 0) data = pack_mode_data(obyt, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=12, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Raw")) q.add_log_cmd("Star tracker: Mode Raw")
command = pack_mode_data(object_id, 3, 0) data = pack_mode_data(obyt, Modes.RAW, 0)
command = PusTelecommand(service=200, subservice=1, ssc=13, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping")) q.add_log_cmd("Star tracker: Ping")
command = object_id + struct.pack("!I", StarTrackerActionIds.PING) data = obyt + struct.pack("!I", StarTrackerActionIds.PING)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Switch to bootloader program")
(QueueCommands.PRINT, "Star tracker: Switch to bootloader program") data = obyt + struct.pack(
)
command = object_id + struct.pack(
"!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM "!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM
) )
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request")) q.add_log_cmd("Star tracker: Temperature request")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version")) q.add_log_cmd("Star tracker: Request version")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VERSION) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_VERSION)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9": if op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface")) q.add_log_cmd("Star tracker: Request interface")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE)
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "10": if op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power")) q.add_log_cmd("Star tracker: Request power")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_POWER) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_POWER)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11": if op_code == "11":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set subscription parameters")
(QueueCommands.PRINT, "Star tracker: Set subscription parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIPTION) + struct.pack("!I", StarTrackerActionIds.SUBSCRIPTION)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12": if op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot")) q.add_log_cmd("Star tracker: Boot")
command = object_id + struct.pack("!I", StarTrackerActionIds.BOOT) data = obyt + struct.pack("!I", StarTrackerActionIds.BOOT)
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13": if op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time")) q.add_log_cmd("Star tracker: Request time")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TIME) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TIME)
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "14": if op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution")) q.add_log_cmd("Star tracker: Request solution")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION)
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "15": if op_code == "15":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image")) q.add_log_cmd("Star tracker: Upload image")
image = get_upload_image() image = get_upload_image()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE) + struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
+ bytearray(image, "utf-8") + bytearray(image, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "16": if op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image")) q.add_log_cmd("Star tracker: Download image")
path = input("Specify storage location (default - /mnt/sd0/startracker): ") path = input("Specify storage location (default - /mnt/sd0/startracker): ")
if not path: if not path:
path = FileDefs.download_path path = FileDefs.download_path
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
+ bytearray(path, "utf-8") + bytearray(path, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "17": if op_code == "17":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits")) q.add_log_cmd("Star tracker: Set limits")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.LIMITS) + struct.pack("!I", StarTrackerActionIds.LIMITS)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "18": if op_code == "18":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set tracking parameters")
(QueueCommands.PRINT, "Star tracker: Set tracking parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.TRACKING) + struct.pack("!I", StarTrackerActionIds.TRACKING)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "19": if op_code == "19":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting")) q.add_log_cmd("Star tracker: Mounting")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.MOUNTING) + struct.pack("!I", StarTrackerActionIds.MOUNTING)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "20": if op_code == "20":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera")) q.add_log_cmd("Star tracker: Camera")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.CAMERA) + struct.pack("!I", StarTrackerActionIds.CAMERA)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "22": if op_code == "22":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding")) q.add_log_cmd("Star tracker: Centroiding")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING) + struct.pack("!I", StarTrackerActionIds.CENTROIDING)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "23": if op_code == "23":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA")) q.add_log_cmd("Star tracker: LISA")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.LISA) + struct.pack("!I", StarTrackerActionIds.LISA)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "24": if op_code == "24":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching")) q.add_log_cmd("Star tracker: Matching")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.MATCHING) + struct.pack("!I", StarTrackerActionIds.MATCHING)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "25": if op_code == "25":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation")) q.add_log_cmd("Star tracker: Validation")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.VALIDATION) + struct.pack("!I", StarTrackerActionIds.VALIDATION)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "26": if op_code == "26":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo")) q.add_log_cmd("Star tracker: Algo")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.ALGO) + struct.pack("!I", StarTrackerActionIds.ALGO)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "27": if op_code == "27":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image")) q.add_log_cmd("Star tracker: Take image")
actionid = int(input("Specify parameter ID (take image - 4): ")) actionid = int(input("Specify parameter ID (take image - 4): "))
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE) + struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE)
+ struct.pack("!B", actionid) + struct.pack("!B", actionid)
) )
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "28": if op_code == "28":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop str helper")) q.add_log_cmd("Star tracker: Stop str helper")
command = object_id + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER) data = obyt + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "30": if op_code == "30":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set name of download image")
(QueueCommands.PRINT, "Star tracker: Set name of download image")
)
filename = input("Specify download image name: ") filename = input("Specify download image name: ")
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE) + struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
+ bytearray(filename, "utf-8") + bytearray(filename, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "31": if op_code == "31":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request histogram")) q.add_log_cmd("Star tracker: Request histogram")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM)
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "32": if op_code == "32":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request contrast")) q.add_log_cmd("Star tracker: Request contrast")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST)
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "33": if op_code == "33":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename")) q.add_log_cmd("Star tracker: Set json filename")
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME) + struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "35": if op_code == "35":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Flash read")) q.add_log_cmd("Star tracker: Flash read")
command = pack_read_command(object_id) data = pack_read_command(obyt)
command = PusTelecommand(service=8, subservice=128, ssc=59, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "36": if op_code == "36":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set flash read filename")
(QueueCommands.PRINT, "Star tracker: Set flash read filename")
)
filename = input("Specify filename: ") filename = input("Specify filename: ")
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.SET_FLASH_READ_FILENAME) + struct.pack("!I", StarTrackerActionIds.SET_FLASH_READ_FILENAME)
+ bytearray(filename, "utf-8") + bytearray(filename, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "37": if op_code == "37":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Get checksum")) q.add_log_cmd("Star tracker: Get checksum")
command = pack_checksum_command(object_id) data = pack_checksum_command(obyt)
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "38": if op_code == "38":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time")) q.add_log_cmd("Star tracker: Set time")
unix_time = 1640783543 unix_time = 1640783543
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.SET_TIME) + struct.pack("!I", StarTrackerActionIds.SET_TIME)
+ struct.pack("!Q", unix_time) + struct.pack("!Q", unix_time)
) )
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "39": if op_code == "39":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid")) q.add_log_cmd("Star tracker: Download Centroid")
id = 0 id = 0
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
+ struct.pack("!B", id) + struct.pack("!B", id)
) )
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "41": if op_code == "41":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Download matched star")
(QueueCommands.PRINT, "Star tracker: Download matched star")
)
id = 0 id = 0
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
+ struct.pack("!B", id) + struct.pack("!B", id)
) )
command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "42": if op_code == "42":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image")) q.add_log_cmd("Star tracker: Download DB Image")
id = 0 id = 0
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
+ struct.pack("!B", id) + struct.pack("!B", id)
) )
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "43": if op_code == "43":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel")) q.add_log_cmd("Star tracker: Download Blob Pixel")
id = 0 id = 0
type = 1 # 0 - normal, 1 - fast type = 1 # 0 - normal, 1 - fast
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL)
+ struct.pack("!B", id) + struct.pack("!B", id)
+ struct.pack("!B", type) + struct.pack("!B", type)
) )
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "44": if op_code == "44":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image")) q.add_log_cmd("Star tracker: Download FPGA Image")
position = int(input("Start position: ")) position = int(input("Start position: "))
length = int(input("Size to download: ")) length = int(input("Size to download: "))
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE) + struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE)
+ struct.pack("!I", position) + struct.pack("!I", position)
+ struct.pack("!I", length) + struct.pack("!I", length)
+ bytearray(FileDefs.downloadFpgaImagePath, "utf-8") + bytearray(FileDefs.downloadFpgaImagePath, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "45": if op_code == "45":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Change donwload FPGA image file name")
(QueueCommands.PRINT, "Star tracker: Change donwload FPGA image file name") data = (
) obyt
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE) + struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE)
+ bytearray(FileDefs.downloadFpgaImageName, "utf-8") + bytearray(FileDefs.downloadFpgaImageName, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "46": if op_code == "46":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image")) q.add_log_cmd("Star tracker: Upload FPGA image")
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE) + struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE)
+ bytearray(FileDefs.uploadFpgaImageName, "utf-8") + bytearray(FileDefs.uploadFpgaImageName, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "47": if op_code == "47":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action")) q.add_log_cmd("Star tracker: FPGA action")
id = 3 id = 3
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.FPGA_ACTION) + struct.pack("!I", StarTrackerActionIds.FPGA_ACTION)
+ struct.pack("!B", id) + struct.pack("!B", id)
) )
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "48": if op_code == "48":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Unlock")) q.add_log_cmd("Star tracker: Unlock")
command = object_id + struct.pack("!I", StarTrackerActionIds.UNLOCK) data = obyt + struct.pack("!I", StarTrackerActionIds.UNLOCK)
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "49": if op_code == "49":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request camera parameters")
(QueueCommands.PRINT, "Star tracker: Request camera parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CAMERA_PARAMS)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CAMERA_PARAMS)
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "50": if op_code == "50":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request limits")) q.add_log_cmd("Star tracker: Request limits")
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LIMITS) data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LIMITS)
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "51": if op_code == "51":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set image processor parameters")
(QueueCommands.PRINT, "Star tracker: Set image processor parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.IMAGE_PROCESSOR) + struct.pack("!I", StarTrackerActionIds.IMAGE_PROCESSOR)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "52": if op_code == "52":
tc_queue.appendleft( q.add_log_cmd("Star tracker: EGSE load ground config camera parameters")
( data = (
QueueCommands.PRINT, obyt
"Star tracker: EGSE load ground config camera parameters",
)
)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CAMERA) + struct.pack("!I", StarTrackerActionIds.CAMERA)
+ bytearray(FileDefs.egse_ground_config, "utf-8") + bytearray(FileDefs.egse_ground_config, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "53": if op_code == "53":
tc_queue.appendleft( q.add_log_cmd("Star tracker: EGSE load flight config camera parameters")
( data = (
QueueCommands.PRINT, obyt
"Star tracker: EGSE load flight config camera parameters",
)
)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CAMERA) + struct.pack("!I", StarTrackerActionIds.CAMERA)
+ bytearray(FileDefs.egse_flight_config, "utf-8") + bytearray(FileDefs.egse_flight_config, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "54": if op_code == "54":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request log level parameters")
(QueueCommands.PRINT, "Star tracker: Request log level parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LOG_LEVEL)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LOG_LEVEL)
command = PusTelecommand(service=8, subservice=128, ssc=74, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "55": if op_code == "55":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request mounting parameters")
(QueueCommands.PRINT, "Star tracker: Request mounting parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_MOUNTING)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_MOUNTING)
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "56": if op_code == "56":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request image processor parameters")
(QueueCommands.PRINT, "Star tracker: Request image processor parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_IMAGE_PROCESSOR)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack(
"!I", StarTrackerActionIds.REQ_IMAGE_PROCESSOR
)
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "57": if op_code == "57":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request centroiding parameters")
(QueueCommands.PRINT, "Star tracker: Request centroiding parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CENTROIDING)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CENTROIDING)
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "58": if op_code == "58":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request lisa parameters")
(QueueCommands.PRINT, "Star tracker: Request lisa parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LISA)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LISA)
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "59": if op_code == "59":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request matching parameters")
(QueueCommands.PRINT, "Star tracker: Request matching parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_MATCHING)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_MATCHING)
command = PusTelecommand(service=8, subservice=128, ssc=77, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "60": if op_code == "60":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request tracking parameters")
(QueueCommands.PRINT, "Star tracker: Request tracking parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TRACKING)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TRACKING)
command = PusTelecommand(service=8, subservice=128, ssc=78, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "61": if op_code == "61":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request validation parameters")
(QueueCommands.PRINT, "Star tracker: Request validation parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_VALIDATION)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VALIDATION)
command = PusTelecommand(service=8, subservice=128, ssc=79, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "62": if op_code == "62":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request algo parameters")
(QueueCommands.PRINT, "Star tracker: Request algo parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_ALGO)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_ALGO)
command = PusTelecommand(service=8, subservice=128, ssc=80, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "63": if op_code == "63":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request subscription parameters")
(QueueCommands.PRINT, "Star tracker: Request subscription parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_SUBSCRIPTION)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SUBSCRIPTION)
command = PusTelecommand(service=8, subservice=128, ssc=81, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "64": if op_code == "64":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request log subscription parameters")
(QueueCommands.PRINT, "Star tracker: Request log subscription parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LOG_SUBSCRIPTION)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack(
"!I", StarTrackerActionIds.REQ_LOG_SUBSCRIPTION
)
command = PusTelecommand(service=8, subservice=128, ssc=82, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "65": if op_code == "65":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Request debug camera parameters")
(QueueCommands.PRINT, "Star tracker: Request debug camera parameters") data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_DEBUG_CAMERA)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_DEBUG_CAMERA)
command = PusTelecommand(service=8, subservice=128, ssc=83, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "66": if op_code == "66":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set log level parameters")
(QueueCommands.PRINT, "Star tracker: Set log level parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.LOGLEVEL) + struct.pack("!I", StarTrackerActionIds.LOGLEVEL)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=84, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "67": if op_code == "67":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set log subscription parameters")
(QueueCommands.PRINT, "Star tracker: Set log subscription parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.LOG_SUBSCRIPTION) + struct.pack("!I", StarTrackerActionIds.LOG_SUBSCRIPTION)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=85, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "68": if op_code == "68":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Set debug camera parameters")
(QueueCommands.PRINT, "Star tracker: Set debug camera parameters")
)
json_file = get_config_file() json_file = get_config_file()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.DEBUG_CAMERA) + struct.pack("!I", StarTrackerActionIds.DEBUG_CAMERA)
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=86, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "69": if op_code == "69":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Firmware update")) q.add_log_cmd("Star tracker: Firmware update")
firmware = get_firmware() firmware = get_firmware()
command = ( data = (
object_id obyt
+ struct.pack("!I", StarTrackerActionIds.FIRMWARE_UPDATE) + struct.pack("!I", StarTrackerActionIds.FIRMWARE_UPDATE)
+ bytearray(firmware, "utf-8") + bytearray(firmware, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=87, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "70": if op_code == "70":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Disable timestamp generation")
(QueueCommands.PRINT, "Star tracker: Disable timestamp generation") command = obyt + struct.pack(
)
command = object_id + struct.pack(
"!I", StarTrackerActionIds.DISBALE_TIMESTAMP_GENERATION "!I", StarTrackerActionIds.DISBALE_TIMESTAMP_GENERATION
) )
command = PusTelecommand(service=8, subservice=128, ssc=88, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "71": if op_code == "71":
tc_queue.appendleft( q.add_log_cmd("Star tracker: Enable timestamp generation")
(QueueCommands.PRINT, "Star tracker: Enable timestamp generation") command = obyt + struct.pack(
)
command = object_id + struct.pack(
"!I", StarTrackerActionIds.ENABLE_TIMESTAMP_GENERATION "!I", StarTrackerActionIds.ENABLE_TIMESTAMP_GENERATION
) )
command = PusTelecommand(service=8, subservice=128, ssc=89, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
def pack_read_command(object_id: bytearray) -> bytearray: def pack_read_command(object_id: bytes) -> bytearray:
start_region = StartRegion.STAR_TRACKER_FIRMWARE start_region = StartRegion.STAR_TRACKER_FIRMWARE
size = PartitionSize.STAR_TRACKER_FIRMWARE size = PartitionSize.STAR_TRACKER_FIRMWARE
path = input("Specify storage location (default - /mnt/sd0/startracker): ") path = input("Specify storage location (default - /mnt/sd0/startracker): ")
if not path: if not path:
path = FileDefs.download_path path = FileDefs.download_path
command = ( data = (
object_id object_id
+ struct.pack("!I", StarTrackerActionIds.FLASH_READ) + struct.pack("!I", StarTrackerActionIds.FLASH_READ)
+ struct.pack("!B", start_region) + struct.pack("!B", start_region)
+ struct.pack("!I", size) + struct.pack("!I", size)
+ bytearray(path, "utf-8") + bytearray(path, "utf-8")
) )
return command return bytearray(data)
def pack_checksum_command(object_id: bytearray) -> bytearray: def pack_checksum_command(object_id: bytes) -> bytearray:
start_region = StartRegion.STAR_TRACKER_FIRMWARE start_region = StartRegion.STAR_TRACKER_FIRMWARE
address = 0 address = 0
size = PartitionSize.STAR_TRACKER_FIRMWARE size = PartitionSize.STAR_TRACKER_FIRMWARE
command = ( data = (
object_id object_id
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM) + struct.pack("!I", StarTrackerActionIds.CHECKSUM)
+ struct.pack("!B", start_region) + struct.pack("!B", start_region)
+ struct.pack("!I", address) + struct.pack("!I", address)
+ struct.pack("!I", size) + struct.pack("!I", size)
) )
return command return bytearray(data)
def get_config_file() -> str: def get_config_file() -> str:

View File

@ -10,10 +10,9 @@
""" """
import struct import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.utility import ObjectIdU32
class Commands: class Commands:
@ -25,24 +24,15 @@ class ImagePathDefs:
uploadFile = "/mnt/sd0/startracker/gemma.bin" uploadFile = "/mnt/sd0/startracker/gemma.bin"
def pack_str_img_helper_command( def pack_str_img_helper_command(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str q.add_log_cmd(
) -> TcQueueT: f"Testing star tracker image helper object id: {object_id.as_hex_string}"
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing star tracker image helper object id: 0x" + object_id.hex(),
) )
)
if op_code == "0": if op_code == "0":
tc_queue.appendleft( q.add_log_cmd("Star tracker image helper: Upload image")
(QueueCommands.PRINT, "Star tracker image helper: Upload image")
)
command = ( command = (
object_id object_id.as_bytes
+ struct.pack("!I", Commands.UPLOAD_IMAGE) + struct.pack("!I", Commands.UPLOAD_IMAGE)
+ bytearray(ImagePathDefs.uploadFile, "utf-8") + bytearray(ImagePathDefs.uploadFile, "utf-8")
) )
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -5,14 +5,14 @@
@author J. Meier @author J. Meier
@date 13.12.2020 @date 13.12.2020
""" """
from tmtccmd.tc import QueueHelper
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
import struct import struct
from tmtccmd.utility import ObjectIdU32
class SetIds: class SetIds:
RX_REGISTERS_DATASET = 1 RX_REGISTERS_DATASET = 1
@ -37,117 +37,86 @@ class CommandIds:
DISABLE_DEBUG = 21 DISABLE_DEBUG = 21
def pack_syrlinks_command( def pack_syrlinks_command(object_id: ObjectIdU32, q: QueueHelper, op_code: str):
object_id: bytearray, tc_queue: TcQueueT, op_code: str obyt = object_id.as_bytes
) -> TcQueueT: q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing Syrlinks with object id: 0x" + object_id.hex(),
)
)
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set mode off")) q.add_log_cmd("Syrlinks: Set mode off")
command = pack_mode_data(object_id, Modes.OFF, 0) data = pack_mode_data(obyt, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set mode on")) q.add_log_cmd("Syrlinks: Set mode on")
command = pack_mode_data(object_id, Modes.ON, 0) data = pack_mode_data(obyt, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Mode Normal")) q.add_log_cmd("Syrlinks: Mode Normal")
command = pack_mode_data(object_id, Modes.NORMAL, 0) data = pack_mode_data(obyt, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode standby")) q.add_log_cmd("syrlinks: Set TX mode standby")
command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY) data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY)
command = PusTelecommand(service=8, subservice=128, ssc=10, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode modulation")) q.add_log_cmd("syrlinks: Set TX mode modulation")
command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION) data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION)
command = PusTelecommand(service=8, subservice=128, ssc=11, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode CW")) q.add_log_cmd("syrlinks: Set TX mode CW")
command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_CW) data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_CW)
command = PusTelecommand(service=8, subservice=128, ssc=12, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get RX Registers")) q.add_log_cmd("Syrlinks: Get RX Registers")
sid = make_sid(object_id, SetIds.RX_REGISTERS_DATASET) sid = make_sid(obyt, SetIds.RX_REGISTERS_DATASET)
command = generate_one_hk_command(sid, 200) q.add_pus_tc(generate_one_hk_command(sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get TX Registers")) q.add_log_cmd("Syrlinks: Get TX Registers")
sid = make_sid(object_id, SetIds.TX_REGISTERS_DATASET) sid = make_sid(obyt, SetIds.TX_REGISTERS_DATASET)
command = generate_one_hk_command(sid, 201) q.add_pus_tc(generate_one_hk_command(sid))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX status")) q.add_log_cmd("Syrlinks: Read TX status")
command = object_id + struct.pack("!I", CommandIds.READ_TX_STATUS) command = obyt + struct.pack("!I", CommandIds.READ_TX_STATUS)
command = PusTelecommand(service=8, subservice=128, ssc=13, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9": if op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX waveform")) q.add_log_cmd("Syrlinks: Read TX waveform")
command = object_id + struct.pack("!I", CommandIds.READ_TX_WAVEFORM) command = obyt + struct.pack("!I", CommandIds.READ_TX_WAVEFORM)
command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "10": if op_code == "10":
tc_queue.appendleft( q.add_log_cmd("Syrlinks: Read TX AGC value high byte")
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte") command = obyt + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE)
command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11": if op_code == "11":
tc_queue.appendleft( q.add_log_cmd("Syrlinks: Read TX AGC value low byte")
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte") command = obyt + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_LOW_BYTE)
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_LOW_BYTE)
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12": if op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Write LCL config")) q.add_log_cmd("Syrlinks: Write LCL config")
command = object_id + struct.pack("!I", CommandIds.WRITE_LCL_CONFIG) command = obyt + struct.pack("!I", CommandIds.WRITE_LCL_CONFIG)
command = PusTelecommand(service=8, subservice=128, ssc=17, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13": if op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read RX status registers")) q.add_log_cmd("Syrlinks: Read RX status registers")
command = object_id + struct.pack("!I", CommandIds.READ_RX_STATUS_REGISTERS) command = obyt + struct.pack("!I", CommandIds.READ_RX_STATUS_REGISTERS)
command = PusTelecommand(service=8, subservice=128, ssc=18, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "14": if op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read LCL config register")) q.add_log_cmd("Syrlinks: Read LCL config register")
command = object_id + struct.pack("!I", CommandIds.READ_LCL_CONFIG_REGISTER) command = obyt + struct.pack("!I", CommandIds.READ_LCL_CONFIG_REGISTER)
command = PusTelecommand(service=8, subservice=128, ssc=19, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "15": if op_code == "15":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set waveform OQPSK")) q.add_log_cmd("Syrlinks: Set waveform OQPSK")
command = object_id + struct.pack("!I", CommandIds.SET_WAVEFORM_OQPSK) command = obyt + struct.pack("!I", CommandIds.SET_WAVEFORM_OQPSK)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "16": if op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set waveform BPSK")) q.add_log_cmd("Syrlinks: Set waveform BPSK")
command = object_id + struct.pack("!I", CommandIds.SET_WAVEFORM_BPSK) command = obyt + struct.pack("!I", CommandIds.SET_WAVEFORM_BPSK)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "17": if op_code == "17":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set second config")) q.add_log_cmd("Syrlinks: Set second config")
command = object_id + struct.pack("!I", CommandIds.SET_SECOND_CONFIG) command = obyt + struct.pack("!I", CommandIds.SET_SECOND_CONFIG)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "18": if op_code == "18":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Enable debug printout")) q.add_log_cmd("Syrlinks: Enable debug printout")
command = object_id + struct.pack("!I", CommandIds.ENABLE_DEBUG) command = obyt + struct.pack("!I", CommandIds.ENABLE_DEBUG)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "19": if op_code == "19":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Disable debug printout")) q.add_log_cmd("Syrlinks: Disable debug printout")
command = object_id + struct.pack("!I", CommandIds.DISABLE_DEBUG) command = obyt + struct.pack("!I", CommandIds.DISABLE_DEBUG)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -5,11 +5,11 @@
@author J. Meier @author J. Meier
@date 06.01.2021 @date 06.01.2021
""" """
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data from pus_tc.service_200_mode import pack_mode_data
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import Modes
from tmtccmd.utility import ObjectIdU32
class Tmp1075TestProcedure: class Tmp1075TestProcedure:
@ -33,41 +33,28 @@ class Tmp1075ActionIds:
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02]) start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
def pack_tmp1075_test_into( def pack_tmp1075_test_into(object_id: ObjectIdU32, op_code: str, q: QueueHelper):
object_id: bytearray, op_code: str, tc_queue: TcQueueT q.add_log_cmd(
) -> TcQueueT: f"Testing Tmp1075 Temperature Sensor Handler with object id: {object_id.as_hex_string}"
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x"
+ object_id.hex(),
) )
) obyt = object_id.as_bytes
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion: if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
tc_queue.appendleft( q.add_log_cmd("TMP1075: Starting new temperature conversion")
(QueueCommands.PRINT, "TMP1075: Starting new temperature conversion") command = obyt + Tmp1075ActionIds.start_adc_conversion
) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
command = object_id + Tmp1075ActionIds.start_adc_conversion
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp: if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Read temperature")) q.add_log_cmd("TMP1075: Read temperature")
command = object_id + Tmp1075ActionIds.get_temp command = obyt + Tmp1075ActionIds.get_temp
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
tc_queue.appendleft(command.pack_command_tuple())
if Tmp1075TestProcedure.set_mode_normal: if Tmp1075TestProcedure.set_mode_normal:
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Set Mode Normal")) q.add_log_cmd("TMP1075: Set Mode Normal")
mode_data = pack_mode_data(object_id, 2, 0) mode_data = pack_mode_data(obyt, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=220, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
if Tmp1075TestProcedure.set_mode_on: if Tmp1075TestProcedure.set_mode_on:
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Set Mode On")) q.add_log_cmd("TMP1075: Set Mode On")
mode_data = pack_mode_data(object_id, 1, 0) mode_data = pack_mode_data(obyt, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=221, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return q

View File

@ -1,20 +1,14 @@
"""Hook function which packs telecommands based on service and operation code string """Hook function which packs telecommands based on service and operation code string
""" """
import logging
import os
from collections import deque
from typing import Union
from pus_tc.devs.rtd import pack_rtd_commands from pus_tc.devs.rtd import pack_rtd_commands
from spacepackets.ecss import PusTelecommand from tmtccmd import DefaultProcedureInfo
from tmtccmd.com_if.com_interface_base import CommunicationInterface from tmtccmd.config import CoreServiceList
from tmtccmd.config.definitions import CoreServiceList, QueueCommands
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.logging.pus import log_raw_pus_tc from tmtccmd.tc import FeedWrapper
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.pus_5_event import (
from tmtccmd.tc.pus_5_event import pack_generic_service5_test_into pack_generic_service_5_test_into,
)
from tmtccmd.pus.pus_17_test import pack_service_17_ping_command from tmtccmd.pus.pus_17_test import pack_service_17_ping_command
from tmtccmd.logging import get_current_time_string
from pus_tc.service_200_mode import pack_service200_test_into from pus_tc.service_200_mode import pack_service200_test_into
from pus_tc.devs.p60dock import pack_p60dock_cmds from pus_tc.devs.p60dock import pack_p60dock_cmds
@ -42,10 +36,8 @@ from pus_tc.devs.plpcdu import pack_pl_pcdu_commands
from pus_tc.devs.str_img_helper import pack_str_img_helper_command from pus_tc.devs.str_img_helper import pack_str_img_helper_command
from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.tcs import pack_tcs_sys_commands
from pus_tc.system.proc import pack_proc_commands from pus_tc.system.proc import pack_proc_commands
from pus_tc.system.controllers import pack_cmd_ctrl_to_prompted_mode
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import ( from config.object_ids import (
get_object_ids,
P60_DOCK_HANDLER, P60_DOCK_HANDLER,
PDU_1_HANDLER_ID, PDU_1_HANDLER_ID,
PDU_2_HANDLER_ID, PDU_2_HANDLER_ID,
@ -63,7 +55,6 @@ from config.object_ids import (
PLOC_SUPV_ID, PLOC_SUPV_ID,
STAR_TRACKER_ID, STAR_TRACKER_ID,
PLOC_MEMORY_DUMPER_ID, PLOC_MEMORY_DUMPER_ID,
GPS_CONTROLLER,
CCSDS_HANDLER_ID, CCSDS_HANDLER_ID,
PDEC_HANDLER_ID, PDEC_HANDLER_ID,
STR_IMG_HELPER_ID, STR_IMG_HELPER_ID,
@ -77,179 +68,131 @@ import config.object_ids as oids
LOGGER = get_console_logger() LOGGER = get_console_logger()
def pre_tc_send_cb( def handle_default_procedure(info: DefaultProcedureInfo, wrapper: FeedWrapper):
queue_entry: Union[bytes, QueueCommands], queue_helper = wrapper.queue_helper
com_if: CommunicationInterface, service = info.service
queue_info: Union[PusTelecommand, any], op_code = info.op_code
file_logger: logging.Logger,
):
if isinstance(queue_entry, bytes) or isinstance(queue_entry, bytearray):
log_raw_pus_tc(
packet=queue_entry,
srv_subservice=(queue_info.service, queue_info.subservice),
)
tc_info_string = f"Sent {queue_info}"
LOGGER.info(tc_info_string)
file_logger.info(f"{get_current_time_string(True)}: {tc_info_string}")
com_if.send(data=queue_entry)
elif isinstance(queue_entry, QueueCommands):
if queue_entry == QueueCommands.PRINT:
file_logger.info(queue_info)
def pack_service_queue_user(
service: Union[str, int], op_code: str, service_queue: TcQueueT
):
obj_id_man = get_object_ids() obj_id_man = get_object_ids()
if service == CoreServiceList.SERVICE_5.value: if service == CoreServiceList.SERVICE_5.value:
return pack_generic_service5_test_into(tc_queue=service_queue) return pack_generic_service_5_test_into(q=queue_helper)
if service == CoreServiceList.SERVICE_17.value: if service == CoreServiceList.SERVICE_17.value:
return service_queue.appendleft( return queue_helper.add_pus_tc(pack_service_17_ping_command())
pack_service_17_ping_command(ssc=1700).pack_command_tuple()
)
if service == CoreServiceList.SERVICE_200.value: if service == CoreServiceList.SERVICE_200.value:
return pack_service200_test_into(tc_queue=service_queue) return pack_service200_test_into(q=queue_helper)
if service == CustomServiceList.P60DOCK.value: if service == CustomServiceList.P60DOCK.value:
object_id = obj_id_man.get(P60_DOCK_HANDLER) object_id = obj_id_man.get(P60_DOCK_HANDLER)
return pack_p60dock_cmds( return pack_p60dock_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.RTD.value: if service == CustomServiceList.RTD.value:
return pack_rtd_commands( return pack_rtd_commands(object_id=None, q=queue_helper, op_code=op_code)
object_id=None, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
object_id = obj_id_man.get(PDU_1_HANDLER_ID) object_id = obj_id_man.get(PDU_1_HANDLER_ID)
return pack_pdu1_commands( return pack_pdu1_commands(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU2.value: if service == CustomServiceList.PDU2.value:
object_id = obj_id_man.get(PDU_2_HANDLER_ID) object_id = obj_id_man.get(PDU_2_HANDLER_ID)
return pack_pdu2_commands( return pack_pdu2_commands(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.ACU.value: if service == CustomServiceList.ACU.value:
object_id = obj_id_man.get(ACU_HANDLER_ID) object_id = obj_id_man.get(ACU_HANDLER_ID)
return pack_acu_commands( return pack_acu_commands(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.BPX_BATTERY.value: if service == CustomServiceList.BPX_BATTERY.value:
return pack_bpx_commands(tc_queue=service_queue, op_code=op_code) return pack_bpx_commands(q=queue_helper, op_code=op_code)
if service == CustomServiceList.TMP1075_1.value: if service == CustomServiceList.TMP1075_1.value:
object_id = TMP_1075_1_HANDLER_ID object_id = obj_id_man.get(TMP_1075_1_HANDLER_ID)
return pack_tmp1075_test_into( return pack_tmp1075_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.TMP1075_2.value: if service == CustomServiceList.TMP1075_2.value:
object_id = TMP_1075_2_HANDLER_ID object_id = obj_id_man.get(TMP_1075_2_HANDLER_ID)
return pack_tmp1075_test_into( return pack_tmp1075_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.HEATER.value: if service == CustomServiceList.HEATER.value:
object_id = HEATER_ID object_id = HEATER_ID
return pack_heater_cmds( return pack_heater_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.IMTQ.value: if service == CustomServiceList.IMTQ.value:
object_id = IMTQ_HANDLER_ID object_id = obj_id_man.get(IMTQ_HANDLER_ID)
return pack_imtq_test_into( return pack_imtq_test_into(object_id=object_id, q=queue_helper, op_code=op_code)
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PLOC_MPSOC.value: if service == CustomServiceList.PLOC_MPSOC.value:
object_id = PLOC_MPSOC_ID object_id = obj_id_man.get(PLOC_MPSOC_ID)
return pack_ploc_mpsoc_commands( return pack_ploc_mpsoc_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.REACTION_WHEEL_1.value: if service == CustomServiceList.REACTION_WHEEL_1.value:
return pack_single_rw_test_into( return pack_single_rw_test_into(
object_id=RW1_ID, rw_idx=1, tc_queue=service_queue, op_code=op_code object_id=RW1_ID, rw_idx=1, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.REACTION_WHEEL_2.value: if service == CustomServiceList.REACTION_WHEEL_2.value:
return pack_single_rw_test_into( return pack_single_rw_test_into(
object_id=RW2_ID, rw_idx=2, tc_queue=service_queue, op_code=op_code object_id=RW2_ID, rw_idx=2, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.REACTION_WHEEL_3.value: if service == CustomServiceList.REACTION_WHEEL_3.value:
return pack_single_rw_test_into( return pack_single_rw_test_into(
object_id=RW3_ID, rw_idx=3, tc_queue=service_queue, op_code=op_code object_id=RW3_ID, rw_idx=3, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.REACTION_WHEEL_4.value: if service == CustomServiceList.REACTION_WHEEL_4.value:
return pack_single_rw_test_into( return pack_single_rw_test_into(
object_id=RW4_ID, rw_idx=4, tc_queue=service_queue, op_code=op_code object_id=RW4_ID, rw_idx=4, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.RAD_SENSOR.value: if service == CustomServiceList.RAD_SENSOR.value:
object_id = obj_id_man.get(RAD_SENSOR_ID) object_id = obj_id_man.get(RAD_SENSOR_ID)
return pack_rad_sensor_test_into( return pack_rad_sensor_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.PLOC_SUPV.value: if service == CustomServiceList.PLOC_SUPV.value:
object_id = PLOC_SUPV_ID object_id = obj_id_man.get(PLOC_SUPV_ID)
return pack_ploc_supv_commands( return pack_ploc_supv_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.STAR_TRACKER.value: if service == CustomServiceList.STAR_TRACKER.value:
object_id = STAR_TRACKER_ID object_id = obj_id_man.get(STAR_TRACKER_ID)
return pack_star_tracker_commands( return pack_star_tracker_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.STR_IMG_HELPER.value: if service == CustomServiceList.STR_IMG_HELPER.value:
object_id = STR_IMG_HELPER_ID object_id = obj_id_man.get(STR_IMG_HELPER_ID)
return pack_str_img_helper_command( return pack_str_img_helper_command(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.CORE.value: if service == CustomServiceList.CORE.value:
return pack_core_commands(tc_queue=service_queue, op_code=op_code) return pack_core_commands(q=queue_helper, op_code=op_code)
if service == CustomServiceList.PLOC_MEMORY_DUMPER.value: if service == CustomServiceList.PLOC_MEMORY_DUMPER.value:
object_id = PLOC_MEMORY_DUMPER_ID object_id = obj_id_man.get(PLOC_MEMORY_DUMPER_ID)
return pack_ploc_memory_dumper_cmd( return pack_ploc_memory_dumper_cmd(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.ACS.value: if service == CustomServiceList.ACS.value:
return pack_acs_command(tc_queue=service_queue, op_code=op_code) return pack_acs_command(q=queue_helper, op_code=op_code)
if service == CustomServiceList.GPS_CTRL.value: if service == CustomServiceList.GPS_CTRL.value:
return pack_gps_command( return pack_gps_command(
object_id=oids.GPS_CONTROLLER, tc_queue=service_queue, op_code=op_code object_id=oids.GPS_CONTROLLER, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.CCSDS_HANDLER.value: if service == CustomServiceList.CCSDS_HANDLER.value:
return pack_ccsds_handler_test( return pack_ccsds_handler_test(
object_id=CCSDS_HANDLER_ID, tc_queue=service_queue, op_code=op_code object_id=CCSDS_HANDLER_ID, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.PDEC_HANDLER.value: if service == CustomServiceList.PDEC_HANDLER.value:
return pack_ccsds_handler_test( return pack_ccsds_handler_test(
object_id=PDEC_HANDLER_ID, tc_queue=service_queue, op_code=op_code object_id=PDEC_HANDLER_ID, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.SYRLINKS.value: if service == CustomServiceList.SYRLINKS.value:
return pack_syrlinks_command( return pack_syrlinks_command(
object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code object_id=SYRLINKS_HANDLER_ID, q=queue_helper, op_code=op_code
) )
if service == CustomServiceList.SA_DEPLYOMENT.value: if service == CustomServiceList.SA_DEPLYOMENT.value:
return pack_solar_array_deployment_test_into( return pack_solar_array_deployment_test_into(
object_id=SOLAR_ARRAY_DEPLOYMENT_ID, tc_queue=service_queue object_id=SOLAR_ARRAY_DEPLOYMENT_ID, q=queue_helper
) )
if service == CustomServiceList.PROCEDURE.value: if service == CustomServiceList.PROCEDURE.value:
return pack_proc_commands(tc_queue=service_queue, op_code=op_code) return pack_proc_commands(q=queue_helper, op_code=op_code)
if service == CustomServiceList.SUS_ASS.value: if service == CustomServiceList.SUS_ASS.value:
return pack_sus_cmds(tc_queue=service_queue, op_code=op_code) return pack_sus_cmds(q=queue_helper, op_code=op_code)
if service == CustomServiceList.PL_PCDU.value: if service == CustomServiceList.PL_PCDU.value:
return pack_pl_pcdu_commands(tc_queue=service_queue, op_code=op_code) return pack_pl_pcdu_commands(q=queue_helper, op_code=op_code)
if service == CustomServiceList.ACS_ASS.value: if service == CustomServiceList.ACS_ASS.value:
return pack_acs_command(tc_queue=service_queue, op_code=op_code) return pack_acs_command(q=queue_helper, op_code=op_code)
if service == CustomServiceList.TCS_ASS.value: if service == CustomServiceList.TCS_ASS.value:
return pack_tcs_sys_commands(tc_queue=service_queue, op_code=op_code) return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
if service == CustomServiceList.TIME.value: if service == CustomServiceList.TIME.value:
return pack_set_current_time_ascii_command(tc_queue=service_queue, ssc=0) return pack_set_current_time_ascii_command(q=queue_helper)
if service == CustomServiceList.RW_ASSEMBLY.value: if service == CustomServiceList.RW_ASSEMBLY.value:
return pack_rw_ass_cmds( return pack_rw_ass_cmds(q=queue_helper, object_id=RW_ASSEMBLY, op_code=op_code)
tc_queue=service_queue, object_id=RW_ASSEMBLY, op_code=op_code
)
if service == CustomServiceList.CONTROLLERS.value:
return pack_controller_commands(tc_queue=service_queue, op_code=op_code)
LOGGER.warning(f"Invalid Service {service}") LOGGER.warning(f"Invalid Service {service}")
def create_total_tc_queue_user() -> TcQueueT:
if not os.path.exists("log"):
os.mkdir("log")
tc_queue = deque()
pack_generic_service5_test_into(tc_queue)
tc_queue.appendleft(pack_service_17_ping_command(ssc=1700).pack_command_tuple())
return tc_queue

View File

@ -10,9 +10,8 @@ from PyQt5.QtWidgets import (
from PyQt5 import QtCore from PyQt5 import QtCore
from tmtccmd.config import CoreModeList
from tmtccmd.core.globals_manager import get_global from tmtccmd.core.globals_manager import get_global
from tmtccmd.config.definitions import CoreGlobalIds, CoreModeList
class Parameter: class Parameter:
@ -93,32 +92,29 @@ class ParameterDialog(QDialog):
""" """
def prompt_parameters(parameterList): def prompt_parameters_gui(param_list) -> dict:
gui = get_global(CoreGlobalIds.GUI) return _gui_prompt(param_list)
mode = get_global(CoreGlobalIds.MODE)
# gui only works in cont mode right now
if gui and mode == CoreModeList.CONTINUOUS_MODE:
return _gui_prompt(parameterList)
else:
return _cli_prompt(parameterList)
def _gui_prompt(parameterList): def prompt_parameters_cli(param_list) -> dict:
return _cli_prompt(param_list)
def _gui_prompt(param_list) -> dict:
dialog = ParameterDialog() dialog = ParameterDialog()
for parameter in parameterList: for parameter in param_list:
dialog.addParameter(parameter["name"], parameter["defaultValue"]) dialog.addParameter(parameter["name"], parameter["defaultValue"])
dialog.exec_() dialog.exec_()
return dialog.getParameters() return dialog.getParameters()
def _cli_prompt(parameterList): def _cli_prompt(param_list) -> dict:
result = {} result = {}
for parameter in parameterList: for parameter in param_list:
userInput = input( user_input = input(
"Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"]) "Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])
) )
if userInput == "": if user_input == "":
userInput = parameter["defaultValue"] user_input = parameter["defaultValue"]
result[parameter["name"]] = userInput result[parameter["name"]] = user_input
return result return result

View File

@ -5,37 +5,31 @@
@author R. Mueller @author R. Mueller
@date 02.05.2020 @date 02.05.2020
""" """
from tmtccmd.config.definitions import QueueCommands
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from config.object_ids import TEST_DEVICE_ID from config.object_ids import TEST_DEVICE_ID
TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT: def pack_service200_test_into(q: QueueHelper):
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200")) q.add_log_cmd("Testing Service 200")
# Object ID: Dummy Device # Object ID: Dummy Device
obj_id = TEST_DEVICE_OBJ_ID obj_id = TEST_DEVICE_OBJ_ID
# Set On Mode # Set On Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode On")) q.add_log_cmd("Testing Service 200: Set Mode On")
mode_data = pack_mode_data(obj_id, Modes.ON, 0) mode_data = pack_mode_data(obj_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
# Set Normal mode # Set Normal mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Normal")) q.add_log_cmd("Testing Service 200: Set Mode Normal")
mode_data = pack_mode_data(obj_id, Modes.NORMAL, 0) mode_data = pack_mode_data(obj_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
# Set Raw Mode # Set Raw Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Raw")) q.add_log_cmd("Testing Service 200: Set Mode Raw")
mode_data = pack_mode_data(obj_id, Modes.RAW, 0) mode_data = pack_mode_data(obj_id, Modes.RAW, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
# Set Off Mode # Set Off Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Off")) q.add_log_cmd("Testing Service 200: Set Mode Off")
mode_data = pack_mode_data(obj_id, Modes.OFF, 0) mode_data = pack_mode_data(obj_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=mode_data) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -1,5 +1,6 @@
import enum import enum
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_200_fsfw_modes import Modes
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
@ -29,13 +30,13 @@ class DualSideSubmodes(enum.IntEnum):
DUAL_SIDE = 2 DUAL_SIDE = 2
def pack_acs_command(tc_queue: TcQueueT, op_code: str): def pack_acs_command(q: QueueHelper, op_code: str):
if op_code in AcsOpCodes.ACS_ASS_A_SIDE: if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
command_mode( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to ACS board assembly A side", info="Switching to ACS board assembly A side",
) )
if op_code in AcsOpCodes.ACS_ASS_B_SIDE: if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
@ -43,7 +44,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to ACS board assembly B side", info="Switching to ACS board assembly B side",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE: if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
@ -51,7 +52,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE, submode=DualSideSubmodes.DUAL_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to ACS board assembly dual mode", info="Switching to ACS board assembly dual mode",
) )
if op_code in AcsOpCodes.ACS_ASS_A_ON: if op_code in AcsOpCodes.ACS_ASS_A_ON:
@ -59,7 +60,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue, q=q,
info="Switching ACS board assembly A side on", info="Switching ACS board assembly A side on",
) )
if op_code in AcsOpCodes.ACS_ASS_B_ON: if op_code in AcsOpCodes.ACS_ASS_B_ON:
@ -67,7 +68,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue, q=q,
info="Switching ACS board assembly B side on", info="Switching ACS board assembly B side on",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON: if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
@ -75,7 +76,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue, q=q,
info="Switching ACS board assembly dual side on", info="Switching ACS board assembly dual side on",
) )
if op_code in AcsOpCodes.ACS_ASS_OFF: if op_code in AcsOpCodes.ACS_ASS_OFF:
@ -83,18 +84,18 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info="Switching to ACS board assembly off", info="Switching to ACS board assembly off",
) )
def pack_sus_cmds(tc_queue: TcQueueT, op_code: str): def pack_sus_cmds(q: QueueHelper, op_code: str):
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE: if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
command_mode( command_mode(
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to SUS board to nominal side", info="Switching to SUS board to nominal side",
) )
if op_code in SusOpCodes.SUS_ASS_RED_SIDE: if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
@ -102,7 +103,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to SUS board to redundant side", info="Switching to SUS board to redundant side",
) )
if op_code in SusOpCodes.SUS_ASS_OFF: if op_code in SusOpCodes.SUS_ASS_OFF:
@ -110,7 +111,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info="Switching SUS board off", info="Switching SUS board off",
) )
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE: if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
@ -118,6 +119,6 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE, submode=DualSideSubmodes.DUAL_SIDE,
tc_queue=tc_queue, q=q,
info="Switching to SUS board to dual side", info="Switching to SUS board to dual side",
) )

View File

@ -1,7 +1,7 @@
from typing import Union from typing import Union
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
@ -9,16 +9,17 @@ def command_mode(
object_id: bytes, object_id: bytes,
mode: Union[int, Modes], mode: Union[int, Modes],
submode: int, submode: int,
tc_queue: TcQueueT, q: QueueHelper,
info: str, info: str,
): ):
tc_queue.appendleft((QueueCommands.PRINT, info)) q.add_log_cmd(info)
mode_data = pack_mode_data( mode_data = pack_mode_data(
object_id=object_id, object_id=object_id,
mode=mode, mode=mode,
submode=submode, submode=submode,
) )
cmd = PusTelecommand( q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )

View File

@ -1,12 +1,11 @@
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc import QueueHelper
from tmtccmd.config import QueueCommands
from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_200_fsfw_modes import Modes
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectIdU32
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 from pus_tc.prompt_parameters import prompt_parameters_cli, prompt_parameters_gui
class OpCodes: class OpCodes:
@ -19,13 +18,15 @@ class Info:
CORE_CONTROLLER = "ACS controller" CORE_CONTROLLER = "ACS controller"
def pack_cmd_ctrl_to_prompted_mode(tc_queue: TcQueueT, object_id: ObjectId): def pack_cmd_ctrl_to_prompted_mode(q: QueueHelper, object_id: ObjectIdU32, gui: bool):
parameters = prompt_parameters( param_list = [
[
{"name": "Mode", "defaultValue": "2"}, {"name": "Mode", "defaultValue": "2"},
{"name": "Submode", "defaultValue": "0"}, {"name": "Submode", "defaultValue": "0"},
] ]
) if gui:
parameters = prompt_parameters_gui(param_list)
else:
parameters = prompt_parameters_cli(param_list)
mode = int(parameters["Mode"]) mode = int(parameters["Mode"])
if mode < 0 or mode > 2: if mode < 0 or mode > 2:
print("Invalid Mode, defaulting to OFF") print("Invalid Mode, defaulting to OFF")
@ -35,37 +36,37 @@ def pack_cmd_ctrl_to_prompted_mode(tc_queue: TcQueueT, object_id: ObjectId):
object_id=object_id.as_bytes, object_id=object_id.as_bytes,
mode=mode, mode=mode,
submode=submode, submode=submode,
tc_queue=tc_queue, q=q,
info=f"Commanding {object_id} to {mode}, {submode}", info=f"Commanding {object_id} to {mode}, {submode}",
) )
def pack_cmd_ctrl_to_off(tc_queue: TcQueueT, object_id: ObjectId): def pack_cmd_ctrl_to_off(q: QueueHelper, object_id: ObjectIdU32):
command_mode( command_mode(
object_id=object_id.as_bytes, object_id=object_id.as_bytes,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info=f"Commanding {object_id} OFF", info=f"Commanding {object_id} OFF",
) )
def pack_cmd_ctrl_to_on(tc_queue: TcQueueT, object_id: ObjectId): def pack_cmd_ctrl_to_on(q: QueueHelper, object_id: ObjectIdU32):
command_mode( command_mode(
object_id=object_id.as_bytes, object_id=object_id.as_bytes,
mode=Modes.ON, mode=Modes.ON,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info=f"Commanding {object_id} ON", info=f"Commanding {object_id} ON",
) )
def pack_cmd_ctrl_to_nml(tc_queue: TcQueueT, object_id: ObjectId): def pack_cmd_ctrl_to_nml(q: QueueHelper, object_id: ObjectIdU32):
command_mode( command_mode(
object_id=object_id.as_bytes, object_id=object_id.as_bytes,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info=f"Commanding {object_id} NORMAL", info=f"Commanding {object_id} NORMAL",
) )

View File

@ -1,14 +1,16 @@
import enum import enum
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry from tmtccmd.config import TmTcDefWrapper
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from tmtccmd.config.tmtc import OpCodeEntry
from config.object_ids import CORE_CONTROLLER_ID from config.object_ids import CORE_CONTROLLER_ID
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -65,104 +67,93 @@ class Copy(enum.IntEnum):
NONE = 2 NONE = 2
def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT): def add_core_controller_definitions(defs: TmTcDefWrapper):
od = dict() oce = OpCodeEntry()
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC) oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_FULL, info=Info.REBOOT_FULL) oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_SELF, info="Reboot Self") oce.add(keys=OpCodes.REBOOT_FULL, info=Info.REBOOT_FULL)
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_0, info="Reboot 0 0") oce.add(keys=OpCodes.XSC_REBOOT_SELF, info="Reboot Self")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_1, info="Reboot 0 1") oce.add(keys=OpCodes.XSC_REBOOT_0_0, info="Reboot 0 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_0, info="Reboot 1 0") oce.add(keys=OpCodes.XSC_REBOOT_0_1, info="Reboot 0 1")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_1, info="Reboot 1 1") oce.add(keys=OpCodes.XSC_REBOOT_1_0, info="Reboot 1 0")
add_op_code_entry( oce.add(keys=OpCodes.XSC_REBOOT_1_1, info="Reboot 1 1")
op_code_dict=od, oce.add(
keys=OpCodes.GET_HK, keys=OpCodes.GET_HK,
info="Request housekeeping set", info="Request housekeeping set",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING, keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
info="Enable reboot file handling", info="Enable reboot file handling",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING, keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
info="Disable reboot file handling", info="Disable reboot file handling",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS, keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
info="Reset all reboot counters", info="Reset all reboot counters",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_00, keys=OpCodes.RESET_REBOOT_COUNTER_00,
info="Reset reboot counter 0 0", info="Reset reboot counter 0 0",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_01, keys=OpCodes.RESET_REBOOT_COUNTER_01,
info="Reset reboot counter 0 1", info="Reset reboot counter 0 1",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_10, keys=OpCodes.RESET_REBOOT_COUNTER_10,
info="Reset reboot counter 1 0", info="Reset reboot counter 1 0",
) )
add_op_code_entry( oce.add(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_11, keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1", info="Reset reboot counter 1 1",
) )
add_service_op_code_entry( defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
info="Core Controller",
op_code_entry=od,
)
def pack_core_commands(tc_queue: TcQueueT, op_code: str): def pack_core_commands(q: QueueHelper, op_code: str):
if op_code in OpCodes.REBOOT_XSC: if op_code in OpCodes.REBOOT_XSC:
reboot_self, chip_select, copy_select = determine_reboot_params() reboot_self, chip_select, copy_select = determine_reboot_params()
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, q=q,
reboot_self=reboot_self, reboot_self=reboot_self,
chip=chip_select, chip=chip_select,
copy=copy_select, copy=copy_select,
) )
if op_code in OpCodes.REBOOT_FULL: if op_code in OpCodes.REBOOT_FULL:
tc_queue.appendleft((QueueCommands.PRINT, f"Core Command: {Info.REBOOT_FULL}")) q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
cmd = generate_action_command( q.add_pus_tc(
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT
) )
tc_queue.appendleft(cmd.pack_command_tuple()) )
if op_code in OpCodes.XSC_REBOOT_SELF: if op_code in OpCodes.XSC_REBOOT_SELF:
perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True) perform_reboot_cmd(q=q, reboot_self=True)
if op_code in OpCodes.XSC_REBOOT_0_0: if op_code in OpCodes.XSC_REBOOT_0_0:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
) )
if op_code in OpCodes.XSC_REBOOT_0_1: if op_code in OpCodes.XSC_REBOOT_0_1:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, q=q,
reboot_self=False, reboot_self=False,
chip=Chip.CHIP_0, chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD, copy=Copy.COPY_1_GOLD,
) )
if op_code in OpCodes.XSC_REBOOT_1_0: if op_code in OpCodes.XSC_REBOOT_1_0:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM q=q, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
) )
if op_code in OpCodes.XSC_REBOOT_1_1: if op_code in OpCodes.XSC_REBOOT_1_1:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, q=q,
reboot_self=False, reboot_self=False,
chip=Chip.CHIP_1, chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD, copy=Copy.COPY_1_GOLD,
) )
if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING: if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Disabling reboot file handling")) q.add_log_cmd("Disabling reboot file handling")
app_data = bytearray([0]) app_data = bytearray([0])
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, object_id=CORE_CONTROLLER_ID,
@ -170,7 +161,7 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
app_data=app_data, app_data=app_data,
) )
if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING: if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Enabling reboot file handling")) q.add_log_cmd("Enabling reboot file handling")
app_data = bytearray([1]) app_data = bytearray([1])
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, object_id=CORE_CONTROLLER_ID,
@ -178,35 +169,34 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
app_data=app_data, app_data=app_data,
) )
if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS: if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting all reboot counters")) q.add_log_cmd("Resetting all reboot counters")
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS
) )
if op_code in OpCodes.RESET_REBOOT_COUNTER_00: if op_code in OpCodes.RESET_REBOOT_COUNTER_00:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 0")) q.add_log_cmd("Resetting reboot counter 0 0")
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00 object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00
) )
if op_code in OpCodes.RESET_REBOOT_COUNTER_01: if op_code in OpCodes.RESET_REBOOT_COUNTER_01:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 1")) q.add_log_cmd("Resetting reboot counter 0 1")
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01 object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01
) )
if op_code in OpCodes.RESET_REBOOT_COUNTER_10: if op_code in OpCodes.RESET_REBOOT_COUNTER_10:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 0")) q.add_log_cmd("Resetting reboot counter 1 0")
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10 object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10
) )
if op_code in OpCodes.RESET_REBOOT_COUNTER_11: if op_code in OpCodes.RESET_REBOOT_COUNTER_11:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 1")) q.add_log_cmd("Resetting reboot counter 1 1")
generate_action_command( generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11 object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11
) )
if op_code in OpCodes.GET_HK: if op_code in OpCodes.GET_HK:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting housekeeping set")) q.add_log_cmd("Requesting housekeeping set")
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetIds.HK) sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetIds.HK)
command = generate_one_hk_command(sid, 201) q.add_pus_tc(generate_one_hk_command(sid))
tc_queue.appendleft(command.pack_command_tuple())
def determine_reboot_params() -> (bool, Chip, Copy): def determine_reboot_params() -> (bool, Chip, Copy):
@ -241,31 +231,25 @@ def determine_reboot_params() -> (bool, Chip, Copy):
def perform_reboot_cmd( def perform_reboot_cmd(
tc_queue: TcQueueT, q: QueueHelper,
reboot_self: bool, reboot_self: bool,
chip: Chip = Chip.NONE, chip: Chip = Chip.NONE,
copy: Copy = Copy.NONE, copy: Copy = Copy.NONE,
): ):
tc_data = bytearray() tc_data = bytearray()
if reboot_self: if reboot_self:
tc_queue.appendleft( q.add_log_cmd("Packing reboot command for current image")
(QueueCommands.PRINT, "Packing reboot command for current image")
)
tc_data.append(True) tc_data.append(True)
else: else:
tc_data.append(False) tc_data.append(False)
tc_data.append(chip) tc_data.append(chip)
tc_data.append(copy) tc_data.append(copy)
tc_queue.append( q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
( q.add_pus_tc(
QueueCommands.PRINT, generate_action_command(
f"Packing reboot command for chip {chip} and copy {copy}",
)
)
action_cmd = generate_action_command(
object_id=CORE_CONTROLLER_ID, object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.XSC_REBOOT, action_id=ActionIds.XSC_REBOOT,
app_data=tc_data, app_data=tc_data,
ssc=0, ssc=0,
) )
tc_queue.appendleft(action_cmd.pack_command_tuple()) )

View File

@ -1,19 +1,15 @@
from __future__ import annotations from __future__ import annotations
import struct
import time import time
from datetime import timedelta
from typing import List from typing import List
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import get_object_ids from config.object_ids import get_object_ids
from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.tcs import pack_tcs_sys_commands
from tmtccmd.config import ( from tmtccmd.config import TmTcDefWrapper, OpCodeEntry
QueueCommands,
ServiceOpCodeDictT, from tmtccmd.tc import QueueHelper
add_op_code_entry,
add_service_op_code_entry,
)
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_11_tc_sched import ( from tmtccmd.tc.pus_11_tc_sched import (
generate_time_tagged_cmd, generate_time_tagged_cmd,
generate_enable_tc_sched_cmd, generate_enable_tc_sched_cmd,
@ -82,7 +78,12 @@ class KeyAndInfo:
KAI = KeyAndInfo KAI = KeyAndInfo
PROC_INFO_DICT = { PROC_INFO_DICT = {
KAI.TV_SETUP_TCS_FT_ON[0]: [OpCodes.TV_SETUP_TCS_FT_ON, KAI.TV_SETUP_TCS_FT_ON[1], 120.0, 10.0], KAI.TV_SETUP_TCS_FT_ON[0]: [
OpCodes.TV_SETUP_TCS_FT_ON,
KAI.TV_SETUP_TCS_FT_ON[1],
120.0,
10.0,
],
KAI.TV_TEARDOWN_TCS_FT_OFF[0]: [ KAI.TV_TEARDOWN_TCS_FT_OFF[0]: [
OpCodes.TV_TEARDOWN_TCS_FT_OFF, OpCodes.TV_TEARDOWN_TCS_FT_OFF,
KAI.TV_TEARDOWN_TCS_FT_OFF[1], KAI.TV_TEARDOWN_TCS_FT_OFF[1],
@ -121,28 +122,23 @@ class GenericHkListeningCfg:
return GenericHkListeningCfg(False, False, False) return GenericHkListeningCfg(False, False, False)
def generic_print(tc_queue: TcQueueT, info: dict): def generic_print(q: QueueHelper, info: dict):
tc_queue.appendleft( q.add_log_cmd(f"Executing {info[1]} Procedure (OpCodes: {info[0]})")
(QueueCommands.PRINT, f"Executing {info[1]} Procedure (OpCodes: {info[0]})")
)
def add_proc_cmds(cmd_dict: ServiceOpCodeDictT): def add_proc_cmds(defs: TmTcDefWrapper):
op_code_dict = dict() oce = OpCodeEntry()
for proc_entry in PROC_INFO_DICT.values(): for proc_entry in PROC_INFO_DICT.values():
add_op_code_entry( oce.add(keys=proc_entry[0], info=proc_entry[1])
op_code_dict=op_code_dict, keys=proc_entry[0], info=proc_entry[1] defs.add_service(
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.PROCEDURE.value, name=CustomServiceList.PROCEDURE.value,
info="TV Test Procedures", info="TV Test Procedures",
op_code_entry=op_code_dict, op_code_entry=oce,
) )
def pack_generic_hk_listening_cmds( def pack_generic_hk_listening_cmds(
tc_queue: TcQueueT, q: QueueHelper,
proc_key: str, proc_key: str,
sid_list: list[bytearray], sid_list: list[bytearray],
diag_list: list[bool], diag_list: list[bool],
@ -150,83 +146,77 @@ def pack_generic_hk_listening_cmds(
): ):
info = PROC_INFO_DICT[proc_key] info = PROC_INFO_DICT[proc_key]
collection_time = info[2] collection_time = info[2]
generic_print(tc_queue=tc_queue, info=info) generic_print(q=q, info=info)
for i in range(len(sid_list)): for i in range(len(sid_list)):
enable_listen_to_hk_for_x_seconds( enable_listen_to_hk_for_x_seconds(
diag=diag_list[i], diag=diag_list[i],
tc_queue=tc_queue, q=q,
device=proc_key, device=proc_key,
sid=sid_list[i], sid=sid_list[i],
interval_seconds=info[3], interval_seconds=info[3],
) )
if not cfg.use_tc_sched: if not cfg.use_tc_sched:
tc_queue.appendleft((QueueCommands.WAIT, 2.0)) q.add_wait_seconds(2.0)
if cfg.mgt: if cfg.mgt:
activate_mgts_alternately( activate_mgts_alternately(q)
tc_queue=tc_queue,
)
elif cfg.one_rw: elif cfg.one_rw:
activate_all_rws_in_sequence( activate_all_rws_in_sequence(
tc_queue=tc_queue, test_speed=20000, test_ramp_time=10000, init_ssc=0 q=q, test_speed=20000, test_ramp_time=10000, init_ssc=0
) )
elif cfg.two_rws: elif cfg.two_rws:
activate_all_rws_two_consecutively(tc_queue=tc_queue, init_ssc=0) activate_all_rws_two_consecutively(q=q)
else: else:
pass pass
if not cfg.use_tc_sched: if not cfg.use_tc_sched:
tc_queue.appendleft((QueueCommands.WAIT, collection_time)) q.add_wait_seconds(collection_time)
disable_cmd_list = [] disable_cmd_list = []
for i in range(len(sid_list)): for i in range(len(sid_list)):
disable_cmd_list.append( disable_cmd_list.append(
gen_disable_listen_to_hk_for_x_seconds( gen_disable_listen_to_hk_for_x_seconds(
diag=diag_list[i], diag=diag_list[i],
tc_queue=tc_queue, q=q,
device=proc_key, device=proc_key,
sid=sid_list[i], sid=sid_list[i],
) )
) )
if cfg.one_rw or cfg.two_rws: if cfg.one_rw or cfg.two_rws:
activate_all_rws_in_sequence( activate_all_rws_in_sequence(q=q, test_speed=0, test_ramp_time=5000, init_ssc=0)
tc_queue=tc_queue, test_speed=0, test_ramp_time=5000, init_ssc=0 q.add_wait_seconds(60.0)
)
tc_queue.appendleft((QueueCommands.WAIT, 60))
current_time = time.time() current_time = time.time()
current_time += collection_time current_time += collection_time
if not cfg.use_tc_sched: if not cfg.use_tc_sched:
for cmd in disable_cmd_list: for cmd in disable_cmd_list:
tc_queue.appendleft(cmd.pack_command_tuple()) q.add_pus_tc(cmd)
else: else:
for cmd in disable_cmd_list: for cmd in disable_cmd_list:
tc_queue.appendleft( q.add_pus_tc(
generate_time_tagged_cmd( generate_time_tagged_cmd(
release_time=struct.pack("!I", int(current_time)), release_time=struct.pack("!I", int(current_time)), tc_to_insert=cmd
tc_to_insert=cmd,
ssc=0,
) )
) )
if not cfg.use_tc_sched: if not cfg.use_tc_sched:
tc_queue.appendleft((QueueCommands.WAIT, 60)) q.add_wait_seconds(60.0)
sid_list.clear() sid_list.clear()
diag_list.clear() diag_list.clear()
def pack_proc_commands(tc_queue: TcQueueT, op_code: str): def pack_proc_commands(q: QueueHelper, op_code: str):
sid_list = [] sid_list = []
obj_id_dict = get_object_ids() obj_id_dict = get_object_ids()
if op_code in OpCodes.RESET_SCHED: if op_code in OpCodes.RESET_SCHED:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting/Clearing TC schedule")) q.add_log_cmd("Resetting/Clearing TC schedule")
tc_queue.appendleft(generate_reset_tc_sched_cmd().pack_command_tuple()) q.add_pus_tc(generate_reset_tc_sched_cmd())
if op_code in OpCodes.BAT_FT: if op_code in OpCodes.BAT_FT:
key = KAI.BAT_FT[0] key = KAI.BAT_FT[0]
sid_list.append(make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)) sid_list.append(make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET))
diag_list = [False] diag_list = [False]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
@ -238,7 +228,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)) sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK))
diag_list = [False] diag_list = [False]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
@ -274,7 +264,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
set_id = pcdu_dev[1] set_id = pcdu_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
@ -286,7 +276,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.HK)) sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.HK))
diag_list = [False] diag_list = [False]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
@ -295,20 +285,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.TV_SETUP_TCS_FT_ON: if op_code in OpCodes.TV_SETUP_TCS_FT_ON:
# Enable scheduling # Enable scheduling
tc_queue.appendleft(generate_enable_tc_sched_cmd(ssc=22).pack_command_tuple()) q.add_pus_tc(generate_enable_tc_sched_cmd())
# check whether tcs_assembly also has to be commanded to NORMAL Mode # check whether tcs_assembly also has to be commanded to NORMAL Mode
pack_tcs_sys_commands( pack_tcs_sys_commands(q=q, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0])
tc_queue=tc_queue, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0] pack_cmd_ctrl_to_nml(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
)
pack_cmd_ctrl_to_nml(
tc_queue=tc_queue, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID)
)
if op_code in OpCodes.TV_TEARDOWN_TCS_FT_OFF: if op_code in OpCodes.TV_TEARDOWN_TCS_FT_OFF:
# TCS board should always be on anyway, do not command it off here # TCS board should always be on anyway, do not command it off here
pack_cmd_ctrl_to_off( pack_cmd_ctrl_to_off(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
tc_queue=tc_queue, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID)
)
if op_code in OpCodes.ACS_FT: if op_code in OpCodes.ACS_FT:
key = KAI.ACS_FT[0] key = KAI.ACS_FT[0]
@ -327,55 +311,43 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
(oids.GPS_CONTROLLER, GpsSetIds.HK), (oids.GPS_CONTROLLER, GpsSetIds.HK),
] ]
d_side_pairs = a_side_pairs + b_side_pairs d_side_pairs = a_side_pairs + b_side_pairs
diag_list = [ diag_list = [False, False, True, False, False]
False, pack_acs_command(q=q, op_code="acs-a")
False,
True,
False,
False
]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
for a_side_dev in a_side_pairs: for a_side_dev in a_side_pairs:
oid = a_side_dev[0] oid = a_side_dev[0]
set_id = a_side_dev[1] set_id = a_side_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="acs-off") pack_acs_command(q=q, op_code="acs-off")
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) q.add_wait_seconds(5.0)
pack_acs_command(tc_queue=tc_queue, op_code="acs-b") pack_acs_command(q=q, op_code="acs-b")
sid_list.clear() sid_list.clear()
diag_list = [ diag_list = [False, False, True, False, False]
False,
False,
True,
False,
False
]
for b_side_dev in b_side_pairs: for b_side_dev in b_side_pairs:
oid = b_side_dev[0] oid = b_side_dev[0]
set_id = b_side_dev[1] set_id = b_side_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="acs-off") pack_acs_command(q=q, op_code="acs-off")
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) q.add_wait_seconds(5.0)
pack_acs_command(tc_queue=tc_queue, op_code="acs-d") pack_acs_command(q=q, op_code="acs-d")
sid_list.clear() sid_list.clear()
@ -396,14 +368,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
False, False,
] ]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="acs-off") pack_acs_command(q=q, op_code="acs-off")
if op_code in OpCodes.MGT_FT: if op_code in OpCodes.MGT_FT:
key = KAI.MGT_FT[0] key = KAI.MGT_FT[0]
@ -419,20 +391,24 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
] ]
# Command MGT to mode on # Command MGT to mode on
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
tc_queue.appendleft((QueueCommands.WAIT, 5)) q.add_wait_seconds(5.0)
# Command MGT to normal mode # Command MGT to normal mode
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
for imtq_dev in imtq_pairs: for imtq_dev in imtq_pairs:
oid = imtq_dev[0] oid = imtq_dev[0]
set_id = imtq_dev[1] set_id = imtq_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag_list=diag_list, cfg=GenericHkListeningCfg.default() q=q,
proc_key=key,
sid_list=sid_list,
diag_list=diag_list,
cfg=GenericHkListeningCfg.default(),
) )
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="0") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
if op_code in OpCodes.MGT_FT_DP: if op_code in OpCodes.MGT_FT_DP:
key = KAI.MGT_FT_DP[0] key = KAI.MGT_FT_DP[0]
@ -471,12 +447,12 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
True, True,
True, True,
] ]
pack_acs_command(tc_queue=tc_queue, op_code="acs-d") pack_acs_command(q=q, op_code="acs-d")
# Command MGT to mode on # Command MGT to mode on
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
tc_queue.appendleft((QueueCommands.WAIT, 20)) q.add_wait_seconds(20.0)
# Command MGT to normal mode # Command MGT to normal mode
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
for d_side_and_imtq_dev in d_side_and_imtq_pairs: for d_side_and_imtq_dev in d_side_and_imtq_pairs:
oid = d_side_and_imtq_dev[0] oid = d_side_and_imtq_dev[0]
@ -486,20 +462,20 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
cfg = GenericHkListeningCfg.default() cfg = GenericHkListeningCfg.default()
cfg.mgt = True cfg.mgt = True
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=cfg, cfg=cfg,
) )
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="0") pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
pack_acs_command(tc_queue=tc_queue, op_code="acs-off") pack_acs_command(q=q, op_code="acs-off")
if op_code in OpCodes.SUS_FT: if op_code in OpCodes.SUS_FT:
key = KAI.SUS_FT[0] key = KAI.SUS_FT[0]
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-nom") pack_sus_cmds(q=q, op_code="sus-nom")
sus_n_ids = [ sus_n_ids = [
oids.SUS_0_N_LOC_XFYFZM_PT_XF, oids.SUS_0_N_LOC_XFYFZM_PT_XF,
@ -530,16 +506,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
for nom_sus in sus_n_ids: for nom_sus in sus_n_ids:
sid_list.append(make_sid(nom_sus, SetIds.HK)) sid_list.append(make_sid(nom_sus, SetIds.HK))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="sus-off") pack_acs_command(q=q, op_code="sus-off")
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) q.add_wait_seconds(5.0)
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-red") pack_sus_cmds(q=q, op_code="sus-red")
diag_list = [ diag_list = [
True, True,
@ -554,16 +530,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
for red_sus in sus_r_ids: for red_sus in sus_r_ids:
sid_list.append(make_sid(red_sus, SetIds.HK)) sid_list.append(make_sid(red_sus, SetIds.HK))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="sus-off") pack_acs_command(q=q, op_code="sus-off")
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) q.add_wait_seconds(5.0)
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-d") pack_sus_cmds(q=q, op_code="sus-d")
# SUSs # SUSs
for nom_sus in sus_n_ids: for nom_sus in sus_n_ids:
@ -585,36 +561,32 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
True, True,
] ]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_acs_command(tc_queue=tc_queue, op_code="sus-off") pack_acs_command(q=q, op_code="sus-off")
if op_code in OpCodes.STR_FT: if op_code in OpCodes.STR_FT:
key = KAI.STR_FT[0] key = KAI.STR_FT[0]
pack_star_tracker_commands( pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="2")
object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="2"
)
# STR # STR
sid_list.append(make_sid(oids.STAR_TRACKER_ID, StrSetIds.TEMPERATURE)) sid_list.append(make_sid(oids.STAR_TRACKER_ID, StrSetIds.TEMPERATURE))
diag_list = [False] diag_list = [False]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg.default(), cfg=GenericHkListeningCfg.default(),
) )
pack_star_tracker_commands( pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="3")
object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="3"
)
if op_code in OpCodes.RW_FT_ONE_RW: if op_code in OpCodes.RW_FT_ONE_RW:
key = KAI.RW_FT_ONE_RW[0] key = KAI.RW_FT_ONE_RW[0]
@ -647,7 +619,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
False, False,
] ]
# RW NORMAL # RW NORMAL
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
# RW HK für alle RWs nur einzeln # RW HK für alle RWs nur einzeln
for rw_dev in rw_pairs: for rw_dev in rw_pairs:
@ -655,14 +627,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
set_id = rw_dev[1] set_id = rw_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg(mgt=False, one_rw=True, two_rws=False), cfg=GenericHkListeningCfg(mgt=False, one_rw=True, two_rws=False),
) )
# RW OFF # RW OFF
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
# ass command with 2 rws to speed # ass command with 2 rws to speed
if op_code in OpCodes.RW_FT_TWO_RWS: if op_code in OpCodes.RW_FT_TWO_RWS:
@ -704,7 +676,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
False, False,
] ]
# RW NORMAL # RW NORMAL
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
# RW # RW
for rw_dev in rw_pairs: for rw_dev in rw_pairs:
@ -712,190 +684,162 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
set_id = rw_dev[1] set_id = rw_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, q=q,
proc_key=key, proc_key=key,
sid_list=sid_list, sid_list=sid_list,
diag_list=diag_list, diag_list=diag_list,
cfg=GenericHkListeningCfg(mgt=False, one_rw=False, two_rws=True), cfg=GenericHkListeningCfg(mgt=False, one_rw=False, two_rws=True),
) )
# RW OFF # RW OFF
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
def enable_listen_to_hk_for_x_seconds( def enable_listen_to_hk_for_x_seconds(
tc_queue: TcQueueT, q: QueueHelper,
diag: bool, diag: bool,
device: str, device: str,
sid: bytes, sid: bytes,
interval_seconds: float, interval_seconds: float,
): ):
tc_queue.appendleft((QueueCommands.PRINT, f"Enabling periodic HK for {device}")) q.add_log_cmd(f"Enabling periodic HK for {device}")
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
diag=diag, sid=sid, interval_seconds=interval_seconds, ssc=0 diag=diag, sid=sid, interval_seconds=interval_seconds, ssc=0
) )
for cmd in cmd_tuple: for cmd in cmd_tuple:
tc_queue.appendleft(cmd.pack_command_tuple()) q.add_pus_tc(cmd)
def gen_disable_listen_to_hk_for_x_seconds( def gen_disable_listen_to_hk_for_x_seconds(
tc_queue: TcQueueT, q: QueueHelper,
diag: bool, diag: bool,
device: str, device: str,
sid: bytes, sid: bytes,
) -> PusTelecommand: ) -> PusTelecommand:
tc_queue.appendleft((QueueCommands.PRINT, f"Disabling periodic HK for {device}")) q.add_log_cmd(f"Disabling periodic HK for {device}")
return disable_periodic_hk_command(diag=diag, sid=sid, ssc=0) return disable_periodic_hk_command(diag=diag, sid=sid)
def activate_mgts_alternately( def activate_mgts_alternately(
tc_queue: TcQueueT, q: QueueHelper,
): ):
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=2000, x_dipole=2000,
y_dipole=0, y_dipole=0,
z_dipole=0, z_dipole=0,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=-2000, x_dipole=-2000,
y_dipole=0, y_dipole=0,
z_dipole=0, z_dipole=0,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=0, x_dipole=0,
y_dipole=2000, y_dipole=2000,
z_dipole=0, z_dipole=0,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=0, x_dipole=0,
y_dipole=-2000, y_dipole=-2000,
z_dipole=0, z_dipole=0,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=0, x_dipole=0,
y_dipole=0, y_dipole=0,
z_dipole=2000, z_dipole=2000,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
command = pack_dipole_command( q.add_pus_tc(
pack_dipole_command(
object_id=oids.IMTQ_HANDLER_ID, object_id=oids.IMTQ_HANDLER_ID,
x_dipole=0, x_dipole=0,
y_dipole=0, y_dipole=0,
z_dipole=-2000, z_dipole=-2000,
duration=30000, duration=30000,
) )
tc_queue.appendleft(command.pack_command_tuple()) )
tc_queue.appendleft((QueueCommands.WAIT, 40.0)) q.add_wait_seconds(40.0)
def rw_speed_cmd_single( def rw_speed_cmd_single(q: QueueHelper, oid: bytes, speed: int, ramp_time: int):
tc_queue: TcQueueT, oid: bytes, init_ssc: int, speed: int, ramp_time: int q.add_pus_tc(
) -> int: pack_set_speed_command(object_id=oid, speed=speed, ramp_time_ms=ramp_time)
command = pack_set_speed_command(
object_id=oid, speed=speed, ramp_time_ms=ramp_time, ssc=init_ssc
) )
init_ssc += 1 q.add_wait(timedelta(seconds=70.0))
tc_queue.appendleft(command.pack_command_tuple()) q.add_pus_tc(pack_set_speed_command(object_id=oid, speed=0, ramp_time_ms=ramp_time))
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command(
object_id=oid, speed=0, ramp_time_ms=ramp_time, ssc=init_ssc
)
tc_queue.appendleft(command.pack_command_tuple())
return init_ssc + 1
def rw_speed_up_cmd_consec( def rw_speed_up_cmd_consec(
tc_queue: TcQueueT, obids: List[bytes], init_ssc: int, speed: int, ramp_time: int q: QueueHelper, obids: List[bytes], speed: int, ramp_time: int
) -> int: ):
for oid in obids: for oid in obids:
command = pack_set_speed_command( q.add_pus_tc(
object_id=oid, speed=speed, ramp_time_ms=ramp_time, ssc=init_ssc pack_set_speed_command(object_id=oid, speed=speed, ramp_time_ms=ramp_time)
) )
tc_queue.appendleft(command.pack_command_tuple())
init_ssc += 1
return init_ssc
def rw_speed_down_cmd_consec( def rw_speed_down_cmd_consec(q: QueueHelper, obids: List[bytes], ramp_time: int):
tc_queue: TcQueueT, obids: List[bytes], init_ssc: int, ramp_time: int
) -> int:
for oid in obids: for oid in obids:
command = pack_set_speed_command( q.add_pus_tc(
object_id=oid, speed=0, ramp_time_ms=ramp_time, ssc=init_ssc pack_set_speed_command(object_id=oid, speed=0, ramp_time_ms=ramp_time)
) )
tc_queue.appendleft(command.pack_command_tuple())
init_ssc += 1
return init_ssc
def activate_all_rws_in_sequence( def activate_all_rws_in_sequence(
tc_queue: TcQueueT, init_ssc: int, test_speed: int, test_ramp_time: int q: QueueHelper, init_ssc: int, test_speed: int, test_ramp_time: int
) -> int: ):
new_ssc = init_ssc new_ssc = init_ssc
# RW1 speed cmd # RW1 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 58)) q.add_wait(timedelta(seconds=58.0))
new_ssc = rw_speed_cmd_single( rw_speed_cmd_single(q, oids.RW1_ID, test_speed, test_ramp_time)
tc_queue, oids.RW1_ID, new_ssc, test_speed, test_ramp_time q.add_wait_seconds(30.0)
) rw_speed_cmd_single(q, oids.RW2_ID, test_speed, test_ramp_time)
tc_queue.appendleft((QueueCommands.WAIT, 30)) q.add_wait_seconds(30.0)
new_ssc = rw_speed_cmd_single( rw_speed_cmd_single(q, oids.RW3_ID, test_speed, test_ramp_time)
tc_queue, oids.RW2_ID, new_ssc, test_speed, test_ramp_time q.add_wait_seconds(30.0)
) rw_speed_cmd_single(q, oids.RW4_ID, test_speed, test_ramp_time)
tc_queue.appendleft((QueueCommands.WAIT, 30)) q.add_wait_seconds(30.0)
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW3_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 30))
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW4_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 30))
return new_ssc return new_ssc
def activate_all_rws_two_consecutively(tc_queue: TcQueueT, init_ssc: int) -> int: def activate_all_rws_two_consecutively(q: QueueHelper):
new_ssc = init_ssc
# RW1+3 speed cmd # RW1+3 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) q.add_wait_seconds(5.0)
new_ssc = rw_speed_up_cmd_consec( rw_speed_up_cmd_consec(q, [oids.RW1_ID, oids.RW3_ID], -20000, 10000)
tc_queue, [oids.RW1_ID, oids.RW3_ID], new_ssc, -20000, 10000 q.add_wait_seconds(70.0)
) rw_speed_down_cmd_consec(q, [oids.RW1_ID, oids.RW3_ID], 10000)
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) q.add_wait_seconds(15.0)
new_ssc = rw_speed_down_cmd_consec(
tc_queue, [oids.RW1_ID, oids.RW3_ID], new_ssc, 10000
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
# RW2+4 speed cmd # RW2+4 speed cmd
new_ssc = rw_speed_up_cmd_consec( rw_speed_up_cmd_consec(q, [oids.RW2_ID, oids.RW4_ID], -20000, 10000)
tc_queue, [oids.RW2_ID, oids.RW4_ID], new_ssc, -20000, 10000 q.add_wait_seconds(70.0)
) rw_speed_down_cmd_consec(q, [oids.RW2_ID, oids.RW4_ID], 10000)
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) q.add_wait_seconds(15.0)
new_ssc = rw_speed_down_cmd_consec(
tc_queue, [oids.RW2_ID, oids.RW4_ID], new_ssc, 10000
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
return new_ssc

View File

@ -1,4 +1,4 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands from tmtccmd.tc import QueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_200_fsfw_modes import Modes
from .common import command_mode from .common import command_mode
@ -15,13 +15,13 @@ class Info:
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off" TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str): def pack_tcs_sys_commands(q: QueueHelper, op_code: str):
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL: if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
command_mode( command_mode(
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info=Info.TCS_BOARD_ASS_NORMAL, info=Info.TCS_BOARD_ASS_NORMAL,
) )
if op_code in OpCodes.TCS_BOARD_ASS_OFF: if op_code in OpCodes.TCS_BOARD_ASS_OFF:
@ -29,6 +29,6 @@ def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str):
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
tc_queue=tc_queue, q=q,
info=Info.TCS_BOARD_ASS_OFF, info=Info.TCS_BOARD_ASS_OFF,
) )

View File

@ -1,10 +1,9 @@
from datetime import datetime from datetime import datetime
from spacepackets.ecss import PusTelecommand from spacepackets.ecss import PusTelecommand
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.tc import QueueHelper
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -17,12 +16,9 @@ class Info:
SET_CURRENT_TIME = "Setting current time in ASCII format" SET_CURRENT_TIME = "Setting current time in ASCII format"
def pack_set_current_time_ascii_command(tc_queue: TcQueueT, ssc: int): def pack_set_current_time_ascii_command(q: QueueHelper):
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0" time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
current_time_ascii = time_test_current_time.encode("ascii") current_time_ascii = time_test_current_time.encode("ascii")
LOGGER.info(f"Current time in ASCII format: {current_time_ascii}") LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
tc_queue.appendleft((QueueCommands.PRINT, Info.SET_CURRENT_TIME)) q.add_log_cmd(Info.SET_CURRENT_TIME)
command = PusTelecommand( q.add_pus_tc(PusTelecommand(service=9, subservice=128, app_data=current_time_ascii))
service=9, subservice=128, ssc=ssc, app_data=current_time_ascii
)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -6,7 +6,6 @@ from pus_tc.devs.ploc_supervisor import SupvActionIds
from pus_tc.devs.star_tracker import StarTrackerActionIds from pus_tc.devs.star_tracker import StarTrackerActionIds
from gomspace.gomspace_common import GomspaceDeviceActionIds from gomspace.gomspace_common import GomspaceDeviceActionIds
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from tmtccmd.config.definitions import DataReplyUnpacked
from tmtccmd.tm import Service8FsfwTm from tmtccmd.tm import Service8FsfwTm
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
@ -91,7 +90,6 @@ def handle_ploc_replies(
def handle_supervisor_replies( def handle_supervisor_replies(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
): ):
reply = DataReplyUnpacked()
if action_id == SupvActionIds.DUMP_MRAM: if action_id == SupvActionIds.DUMP_MRAM:
header_list = ["MRAM Dump"] header_list = ["MRAM Dump"]
content_list = [custom_data[: len(custom_data)]] content_list = [custom_data[: len(custom_data)]]
@ -132,14 +130,14 @@ def handle_acu_replies(
): ):
if action_id == GomspaceDeviceActionIds.PARAM_GET: if action_id == GomspaceDeviceActionIds.PARAM_GET:
header_list = [ header_list = [
"Gomspace action ID" "Gomspace action ID" "Table ID",
"Table ID",
"Memory Address", "Memory Address",
"Payload length" "Payload length" "Payload",
"Payload"
] ]
fmt_str = "!BBHH" fmt_str = "!BBHH"
(action, table_id, address, payload_length) = struct.unpack(fmt_str, custom_data[:6]) (action, table_id, address, payload_length) = struct.unpack(
fmt_str, custom_data[:6]
)
content_list = [ content_list = [
action, action,
table_id, table_id,

View File

@ -1,7 +1,7 @@
import struct import struct
from pus_tm.defs import PrintWrapper from pus_tm.defs import PrintWrapper
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectIdU32
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from pus_tc.devs.gyros import L3gGyroSetIds, AdisGyroSetIds from pus_tc.devs.gyros import L3gGyroSetIds, AdisGyroSetIds
@ -9,7 +9,7 @@ import config.object_ids as obj_ids
def handle_gyros_hk_data( def handle_gyros_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if object_id.as_bytes in [ if object_id.as_bytes in [
obj_ids.GYRO_0_ADIS_HANDLER_ID, obj_ids.GYRO_0_ADIS_HANDLER_ID,
@ -28,7 +28,7 @@ def handle_gyros_hk_data(
def handle_adis_gyro_hk( def handle_adis_gyro_hk(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id == AdisGyroSetIds.CORE_HK: if set_id == AdisGyroSetIds.CORE_HK:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
@ -58,7 +58,7 @@ def handle_adis_gyro_hk(
def handle_l3g_gyro_hk( def handle_l3g_gyro_hk(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id == L3gGyroSetIds.CORE_HK: if set_id == L3gGyroSetIds.CORE_HK:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)

View File

@ -2,30 +2,36 @@ import struct
from pus_tm.defs import PrintWrapper from pus_tm.defs import PrintWrapper
from pus_tc.devs.mgms import MgmRm3100SetIds, MgmLis3SetIds from pus_tc.devs.mgms import MgmRm3100SetIds, MgmLis3SetIds
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectIdU32
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
import config.object_ids as obj_ids import config.object_ids as obj_ids
def handle_mgm_hk_data( def handle_mgm_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if object_id.as_bytes in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]: if object_id.as_bytes in [
obj_ids.MGM_0_LIS3_HANDLER_ID,
obj_ids.MGM_2_LIS3_HANDLER_ID,
]:
handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data) handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data)
elif object_id.as_bytes in [obj_ids.MGM_1_RM3100_HANDLER_ID, obj_ids.MGM_3_RM3100_HANDLER_ID]: elif object_id.as_bytes in [
obj_ids.MGM_1_RM3100_HANDLER_ID,
obj_ids.MGM_3_RM3100_HANDLER_ID,
]:
handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data) handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data)
pass pass
def handle_mgm_lis3_hk_data( def handle_mgm_lis3_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id == MgmLis3SetIds.CORE_HK: if set_id == MgmLis3SetIds.CORE_HK:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
fmt_str = "!ffff" fmt_str = "!ffff"
inc_len = struct.calcsize(fmt_str) inc_len = struct.calcsize(fmt_str)
(field_x, field_y, field_z, temp) = struct.unpack( (field_x, field_y, field_z, temp) = struct.unpack(
fmt_str, hk_data[0: 0 + inc_len] fmt_str, hk_data[0 : 0 + inc_len]
) )
pw.dlog(f"Received MGM LIS3 from object {object_id}") pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog( pw.dlog(
@ -35,7 +41,7 @@ def handle_mgm_lis3_hk_data(
def handle_mgm_rm3100_hk_data( def handle_mgm_rm3100_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id == MgmRm3100SetIds.CORE_HK: if set_id == MgmRm3100SetIds.CORE_HK:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)

View File

@ -180,13 +180,13 @@ def handle_pdu_data(
current_list = [] current_list = []
for idx in range(len(PDU1_CHANNELS_NAMES)): for idx in range(len(PDU1_CHANNELS_NAMES)):
current_list.append( current_list.append(
struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0] struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
) )
current_idx += 2 current_idx += 2
voltage_list = [] voltage_list = []
for idx in range(len(PDU1_CHANNELS_NAMES)): for idx in range(len(PDU1_CHANNELS_NAMES)):
voltage_list.append( voltage_list.append(
struct.unpack("!H", hk_data[current_idx: current_idx + 2])[0] struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
) )
current_idx += 2 current_idx += 2
output_enb_list = [] output_enb_list = []
@ -205,7 +205,7 @@ def handle_pdu_data(
fmt_str = "!IBf" fmt_str = "!IBf"
inc_len = struct.calcsize(fmt_str) inc_len = struct.calcsize(fmt_str)
(boot_count, batt_mode, temperature) = struct.unpack( (boot_count, batt_mode, temperature) = struct.unpack(
fmt_str, hk_data[current_idx: current_idx + inc_len] fmt_str, hk_data[current_idx : current_idx + inc_len]
) )
info = ( info = (
f"Boot Count {boot_count} | Battery Mode {batt_mode} | " f"Boot Count {boot_count} | Battery Mode {batt_mode} | "

View File

@ -1,11 +1,11 @@
import struct import struct
from pus_tm.defs import PrintWrapper, FsfwTmTcPrinter from pus_tm.defs import PrintWrapper, FsfwTmTcPrinter
from tmtccmd.utility.obj_id import ObjectId from tmtccmd.utility.obj_id import ObjectIdU32
def handle_rw_hk_data( def handle_rw_hk_data(
printer: FsfwTmTcPrinter, object_id: ObjectId, set_id: int, hk_data: bytes printer: FsfwTmTcPrinter, object_id: ObjectIdU32, set_id: int, hk_data: bytes
): ):
from pus_tc.devs.reaction_wheels import RwSetIds from pus_tc.devs.reaction_wheels import RwSetIds

Some files were not shown because too many files have changed in this diff Show More