Compare commits
464 Commits
Author | SHA1 | Date | |
---|---|---|---|
65ada579d3 | |||
fce0c4400b | |||
f4e9091484 | |||
e334521e6d | |||
cd0fd4d5a7 | |||
4686550eb9 | |||
26cd265e19 | |||
a4984c34c2 | |||
948ad4ef7f | |||
e32a6ded66 | |||
0add5c6ac5 | |||
9f905524b6 | |||
d5685adb48 | |||
4acae93206 | |||
05429d2048 | |||
a249d71840 | |||
a5cc03d8a0 | |||
fd692c901d | |||
b0f51072b2 | |||
be5cf32dc8 | |||
cbbb335254 | |||
42434cbe7e | |||
bf158bee2d | |||
80539cf897 | |||
ffd2eb11f8 | |||
ed5cb87cad | |||
4386b18049 | |||
a3e03350fa | |||
d758a1f11a | |||
af17e30676 | |||
5652305ee1 | |||
a3f5c92654 | |||
2e21087c6d | |||
e74e751142 | |||
d43badaddf | |||
26b292f05a | |||
6f397289ca | |||
3d4ef7003c | |||
bf31810f25 | |||
9462a6e245 | |||
208d328683 | |||
90ea903c0a | |||
2aa1ecd3a7 | |||
f18a7f49cf | |||
7f872c92c4 | |||
82352bc5fa | |||
a5bfee076a | |||
0c17203825 | |||
beb8e61e2c | |||
e9d10dae1b | |||
b959f60f0a | |||
3e666d76b7 | |||
7eafefc93b | |||
09c694cf9c | |||
94ae2d16e2 | |||
68a4764a56 | |||
a9e59ae42b | |||
3522405e8a | |||
783d5a8ed5 | |||
fc9b4efecf | |||
2468998dbd | |||
74e6d6fe5f | |||
cd393a1596 | |||
8747333880 | |||
77fbcede10 | |||
ba87c01f66 | |||
68c46a299f | |||
2dd850f072 | |||
c83e17bba3 | |||
e5eb2e479c | |||
d2bc142b50 | |||
9115f2519b | |||
54c78d4441 | |||
e46f685607 | |||
b0294e2764 | |||
350ffda6c6 | |||
9219f5863c | |||
4dcac73755 | |||
481e57be59 | |||
039eed1e16 | |||
001270a1e5 | |||
b443867512 | |||
9867ee873a | |||
aa427151f5 | |||
0ce32521f4 | |||
649c019eb8 | |||
fa5c24df6b | |||
a13454851b | |||
78b55f919c | |||
3259cf0807 | |||
8919f5c8e9 | |||
736bc23fc5 | |||
02797ffc5b | |||
6a30f6d0ac | |||
11454f6015 | |||
9720fcddec | |||
47fef53ac1 | |||
13014eb250 | |||
d47e9039a5 | |||
60c88fd21c | |||
fd649ff1bb | |||
3f71475860 | |||
7120f14601 | |||
7a82a77876 | |||
23aeb8bcf9 | |||
bc9f13f296 | |||
09dbc6b14d | |||
31d51e3660 | |||
da960b5344 | |||
24f0d8e1a6 | |||
86c1fc96d1 | |||
fda044c2ff | |||
75a8712f91 | |||
0bb1f57599 | |||
446e38ed57 | |||
a04bd8aa73 | |||
e47eb577fa | |||
7e06043df7 | |||
cf342fb14c | |||
ddf1900376 | |||
ed640dbbb1 | |||
4eb470c724 | |||
1dd667ae25 | |||
be032ab925 | |||
24e9c25ba4 | |||
336ed58272 | |||
679df9ebe1 | |||
6228181357 | |||
a06f703d6f | |||
fb676dc90f | |||
4917ddbbe4 | |||
f409d694aa | |||
a470484b9e | |||
4ced2d0b18 | |||
0f5401a2db | |||
9686701c2e | |||
d87361ae75 | |||
5f082cd9fc | |||
d1f96cb83d | |||
8f5f7064e9 | |||
6a6d9c0a7a | |||
db1dbe9661 | |||
1bc38ea4b5 | |||
37fcdb9a60 | |||
6e22e3528a | |||
a57511e725 | |||
887e76baf8 | |||
335d901451 | |||
a2d04b28fd | |||
802757ba72 | |||
af4ceec4f4 | |||
4cf131e9c1 | |||
1989a37e1e | |||
fbf507b2a8 | |||
b19d1e8869 | |||
201e08afe1 | |||
9f8ab3e235 | |||
676f851659 | |||
ab9f2ca05d | |||
e51b55811c | |||
c9f35c3e5c | |||
d97eb7334b | |||
aabfcf83ac | |||
2ef56ae8c4 | |||
7433982f6f | |||
57f2143d79 | |||
556060a3f3 | |||
d9945d4054 | |||
1947ebcb1f | |||
cf2b7443d4 | |||
49521e1661 | |||
08c315fbf9 | |||
1e143ea6fa | |||
8b677041e2 | |||
ff787f4497 | |||
7e90d6183c | |||
20e107c7ae | |||
4f9c728e51 | |||
bd3b666f8c | |||
483ebe87ad | |||
9b7471e909 | |||
09cf960350 | |||
d47da4c314 | |||
2d79f6f484 | |||
d99adf55a1 | |||
6db34aacaa | |||
654a5a2e13 | |||
8ec086f778 | |||
8d23f29f94 | |||
9178251ed7 | |||
d7c30ba406 | |||
5fa9727375 | |||
71f2f31fc5 | |||
d65480dfed | |||
0ae3ae294c | |||
841780593e | |||
669e9559b9 | |||
4a13be1beb | |||
1d73bcce00 | |||
aadd6f59b5 | |||
e5bb7f395f | |||
33da498ea8 | |||
94a82b84e8 | |||
d0c8e20d4f | |||
9955295dfe | |||
4086e7947b | |||
ca04b6018b | |||
dedfe1c977 | |||
ef42b1a179 | |||
5d3de069a6 | |||
f16e27b79b | |||
78c3b7dd93 | |||
8a96e21d1a | |||
eed6b82353 | |||
2bd6caa3c2 | |||
2766a5de7b | |||
895987ebf3 | |||
d6445d38a8 | |||
8aec6c48a0 | |||
cab0aa027a | |||
457ccf1ca0 | |||
fbb078784f | |||
f50aac689f | |||
66867ad9d2 | |||
e617faa4df | |||
fc5e3c88ff | |||
b474841d69 | |||
5e27a22a85 | |||
04f5a76962 | |||
5ed3cec20b | |||
c3c58b95ad | |||
5b309e4013 | |||
a39e94279b | |||
b9f58e0612 | |||
d9c202c68e | |||
28c367c6fb | |||
15adb9bf2e | |||
b4e4228040 | |||
26ebe9ab67 | |||
a680bf28f0 | |||
a3a3aaa883 | |||
17486fdca7 | |||
c633893df4 | |||
bf16fa14ad | |||
d7c66e4ac3 | |||
2cb923314b | |||
ee38f83ec1 | |||
0399b478f3 | |||
4fa333977a | |||
e4ec0689b5 | |||
fa23e05971 | |||
bf06dd70f4 | |||
c8ea75b2ad | |||
6b657b5623 | |||
6c663b473c | |||
7b5df331ef | |||
c6478f05fd | |||
b95204ef9e | |||
f082f05886 | |||
28b3e4bec7 | |||
dbd2e5d9fc | |||
3eeb58182b | |||
48675efe3f | |||
b98fc2f56d | |||
3c20d2ea24 | |||
2793b354a6 | |||
72fee20d65 | |||
98af6a7907 | |||
a7f11b3159 | |||
98ba66dba2 | |||
28fda7cdbd | |||
619bd6b71b | |||
ece20bf177 | |||
63d7f577b1 | |||
6f783441be | |||
db70b4bd44 | |||
a4a4a6b666 | |||
f99a3ab74a | |||
a9c23a4453 | |||
407163397d | |||
65839f5aec | |||
14ed2415a4 | |||
fb6d5eeb80 | |||
39a9497494 | |||
f4702eb701 | |||
b7e6a79704 | |||
b8376c6f48 | |||
8b6039e15d | |||
e4963fb712 | |||
feacfeaf65 | |||
47480a7959 | |||
67c6b86baf | |||
df1bbe9ded | |||
39dfac2520 | |||
b8a8f4b5a3 | |||
733fc19d78 | |||
83f10ed253 | |||
c4329558c9 | |||
72c577e991 | |||
0fe6cec54c | |||
2ac182e753 | |||
ffdc6a68bb | |||
99d5ed014b | |||
05f22ae4ce | |||
69e2b82c8e | |||
8a5e779e23 | |||
c36c7ca5bb | |||
8a7880bc35 | |||
cac68dba7f | |||
4323b0659d | |||
55cecdf81c | |||
82c6b60af2 | |||
35a485d79e | |||
49ccb4be8d | |||
8341ccc99d | |||
5998aa12a4 | |||
5a05eb4825 | |||
f8299b91cd | |||
45253bc9b8 | |||
7537388f6e | |||
fe19284a8e | |||
49f27c9923 | |||
0010ac581a | |||
0a7feff169 | |||
9b30d290a7 | |||
d23201466c | |||
8bcee7c094 | |||
033c8927c0 | |||
220cb5e9f4 | |||
7387ae3583 | |||
2f33a43937 | |||
a2cd9245a2 | |||
5a0feff284 | |||
912728474a | |||
2b5ad32fdd | |||
b3b98eb2d2 | |||
7d068d85c8 | |||
d6c35262bf | |||
1317441c03 | |||
cd8fdc4865 | |||
3a60fd2d6d | |||
d77ccbf8e9 | |||
f3c0b7567a | |||
485f0015d7 | |||
a3eb34a73d | |||
dfa5cad8a6 | |||
1cab6dc065 | |||
a5337b5293 | |||
887312371b | |||
c2f43c90fb | |||
b9b1769bc5 | |||
118b439272 | |||
612383ade1 | |||
2e40e31c15 | |||
aba0dd8ebb | |||
c9790911ef | |||
8001156a02 | |||
db0cbf620e | |||
43e6f0cefa | |||
0c67ce5b08 | |||
9cccefc938 | |||
404082c38d | |||
5021a88112 | |||
15fbfd0f95 | |||
4a02e284b3 | |||
bd9c134729 | |||
44f15eced7 | |||
ff72c02508 | |||
f14bb81c9b | |||
136aaecb77 | |||
32db4fabdc | |||
484deb0f97 | |||
ead4c91769 | |||
e5e19a8c04 | |||
92ef500f42 | |||
43ca7de786 | |||
4839ab4365 | |||
7bc49f1ff7 | |||
74a439955f | |||
aff3ced2c2 | |||
e1cd0e9b5c | |||
a42cdcdfba | |||
9d835e5705 | |||
e7609f02b9 | |||
87f5bf83d1 | |||
0e9f7e6444 | |||
cae971e90b | |||
d294649916 | |||
d652c4663b | |||
677a0d70cc | |||
0390995773 | |||
bb66d15d1f | |||
1be338b272 | |||
5f3180dbc8 | |||
b018784a11 | |||
7c5f21e83c | |||
9d42005816 | |||
ecae444ee3 | |||
a994e87f8a | |||
87607aa681 | |||
7d2c639f01 | |||
d48e86f5fe | |||
efa778c0e8 | |||
1de02aab77 | |||
b032defa7c | |||
ef6a1bb263 | |||
40831064d6 | |||
dcd881bc14 | |||
ee2c4bb4c3 | |||
c4dbf3d8be | |||
a7326b95c4 | |||
24f6a59cf9 | |||
5c675560ea | |||
825a1972c4 | |||
20c2f61555 | |||
9016d3d992 | |||
00991b92f1 | |||
6385a4a7db | |||
383b32141c | |||
486b203534 | |||
e060b40b4b | |||
f02a2d402c | |||
178b624784 | |||
a3b77d2366 | |||
724abca8f1 | |||
30cf47365f | |||
83e5b9ebeb | |||
a55572db28 | |||
febf29e8a7 | |||
96e27e7163 | |||
21b57ab171 | |||
8c959a0b7f | |||
faf34fa6a3 | |||
20d72a40a7 | |||
5745973d3d | |||
622dfde84e | |||
4bf3e2e5e2 | |||
ab42ec65ff | |||
d67d4b07a2 | |||
9e68425058 | |||
50db0eb28d | |||
eee3168712 | |||
c4a444b319 | |||
c256da5b07 | |||
72230c613b | |||
56d0f26cbf | |||
56d163f710 | |||
15f7b23ac2 | |||
742a8a6ae4 | |||
c761262112 | |||
a1cc1aef94 | |||
d9fc58abed | |||
6e15281870 | |||
6308bbb3f0 | |||
24a4fcdeaf | |||
30216bcd1b | |||
8a600f9d2b | |||
68e3203540 | |||
16e4853582 | |||
140c827ce7 | |||
c421f3f5d7 | |||
4cfd2d684a | |||
2df1f79164 | |||
f2a8e4d21a |
17
.flake8
Normal file
17
.flake8
Normal file
@ -0,0 +1,17 @@
|
||||
[flake8]
|
||||
max-line-length = 100
|
||||
ignore = D203, W503
|
||||
per-file-ignores =
|
||||
*/__init__.py: F401
|
||||
exclude =
|
||||
.git,
|
||||
__pycache__,
|
||||
docs/conf.py,
|
||||
old,
|
||||
build,
|
||||
dist,
|
||||
venv
|
||||
max-complexity = 10
|
||||
extend-ignore =
|
||||
# See https://github.com/PyCQA/pycodestyle/issues/373
|
||||
E203,
|
7
.gitmodules
vendored
7
.gitmodules
vendored
@ -1,7 +0,0 @@
|
||||
[submodule "tmtccmd"]
|
||||
path = deps/tmtccmd
|
||||
url = https://github.com/robamu-org/tmtccmd.git
|
||||
|
||||
[submodule "spacepackets"]
|
||||
path = deps/spacepackets
|
||||
url = https://github.com/robamu-org/py-spacepackets.git
|
||||
|
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="cfdp filetest/obsw_update.bin /tmp/obsw_update.bin -d 0.3" />
|
||||
<option name="PARAMETERS" value="cfdp filetest/obsw_update.bin /tmp/obsw_update.bin -d 0.1" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
|
24
.run/CFDP Test File Small Closure.run.xml
Normal file
24
.run/CFDP Test File Small Closure.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="CFDP Test File Small Closure" type="PythonConfigurationType" factoryName="Python" folderName="CFDP">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<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="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="cfdp filetest/cfdp_test.txt /tmp/cfdp_test.txt -d 0.2" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="PLOC MPSoC" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<configuration default="false" name="PLOC MPSoC with Listener" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -d 6" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
@ -1,7 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="tmtccli" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="-X dev" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
|
316
CHANGELOG.md
316
CHANGELOG.md
@ -10,11 +10,321 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v2.18.0] 2023-03-11
|
||||
|
||||
## Added
|
||||
|
||||
- Added GPS Altitude for GPS Processed Data Dataset
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated CSVs.
|
||||
- ACS mode changes: The ACS CTRL submodes are now modes. DETUBMLE is now submode of SAFE mode.
|
||||
|
||||
# [v2.17.3] 2023-03-09
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed the heater object ID names completely. Also,
|
||||
the HPA heater is now the Syrlinks heater.
|
||||
|
||||
# [v2.17.2] 2023-03-07
|
||||
|
||||
- Updated CSVs
|
||||
- New events for core controller
|
||||
|
||||
# [v2.17.1] 2023-03-07
|
||||
|
||||
## Added
|
||||
|
||||
- `MGT_ASSEMBLY` object ID
|
||||
|
||||
# [v2.17.0] 2023-03-07
|
||||
|
||||
## Added
|
||||
|
||||
- Health set and health announce commands
|
||||
- Camera Switcher, Syrlinks Assembly, IMTQ assembly and Star Tracker assembly object IDs added
|
||||
|
||||
## Changed
|
||||
|
||||
- Breaking typo fix in TMP1075 `SetId`
|
||||
|
||||
# [v2.16.4] 2023-03-04
|
||||
|
||||
## Added
|
||||
|
||||
- Some more IMTQ commands
|
||||
|
||||
# [v2.16.3] 2023-03-03
|
||||
|
||||
## Added
|
||||
|
||||
- Syrlinks ASSY object ID
|
||||
|
||||
# [v2.16.2] 2023-03-01
|
||||
|
||||
## Added
|
||||
|
||||
- Added ACS action cmds
|
||||
- Added new ACS hk values
|
||||
- Added ACS set parameter cmds
|
||||
|
||||
## Fixed
|
||||
|
||||
- Correction for ACS CTRL raw data requests HK type
|
||||
- Fixed diag related ACS hk cmds
|
||||
|
||||
## Added
|
||||
|
||||
- Basic MGM commanding (modes)
|
||||
|
||||
# [v2.16.1] 2023-02-24
|
||||
|
||||
- Updated CSVs for new persistent TM store
|
||||
|
||||
# [v2.16.0] 2023-02-23
|
||||
|
||||
## Added
|
||||
|
||||
- PDEC parameter commands to change size of positive and negative window of AD frames.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Added missing skip directive for private resultcode.
|
||||
|
||||
# [v2.15.2] 2023-02-23
|
||||
|
||||
- Update of generated returnvalue and event files.
|
||||
|
||||
# [v2.15.1] 2023-02-23
|
||||
|
||||
- Actually use `tmtccmd` 4.1 in requirements.
|
||||
- Remove `setup.cfg` completely
|
||||
|
||||
# [v2.15.0] 2023-02-23
|
||||
|
||||
tmtccmd version v4.1.1
|
||||
|
||||
## Changed
|
||||
|
||||
- Moved to `pyproject.toml` package file
|
||||
|
||||
## Fixed
|
||||
|
||||
- Correction in `tmtccmd` dependency, added missing function
|
||||
|
||||
# [v2.14.0] 2023-02-22
|
||||
|
||||
## Changed
|
||||
|
||||
- Generated CSV files for PDEC handler
|
||||
|
||||
# [v2.13.0] 2023-02-21
|
||||
|
||||
tmtccmd version 4.0.0
|
||||
|
||||
Added `python-dateutil` dependency for time prompts.
|
||||
|
||||
## Added
|
||||
|
||||
- Basic persistent TM store commanding
|
||||
- System and TCS system announce mode commands
|
||||
|
||||
## Changed
|
||||
|
||||
- IMTQ set IDs.
|
||||
- Significantly improved IMTQ module and also updated it to refactored OBSW IMTQ handlers.
|
||||
- Update of generated CSVs: Explicit no description strings
|
||||
|
||||
# [v2.12.7] 2023-02-17
|
||||
|
||||
- Re-run generators
|
||||
- Small fix for HK parsing, faulty printout
|
||||
|
||||
# [v2.12.6] 2023-02-14
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed GPS processed set output
|
||||
|
||||
## Added
|
||||
|
||||
- Added command to request switcher set from PCDU handler.
|
||||
|
||||
# [v2.12.5] 2023-02-13
|
||||
|
||||
## Added
|
||||
|
||||
- EIVE system commands
|
||||
|
||||
# [v2.12.4] 2023-02-12
|
||||
|
||||
## Fixed
|
||||
|
||||
- `tmtccmd` bumped to v4.0.0rc2, package discovery was broken.
|
||||
|
||||
## Added
|
||||
|
||||
- Syrlinks temperatur set readout
|
||||
|
||||
# [v2.12.3] 2023-02-10
|
||||
|
||||
tmtccmd v4.0.0rc1
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed SUS processed data printout format.
|
||||
- Fixed other ACS processed data printout format.
|
||||
- Fixed ACS submode: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/132
|
||||
|
||||
# [v2.12.2] 2023-02-08
|
||||
|
||||
- Use specific `tmtccmd` rev with new mode helper method.
|
||||
|
||||
# [v2.12.1] 2023-02-08
|
||||
|
||||
## Added
|
||||
|
||||
- Added version announce and current image announce commands.
|
||||
- Added persistent TM store object IDs
|
||||
- GPS enable and disable HK commands
|
||||
- All mode commands for the COM subsystem.
|
||||
|
||||
# [v2.12.0] 2023-02-06
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated the subsystem IDs to avoid value clashes with regular device handler mode IDs.
|
||||
|
||||
# [v2.11.0] 2023-02-06
|
||||
|
||||
## Fixed
|
||||
|
||||
- TMP1075 comands: Implement proper prompt for device select.
|
||||
- TMP1075 commands: Add OFF, ON, NORMAL, and HK command
|
||||
|
||||
# [v2.10.0] 2023-02-03
|
||||
|
||||
tmtccmd v4.0.0rc0
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated ACS SS commands for OBSW ACS SS update.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/130
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed parsing of processed GPS data
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/129
|
||||
|
||||
# [v2.9.0] 2023-02-01
|
||||
|
||||
## Fixed
|
||||
|
||||
- Create proper application root logger now.
|
||||
- Generated files update.
|
||||
|
||||
## Added
|
||||
|
||||
- Dedicated handling for health events.
|
||||
- Add time dump command.
|
||||
- Time event handling.
|
||||
|
||||
# [v2.8.0] 2023-02-01
|
||||
|
||||
- Move all device modules inside `pus_tc` and `pus_tm` to `tmtc` module and respective
|
||||
subsystem submodules.
|
||||
- Move low level ACS board device modules `gyros.py` and `mgms.py`
|
||||
to the `tmtc.acs` module.
|
||||
- Bump tmtccmd to include more pythonic log usage. All related changes.
|
||||
It is recommended to use `logging.getLogger(__name__)` for module level loggers now.
|
||||
- Moved TCS components to `tmtc` module
|
||||
- Renamed `HEATER_ID` to `HEATER_CONTROLLER_ID`
|
||||
|
||||
# [v2.7.0] 2023-01-31
|
||||
|
||||
- tmtccmd v4.0.0a3
|
||||
|
||||
# [v2.6.0 and v2.6.1] 2023-01-28
|
||||
|
||||
## Changed
|
||||
|
||||
- Reworked and improved PUS 20 parameter reply handling
|
||||
|
||||
## Added
|
||||
|
||||
- COM subsystem commanding. Default datarate parameter commanding
|
||||
was moved to the subsystem as well.
|
||||
|
||||
# [v2.5.0] 2023-01-26
|
||||
|
||||
## Fixed
|
||||
|
||||
- Bugfix for CCSDS handler commanding: Pass correct object ID
|
||||
- Processed MGM set TM handling fix
|
||||
|
||||
## Added
|
||||
|
||||
- Star Tracker: Add commands to update default datarate.
|
||||
|
||||
## Changed
|
||||
|
||||
- Move Star Tracker module to `tmtc` folder and add some set IDs. Rename `SetIds` to `SetId`.
|
||||
- Move `syrlinks_hk_handler` and `ccsds_handler` module to `tmtc` module.
|
||||
Rename `syrlinks_hk_handler` to `syrlinks_handler`.
|
||||
- Move `star_tracker` module into `tmtc.acs`
|
||||
- CCSDS Handler: Switch from action commands to mode commands for ON/OFF handling.
|
||||
- Star Tracker: Switch from actions commands to mode commands for RX/TX/Modulation commanding.
|
||||
|
||||
# [v2.4.0] and [v2.4.1] 2023-01-23
|
||||
|
||||
- Pin `tmtccmd` to v4.0.0a2
|
||||
- Unify and move Syrlinks module, some bugfixes
|
||||
- Add/Re-enable handling for SUS temp packets
|
||||
- Update SA deployment commands for OBSW https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/347
|
||||
- Extend, fix and improve Syrlinks TMTC handling a bit
|
||||
|
||||
# [v2.3.0] and [v2.3.1] 2023-01-18
|
||||
|
||||
- Bumped `tmtccmd` version to new alpha release, use some new features
|
||||
and fix the breaking changes
|
||||
|
||||
# [v2.2.0] 2023-01-16
|
||||
|
||||
- A lot of consistency renaming: Single name for enums which are not flag enums,
|
||||
e.g `ActionId` instead of `ActionIds`
|
||||
- Updated required Python version to 3.10
|
||||
|
||||
# [v2.1.1] 2023-01-12
|
||||
|
||||
- Typo in `setup.cfg`, missing version prefix `v` for `tmtccmd`
|
||||
|
||||
# [v2.1.0] 2023-01-12
|
||||
|
||||
- Various refactoring and tweaks to allow easier integration into `eive-mib`.
|
||||
- Handle ACS CTRL HK sets.
|
||||
- Add reboot commands for PCDU modules.
|
||||
- Extend MPSoC commands.
|
||||
- Starting from now, more regular releases, especially on breaking changes. This is because
|
||||
this is now also a library with dependents.
|
||||
|
||||
# [v2.0.2] 2022-01-12
|
||||
|
||||
- Bumped dependencies, small fix to allow working script if PyQt is not installed
|
||||
|
||||
# [v2.0.1] 2022-11-29
|
||||
|
||||
- Minor bugfix
|
||||
|
||||
# [v2.0.0] 2022-11-29
|
||||
|
||||
- The tmtc program is installable now, which allow re-using it in other Python applications
|
||||
- Bugfixes for IMTQ TM handling
|
||||
- Updates S/A deployment command
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/118
|
||||
|
||||
# [v1.13.0] 13.10.2022
|
||||
# [v1.13.0] 2022-10-13
|
||||
|
||||
- CFDP integration
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/113
|
||||
@ -27,7 +337,7 @@ list yields a list of all related PRs for each release.
|
||||
- Update PLOC supervisor commands
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/107
|
||||
|
||||
# [v1.12.0] 05.07.2022
|
||||
# [v1.12.0] 2022-07-05
|
||||
|
||||
- Update GPS HK Parsing
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/86
|
||||
@ -67,4 +377,4 @@ list yields a list of all related PRs for each release.
|
||||
- Extended heater commands for more informative output which component is heated
|
||||
|
||||
See [milestones](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/milestones)
|
||||
and [releases](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/releases)
|
||||
and [releases](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/releases)
|
||||
|
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
@ -0,0 +1 @@
|
||||
recursive-include eive_tmtc/config *.csv
|
14
README.md
14
README.md
@ -19,13 +19,13 @@ were installed properly.
|
||||
Run CLI mode
|
||||
|
||||
```sh
|
||||
./tmtccli.py
|
||||
./tmtcc.py
|
||||
```
|
||||
|
||||
Run GUI mode
|
||||
|
||||
```sh
|
||||
./tmtcgui.py
|
||||
./tmtcc.py -g
|
||||
```
|
||||
|
||||
# <a id="venv"></a> Set up virtual environment
|
||||
@ -68,18 +68,10 @@ Assuming you are running in a virtual environment:
|
||||
1. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
|
||||
|
||||
```sh
|
||||
cd tmtccmd
|
||||
cd deps/tmtccmd
|
||||
pip install -e .[gui]
|
||||
```
|
||||
|
||||
2. You can also install the `spacepackets` package locally/interactively
|
||||
Normally, it will be installed as a `tmtccmd` dependency.
|
||||
|
||||
```sh
|
||||
cd spacepackets
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
Alternatively you can also install the packages from PyPI completely, but the risk of
|
||||
incompatibilities will be high there
|
||||
|
||||
|
4
deps/.gitignore
vendored
Normal file
4
deps/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*
|
||||
!/*.sh
|
||||
!/.gitignore
|
||||
|
3
deps/install_spacepackets.sh
vendored
Executable file
3
deps/install_spacepackets.sh
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
git clone https://github.com/us-irs/spacepackets-py.git
|
3
deps/install_tmtccmd.sh
vendored
Executable file
3
deps/install_tmtccmd.sh
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
git clone https://github.com/robamu-org/tmtccmd.git
|
1
deps/spacepackets
vendored
1
deps/spacepackets
vendored
Submodule deps/spacepackets deleted from 84f1af27d4
1
deps/tmtccmd
vendored
1
deps/tmtccmd
vendored
Submodule deps/tmtccmd deleted from ad8f049d66
@ -1,6 +1,14 @@
|
||||
SW_NAME = "eive"
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 13
|
||||
VERSION_SUBMINOR = 0
|
||||
__version__ = "2.18.0"
|
||||
|
||||
__version__ = "1.13.0"
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 18
|
||||
VERSION_REVISION = 0
|
||||
|
||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
||||
|
||||
APP_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -1,6 +0,0 @@
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 0
|
||||
VERSION_SUBMINOR = 0
|
||||
|
||||
__version__ = "2.0.0"
|
||||
|
@ -9,14 +9,16 @@ import enum
|
||||
from spacepackets import PacketType
|
||||
from spacepackets.ccsds import PacketId
|
||||
from spacepackets.util import UnsignedByteField
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
PUS_APID = 0x65
|
||||
CFDP_APID = 0x66
|
||||
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
||||
CFDP_PACKET_ID = PacketId(PacketType.TM, False, CFDP_APID)
|
||||
SPACE_PACKET_IDS = (
|
||||
PUS_PACKET_ID.raw(),
|
||||
CFDP_PACKET_ID.raw(),
|
||||
PUS_PACKET_ID,
|
||||
CFDP_PACKET_ID,
|
||||
)
|
||||
|
||||
CFDP_LOCAL_ENTITY_ID = UnsignedByteField(byte_len=2, val=1)
|
||||
@ -27,15 +29,17 @@ class CustomServiceList(str, enum.Enum):
|
||||
value: str
|
||||
|
||||
TEST_DEVICE = "test"
|
||||
HEALTH = "health"
|
||||
P60DOCK = "p60dock"
|
||||
PDU1 = "pdu1"
|
||||
PDU2 = "pdu2"
|
||||
POWER = "power"
|
||||
ACU = "acu"
|
||||
ACS = "acs"
|
||||
GYRO = "gyro"
|
||||
MGMS = "mgms"
|
||||
COM_SS = "com"
|
||||
BPX_BATTERY = "bpx"
|
||||
TMP1075_1 = "tmp1075_1"
|
||||
TMP1075_2 = "tmp1075_2"
|
||||
HEATER = "heater"
|
||||
IMTQ = "imtq"
|
||||
PLOC_SUPV = "ploc_supv"
|
||||
@ -49,7 +53,7 @@ class CustomServiceList(str, enum.Enum):
|
||||
REACTION_WHEEL_4 = "rw_4"
|
||||
RW_ASSEMBLY = "rw_ass"
|
||||
RAD_SENSOR = "rad_sensor"
|
||||
GPS_CTRL = "gnss-ctrl"
|
||||
GPS_CTRL = "gps"
|
||||
PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
|
||||
CORE = "core"
|
||||
STAR_TRACKER = "star_tracker"
|
||||
@ -67,6 +71,8 @@ class CustomServiceList(str, enum.Enum):
|
||||
TIME = "time"
|
||||
PROCEDURE = "proc"
|
||||
RTD = "rtd"
|
||||
TMP1075 = "tcs_tmp"
|
||||
TVTTESTPROCEDURE = "tvtestproc"
|
||||
CONTROLLERS = "controllers"
|
||||
SCEX = "scex"
|
||||
TM_STORE = "tm_store"
|
||||
SYSTEM = "system"
|
||||
|
@ -1,109 +1,117 @@
|
||||
Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
2200;0x0898;STORE_SEND_WRITE_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2201;0x0899;STORE_WRITE_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2202;0x089a;STORE_SEND_READ_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2203;0x089b;STORE_READ_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2204;0x089c;UNEXPECTED_MSG;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2205;0x089d;STORING_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2206;0x089e;TM_DUMP_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2207;0x089f;STORE_INIT_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2208;0x08a0;STORE_INIT_EMPTY;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2209;0x08a1;STORE_CONTENT_CORRUPTED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2210;0x08a2;STORE_INITIALIZE;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2211;0x08a3;INIT_DONE;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2212;0x08a4;DUMP_FINISHED;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2213;0x08a5;DELETION_FINISHED;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2214;0x08a6;DELETION_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2215;0x08a7;AUTO_CATALOGS_SENDING_FAILED;INFO;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2600;0x0a28;GET_DATA_FAILED;LOW;;fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2601;0x0a29;STORE_DATA_FAILED;LOW;;fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2800;0x0af0;DEVICE_BUILDING_COMMAND_FAILED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2801;0x0af1;DEVICE_SENDING_COMMAND_FAILED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2802;0x0af2;DEVICE_REQUESTING_REPLY_FAILED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2803;0x0af3;DEVICE_READING_REPLY_FAILED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2804;0x0af4;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2805;0x0af5;DEVICE_MISSED_REPLY;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2806;0x0af6;DEVICE_UNKNOWN_REPLY;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2807;0x0af7;DEVICE_UNREQUESTED_REPLY;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2200;0x0898;STORE_SEND_WRITE_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2201;0x0899;STORE_WRITE_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2202;0x089a;STORE_SEND_READ_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2203;0x089b;STORE_READ_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2204;0x089c;UNEXPECTED_MSG;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2205;0x089d;STORING_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2206;0x089e;TM_DUMP_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2207;0x089f;STORE_INIT_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2208;0x08a0;STORE_INIT_EMPTY;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2209;0x08a1;STORE_CONTENT_CORRUPTED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2210;0x08a2;STORE_INITIALIZE;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2211;0x08a3;INIT_DONE;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2212;0x08a4;DUMP_FINISHED;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2213;0x08a5;DELETION_FINISHED;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2214;0x08a6;DELETION_FAILED;LOW;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2215;0x08a7;AUTO_CATALOGS_SENDING_FAILED;INFO;No description;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2600;0x0a28;GET_DATA_FAILED;LOW;No description;fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2601;0x0a29;STORE_DATA_FAILED;LOW;No description;fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2800;0x0af0;DEVICE_BUILDING_COMMAND_FAILED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2801;0x0af1;DEVICE_SENDING_COMMAND_FAILED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2802;0x0af2;DEVICE_REQUESTING_REPLY_FAILED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2803;0x0af3;DEVICE_READING_REPLY_FAILED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2804;0x0af4;DEVICE_INTERPRETING_REPLY_FAILED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2805;0x0af5;DEVICE_MISSED_REPLY;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2806;0x0af6;DEVICE_UNKNOWN_REPLY;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2807;0x0af7;DEVICE_UNREQUESTED_REPLY;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2808;0x0af8;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2809;0x0af9;MONITORING_LIMIT_EXCEEDED;LOW;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2810;0x0afa;MONITORING_AMBIGUOUS;HIGH;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2811;0x0afb;DEVICE_WANTS_HARD_REBOOT;HIGH;;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
4201;0x1069;FUSE_CURRENT_HIGH;LOW;;fsfw/src/fsfw/power/Fuse.h
|
||||
4202;0x106a;FUSE_WENT_OFF;LOW;;fsfw/src/fsfw/power/Fuse.h
|
||||
4204;0x106c;POWER_ABOVE_HIGH_LIMIT;LOW;;fsfw/src/fsfw/power/Fuse.h
|
||||
4205;0x106d;POWER_BELOW_LOW_LIMIT;LOW;;fsfw/src/fsfw/power/Fuse.h
|
||||
4300;0x10cc;SWITCH_WENT_OFF;LOW;;fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||
5000;0x1388;HEATER_ON;INFO;;fsfw/src/fsfw/thermal/Heater.h
|
||||
5001;0x1389;HEATER_OFF;INFO;;fsfw/src/fsfw/thermal/Heater.h
|
||||
5002;0x138a;HEATER_TIMEOUT;LOW;;fsfw/src/fsfw/thermal/Heater.h
|
||||
5003;0x138b;HEATER_STAYED_ON;LOW;;fsfw/src/fsfw/thermal/Heater.h
|
||||
5004;0x138c;HEATER_STAYED_OFF;LOW;;fsfw/src/fsfw/thermal/Heater.h
|
||||
5200;0x1450;TEMP_SENSOR_HIGH;LOW;;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5201;0x1451;TEMP_SENSOR_LOW;LOW;;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5202;0x1452;TEMP_SENSOR_GRADIENT;LOW;;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5901;0x170d;COMPONENT_TEMP_LOW;LOW;;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5902;0x170e;COMPONENT_TEMP_HIGH;LOW;;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5903;0x170f;COMPONENT_TEMP_OOL_LOW;LOW;;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5904;0x1710;COMPONENT_TEMP_OOL_HIGH;LOW;;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5905;0x1711;TEMP_NOT_IN_OP_RANGE;LOW;;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
7101;0x1bbd;FDIR_CHANGED_STATE;INFO;;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7102;0x1bbe;FDIR_STARTS_RECOVERY;MEDIUM;;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7103;0x1bbf;FDIR_TURNS_OFF_DEVICE;MEDIUM;;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7201;0x1c21;MONITOR_CHANGED_STATE;LOW;;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7202;0x1c22;VALUE_BELOW_LOW_LIMIT;LOW;;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7203;0x1c23;VALUE_ABOVE_HIGH_LIMIT;LOW;;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7204;0x1c24;VALUE_OUT_OF_RANGE;LOW;;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7400;0x1ce8;CHANGING_MODE;INFO;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7401;0x1ce9;MODE_INFO;INFO;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7402;0x1cea;FALLBACK_FAILED;HIGH;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7403;0x1ceb;MODE_TRANSITION_FAILED;LOW;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7404;0x1cec;CANT_KEEP_MODE;HIGH;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7405;0x1ced;OBJECT_IN_INVALID_MODE;LOW;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7406;0x1cee;FORCING_MODE;MEDIUM;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7407;0x1cef;MODE_CMD_REJECTED;LOW;;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7506;0x1d52;HEALTH_INFO;INFO;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7507;0x1d53;CHILD_CHANGED_HEALTH;INFO;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7508;0x1d54;CHILD_PROBLEMS;LOW;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7509;0x1d55;OVERWRITING_HEALTH;LOW;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7510;0x1d56;TRYING_RECOVERY;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7511;0x1d57;RECOVERY_STEP;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7512;0x1d58;RECOVERY_DONE;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7600;0x1db0;HANDLE_PACKET_FAILED;LOW;;fsfw/src/fsfw/tcdistribution/definitions.h
|
||||
2809;0x0af9;MONITORING_LIMIT_EXCEEDED;LOW;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2810;0x0afa;MONITORING_AMBIGUOUS;HIGH;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2811;0x0afb;DEVICE_WANTS_HARD_REBOOT;HIGH;No description;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
4201;0x1069;FUSE_CURRENT_HIGH;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4202;0x106a;FUSE_WENT_OFF;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4204;0x106c;POWER_ABOVE_HIGH_LIMIT;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4205;0x106d;POWER_BELOW_LOW_LIMIT;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4300;0x10cc;SWITCH_WENT_OFF;LOW;No description;fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||
5000;0x1388;HEATER_ON;INFO;No description;fsfw/src/fsfw/thermal/Heater.h
|
||||
5001;0x1389;HEATER_OFF;INFO;No description;fsfw/src/fsfw/thermal/Heater.h
|
||||
5002;0x138a;HEATER_TIMEOUT;LOW;No description;fsfw/src/fsfw/thermal/Heater.h
|
||||
5003;0x138b;HEATER_STAYED_ON;LOW;No description;fsfw/src/fsfw/thermal/Heater.h
|
||||
5004;0x138c;HEATER_STAYED_OFF;LOW;No description;fsfw/src/fsfw/thermal/Heater.h
|
||||
5200;0x1450;TEMP_SENSOR_HIGH;LOW;No description;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5201;0x1451;TEMP_SENSOR_LOW;LOW;No description;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5202;0x1452;TEMP_SENSOR_GRADIENT;LOW;No description;fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5901;0x170d;COMPONENT_TEMP_LOW;LOW;No description;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5902;0x170e;COMPONENT_TEMP_HIGH;LOW;No description;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5903;0x170f;COMPONENT_TEMP_OOL_LOW;LOW;No description;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5904;0x1710;COMPONENT_TEMP_OOL_HIGH;LOW;No description;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5905;0x1711;TEMP_NOT_IN_OP_RANGE;LOW;No description;fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
7101;0x1bbd;FDIR_CHANGED_STATE;INFO;No description;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7102;0x1bbe;FDIR_STARTS_RECOVERY;MEDIUM;No description;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7103;0x1bbf;FDIR_TURNS_OFF_DEVICE;MEDIUM;No description;fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7201;0x1c21;MONITOR_CHANGED_STATE;LOW;No description;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7202;0x1c22;VALUE_BELOW_LOW_LIMIT;LOW;No description;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7203;0x1c23;VALUE_ABOVE_HIGH_LIMIT;LOW;No description;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7204;0x1c24;VALUE_OUT_OF_RANGE;LOW;No description;fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7400;0x1ce8;CHANGING_MODE;INFO;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7401;0x1ce9;MODE_INFO;INFO;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7402;0x1cea;FALLBACK_FAILED;HIGH;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7403;0x1ceb;MODE_TRANSITION_FAILED;LOW;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7404;0x1cec;CANT_KEEP_MODE;HIGH;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7405;0x1ced;OBJECT_IN_INVALID_MODE;LOW;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7406;0x1cee;FORCING_MODE;MEDIUM;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7407;0x1cef;MODE_CMD_REJECTED;LOW;No description;fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7506;0x1d52;HEALTH_INFO;INFO;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7507;0x1d53;CHILD_CHANGED_HEALTH;INFO;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7508;0x1d54;CHILD_PROBLEMS;LOW;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7509;0x1d55;OVERWRITING_HEALTH;LOW;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7510;0x1d56;TRYING_RECOVERY;MEDIUM;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7511;0x1d57;RECOVERY_STEP;MEDIUM;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7512;0x1d58;RECOVERY_DONE;MEDIUM;No description;fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7600;0x1db0;HANDLE_PACKET_FAILED;LOW;No description;fsfw/src/fsfw/tcdistribution/definitions.h
|
||||
7900;0x1edc;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7901;0x1edd;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7902;0x1ede;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_SET_FAILURE;LOW;;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
|
||||
9700;0x25e4;TEST;INFO;;fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
10800;0x2a30;STORE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10801;0x2a31;MSG_QUEUE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10802;0x2a32;SERIALIZATION_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
10800;0x2a30;STORE_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10801;0x2a31;MSG_QUEUE_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10802;0x2a32;SERIALIZATION_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10803;0x2a33;FILESTORE_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10804;0x2a34;FILENAME_TOO_LARGE_ERROR;LOW;P1: Transaction step ID, P2: 0 for source file name, 1 for dest file name;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;No description;mission/acsDefs.h
|
||||
11201;0x2bc1;SAFE_RATE_RECOVERY;MEDIUM;No description;mission/acsDefs.h
|
||||
11202;0x2bc2;MULTIPLE_RW_INVALID;HIGH;No description;mission/acsDefs.h
|
||||
11203;0x2bc3;MEKF_INVALID_INFO;INFO;No description;mission/acsDefs.h
|
||||
11204;0x2bc4;MEKF_INVALID_MODE_VIOLATION;HIGH;No description;mission/acsDefs.h
|
||||
11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11303;0x2c27;FDIR_REACTION_IGNORED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11400;0x2c88;GPIO_PULL_HIGH_FAILED;LOW;;mission/devices/HeaterHandler.h
|
||||
11401;0x2c89;GPIO_PULL_LOW_FAILED;LOW;;mission/devices/HeaterHandler.h
|
||||
11402;0x2c8a;HEATER_WENT_ON;INFO;;mission/devices/HeaterHandler.h
|
||||
11403;0x2c8b;HEATER_WENT_OFF;INFO;;mission/devices/HeaterHandler.h
|
||||
11404;0x2c8c;SWITCH_ALREADY_ON;LOW;;mission/devices/HeaterHandler.h
|
||||
11405;0x2c8d;SWITCH_ALREADY_OFF;LOW;;mission/devices/HeaterHandler.h
|
||||
11406;0x2c8e;MAIN_SWITCH_TIMEOUT;MEDIUM;;mission/devices/HeaterHandler.h
|
||||
11407;0x2c8f;FAULTY_HEATER_WAS_ON;LOW;;mission/devices/HeaterHandler.h
|
||||
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11303;0x2c27;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11400;0x2c88;GPIO_PULL_HIGH_FAILED;LOW;No description;mission/devices/HeaterHandler.h
|
||||
11401;0x2c89;GPIO_PULL_LOW_FAILED;LOW;No description;mission/devices/HeaterHandler.h
|
||||
11402;0x2c8a;HEATER_WENT_ON;INFO;No description;mission/devices/HeaterHandler.h
|
||||
11403;0x2c8b;HEATER_WENT_OFF;INFO;No description;mission/devices/HeaterHandler.h
|
||||
11404;0x2c8c;SWITCH_ALREADY_ON;LOW;No description;mission/devices/HeaterHandler.h
|
||||
11405;0x2c8d;SWITCH_ALREADY_OFF;LOW;No description;mission/devices/HeaterHandler.h
|
||||
11406;0x2c8e;MAIN_SWITCH_TIMEOUT;MEDIUM;No description;mission/devices/HeaterHandler.h
|
||||
11407;0x2c8f;FAULTY_HEATER_WAS_ON;LOW;No description;mission/devices/HeaterHandler.h
|
||||
11500;0x2cec;BURN_PHASE_START;INFO;P1: Burn duration in milliseconds, P2: Dry run flag;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11501;0x2ced;BURN_PHASE_DONE;INFO;P1: Burn duration in milliseconds, P2: Dry run flag;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11502;0x2cee;MAIN_SWITCH_ON_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11503;0x2cef;MAIN_SWITCH_OFF_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11504;0x2cf0;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11505;0x2cf1;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11502;0x2cee;MAIN_SWITCH_ON_TIMEOUT;LOW;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11503;0x2cef;MAIN_SWITCH_OFF_TIMEOUT;LOW;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11504;0x2cf0;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11505;0x2cf1;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/devices/SolarArrayDeploymentHandler.h
|
||||
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
@ -118,30 +126,34 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11706;0x2dba;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
|
||||
11707;0x2dbb;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
|
||||
11708;0x2dbc;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/ImtqHandler.h
|
||||
11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/devicedefinitions/RwDefinitions.h
|
||||
11802;0x2e1a;RESET_OCCURED;LOW;;mission/devices/devicedefinitions/RwDefinitions.h
|
||||
11901;0x2e7d;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
|
||||
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;linux/devices/startracker/StarTrackerHandler.h
|
||||
11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/devicedefinitions/rwHelpers.h
|
||||
11802;0x2e1a;RESET_OCCURED;LOW;No description;mission/devices/devicedefinitions/rwHelpers.h
|
||||
11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
|
||||
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;linux/devices/startracker/StarTrackerHandler.h
|
||||
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12004;0x2ee4;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12005;0x2ee5;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12006;0x2ee6;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12007;0x2ee7;SUPV_HELPER_EXECUTING;LOW;Supervisor helper currently executing a command;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12008;0x2ee8;SUPV_MPSOC_SHUTDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/devices/ploc/PlocSupervisorHandler.h
|
||||
12100;0x2f44;SANITIZATION_FAILED;LOW;;bsp_q7s/fs/SdCardManager.h
|
||||
12101;0x2f45;MOUNTED_SD_CARD;INFO;;bsp_q7s/fs/SdCardManager.h
|
||||
12100;0x2f44;SANITIZATION_FAILED;LOW;No description;bsp_q7s/fs/SdCardManager.h
|
||||
12101;0x2f45;MOUNTED_SD_CARD;INFO;No description;bsp_q7s/fs/SdCardManager.h
|
||||
12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/devices/ploc/PlocMemoryDumper.h
|
||||
12301;0x300d;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;linux/devices/ploc/PlocMemoryDumper.h
|
||||
12302;0x300e;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;linux/devices/ploc/PlocMemoryDumper.h
|
||||
12401;0x3071;INVALID_TC_FRAME;HIGH;;linux/ipcore/PdecHandler.h
|
||||
12401;0x3071;INVALID_TC_FRAME;HIGH;No description;linux/ipcore/PdecHandler.h
|
||||
12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/ipcore/PdecHandler.h
|
||||
12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/ipcore/PdecHandler.h
|
||||
12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/PdecHandler.h
|
||||
12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/PdecHandler.h
|
||||
12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/PdecHandler.h
|
||||
12407;0x3077;POLL_ERROR_PDEC;MEDIUM;;linux/ipcore/PdecHandler.h
|
||||
12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/PdecHandler.h
|
||||
12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h
|
||||
12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;HIGH;No description;linux/ipcore/PdecHandler.h
|
||||
12410;0x307a;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/PdecHandler.h
|
||||
12411;0x307b;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/PdecHandler.h
|
||||
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h
|
||||
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h
|
||||
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h
|
||||
@ -157,11 +169,11 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
12512;0x30e0;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrHelper.h
|
||||
12513;0x30e1;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrHelper.h
|
||||
12514;0x30e2;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrHelper.h
|
||||
12515;0x30e3;STR_HELPER_SENDING_PACKET_FAILED;LOW;;linux/devices/startracker/StrHelper.h
|
||||
12516;0x30e4;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h
|
||||
12515;0x30e3;STR_HELPER_SENDING_PACKET_FAILED;LOW;No description;linux/devices/startracker/StrHelper.h
|
||||
12516;0x30e4;STR_HELPER_REQUESTING_MSG_FAILED;LOW;No description;linux/devices/startracker/StrHelper.h
|
||||
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12603;0x313b;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12604;0x313c;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
@ -171,8 +183,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
12609;0x3141;MPSOC_ACK_INVALID_APID;LOW;Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12610;0x3142;MPSOC_EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12611;0x3143;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/devices/PayloadPcduHandler.h
|
||||
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
@ -185,16 +197,17 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
12709;0x31a5;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12710;0x31a6;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12711;0x31a7;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/objects/AcsBoardAssembly.h
|
||||
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/objects/AcsBoardAssembly.h
|
||||
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/objects/AcsBoardAssembly.h
|
||||
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;No description;mission/system/objects/AcsBoardAssembly.h
|
||||
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;No description;mission/system/objects/AcsBoardAssembly.h
|
||||
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/objects/AcsBoardAssembly.h
|
||||
12803;0x3203;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/objects/AcsBoardAssembly.h
|
||||
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/objects/SusAssembly.h
|
||||
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/objects/SusAssembly.h
|
||||
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/objects/SusAssembly.h
|
||||
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;No description;mission/system/objects/SusAssembly.h
|
||||
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;No description;mission/system/objects/SusAssembly.h
|
||||
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/objects/SusAssembly.h
|
||||
12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/objects/SusAssembly.h
|
||||
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;;mission/system/objects/TcsBoardAssembly.h
|
||||
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/objects/TcsBoardAssembly.h
|
||||
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/devices/devicedefinitions/GPSDefinitions.h
|
||||
13101;0x332d;CANT_GET_FIX;LOW;Could not get fix in maximum allowed time. P1: Maximum allowed time to get a fix after the GPS was switched on.;mission/devices/devicedefinitions/GPSDefinitions.h
|
||||
13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/devices/P60DockHandler.h
|
||||
13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/devices/P60DockHandler.h
|
||||
13202;0x3392;BATT_MODE_CHANGED;MEDIUM;Battery mode has changed. P1: Old mode. P2: New mode;mission/devices/P60DockHandler.h
|
||||
@ -206,9 +219,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13605;0x3525;SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL;LOW;Requesting event buffer was successful;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13606;0x3526;SUPV_EVENT_BUFFER_REQUEST_FAILED;LOW;Requesting event buffer failed;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13607;0x3527;SUPV_EVENT_BUFFER_REQUEST_TERMINATED;LOW;Terminated event buffer request by command P1: Number of packets read before process was terminated;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13608;0x3528;SUPV_MEM_CHECK_OK;INFO;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13609;0x3529;SUPV_MEM_CHECK_FAIL;INFO;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13616;0x3530;SUPV_SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13608;0x3528;SUPV_MEM_CHECK_OK;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13609;0x3529;SUPV_MEM_CHECK_FAIL;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13616;0x3530;SUPV_SENDING_COMMAND_FAILED;LOW;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13617;0x3531;SUPV_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13618;0x3532;SUPV_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13619;0x3533;SUPV_MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
@ -220,21 +233,46 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13625;0x3539;ACK_RECEPTION_FAILURE;LOW;Failed to receive acknowledgment report P1: Return value P2: Apid of command for which the reception of the acknowledgment report failed;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13626;0x353a;EXE_RECEPTION_FAILURE;LOW;Failed to receive execution report P1: Return value P2: Apid of command for which the reception of the execution report failed;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13627;0x353b;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13628;0x353c;SUPV_REPLY_SIZE_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13629;0x353d;SUPV_REPLY_CRC_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13628;0x353c;SUPV_REPLY_SIZE_MISSMATCH;LOW;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13629;0x353d;SUPV_REPLY_CRC_MISSMATCH;LOW;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13632;0x3540;HDLC_CRC_ERROR;INFO;;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13700;0x3584;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
|
||||
13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
|
||||
13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
|
||||
13704;0x3588;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;bsp_q7s/core/CoreController.h
|
||||
13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
|
||||
13902;0x364e;GET_CONFIGFILEVALUE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
|
||||
13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
|
||||
13904;0x3650;WRITE_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
|
||||
13905;0x3651;READ_CONFIGFILE_FAILED;MEDIUM;;mission/utility/GlobalConfigHandler.h
|
||||
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h
|
||||
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
|
||||
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
|
||||
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;No description;mission/devices/devicedefinitions/ScexDefinitions.h
|
||||
13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13902;0x364e;GET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13904;0x3650;WRITE_CONFIGFILE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13905;0x3651;READ_CONFIGFILE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
14000;0x36b0;ALLOC_FAILURE;MEDIUM;No description;bsp_q7s/core/CoreController.h
|
||||
14001;0x36b1;REBOOT_SW;LOW; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
14002;0x36b2;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
|
||||
14003;0x36b3;REBOOT_HW;MEDIUM;No description;bsp_q7s/core/CoreController.h
|
||||
14004;0x36b4;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;bsp_q7s/core/CoreController.h
|
||||
14005;0x36b5;VERSION_INFO;INFO;P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;bsp_q7s/core/CoreController.h
|
||||
14006;0x36b6;CURRENT_IMAGE_INFO;INFO;P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
14007;0x36b7;REBOOT_COUNTER;INFO;Total reboot counter, which is the sum of the boot count of all individual images.;bsp_q7s/core/CoreController.h
|
||||
14008;0x36b8;INDIVIDUAL_BOOT_COUNTS;INFO;Get the boot count of the individual images. P1: First 16 bits boot count of image 0 0, last 16 bits boot count of image 0 1. P2: First 16 bits boot count of image 1 0, last 16 bits boot count of image 1 1.;bsp_q7s/core/CoreController.h
|
||||
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/ThermalController.h
|
||||
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/ThermalController.h
|
||||
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
14103;0x3717;PLOC_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
14104;0x3718;OBC_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
14105;0x3719;HPA_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
14106;0x371a;PLPCDU_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/objects/ComSubsystem.h
|
||||
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/objects/ComSubsystem.h
|
||||
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h
|
||||
14301;0x37dd;FILE_TOO_LARGE;LOW;File in store too large. P1: Detected file size P2: Allowed file size;mission/persistentTmStoreDefs.h
|
||||
14302;0x37de;BUSY_DUMPING_EVENT;INFO;No description;mission/persistentTmStoreDefs.h
|
||||
14303;0x37df;DUMP_WAS_CANCELLED;LOW;Dump was cancelled. P1: Object ID of store.;mission/persistentTmStoreDefs.h
|
||||
14305;0x37e1;DUMP_OK_STORE_DONE;INFO;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14306;0x37e2;DUMP_NOK_STORE_DONE;INFO;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14307;0x37e3;DUMP_MISC_STORE_DONE;INFO;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14308;0x37e4;DUMP_HK_STORE_DONE;INFO;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14309;0x37e5;DUMP_CFDP_STORE_DONE;INFO;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
|
|
22
eive_tmtc/config/events.py
Normal file
22
eive_tmtc/config/events.py
Normal file
@ -0,0 +1,22 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.fsfw import parse_fsfw_events_csv
|
||||
from tmtccmd.pus.s5_fsfw_event import EventDictT
|
||||
|
||||
DEFAULT_EVENTS_CSV_PATH = EIVE_TMTC_ROOT / "config/events.csv"
|
||||
__EVENT_DICT = None
|
||||
|
||||
|
||||
def get_event_dict() -> EventDictT:
|
||||
global __EVENT_DICT
|
||||
if __EVENT_DICT is None:
|
||||
if os.path.exists(DEFAULT_EVENTS_CSV_PATH):
|
||||
__EVENT_DICT = parse_fsfw_events_csv(DEFAULT_EVENTS_CSV_PATH)
|
||||
else:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}"
|
||||
)
|
||||
__EVENT_DICT = dict()
|
||||
return __EVENT_DICT
|
@ -1,33 +0,0 @@
|
||||
"""
|
||||
@brief This file transfers definitions of global variables to the user.
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
import argparse
|
||||
|
||||
|
||||
# All globals can be added here and will be part of a globals dictionary.
|
||||
from config.definitions import CustomServiceList, PUS_APID
|
||||
from config.custom_mode_op import CustomModeList
|
||||
from tmtccmd.config.definitions import CoreComInterfaces
|
||||
from tmtccmd.config.globals import set_default_globals_pre_args_parsing
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class CustomGlobalIds(enum.Enum):
|
||||
from enum import auto
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def set_globals_pre_args_parsing(gui: bool = False):
|
||||
set_default_globals_pre_args_parsing(
|
||||
gui=gui,
|
||||
tc_apid=PUS_APID,
|
||||
tm_apid=PUS_APID,
|
||||
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from tmtccmd import TmTcCfgHookBase, CcsdsTmtcBackend
|
||||
from tmtccmd.com_if import ComInterface
|
||||
from tmtccmd import HookBase, CcsdsTmtcBackend
|
||||
from tmtccmd.com import ComInterface
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
@ -10,7 +10,7 @@ from eive_tmtc.pus_tc.cmd_definitions import get_eive_service_op_code_dict
|
||||
from tmtccmd.util import ObjectIdDictT, RetvalDictT
|
||||
|
||||
|
||||
class EiveHookObject(TmTcCfgHookBase):
|
||||
class EiveHookObject(HookBase):
|
||||
def __init__(self, json_cfg_path: str):
|
||||
super().__init__(json_cfg_path=json_cfg_path)
|
||||
|
||||
@ -18,7 +18,7 @@ class EiveHookObject(TmTcCfgHookBase):
|
||||
return get_eive_service_op_code_dict()
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com_if import (
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_default,
|
||||
create_com_interface_cfg_default,
|
||||
)
|
||||
|
@ -3,14 +3,16 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
import logging
|
||||
import os.path
|
||||
from tmtccmd.util.obj_id import ObjectIdDictT
|
||||
from typing import Dict
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.util.obj_id import ObjectIdDictT, ObjectIdU32
|
||||
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
DEFAULT_OBJECTS_CSV_PATH = "config/objects.csv"
|
||||
DEFAULT_OBJECTS_CSV_PATH = EIVE_TMTC_ROOT / "config/objects.csv"
|
||||
__OBJECT_ID_DICT = None
|
||||
|
||||
|
||||
@ -28,9 +30,11 @@ SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32])
|
||||
|
||||
# Thermal Object IDs
|
||||
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])
|
||||
HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
|
||||
TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04])
|
||||
TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05])
|
||||
HEATER_CONTROLLER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID = bytes([0x44, 0x42, 0x00, 0x04])
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID = bytes([0x44, 0x42, 0x00, 0x05])
|
||||
TMP1075_HANDLER_PLPCDU_0_ID = bytes([0x44, 0x42, 0x00, 0x06])
|
||||
TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08])
|
||||
|
||||
# Communication Object IDs
|
||||
SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3])
|
||||
@ -67,14 +71,14 @@ PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
|
||||
PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00])
|
||||
|
||||
# Other
|
||||
HEATER_0_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
|
||||
HEATER_1_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x01])
|
||||
HEATER_0_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
|
||||
HEATER_1_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x01])
|
||||
HEATER_2_ACS_BRD = bytes([0x60, 0x00, 0x00, 0x02])
|
||||
HEATER_3_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x03])
|
||||
HEATER_3_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x03])
|
||||
HEATER_4_CAMERA = bytes([0x60, 0x00, 0x00, 0x04])
|
||||
HEATER_5_STR = bytes([0x60, 0x00, 0x00, 0x05])
|
||||
HEATER_6_DRO = bytes([0x60, 0x00, 0x00, 0x06])
|
||||
HEATER_7_HPA = bytes([0x60, 0x00, 0x00, 0x07])
|
||||
HEATER_7_SYRLINKS = bytes([0x60, 0x00, 0x00, 0x07])
|
||||
|
||||
# RTDs
|
||||
RTD_0_PLOC_HSPD = bytes([0x44, 0x42, 0x00, 0x16])
|
||||
@ -122,23 +126,48 @@ SUS_5_N_LOC_XFYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x37])
|
||||
SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43])
|
||||
|
||||
# System and Assembly Objects
|
||||
EIVE_SYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x00])
|
||||
ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01])
|
||||
PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
|
||||
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
|
||||
COM_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x04])
|
||||
|
||||
# Legacy names, kept for backwards compatibility
|
||||
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
|
||||
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])
|
||||
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
IMTQ_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
|
||||
|
||||
ACS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x01])
|
||||
SUS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
TCS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x03])
|
||||
RW_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x04])
|
||||
CAM_SWITCHER = bytes([0x73, 0x00, 0x00, 0x06])
|
||||
SYRLINKS_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x07])
|
||||
# To be removed soon..
|
||||
MGT_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
|
||||
STR_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x09])
|
||||
|
||||
# Controllers
|
||||
TCS_CONTROLLER = bytes([0x43, 0x40, 0x00, 0x01])
|
||||
ACS_CONTROLLER = bytes([0x43, 0x00, 0x00, 0x02])
|
||||
CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03])
|
||||
|
||||
MISC_TM_STORE = bytes([0x73, 0x02, 0x00, 0x01])
|
||||
OK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x02])
|
||||
NOT_OK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x03])
|
||||
HK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x04])
|
||||
CFDP_TM_STORE = bytes([0x73, 0x03, 0x00, 0x00])
|
||||
|
||||
def get_object_ids() -> ObjectIdDictT:
|
||||
ObjectIdDict = Dict[bytes, ObjectIdU32]
|
||||
|
||||
|
||||
def get_object_ids() -> ObjectIdDict:
|
||||
global __OBJECT_ID_DICT
|
||||
if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
|
||||
LOGGER.warning(f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}")
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}"
|
||||
)
|
||||
if __OBJECT_ID_DICT is None:
|
||||
if os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
|
||||
__OBJECT_ID_DICT = parse_fsfw_objects_csv(csv_file=DEFAULT_OBJECTS_CSV_PATH)
|
||||
|
@ -29,6 +29,7 @@
|
||||
0x44120350;RW4
|
||||
0x44130001;STAR_TRACKER
|
||||
0x44130045;GPS_CONTROLLER
|
||||
0x44140013;IMTQ_POLLING
|
||||
0x44140014;IMTQ_HANDLER
|
||||
0x442000A1;PCDU_HANDLER
|
||||
0x44250000;P60DOCK_HANDLER
|
||||
@ -44,6 +45,10 @@
|
||||
0x44330003;PLOC_MPSOC_HELPER
|
||||
0x44330004;AXI_PTME_CONFIG
|
||||
0x44330005;PTME_CONFIG
|
||||
0x44330006;PTME_VC0_LIVE_TM
|
||||
0x44330007;PTME_VC1_LOG_TM
|
||||
0x44330008;PTME_VC2_HK_TM
|
||||
0x44330009;PTME_VC3_CFDP_TM
|
||||
0x44330015;PLOC_MPSOC_HANDLER
|
||||
0x44330016;PLOC_SUPERVISOR_HANDLER
|
||||
0x44330017;PLOC_SUPERVISOR_HELPER
|
||||
@ -55,7 +60,6 @@
|
||||
0x44420006;TMP1075_HANDLER_PLPCDU_0
|
||||
0x44420007;TMP1075_HANDLER_PLPCDU_1
|
||||
0x44420008;TMP1075_HANDLER_IF_BOARD
|
||||
0x44420009;TMP1075_HANDLER_OBC_IF_BOARD
|
||||
0x44420016;RTD_0_IC3_PLOC_HEATSPREADER
|
||||
0x44420017;RTD_1_IC4_PLOC_MISSIONBOARD
|
||||
0x44420018;RTD_2_IC5_4K_CAMERA
|
||||
@ -72,20 +76,24 @@
|
||||
0x44420029;RTD_13_IC16_PLPCDU_HEATSPREADER
|
||||
0x44420030;RTD_14_IC17_TCS_BOARD
|
||||
0x44420031;RTD_15_IC18_IMTQ
|
||||
0x445300A3;SYRLINKS_HK_HANDLER
|
||||
0x445300A3;SYRLINKS_HANDLER
|
||||
0x49000000;ARDUINO_COM_IF
|
||||
0x49010005;GPIO_IF
|
||||
0x49010006;SCEX_UART_READER
|
||||
0x49020004;SPI_MAIN_COM_IF
|
||||
0x49020005;SPI_RW_COM_IF
|
||||
0x49020006;SPI_RTD_COM_IF
|
||||
0x49030003;UART_COM_IF
|
||||
0x49040002;I2C_COM_IF
|
||||
0x49050001;CSP_COM_IF
|
||||
0x49060004;ACS_BOARD_POLLING_TASK
|
||||
0x49060005;RW_POLLING_TASK
|
||||
0x49060006;SPI_RTD_COM_IF
|
||||
0x49060007;SUS_POLLING_TASK
|
||||
0x50000100;CCSDS_PACKET_DISTRIBUTOR
|
||||
0x50000200;PUS_PACKET_DISTRIBUTOR
|
||||
0x50000300;TMTC_BRIDGE
|
||||
0x50000400;TMTC_POLLING_TASK
|
||||
0x50000300;TCP_TMTC_SERVER
|
||||
0x50000301;UDP_TMTC_SERVER
|
||||
0x50000400;TCP_TMTC_POLLING_TASK
|
||||
0x50000401;UDP_TMTC_POLLING_TASK
|
||||
0x50000500;FILE_SYSTEM_HANDLER
|
||||
0x50000550;SDC_MANAGER
|
||||
0x50000600;PTME
|
||||
@ -100,6 +108,7 @@
|
||||
0x53000008;PUS_SERVICE_8_FUNCTION_MGMT
|
||||
0x53000009;PUS_SERVICE_9_TIME_MGMT
|
||||
0x53000011;PUS_SERVICE_11_TC_SCHEDULER
|
||||
0x53000015;PUS_SERVICE_15_TM_STORAGE
|
||||
0x53000017;PUS_SERVICE_17_TEST
|
||||
0x53000020;PUS_SERVICE_20_PARAMETERS
|
||||
0x53000200;PUS_SERVICE_200_MODE_MGMT
|
||||
@ -130,12 +139,15 @@
|
||||
0x60000004;HEATER_4_CAMERA
|
||||
0x60000005;HEATER_5_STR
|
||||
0x60000006;HEATER_6_DRO
|
||||
0x60000007;HEATER_7_HPA
|
||||
0x60000007;HEATER_7_SYRLINKS
|
||||
0x73000001;ACS_BOARD_ASS
|
||||
0x73000002;SUS_BOARD_ASS
|
||||
0x73000003;TCS_BOARD_ASS
|
||||
0x73000004;RW_ASS
|
||||
0x73000004;RW_ASSY
|
||||
0x73000006;CAM_SWITCHER
|
||||
0x73000007;SYRLINKS_ASSY
|
||||
0x73000008;IMTQ_ASSY
|
||||
0x73000009;STR_ASSY
|
||||
0x73000100;TM_FUNNEL
|
||||
0x73000101;PUS_TM_FUNNEL
|
||||
0x73000102;CFDP_TM_FUNNEL
|
||||
@ -144,5 +156,18 @@
|
||||
0x73010000;EIVE_SYSTEM
|
||||
0x73010001;ACS_SUBSYSTEM
|
||||
0x73010002;PL_SUBSYSTEM
|
||||
0x73010003;TCS_SUBSYSTEM
|
||||
0x73010004;COM_SUBSYSTEM
|
||||
0x73020001;MISC_TM_STORE
|
||||
0x73020002;OK_TM_STORE
|
||||
0x73020003;NOT_OK_TM_STORE
|
||||
0x73020004;HK_TM_STORE
|
||||
0x73030000;CFDP_TM_STORE
|
||||
0x73040000;LIVE_TM_TASK
|
||||
0x73040001;LOG_STORE_AND_TM_TASK
|
||||
0x73040002;HK_STORE_AND_TM_TASK
|
||||
0x73040003;CFDP_STORE_AND_TM_TASK
|
||||
0x73040004;DOWNLINK_RAM_STORE
|
||||
0x73500000;CCSDS_IP_CORE_BRIDGE
|
||||
0x90000003;THERMAL_TEMP_INSERTER
|
||||
0xFFFFFFFF;NO_OBJECT
|
||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,11 @@
|
||||
import os
|
||||
from tmtccmd.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
|
||||
from tmtccmd.logging import get_console_logger
|
||||
import logging
|
||||
|
||||
DEFAULT_RETVAL_CSV_NAME = "config/returnvalues.csv"
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
|
||||
|
||||
DEFAULT_RETVAL_CSV_NAME = EIVE_TMTC_ROOT / "config/returnvalues.csv"
|
||||
__RETVAL_DICT = None
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def get_retval_dict() -> RetvalDictT:
|
||||
@ -15,7 +16,7 @@ def get_retval_dict() -> RetvalDictT:
|
||||
csv_file=DEFAULT_RETVAL_CSV_NAME
|
||||
)
|
||||
else:
|
||||
LOGGER.warning(
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Return Value CSV file found at {DEFAULT_RETVAL_CSV_NAME}"
|
||||
)
|
||||
__RETVAL_DICT = dict()
|
||||
|
@ -12,11 +12,11 @@ from typing import Union
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
class GomspaceDeviceActionIds(enum.IntEnum):
|
||||
class GomspaceDeviceActionId(enum.IntEnum):
|
||||
PING = 1
|
||||
REBOOT = 4
|
||||
PARAM_GET = 0
|
||||
@ -63,8 +63,8 @@ class Channel:
|
||||
|
||||
|
||||
def pack_request_config_command(object_id: bytes) -> PusTelecommand:
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionId.REQUEST_CONFIG_TABLE
|
||||
)
|
||||
|
||||
|
||||
@ -88,9 +88,9 @@ def pack_get_param_command(
|
||||
else:
|
||||
app_data += memory_address
|
||||
app_data += struct.pack("!B", parameter_size)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id,
|
||||
action_id=GomspaceDeviceActionIds.PARAM_GET,
|
||||
action_id=GomspaceDeviceActionId.PARAM_GET,
|
||||
user_data=app_data,
|
||||
)
|
||||
|
||||
@ -98,12 +98,12 @@ def pack_get_param_command(
|
||||
def pack_set_float_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: float
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!f", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -111,12 +111,12 @@ def pack_set_float_param_command(
|
||||
def pack_set_u8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data.append(parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -124,12 +124,12 @@ def pack_set_u8_param_command(
|
||||
def pack_set_i8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data += struct.pack("!b", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -137,12 +137,12 @@ def pack_set_i8_param_command(
|
||||
def pack_set_u16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!H", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -150,34 +150,34 @@ def pack_set_u16_param_command(
|
||||
def pack_set_i16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!h", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_u32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!I", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_i32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!i", parameter)
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -224,9 +224,9 @@ def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand
|
||||
@note The ping request sends the specified data to a gompsace device. These
|
||||
data are simply copied by the device and then sent back.
|
||||
"""
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.PING,
|
||||
action_id=GomspaceDeviceActionId.PING,
|
||||
user_data=data,
|
||||
)
|
||||
|
||||
@ -235,8 +235,8 @@ def pack_gnd_wdt_reset_command(object_id: ObjectIdBase) -> PusTelecommand:
|
||||
""" " Function to generate the command to reset the watchdog of a gomspace device.
|
||||
@param object_id Object Id of the gomspace device handler.
|
||||
"""
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.WDT_RESET
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.WDT_RESET
|
||||
)
|
||||
|
||||
|
||||
@ -244,8 +244,8 @@ def pack_reboot_command(object_id: ObjectIdU32) -> PusTelecommand:
|
||||
"""Function to generate the command which triggers a reboot of a gomspace device
|
||||
@param object_id The object id of the gomspace device handler.
|
||||
"""
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REBOOT
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.REBOOT
|
||||
)
|
||||
|
||||
|
||||
@ -254,6 +254,6 @@ def pack_request_full_hk_table_command(object_id: ObjectIdU32) -> PusTelecommand
|
||||
device.
|
||||
@param object_id The object id of the gomspace device handler.
|
||||
"""
|
||||
return make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REQUEST_HK_TABLE
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.REQUEST_HK_TABLE
|
||||
)
|
||||
|
@ -1,5 +1,3 @@
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxOpCodes
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
@ -23,152 +21,3 @@ def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
|
||||
)
|
||||
call_all_definitions_providers(def_wrapper)
|
||||
return def_wrapper
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "TMP1075 Tests")
|
||||
defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce)
|
||||
defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pdec_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "PDEC Handler: Print CLCW")
|
||||
oce.add("1", "PDEC Handler: Print PDEC monitor")
|
||||
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "CCSDS Handler: Set low rate")
|
||||
oce.add("1", "CCSDS Handler: Set high rate")
|
||||
oce.add("2", "CCSDS Handler: Enable transmitter")
|
||||
oce.add("3", "CCSDS Handler: Disable transmitter")
|
||||
oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
|
||||
oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
|
||||
oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
|
||||
oce.add("7", "CCSDS Handler: Update tx data on rising edge")
|
||||
oce.add("8", "CCSDS Handler: Update tx data on falling edge")
|
||||
defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "Star Tracker: Mode On, Submode Bootloader")
|
||||
oce.add("1", "Star Tracker: Mode On, Submode Firmware")
|
||||
oce.add("2", "Star Tracker: Mode Normal")
|
||||
oce.add("3", "Star Tracker: Mode Off")
|
||||
oce.add("4", "Star Tracker: Mode Raw")
|
||||
oce.add("5", "Star Tracker: Ping")
|
||||
oce.add("6", "Star Tracker: Switch to bootloader program")
|
||||
oce.add("7", "Star Tracker: Request temperature")
|
||||
oce.add("8", "Star Tracker: Request version")
|
||||
oce.add("9", "Star Tracker: Request interface")
|
||||
oce.add("10", "Star Tracker: Request power")
|
||||
oce.add("11", "Star Tracker: Set subscription parameters")
|
||||
oce.add("12", "Star Tracker: Boot image (requires bootloader mode)")
|
||||
oce.add("13", "Star Tracker: Request time")
|
||||
oce.add("14", "Star Tracker: Request solution")
|
||||
oce.add("15", "Star Tracker: Upload image")
|
||||
oce.add("16", "Star Tracker: Download image")
|
||||
oce.add("17", "Star Tracker: Set limit parameters")
|
||||
oce.add("17", "Star Tracker: Set limit parameters")
|
||||
oce.add("18", "Star Tracker: Set tracking parameters")
|
||||
oce.add("19", "Star Tracker: Set mounting parameters")
|
||||
oce.add("20", "Star Tracker: Set camera parameters")
|
||||
oce.add("22", "Star Tracker: Set centroiding parameters")
|
||||
oce.add("23", "Star Tracker: Set LISA parameters")
|
||||
oce.add("24", "Star Tracker: Set matching parameters")
|
||||
oce.add("25", "Star Tracker: Set validation parameters")
|
||||
oce.add("26", "Star Tracker: Set algo parameters")
|
||||
oce.add("27", "Star Tracker: Take image")
|
||||
oce.add("28", "Star Tracker: Stop str helper")
|
||||
oce.add("30", "Star Tracker: Set name of download image")
|
||||
oce.add("31", "Star Tracker: Request histogram")
|
||||
oce.add("32", "Star Tracker: Request contrast")
|
||||
oce.add("33", "Star Tracker: Set json filename")
|
||||
oce.add("35", "Star Tracker: Flash read")
|
||||
oce.add("36", "Star Tracker: Set flash read filename")
|
||||
oce.add("37", "Star Tracker: Get checksum")
|
||||
oce.add("49", "Star Tracker: Request camera parameter")
|
||||
oce.add("50", "Star Tracker: Request limits")
|
||||
oce.add("51", "Star Tracker: Set image processor parameters")
|
||||
oce.add("52", "Star Tracker: (EGSE only) Load camera ground config")
|
||||
oce.add("53", "Star Tracker: (EGSE only) Load camera flight config")
|
||||
oce.add("54", "Star Tracker: Request log level parameters")
|
||||
oce.add("55", "Star Tracker: Request mounting parameters")
|
||||
oce.add("56", "Star Tracker: Request image processor parameters")
|
||||
oce.add("57", "Star Tracker: Request centroiding parameters")
|
||||
oce.add("58", "Star Tracker: Request lisa parameters")
|
||||
oce.add("59", "Star Tracker: Request matching parameters")
|
||||
oce.add("60", "Star Tracker: Request tracking parameters")
|
||||
oce.add("61", "Star Tracker: Request validation parameters")
|
||||
oce.add("62", "Star Tracker: Request algo parameters")
|
||||
oce.add("63", "Star Tracker: Request subscription parameters")
|
||||
oce.add("64", "Star Tracker: Request log subscription parameters")
|
||||
oce.add("65", "Star Tracker: Request debug camera parameters")
|
||||
oce.add("66", "Star Tracker: Set log level parameters")
|
||||
oce.add("67", "Star Tracker: Set log subscription parameters")
|
||||
oce.add("68", "Star Tracker: Set debug camera parameters")
|
||||
oce.add("69", "Star Tracker: Firmware update")
|
||||
oce.add("70", "Star Tracker: Disable timestamp generation")
|
||||
oce.add("71", "Star Tracker: Enable timestamp generation")
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
|
||||
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
|
||||
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
|
||||
oce.add(
|
||||
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
from eive_tmtc.pus_tc.system.time import OpCodes, Info
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCodes.SET_CURRENT_TIME,
|
||||
info=Info.SET_CURRENT_TIME,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TIME.value,
|
||||
info="Time Service",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_system_cmds(defs: TmtcDefinitionWrapper):
|
||||
import eive_tmtc.pus_tc.system.controllers as controllers
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=controllers.OpCodes.THERMAL_CONTROLLER,
|
||||
info=controllers.Info.THERMAL_CONTROLLER,
|
||||
)
|
||||
oce.add(
|
||||
keys=controllers.OpCodes.CORE_CONTROLLER,
|
||||
info=controllers.Info.CORE_CONTROLLER,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.CONTROLLERS.value,
|
||||
info="Controllers",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -1,61 +0,0 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import BPX_HANDLER_ID
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
|
||||
|
||||
class BpxSetIds:
|
||||
GET_HK_SET = 0
|
||||
GET_CFG_SET = 5
|
||||
|
||||
|
||||
class BpxActionIds:
|
||||
REBOOT = 2
|
||||
RESET_COUNTERS = 3
|
||||
SET_CFG = 4
|
||||
GET_CFG = 5
|
||||
|
||||
|
||||
class BpxOpCodes:
|
||||
HK = ["0", "hk"]
|
||||
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
|
||||
REQUEST_CFG = ["2", "cfg"]
|
||||
REQUEST_CFG_HK = ["3", "cfg_hk"]
|
||||
REBOOT = ["4", "reboot"]
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.BPX_BATTERY.value)
|
||||
def pack_bpx_commands(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in BpxOpCodes.HK:
|
||||
q.add_log_cmd("Requesting BPX battery HK set")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCodes.RST_BOOT_CNT:
|
||||
q.add_log_cmd("Resetting reboot counters")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.REQUEST_CFG:
|
||||
q.add_log_cmd("Requesting configuration struct")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.REQUEST_CFG_HK:
|
||||
q.add_log_cmd("Requesting configuration struct HK")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCodes.REBOOT:
|
||||
q.add_log_cmd("Rebooting BPX battery")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.REBOOT
|
||||
)
|
||||
)
|
@ -1,80 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file ccsds_handler.py
|
||||
@brief Test commanding of CCSDS Handler
|
||||
@author J. Meier
|
||||
@date 20.11.2021
|
||||
"""
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class CommandIds:
|
||||
# Configures input rate of syrlinks to 400 Khz (results in downlink rate of 200 kbps)
|
||||
SET_LOW_RATE = 0
|
||||
# Configures input rate of syrlinks to 2000 Khz (results in downlink rate of 1000 kbps)
|
||||
SET_HIGH_RATE = 1
|
||||
# Enables the syrlinks transmitter (by using RS485 enables lines)
|
||||
EN_TRANSMITTER = 2
|
||||
# Disables the syrlinks transmitter (by using RS485 enables lines)
|
||||
DIS_TRANSMITTER = 3
|
||||
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
|
||||
# required
|
||||
ARBITRARY_BITRATE = 4
|
||||
ENABLE_TX_CLK_MANIPULATOR = 5
|
||||
DISABLE_TX_CLK_MANIPULATOR = 6
|
||||
# Tx data will be updated on rising edge of tx clock
|
||||
UPDATE_ON_RISING_EDGE = 7
|
||||
# Tx data will be updated on falling edge of tx clock
|
||||
UPDATE_ON_FALLING_EDGE = 8
|
||||
|
||||
|
||||
def pack_ccsds_handler_test(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("CCSDS Handler: Set low rate")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_LOW_RATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("CCSDS Handler: Set high rate")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_HIGH_RATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "2":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "3":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "4":
|
||||
q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = (
|
||||
obyt
|
||||
+ struct.pack("!I", CommandIds.ARBITRARY_BITRATE)
|
||||
+ struct.pack("!I", bitrate)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "5":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "6":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "7":
|
||||
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)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "8":
|
||||
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)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
@ -1,48 +0,0 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
REQ_OS_HK = ["0", "hk-os"]
|
||||
RESET_GNSS = ["5", "reset"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQ_OS_HK = "Request One-Shot HK"
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetIds:
|
||||
HK = 0
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCodes.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetIds.HK))
|
||||
)
|
@ -1,10 +0,0 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AdisGyroSetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
@ -1,9 +0,0 @@
|
||||
import enum
|
||||
|
||||
|
||||
class MgmLis3SetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
@ -1,30 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file pdec_handler.py
|
||||
@brief Test commanding of PDEC Handler
|
||||
@author J. Meier
|
||||
@date 22.11.2021
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
|
||||
|
||||
class CommandIds:
|
||||
# prints the clcw to the console. Useful for debugging
|
||||
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
|
||||
# Print PDEC monitor register
|
||||
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
|
||||
|
||||
|
||||
def pack_pdec_handler_test(
|
||||
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("PDEC Handler: Print CLCW")
|
||||
command = object_id + CommandIds.PRINT_CLCW
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
|
||||
command = object_id + CommandIds.PRINT_PDEC_MON
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
@ -1,2 +0,0 @@
|
||||
class SetIds:
|
||||
HK = 3
|
@ -1,162 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file syrlinks_hk_handler.py
|
||||
@brief Syrlinks Hk Handler tests
|
||||
@author J. Meier
|
||||
@date 13.12.2020
|
||||
"""
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
import struct
|
||||
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class SetIds:
|
||||
RX_REGISTERS_DATASET = 1
|
||||
TX_REGISTERS_DATASET = 2
|
||||
|
||||
|
||||
class OpCodes:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NORMAL = "nml"
|
||||
STANDBY = "standby"
|
||||
MODULATION = "modulation"
|
||||
|
||||
|
||||
class CommandIds:
|
||||
READ_RX_STATUS_REGISTERS = 2
|
||||
SET_TX_MODE_STANDBY = 3
|
||||
SET_TX_MODE_MODULATION = 4
|
||||
SET_TX_MODE_CW = 5
|
||||
READ_TX_STATUS = 7
|
||||
READ_TX_WAVEFORM = 8
|
||||
READ_TX_AGC_VALUE_HIGH_BYTE = 9
|
||||
READ_TX_AGC_VALUE_LOW_BYTE = 10
|
||||
WRITE_LCL_CONFIG = 11
|
||||
READ_LCL_CONFIG_REGISTER = 12
|
||||
SET_WAVEFORM_OQPSK = 17
|
||||
SET_WAVEFORM_BPSK = 18
|
||||
SET_SECOND_CONFIG = 19
|
||||
ENABLE_DEBUG = 20
|
||||
DISABLE_DEBUG = 21
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, "Syrlinks Handler: Set mode off")
|
||||
oce.add(OpCodes.ON, "Syrlinks Handler: Set mode on")
|
||||
oce.add(OpCodes.NORMAL, "Syrlinks Handler: Set mode normal")
|
||||
oce.add(OpCodes.STANDBY, "Syrlinks Handler: Set TX standby")
|
||||
oce.add(OpCodes.MODULATION, "Syrlinks Handler: Set TX modulation")
|
||||
oce.add("5", "Syrlinks Handler: Set TX carrier wave")
|
||||
oce.add("6", "Syrlinks Handler: Read TX status")
|
||||
oce.add("7", "Syrlinks Handler: Read TX waveform")
|
||||
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
|
||||
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
|
||||
oce.add("12", "Syrlinks Handler: Write LCL config")
|
||||
oce.add("13", "Syrlinks Handler: Read RX status registers")
|
||||
oce.add("14", "Syrlinks Handler: Read LCL config register")
|
||||
oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
|
||||
oce.add("16", "Syrlinks Handler: Set waveform BPSK")
|
||||
oce.add("17", "Syrlinks Handler: Set second config")
|
||||
oce.add("18", "Syrlinks Handler: Enable debug output")
|
||||
oce.add("19", "Syrlinks Handler: Disable debug output")
|
||||
defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce)
|
||||
|
||||
|
||||
def pack_syrlinks_command(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
|
||||
if op_code == OpCodes.OFF:
|
||||
q.add_log_cmd("Syrlinks: Set mode off")
|
||||
data = pack_mode_data(obyt, Modes.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCodes.ON:
|
||||
q.add_log_cmd("Syrlinks: Set mode on")
|
||||
data = pack_mode_data(obyt, Modes.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCodes.NORMAL:
|
||||
q.add_log_cmd("Syrlinks: Mode Normal")
|
||||
data = pack_mode_data(obyt, Modes.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCodes.STANDBY:
|
||||
q.add_log_cmd("syrlinks: Set TX mode standby")
|
||||
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCodes.MODULATION:
|
||||
q.add_log_cmd("syrlinks: Set TX mode modulation")
|
||||
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "5":
|
||||
q.add_log_cmd("syrlinks: Set TX mode CW")
|
||||
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_CW)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "6":
|
||||
q.add_log_cmd("Syrlinks: Get RX Registers")
|
||||
sid = make_sid(obyt, SetIds.RX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
if op_code == "7":
|
||||
q.add_log_cmd("Syrlinks: Get TX Registers")
|
||||
sid = make_sid(obyt, SetIds.TX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("Syrlinks: Read TX status")
|
||||
command = obyt + struct.pack("!I", CommandIds.READ_TX_STATUS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("Syrlinks: Read TX waveform")
|
||||
command = obyt + struct.pack("!I", CommandIds.READ_TX_WAVEFORM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "10":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("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))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("Syrlinks: Write LCL config")
|
||||
command = obyt + struct.pack("!I", CommandIds.WRITE_LCL_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "13":
|
||||
q.add_log_cmd("Syrlinks: Read RX status registers")
|
||||
command = obyt + struct.pack("!I", CommandIds.READ_RX_STATUS_REGISTERS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "14":
|
||||
q.add_log_cmd("Syrlinks: Read LCL config register")
|
||||
command = obyt + struct.pack("!I", CommandIds.READ_LCL_CONFIG_REGISTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "15":
|
||||
q.add_log_cmd("Syrlinks: Set waveform OQPSK")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_WAVEFORM_OQPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "16":
|
||||
q.add_log_cmd("Syrlinks: Set waveform BPSK")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_WAVEFORM_BPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "17":
|
||||
q.add_log_cmd("Syrlinks: Set second config")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_SECOND_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "18":
|
||||
q.add_log_cmd("Syrlinks: Enable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandIds.ENABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "19":
|
||||
q.add_log_cmd("Syrlinks: Disable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandIds.DISABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
@ -1,62 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmp1075.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Tmp1075TestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the Tmp1075.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
start_adc_conversion = False
|
||||
get_temp = False
|
||||
set_mode_normal = (
|
||||
True # Setting mode to normal starts continuous temperature reading
|
||||
)
|
||||
set_mode_on = False # If mode is MODE_ON, temperature will only be read on command
|
||||
|
||||
|
||||
class Tmp1075ActionIds:
|
||||
get_temp = bytearray([0x0, 0x0, 0x0, 0x01])
|
||||
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(
|
||||
object_id: ObjectIdU32, op_code: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Testing Tmp1075 Temperature Sensor Handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
|
||||
q.add_log_cmd("TMP1075: Starting new temperature conversion")
|
||||
command = obyt + Tmp1075ActionIds.start_adc_conversion
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
|
||||
q.add_log_cmd("TMP1075: Read temperature")
|
||||
command = obyt + Tmp1075ActionIds.get_temp
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_normal:
|
||||
q.add_log_cmd("TMP1075: Set Mode Normal")
|
||||
mode_data = pack_mode_data(obyt, Modes.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_on:
|
||||
q.add_log_cmd("TMP1075: Set Mode On")
|
||||
mode_data = pack_mode_data(obyt, Modes.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
return q
|
@ -1,61 +1,51 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.pus_tc.devs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.pus_tc.devs.scex import pack_scex_cmds
|
||||
from eive_tmtc.pus_tc.system.controllers import (
|
||||
pack_cmd_ctrl_to_prompted_mode,
|
||||
get_object_from_op_code,
|
||||
)
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.payload.scex import pack_scex_cmds
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
from tmtccmd.config import CoreServiceList
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import (
|
||||
route_to_registered_service_handlers,
|
||||
ServiceProviderParams,
|
||||
)
|
||||
from tmtccmd.tc.pus_5_event import (
|
||||
pack_generic_service_5_test_into,
|
||||
)
|
||||
from tmtccmd.pus.pus_17_test import pack_service_17_ping_command
|
||||
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_service_200_test_into
|
||||
from eive_tmtc.tmtc.misc.s200_test import pack_service_200_test_into
|
||||
from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds
|
||||
from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands
|
||||
from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands
|
||||
from eive_tmtc.tmtc.power.acu import pack_acu_commands
|
||||
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into
|
||||
from eive_tmtc.pus_tc.devs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.pus_tc.devs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
pack_single_rw_test_into,
|
||||
pack_rw_ass_cmds,
|
||||
)
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
|
||||
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
||||
from eive_tmtc.pus_tc.devs.ccsds_handler import pack_ccsds_handler_test
|
||||
from eive_tmtc.pus_tc.system.core import pack_core_commands
|
||||
from eive_tmtc.pus_tc.devs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.pus_tc.devs.syrlinks_hk_handler import pack_syrlinks_command
|
||||
from eive_tmtc.pus_tc.devs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_test
|
||||
from eive_tmtc.tmtc.core import pack_core_commands
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||
from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_test
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.tmtc.acs.sus_board import pack_sus_cmds
|
||||
from eive_tmtc.pus_tc.devs.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.pus_tc.devs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.pus_tc.system.tcs import pack_tcs_sys_commands
|
||||
from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import (
|
||||
P60_DOCK_HANDLER,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
ACU_HANDLER_ID,
|
||||
TMP_1075_1_HANDLER_ID,
|
||||
TMP_1075_2_HANDLER_ID,
|
||||
HEATER_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
HEATER_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
@ -71,10 +61,18 @@ from eive_tmtc.config.object_ids import (
|
||||
RW_ASSEMBLY,
|
||||
get_object_ids,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.tmtc.acs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import pack_rad_sensor_test_into
|
||||
from eive_tmtc.tmtc.power.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
def handle_default_procedure(
|
||||
@ -85,8 +83,6 @@ def handle_default_procedure(
|
||||
service = info.service
|
||||
op_code = info.op_code
|
||||
obj_id_man = get_object_ids()
|
||||
if service == CoreServiceList.SERVICE_5.value:
|
||||
return pack_generic_service_5_test_into(q=queue_helper)
|
||||
if service == CoreServiceList.SERVICE_200.value:
|
||||
return pack_service_200_test_into(q=queue_helper)
|
||||
if service == CustomServiceList.P60DOCK.value:
|
||||
@ -105,18 +101,21 @@ def handle_default_procedure(
|
||||
return pack_acu_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS.value:
|
||||
return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TMP1075_1.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_1_HANDLER_ID))
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.TMP1075_2.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_2_HANDLER_ID))
|
||||
if service == CustomServiceList.TMP1075.value:
|
||||
menu_dict = {
|
||||
"0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID),
|
||||
"1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID),
|
||||
"2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
|
||||
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
input_helper = InputHelper(menu_dict)
|
||||
tmp_select = input_helper.get_key()
|
||||
object_id = obj_id_man.get(menu_dict[tmp_select][1])
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.HEATER.value:
|
||||
object_id = HEATER_ID
|
||||
object_id = HEATER_CONTROLLER_ID
|
||||
return pack_heater_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.IMTQ.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID))
|
||||
@ -137,6 +136,8 @@ def handle_default_procedure(
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW4_ID, rw_idx=4, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.MGMS.value:
|
||||
return handle_mgm_cmd(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RAD_SENSOR.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(RAD_SENSOR_ID))
|
||||
return pack_rad_sensor_test_into(
|
||||
@ -168,11 +169,12 @@ def handle_default_procedure(
|
||||
object_id=oids.GPS_CONTROLLER, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.CCSDS_HANDLER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
||||
return pack_ccsds_handler_test(
|
||||
object_id=CCSDS_HANDLER_ID, q=queue_helper, op_code=op_code
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PDEC_HANDLER.value:
|
||||
return pack_ccsds_handler_test(
|
||||
return pack_pdec_handler_test(
|
||||
object_id=PDEC_HANDLER_ID, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.SYRLINKS.value:
|
||||
@ -180,6 +182,8 @@ def handle_default_procedure(
|
||||
return pack_syrlinks_command(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.GYRO.value:
|
||||
return handle_gyr_cmd(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PROCEDURE.value:
|
||||
return pack_proc_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PL_PCDU.value:
|
||||
@ -188,15 +192,6 @@ def handle_default_procedure(
|
||||
return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RW_ASSEMBLY.value:
|
||||
return pack_rw_ass_cmds(q=queue_helper, object_id=RW_ASSEMBLY, op_code=op_code)
|
||||
if service == CustomServiceList.CONTROLLERS.value:
|
||||
from tmtcc import TcHandler
|
||||
|
||||
tc_handler = cast(TcHandler, tc_base)
|
||||
return pack_cmd_ctrl_to_prompted_mode(
|
||||
q=queue_helper,
|
||||
object_id=get_object_from_op_code(op_code),
|
||||
gui=tc_handler.gui,
|
||||
)
|
||||
if service == CustomServiceList.SCEX.value:
|
||||
return pack_scex_cmds(
|
||||
ServiceProviderParams(
|
||||
@ -215,4 +210,4 @@ def handle_default_procedure(
|
||||
queue_helper=queue_helper,
|
||||
),
|
||||
):
|
||||
LOGGER.warning(f"Invalid Service {service}")
|
||||
logging.getLogger(__name__).warning(f"Invalid Service {service}")
|
||||
|
@ -1,19 +1,14 @@
|
||||
from typing import Union
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
from eive_tmtc.pus_tc.prompt_parameters import (
|
||||
prompt_parameters_cli,
|
||||
prompt_parameters_gui,
|
||||
)
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "ctrl-th"]
|
||||
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "ctrl-core"]
|
||||
|
||||
@ -26,11 +21,17 @@ class Info:
|
||||
def pack_cmd_ctrl_to_prompted_mode(
|
||||
q: DefaultPusQueueHelper, object_id: ObjectIdU32, gui: bool
|
||||
):
|
||||
from eive_tmtc.pus_tc.prompt_parameters import (
|
||||
prompt_parameters_cli,
|
||||
)
|
||||
|
||||
param_list = [
|
||||
{"name": "Mode", "defaultValue": "2"},
|
||||
{"name": "Submode", "defaultValue": "0"},
|
||||
]
|
||||
if gui:
|
||||
from eive_tmtc.pus_tc.prompt_parameters import prompt_parameters_gui
|
||||
|
||||
parameters = prompt_parameters_gui(param_list)
|
||||
else:
|
||||
parameters = prompt_parameters_cli(param_list)
|
||||
@ -53,7 +54,7 @@ def pack_cmd_ctrl_to_off(
|
||||
):
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=object_id.as_bytes,
|
||||
mode=Modes.OFF,
|
||||
mode=Mode.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=f"Commanding {object_id} OFF",
|
||||
@ -63,7 +64,7 @@ def pack_cmd_ctrl_to_off(
|
||||
def pack_cmd_ctrl_to_on(q: DefaultPusQueueHelper, object_id: ObjectIdU32):
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=object_id.as_bytes,
|
||||
mode=Modes.ON,
|
||||
mode=Mode.ON,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=f"Commanding {object_id} ON",
|
||||
@ -75,7 +76,7 @@ def pack_cmd_ctrl_to_nml(
|
||||
):
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=object_id.as_bytes,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=f"Commanding {object_id} NORMAL",
|
||||
@ -88,7 +89,7 @@ def get_object_from_op_code(op_code: str):
|
||||
except:
|
||||
pass
|
||||
|
||||
if op_code in OpCodes.THERMAL_CONTROLLER:
|
||||
if op_code in OpCode.THERMAL_CONTROLLER:
|
||||
return obj_ids.THERMAL_CONTROLLER_ID
|
||||
if op_code in OpCodes.CORE_CONTROLLER:
|
||||
if op_code in OpCode.CORE_CONTROLLER:
|
||||
return obj_ids.CORE_CONTROLLER_ID
|
||||
|
@ -5,34 +5,30 @@ from datetime import timedelta
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from eive_tmtc.pus_tc.system.tcs import pack_tcs_sys_commands
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_11_tc_sched import (
|
||||
generate_time_tagged_cmd,
|
||||
generate_enable_tc_sched_cmd,
|
||||
generate_reset_tc_sched_cmd,
|
||||
from tmtccmd.pus.s11_tc_sched import (
|
||||
create_time_tagged_cmd,
|
||||
create_enable_tc_sched_cmd,
|
||||
create_reset_tc_sched_cmd,
|
||||
)
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import *
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.pus_tc.system.tcs import OpCodes as TcsOpCodes
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxSetIds
|
||||
from eive_tmtc.pus_tc.system.core import SetIds as CoreSetIds
|
||||
from eive_tmtc.tmtc.power.common_power import SetIds as GsSetIds
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import SetIds as RadSetIds
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmLis3SetIds as MgmLis3SetIds_0_2
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetIds as MgmRm3100SetIds_1_3
|
||||
from eive_tmtc.pus_tc.devs.gyros import AdisGyroSetIds as AdisGyroSetIds_0_2
|
||||
from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetIds as L3gGyroSetIds_1_3
|
||||
from eive_tmtc.pus_tc.devs.syrlinks_hk_handler import SetIds as SyrlinksSetIds
|
||||
from eive_tmtc.pus_tc.devs.gps import SetIds as GpsSetIds
|
||||
from eive_tmtc.tmtc.acs.imtq import ImtqSetIds
|
||||
from eive_tmtc.pus_tc.devs.sus import SetIds
|
||||
from eive_tmtc.pus_tc.devs.star_tracker import SetIds as StrSetIds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import RwSetIds, rw_speed_up_cmd_consec
|
||||
from eive_tmtc.tmtc.tcs.brd_assy import OpCodeAssy as TcsOpCodes
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from eive_tmtc.tmtc.core import SetId as CoreSetIds
|
||||
from eive_tmtc.tmtc.power.common_power import SetId as GsSetIds
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import SetId as SyrlinksSetIds
|
||||
from eive_tmtc.tmtc.acs.imtq import ImtqSetId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import SetId as StrSetIds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
RwSetId,
|
||||
rw_speed_up_cmd_consec,
|
||||
rw_speed_down_cmd_consec,
|
||||
)
|
||||
from eive_tmtc.pus_tc.system.controllers import (
|
||||
pack_cmd_ctrl_to_off,
|
||||
pack_cmd_ctrl_to_nml,
|
||||
@ -40,11 +36,22 @@ from eive_tmtc.pus_tc.system.controllers import (
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.tmtc.acs.sus_board import pack_sus_cmds
|
||||
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into, pack_dipole_command
|
||||
from eive_tmtc.pus_tc.devs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command
|
||||
|
||||
from eive_tmtc.tmtc.acs.sus import SetId
|
||||
from eive_tmtc.tmtc.power.bpx_batt import BpxSetId
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import SetId as RadSetIds
|
||||
from eive_tmtc.tmtc.acs.mgms import MgmLis3SetId as MgmLis3SetIds_0_2
|
||||
from eive_tmtc.tmtc.acs.mgms import MgmRm3100SetId as MgmRm3100SetIds_1_3
|
||||
from eive_tmtc.tmtc.acs.gyros import (
|
||||
AdisGyroSetId as AdisGyroSetIds_0_2,
|
||||
L3gGyroSetId as L3gGyroSetIds_1_3,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.gps import SetId as GpsSetIds
|
||||
|
||||
class OpCodes:
|
||||
|
||||
class OpCode:
|
||||
"""FT: Functional Test"""
|
||||
|
||||
TV_SETUP_TCS_FT_ON = ["s", "tcs-ft-on"]
|
||||
@ -88,34 +95,34 @@ KAI = KeyAndInfo
|
||||
|
||||
PROC_INFO_DICT = {
|
||||
KAI.TV_SETUP_TCS_FT_ON[0]: [
|
||||
OpCodes.TV_SETUP_TCS_FT_ON,
|
||||
OpCode.TV_SETUP_TCS_FT_ON,
|
||||
KAI.TV_SETUP_TCS_FT_ON[1],
|
||||
120.0,
|
||||
10.0,
|
||||
],
|
||||
KAI.TV_TEARDOWN_TCS_FT_OFF[0]: [
|
||||
OpCodes.TV_TEARDOWN_TCS_FT_OFF,
|
||||
OpCode.TV_TEARDOWN_TCS_FT_OFF,
|
||||
KAI.TV_TEARDOWN_TCS_FT_OFF[1],
|
||||
120.0,
|
||||
10.0,
|
||||
],
|
||||
KAI.BAT_FT[0]: [OpCodes.BAT_FT, KAI.BAT_FT[1], 120.0, 10.0],
|
||||
KAI.CORE_FT[0]: [OpCodes.CORE_FT, KAI.CORE_FT[1], 120.0, 10.0],
|
||||
KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0],
|
||||
KAI.RAD_SEN_FT[0]: [OpCodes.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0],
|
||||
KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0],
|
||||
KAI.MGT_FT[0]: [OpCodes.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0],
|
||||
KAI.BAT_FT[0]: [OpCode.BAT_FT, KAI.BAT_FT[1], 120.0, 10.0],
|
||||
KAI.CORE_FT[0]: [OpCode.CORE_FT, KAI.CORE_FT[1], 120.0, 10.0],
|
||||
KAI.PCDU_FT[0]: [OpCode.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0],
|
||||
KAI.RAD_SEN_FT[0]: [OpCode.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0],
|
||||
KAI.ACS_FT[0]: [OpCode.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0],
|
||||
KAI.MGT_FT[0]: [OpCode.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0],
|
||||
# collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120
|
||||
# seconds is not needed after MGTs are tested
|
||||
KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 10.0, 10.0],
|
||||
KAI.SUS_FT[0]: [OpCodes.SUS_FT, KAI.SUS_FT[1], 120.0, 10.0],
|
||||
KAI.STR_FT[0]: [OpCodes.STR_FT, KAI.STR_FT[1], 120.0, 10.0],
|
||||
KAI.MGT_FT_DP[0]: [OpCode.MGT_FT_DP, KAI.MGT_FT_DP[1], 10.0, 10.0],
|
||||
KAI.SUS_FT[0]: [OpCode.SUS_FT, KAI.SUS_FT[1], 120.0, 10.0],
|
||||
KAI.STR_FT[0]: [OpCode.STR_FT, KAI.STR_FT[1], 120.0, 10.0],
|
||||
# collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120
|
||||
# seconds is not needed after RWs are tested
|
||||
KAI.RW_FT_ONE_RW[0]: [OpCodes.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 1.0],
|
||||
KAI.RW_FT_ONE_RW[0]: [OpCode.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 1.0],
|
||||
# collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120
|
||||
# seconds is not needed after RWs are tested
|
||||
KAI.RW_FT_TWO_RWS[0]: [OpCodes.RW_FT_TWO_RWS, KAI.RW_FT_TWO_RWS[1], 10.0, 1.0],
|
||||
KAI.RW_FT_TWO_RWS[0]: [OpCode.RW_FT_TWO_RWS, KAI.RW_FT_TWO_RWS[1], 10.0, 1.0],
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +211,7 @@ def pack_generic_hk_listening_cmds(
|
||||
else:
|
||||
for cmd in disable_cmd_list:
|
||||
q.add_pus_tc(
|
||||
generate_time_tagged_cmd(
|
||||
create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", int(current_time)), tc_to_insert=cmd
|
||||
)
|
||||
)
|
||||
@ -218,12 +225,12 @@ def pack_generic_hk_listening_cmds(
|
||||
def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
sid_list = []
|
||||
obj_id_dict = get_object_ids()
|
||||
if op_code in OpCodes.RESET_SCHED:
|
||||
if op_code in OpCode.RESET_SCHED:
|
||||
q.add_log_cmd("Resetting/Clearing TC schedule")
|
||||
q.add_pus_tc(generate_reset_tc_sched_cmd())
|
||||
if op_code in OpCodes.BAT_FT:
|
||||
q.add_pus_tc(create_reset_tc_sched_cmd())
|
||||
if op_code in OpCode.BAT_FT:
|
||||
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, BpxSetId.GET_HK_SET))
|
||||
diag_list = [False]
|
||||
pack_generic_hk_listening_cmds(
|
||||
q=q,
|
||||
@ -233,7 +240,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
if op_code in OpCodes.CORE_FT:
|
||||
if op_code in OpCode.CORE_FT:
|
||||
key = KAI.CORE_FT[0]
|
||||
sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK))
|
||||
diag_list = [False]
|
||||
@ -245,7 +252,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
if op_code in OpCodes.PCDU_FT:
|
||||
if op_code in OpCode.PCDU_FT:
|
||||
key = KAI.PCDU_FT[0]
|
||||
pcdu_pairs = [
|
||||
(oids.P60_DOCK_HANDLER, GsSetIds.CORE),
|
||||
@ -281,7 +288,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
if op_code in OpCodes.RAD_SEN_FT:
|
||||
if op_code in OpCode.RAD_SEN_FT:
|
||||
key = KAI.RAD_SEN_FT[0]
|
||||
sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.HK))
|
||||
diag_list = [False]
|
||||
@ -293,18 +300,18 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
if op_code in OpCodes.TV_SETUP_TCS_FT_ON:
|
||||
if op_code in OpCode.TV_SETUP_TCS_FT_ON:
|
||||
# Enable scheduling
|
||||
q.add_pus_tc(generate_enable_tc_sched_cmd())
|
||||
q.add_pus_tc(create_enable_tc_sched_cmd())
|
||||
# check whether tcs_assembly also has to be commanded to NORMAL Mode
|
||||
pack_tcs_sys_commands(q=q, 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))
|
||||
|
||||
if op_code in OpCodes.TV_TEARDOWN_TCS_FT_OFF:
|
||||
if op_code in OpCode.TV_TEARDOWN_TCS_FT_OFF:
|
||||
# TCS board should always be on anyway, do not command it off here
|
||||
pack_cmd_ctrl_to_off(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
|
||||
|
||||
if op_code in OpCodes.ACS_FT:
|
||||
if op_code in OpCode.ACS_FT:
|
||||
key = KAI.ACS_FT[0]
|
||||
a_side_pairs = [
|
||||
(oids.MGM_0_LIS3_HANDLER_ID, MgmLis3SetIds_0_2.CORE_HK),
|
||||
@ -387,12 +394,12 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
|
||||
if op_code in OpCodes.MGT_FT:
|
||||
if op_code in OpCode.MGT_FT:
|
||||
key = KAI.MGT_FT[0]
|
||||
imtq_pairs = [
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.ENG_HK_NO_TORQUE),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.CAL_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.RAW_MTM_NO_TORQUE),
|
||||
]
|
||||
diag_list = [
|
||||
True,
|
||||
@ -420,7 +427,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
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 OpCode.MGT_FT_DP:
|
||||
key = KAI.MGT_FT_DP[0]
|
||||
a_side_pairs = [
|
||||
(oids.MGM_0_LIS3_HANDLER_ID, MgmLis3SetIds_0_2.CORE_HK),
|
||||
@ -437,9 +444,9 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
(oids.GPS_CONTROLLER, GpsSetIds.HK),
|
||||
]
|
||||
imtq_pairs = [
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.ENG_HK_NO_TORQUE),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.CAL_MTM_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.RAW_MTM_NO_TORQUE),
|
||||
]
|
||||
d_side_and_imtq_pairs = a_side_pairs + b_side_pairs + imtq_pairs
|
||||
diag_list = [
|
||||
@ -482,7 +489,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
|
||||
if op_code in OpCodes.SUS_FT:
|
||||
if op_code in OpCode.SUS_FT:
|
||||
key = KAI.SUS_FT[0]
|
||||
|
||||
pack_sus_cmds(q=q, op_code="sus-nom")
|
||||
@ -514,7 +521,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
# SUSs
|
||||
for nom_sus in sus_n_ids:
|
||||
sid_list.append(make_sid(nom_sus, SetIds.HK))
|
||||
sid_list.append(make_sid(nom_sus, SetId.HK))
|
||||
pack_generic_hk_listening_cmds(
|
||||
q=q,
|
||||
proc_key=key,
|
||||
@ -538,7 +545,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
# SUSs
|
||||
for red_sus in sus_r_ids:
|
||||
sid_list.append(make_sid(red_sus, SetIds.HK))
|
||||
sid_list.append(make_sid(red_sus, SetId.HK))
|
||||
pack_generic_hk_listening_cmds(
|
||||
q=q,
|
||||
proc_key=key,
|
||||
@ -553,9 +560,9 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
# SUSs
|
||||
for nom_sus in sus_n_ids:
|
||||
sid_list.append(make_sid(nom_sus, SetIds.HK))
|
||||
sid_list.append(make_sid(nom_sus, SetId.HK))
|
||||
for red_sus in sus_r_ids:
|
||||
sid_list.append(make_sid(red_sus, SetIds.HK))
|
||||
sid_list.append(make_sid(red_sus, SetId.HK))
|
||||
diag_list = [
|
||||
True,
|
||||
True,
|
||||
@ -580,7 +587,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
|
||||
if op_code in OpCodes.SYRLINKS_FT:
|
||||
if op_code in OpCode.SYRLINKS_FT:
|
||||
key = KAI.SYRLINKS_FT[0]
|
||||
sid_list = [
|
||||
make_sid(oids.SYRLINKS_HANDLER_ID, SyrlinksSetIds.RX_REGISTERS_DATASET),
|
||||
@ -594,7 +601,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
diag_list=[False],
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
if op_code in OpCodes.STR_FT:
|
||||
if op_code in OpCode.STR_FT:
|
||||
key = KAI.STR_FT[0]
|
||||
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="2")
|
||||
@ -612,21 +619,21 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="3")
|
||||
|
||||
if op_code in OpCodes.RW_FT_ONE_RW:
|
||||
if op_code in OpCode.RW_FT_ONE_RW:
|
||||
key = KAI.RW_FT_ONE_RW[0]
|
||||
rw_pairs = [
|
||||
(oids.RW1_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW1_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW1_ID, RwSetIds.TM_SET),
|
||||
(oids.RW2_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW2_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW2_ID, RwSetIds.TM_SET),
|
||||
(oids.RW3_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW3_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW3_ID, RwSetIds.TM_SET),
|
||||
(oids.RW4_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW4_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW4_ID, RwSetIds.TM_SET),
|
||||
(oids.RW1_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW1_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW1_ID, RwSetId.TM_SET),
|
||||
(oids.RW2_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW2_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW2_ID, RwSetId.TM_SET),
|
||||
(oids.RW3_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW3_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW3_ID, RwSetId.TM_SET),
|
||||
(oids.RW4_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW4_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW4_ID, RwSetId.TM_SET),
|
||||
]
|
||||
diag_list = [
|
||||
True,
|
||||
@ -661,25 +668,25 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
|
||||
# ass command with 2 rws to speed
|
||||
if op_code in OpCodes.RW_FT_TWO_RWS:
|
||||
if op_code in OpCode.RW_FT_TWO_RWS:
|
||||
key = KAI.RW_FT_TWO_RWS[0]
|
||||
rw_pairs = [
|
||||
(oids.RW1_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW1_ID, RwSetIds.TEMPERATURE_SET_ID),
|
||||
(oids.RW1_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW1_ID, RwSetIds.TM_SET),
|
||||
(oids.RW2_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW2_ID, RwSetIds.TEMPERATURE_SET_ID),
|
||||
(oids.RW2_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW2_ID, RwSetIds.TM_SET),
|
||||
(oids.RW3_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW3_ID, RwSetIds.TEMPERATURE_SET_ID),
|
||||
(oids.RW3_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW3_ID, RwSetIds.TM_SET),
|
||||
(oids.RW4_ID, RwSetIds.STATUS_SET_ID),
|
||||
(oids.RW4_ID, RwSetIds.TEMPERATURE_SET_ID),
|
||||
(oids.RW4_ID, RwSetIds.LAST_RESET),
|
||||
(oids.RW4_ID, RwSetIds.TM_SET),
|
||||
(oids.RW1_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW1_ID, RwSetId.TEMPERATURE_SET_ID),
|
||||
(oids.RW1_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW1_ID, RwSetId.TM_SET),
|
||||
(oids.RW2_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW2_ID, RwSetId.TEMPERATURE_SET_ID),
|
||||
(oids.RW2_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW2_ID, RwSetId.TM_SET),
|
||||
(oids.RW3_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW3_ID, RwSetId.TEMPERATURE_SET_ID),
|
||||
(oids.RW3_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW3_ID, RwSetId.TM_SET),
|
||||
(oids.RW4_ID, RwSetId.STATUS_SET_ID),
|
||||
(oids.RW4_ID, RwSetId.TEMPERATURE_SET_ID),
|
||||
(oids.RW4_ID, RwSetId.LAST_RESET),
|
||||
(oids.RW4_ID, RwSetId.TM_SET),
|
||||
]
|
||||
diag_list = [
|
||||
False,
|
||||
@ -731,7 +738,7 @@ def enable_listen_to_hk_for_x_seconds(
|
||||
)
|
||||
for cmd in cmd_tuple:
|
||||
q.add_pus_tc(cmd)
|
||||
generate_time_tagged_cmd(
|
||||
create_time_tagged_cmd(
|
||||
struct.pack("!I", int(round(time.time() + interval_seconds))),
|
||||
gen_disable_listen_to_hk_for_x_seconds(q, diag, device, sid),
|
||||
)
|
||||
|
@ -1,78 +0,0 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_hk_command,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID, TCS_CONTROLLER
|
||||
|
||||
|
||||
class OpCodes:
|
||||
TCS_BOARD_ASS_NORMAL = ["0", "normal"]
|
||||
TCS_BOARD_ASS_OFF = ["1", "off"]
|
||||
REQUEST_SENSOR_TEMP_SET = ["2", "temps"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQUEST_SENSOR_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
|
||||
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
|
||||
|
||||
|
||||
class SetIds(enum.IntEnum):
|
||||
PRIMARY_SENSORS = 0
|
||||
DEVICE_SENSORS = 1
|
||||
SUS_TEMP_SENSORS = 2
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCodes.TCS_BOARD_ASS_NORMAL,
|
||||
info=Info.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.TCS_BOARD_ASS_OFF,
|
||||
info=Info.TCS_BOARD_ASS_OFF,
|
||||
)
|
||||
oce.add(keys=OpCodes.REQUEST_SENSOR_TEMP_SET, info=Info.REQUEST_SENSOR_TEMP_SET)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS.value,
|
||||
info="TCS Board Assembly",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.REQUEST_SENSOR_TEMP_SET:
|
||||
sensor_set_sid = make_sid(TCS_CONTROLLER, SetIds.PRIMARY_SENSORS)
|
||||
q.add_log_cmd(Info.REQUEST_SENSOR_TEMP_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
||||
pack_tcs_ass_cmds(q, op_code)
|
||||
|
||||
|
||||
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=Info.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
if op_code in OpCodes.TCS_BOARD_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Modes.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=Info.TCS_BOARD_ASS_OFF,
|
||||
)
|
@ -1,29 +0,0 @@
|
||||
from datetime import datetime
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
SET_CURRENT_TIME = ["0", "set-curr-time"]
|
||||
|
||||
|
||||
class Info:
|
||||
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.TIME.value)
|
||||
def pack_set_current_time_ascii_command(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||||
current_time_ascii = time_test_current_time.encode("ascii")
|
||||
LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
|
||||
q.add_log_cmd(Info.SET_CURRENT_TIME)
|
||||
q.add_pus_tc(PusTelecommand(service=9, subservice=128, app_data=current_time_ascii))
|
@ -1,16 +1,16 @@
|
||||
import struct
|
||||
from eive_tmtc.config.object_ids import *
|
||||
from eive_tmtc.tmtc.acs.imtq import ImtqActionIds
|
||||
from eive_tmtc.tmtc.acs.imtq import ImtqActionId
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import PlocReplyIds
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionIds
|
||||
from eive_tmtc.pus_tc.devs.star_tracker import StarTrackerActionIds
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
|
||||
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tm import Service8FsfwTm
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_action_reply(
|
||||
@ -19,7 +19,9 @@ def handle_action_reply(
|
||||
"""Core Action reply handler
|
||||
:return:
|
||||
"""
|
||||
tm_packet = Service8FsfwTm.unpack(raw_telemetry=raw_tm)
|
||||
tm_packet = Service8FsfwTm.unpack(
|
||||
raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||
object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
|
||||
pw = PrintWrapper(printer)
|
||||
@ -52,7 +54,7 @@ def handle_action_reply(
|
||||
def handle_imtq_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
if action_id == struct.unpack("!I", ImtqActionIds.get_commanded_dipole)[0]:
|
||||
if action_id == struct.unpack("!I", ImtqActionId.get_commanded_dipole)[0]:
|
||||
header_list = [
|
||||
"Commanded X-Dipole",
|
||||
"Commanded Y-Dipole",
|
||||
@ -99,14 +101,14 @@ def handle_ploc_replies(
|
||||
def handle_supervisor_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
if action_id == SupvActionIds.DUMP_MRAM:
|
||||
if action_id == SupvActionId.DUMP_MRAM:
|
||||
header_list = ["MRAM Dump"]
|
||||
content_list = [custom_data[: len(custom_data)]]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
elif action_id == SupvActionIds.READ_GPIO:
|
||||
elif action_id == SupvActionId.READ_GPIO:
|
||||
header_list = ["GPIO state"]
|
||||
content_list = [struct.unpack("!H", custom_data[:2])[0]]
|
||||
print(header_list)
|
||||
@ -118,9 +120,9 @@ def handle_supervisor_replies(
|
||||
def handle_startracker_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
if action_id == StarTrackerActionIds.CHECKSUM:
|
||||
if action_id == StarTrackerActionId.CHECKSUM:
|
||||
if len(custom_data) != 5:
|
||||
LOGGER.warning(
|
||||
_LOGGER.warning(
|
||||
"Star tracker reply has invalid length {0}".format(len(custom_data))
|
||||
)
|
||||
return
|
||||
|
@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
@ -9,6 +11,10 @@ class PrintWrapper:
|
||||
print(string)
|
||||
self.printer.file_logger.info(string)
|
||||
|
||||
def ilog(self, logger: logging.Logger, string: str):
|
||||
logger.info(string)
|
||||
self.printer.file_logger.info(string)
|
||||
|
||||
|
||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||
print(string)
|
||||
|
@ -1,66 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxSetIds
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if set_id == BpxSetIds.GET_HK_SET:
|
||||
fmt_str = "!HHHHhhhhIB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
) = struct.unpack(fmt_str, hk_data[0:inc_len])
|
||||
header_list = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause",
|
||||
]
|
||||
content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
]
|
||||
validity_buffer = hk_data[inc_len:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
||||
elif set_id == BpxSetIds.GET_CFG_SET:
|
||||
battheat_mode = hk_data[0]
|
||||
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
||||
battheat_high = struct.unpack("!b", hk_data[2:3])[0]
|
||||
header_list = [
|
||||
"Battery Heater Mode",
|
||||
"Battery Heater Low Limit",
|
||||
"Battery Heater High Limit",
|
||||
]
|
||||
content_list = [battheat_mode, battheat_low, battheat_high]
|
||||
validity_buffer = hk_data[3:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
@ -1,39 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
current_idx = 0
|
||||
fmt_str = "!ddddBBBHBBBBBI"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
lat,
|
||||
long,
|
||||
alt,
|
||||
speed,
|
||||
fix,
|
||||
sats_in_use,
|
||||
sats_in_view,
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
unix_seconds,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
date_string = f"{day}.{month}.{year} {hours}:{minutes}:{seconds}"
|
||||
pw.dlog(f"Lat: {lat} deg")
|
||||
pw.dlog(f"Long: {long} deg")
|
||||
pw.dlog(f"Altitude: {alt} m | Speed: {speed} m/s")
|
||||
pw.dlog(
|
||||
f"Fix Type: {fix} | Sats in View {sats_in_view} | Sats in Use {sats_in_use}"
|
||||
)
|
||||
pw.dlog(f"GNSS Date: {date_string}")
|
||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=14)
|
@ -1,75 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetIds, AdisGyroSetIds
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
|
||||
def handle_gyros_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if object_id.as_bytes in [
|
||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||
]:
|
||||
handle_adis_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif object_id.as_bytes in [
|
||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||
]:
|
||||
handle_l3g_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
|
||||
|
||||
def handle_adis_gyro_hk(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == AdisGyroSetIds.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ddddddf"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(angVelocX, angVelocY, angVelocZ, accelX, accelY, accelZ, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received ADIS1650X Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Acceleration (m/s^2): X {accelX} | Y {accelY} | Z {accelZ}")
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
if set_id == AdisGyroSetIds.CFG_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!HBHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(diag_stat_reg, filter_setting, msc_ctrl_reg, dec_rate_reg) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Diagnostic Status Register {diag_stat_reg:#018b}")
|
||||
pw.dlog(f"Filter Settings {filter_setting:#010b}")
|
||||
pw.dlog(f"Miscellaneous Control Register {msc_ctrl_reg:#018b}")
|
||||
pw.dlog(f"Decimation Rate {dec_rate_reg:#06x}")
|
||||
|
||||
|
||||
def handle_l3g_gyro_hk(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == L3gGyroSetIds.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(angVelocX, angVelocY, angVelocZ, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received L3GD20H Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} °C")
|
@ -1,54 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetIds, MgmLis3SetIds
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
|
||||
def handle_mgm_hk_data(
|
||||
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,
|
||||
]:
|
||||
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,
|
||||
]:
|
||||
handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data)
|
||||
pass
|
||||
|
||||
|
||||
def handle_mgm_lis3_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == MgmLis3SetIds.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(field_x, field_y, field_z, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received MGM LIS3 from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
|
||||
|
||||
def handle_mgm_rm3100_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == MgmRm3100SetIds.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = f"!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(field_x, field_y, field_z) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
pw.dlog(f"Received MGM LIS3 from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
|
||||
)
|
@ -1,52 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tc.devs.plpcdu import SetIds
|
||||
|
||||
|
||||
ADC_CHANNELS_NAMED = [
|
||||
"U BAT DIV 6",
|
||||
"U NEG V FB",
|
||||
"I HPA",
|
||||
"U HPA DIV 6",
|
||||
"I MPA",
|
||||
"U MPA DIV 6",
|
||||
"I TX",
|
||||
"U TX DIV 6",
|
||||
"I X8",
|
||||
"U X8 DIV 6",
|
||||
"I DRO",
|
||||
"U DRO DIV 6",
|
||||
]
|
||||
|
||||
|
||||
def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetIds.ADC:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received PL PCDU ADC HK data")
|
||||
channels = []
|
||||
ch_print = "Channels Raw (hex): ["
|
||||
for i in range(12):
|
||||
channels.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
if i < 11:
|
||||
ch_print += f"{channels[i]:06x},"
|
||||
else:
|
||||
ch_print += f"{channels[i]:06x}]"
|
||||
current_idx += 2
|
||||
processed_vals = []
|
||||
for i in range(12):
|
||||
processed_vals.append(
|
||||
struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
temp = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(ch_print)
|
||||
for i in range(12):
|
||||
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=3)
|
@ -1,24 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import SetIds
|
||||
|
||||
|
||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetIds.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received Radiation Sensor HK data")
|
||||
fmt_str = "!fHHHHHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in ain_dict.items():
|
||||
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||
current_idx += inc_len
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
@ -1,67 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.devs.syrlinks_hk_handler import SetIds
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
def handle_syrlinks_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetIds.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(printer, hk_data)
|
||||
elif set_id == SetIds.TX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_tx_registers_dataset(printer, hk_data)
|
||||
else:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
header_list = [
|
||||
"RX Status",
|
||||
"RX Sensitivity",
|
||||
"RX Frequency Shift",
|
||||
"RX IQ Power",
|
||||
"RX AGC Value",
|
||||
"RX Demod Eb",
|
||||
"RX Demod N0",
|
||||
"RX Datarate",
|
||||
]
|
||||
rx_status = hk_data[0]
|
||||
rx_sensitivity = struct.unpack("!I", hk_data[1:5])
|
||||
rx_frequency_shift = struct.unpack("!I", hk_data[5:9])
|
||||
rx_iq_power = struct.unpack("!H", hk_data[9:11])
|
||||
rx_agc_value = struct.unpack("!H", hk_data[11:13])
|
||||
rx_demod_eb = struct.unpack("!I", hk_data[13:17])
|
||||
rx_demod_n0 = struct.unpack("!I", hk_data[17:21])
|
||||
rx_data_rate = hk_data[21]
|
||||
content_list = [
|
||||
rx_status,
|
||||
rx_sensitivity,
|
||||
rx_frequency_shift,
|
||||
rx_iq_power,
|
||||
rx_agc_value,
|
||||
rx_demod_eb,
|
||||
rx_demod_n0,
|
||||
rx_data_rate,
|
||||
]
|
||||
validity_buffer = hk_data[22:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
||||
|
||||
|
||||
def handle_syrlinks_tx_registers_dataset(
|
||||
printer: FsfwTmTcPrinter,
|
||||
hk_data: bytes,
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
header_list = ["TX Status", "TX Waveform", "TX AGC value"]
|
||||
tx_status = hk_data[0]
|
||||
tx_waveform = hk_data[1]
|
||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])
|
||||
content_list = [tx_status, tx_waveform, tx_agc_value]
|
||||
validity_buffer = hk_data[4:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=3)
|
@ -1,101 +1,124 @@
|
||||
import logging
|
||||
import os.path
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
import struct
|
||||
import sys
|
||||
|
||||
from eive_tmtc.config.events import get_event_dict
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tm.verification_handler import generic_retval_printout
|
||||
from eive_tmtc.tmtc.acs.acs_subsystem import AcsModes
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth
|
||||
|
||||
from tmtccmd.tm import Service5Tm
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw import parse_fsfw_events_csv, EventDictT, EventInfo
|
||||
from tmtccmd.fsfw import EventInfo
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
DEFAULT_EVENTS_CSV_PATH = "config/events.csv"
|
||||
__EVENT_DICT = None
|
||||
|
||||
|
||||
def get_event_dict() -> EventDictT:
|
||||
global __EVENT_DICT
|
||||
if __EVENT_DICT is None:
|
||||
if os.path.exists(DEFAULT_EVENTS_CSV_PATH):
|
||||
__EVENT_DICT = parse_fsfw_events_csv(DEFAULT_EVENTS_CSV_PATH)
|
||||
else:
|
||||
LOGGER.warning(f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}")
|
||||
__EVENT_DICT = dict()
|
||||
return __EVENT_DICT
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
tm = Service5Tm.unpack(raw_telemetry=raw_tm)
|
||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
event_dict = get_event_dict()
|
||||
info = event_dict.get(tm.event_id)
|
||||
event_def = tm.event_definition
|
||||
info = event_dict.get(event_def.event_id)
|
||||
if info is None:
|
||||
LOGGER.warning(f"Event ID {tm.event_id} has no information")
|
||||
_LOGGER.warning(f"Event ID {event_def.event_id} has no information")
|
||||
info = EventInfo()
|
||||
info.name = "Unknown event"
|
||||
obj_ids = get_object_ids()
|
||||
obj_id_obj = obj_ids.get(tm.reporter_id.as_bytes)
|
||||
obj_id_obj = obj_ids.get(event_def.reporter_id)
|
||||
if obj_id_obj is None:
|
||||
LOGGER.warning(f"Object ID 0x{tm.reporter_id.as_hex_string} has no name")
|
||||
obj_name = tm.reporter_id.as_hex_string
|
||||
_LOGGER.warning(f"Object ID 0x{event_def.reporter_id.hex(sep=',')} has no name")
|
||||
obj_name = event_def.reporter_id.hex(sep=",")
|
||||
else:
|
||||
obj_name = obj_id_obj.name
|
||||
generic_event_string = (
|
||||
f"Object {obj_name} generated Event {tm.event_id} | {info.name}"
|
||||
)
|
||||
generic_event_string = f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x}) at {tm.time_provider.as_date_time()}"
|
||||
_LOGGER.info(generic_event_string)
|
||||
pw.printer.file_logger.info(
|
||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
)
|
||||
LOGGER.info(generic_event_string)
|
||||
specific_handler = True
|
||||
specific_handler = False
|
||||
if info.name == "MODE_TRANSITION_FAILED":
|
||||
reason = generic_retval_printout(tm.param_1)
|
||||
reason = generic_retval_printout(event_def.param1)
|
||||
for string in reason:
|
||||
pw.dlog(f"Reason from event parameter 1: {string}")
|
||||
pw.dlog(f"Mode, sequence or table: {tm.param_2:#08x}")
|
||||
pw.dlog(f"Mode, sequence or table: {event_def.param2:#08x}")
|
||||
specific_handler = True
|
||||
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
||||
additional_event_info = f"Additional info: {info.info}"
|
||||
context = (
|
||||
f"Progress Percent: {tm.param_1 >> 24 & 0xff} | Sequence Count: {tm.param_1 & 0xffff} "
|
||||
f"| Bytes Written: {tm.param_2}"
|
||||
f"Progress Percent: {event_def.param1 >> 24 & 0xff} | Sequence Count: {event_def.param1 & 0xffff} "
|
||||
f"| Bytes Written: {event_def.param2}"
|
||||
)
|
||||
pw.dlog(additional_event_info)
|
||||
pw.dlog(context)
|
||||
specific_handler = True
|
||||
if info.name == "MODE_INFO":
|
||||
specific_handler = True
|
||||
mode_name = "Unknown"
|
||||
if obj_name == "ACS_SUBSYSTEM":
|
||||
if tm.param_1 == Modes.OFF:
|
||||
mode_name = "Off"
|
||||
elif tm.param_1 == AcsModes.IDLE:
|
||||
mode_name = "Idle"
|
||||
elif tm.param_1 == AcsModes.DETUMBLE:
|
||||
mode_name = "Detumble"
|
||||
elif tm.param_1 == AcsModes.SAFE:
|
||||
mode_name = "Safe"
|
||||
elif tm.param_1 == AcsModes.TARGET_PT:
|
||||
mode_name = "Target Pointing"
|
||||
acs_mode = AcsMode(event_def.param1)
|
||||
pw.dlog(f"ACS Mode: {acs_mode!r}")
|
||||
elif obj_name == "ACS_CONTROLLER_ID":
|
||||
mode_name = Mode(event_def.param1)
|
||||
submode = AcsMode(event_def.param2)
|
||||
pw.dlog(f"Mode: {mode_name!r}")
|
||||
pw.dlog(f"ACS Mode: {submode!r}")
|
||||
else:
|
||||
if tm.param_1 == Modes.OFF:
|
||||
if event_def.param1 == Mode.OFF:
|
||||
mode_name = "Off"
|
||||
elif tm.param_1 == Modes.ON:
|
||||
elif event_def.param1 == Mode.ON:
|
||||
mode_name = "On"
|
||||
elif tm.param_1 == Modes.NORMAL:
|
||||
elif event_def.param1 == Mode.NORMAL:
|
||||
mode_name = "Normal"
|
||||
elif tm.param_1 == Modes.RAW:
|
||||
elif event_def.param1 == Mode.RAW:
|
||||
mode_name = "Raw"
|
||||
pw.dlog(f"Mode Number {tm.param_1}, Mode Name {mode_name}")
|
||||
pw.dlog(f"Submode: {tm.param_2}")
|
||||
else:
|
||||
specific_handler = False
|
||||
if info.info != "":
|
||||
additional_event_info = (
|
||||
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
||||
pw.dlog(
|
||||
f"Mode Number {event_def.param1}, Mode Name {mode_name}, Submode: {event_def.param2}"
|
||||
)
|
||||
pw.dlog(additional_event_info)
|
||||
if info.name == "VERSION_INFO":
|
||||
specific_handler = True
|
||||
ver_major = (event_def.param1 >> 24) & 0xFF
|
||||
ver_minor = (event_def.param1 >> 16) & 0xFF
|
||||
ver_rev = (event_def.param1 >> 8) & 0xFF
|
||||
has_git_sha = bool(event_def.param1 & 0xFF)
|
||||
git_sha = ""
|
||||
if has_git_sha:
|
||||
p2_as_bytes = event_def.param2.to_bytes(4, sys.byteorder)
|
||||
git_sha = p2_as_bytes.decode("ascii")
|
||||
version_string = f"v{ver_major}.{ver_minor}.{ver_rev}"
|
||||
pw.dlog(f"Version {version_string}")
|
||||
if has_git_sha:
|
||||
pw.dlog(f"Git SHA first four letters: {git_sha}")
|
||||
if info.name == "CLOCK_SET":
|
||||
specific_handler = True
|
||||
old_time = event_def.param1
|
||||
new_time = event_def.param2
|
||||
old_time_dt = datetime.datetime.fromtimestamp(old_time, datetime.timezone.utc)
|
||||
new_time_dt = datetime.datetime.fromtimestamp(new_time, datetime.timezone.utc)
|
||||
pw.dlog(f"Old time (UTC): {old_time_dt}")
|
||||
pw.dlog(f"New time (UTC): {new_time_dt}")
|
||||
if info.name == "CLOCK_DUMP":
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond milliseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Current time: {time_dt}")
|
||||
if info.name == "HEALTH_INFO":
|
||||
specific_handler = True
|
||||
health = FsfwHealth(event_def.param1)
|
||||
pw.dlog(f"{obj_name}: {health!r}")
|
||||
if info.name == "CHANGING_MODE":
|
||||
mode = event_def.param1
|
||||
submode = event_def.param2
|
||||
pw.dlog(f"Mode Number {mode}, Submode: {submode}")
|
||||
if not specific_handler:
|
||||
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||
additional_event_info = f"Additional info: {info.info} | P1: {event_def.param1} | P2: {event_def.param2}"
|
||||
pw.dlog(additional_event_info)
|
||||
if not specific_handler:
|
||||
# printer.handle_long_tm_print(packet_if=tm.pus_tm, info_if=tm.pus_tm)
|
||||
pass
|
||||
|
@ -1,14 +1,18 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
import logging
|
||||
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||
from spacepackets.util import PrintFormats
|
||||
from tmtccmd import get_console_logger
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.tm import Service20FsfwTm, Service200FsfwTm
|
||||
from tmtccmd.tm.pus_200_fsfw_modes import Subservices as ModeSubservices
|
||||
from tmtccmd.tm.pus_20_fsfw_param import Service20ParamDumpWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||
from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from .defs import PrintWrapper
|
||||
|
||||
@ -17,7 +21,7 @@ from .verification_handler import handle_service_1_fsfw_packet, generic_retval_p
|
||||
from .hk_handling import handle_hk_packet
|
||||
from .action_reply_handler import handle_action_reply
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pus_factory_hook(
|
||||
@ -27,13 +31,13 @@ def pus_factory_hook(
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
):
|
||||
if len(packet) < 8:
|
||||
LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
tm_packet = PusTelemetry.unpack(packet)
|
||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
||||
except ValueError:
|
||||
LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
service = tm_packet.service
|
||||
obj_id_dict = get_object_ids()
|
||||
@ -48,16 +52,49 @@ def pus_factory_hook(
|
||||
elif service == 8:
|
||||
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
||||
elif service == 17:
|
||||
tm_packet = Service17Tm.unpack(raw_telemetry=packet)
|
||||
tm_packet = Service17Tm.unpack(
|
||||
data=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == 2:
|
||||
verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
tm_packet = Service20FsfwTm.unpack(raw_telemetry=packet)
|
||||
dedicated_handler = False
|
||||
param_packet = Service20FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ParamSubservice.TM_DUMP_REPLY:
|
||||
param_wrapper = Service20ParamDumpWrapper(param_tm=param_packet)
|
||||
try:
|
||||
param = param_wrapper.get_param()
|
||||
obj = obj_id_dict.get(param_wrapper.param_tm.object_id)
|
||||
pw.dlog(f"Received parameter dump TM from {obj}")
|
||||
pw.dlog(f"Parameter: {param}")
|
||||
if param.rows == 1 and param.columns == 1:
|
||||
try:
|
||||
scalar_param = param.parse_scalar_param()
|
||||
if isinstance(scalar_param, int):
|
||||
pw.dlog(f"Scalar integer parameter: {scalar_param}")
|
||||
elif isinstance(scalar_param, float):
|
||||
pw.dlog(f"Scalar floating point parameter: {scalar_param}")
|
||||
except ValueError as e:
|
||||
pw.dlog("received {e} trying to parse scalar parameter")
|
||||
else:
|
||||
# TODO: Could improve display further by actually displaying a matrix as a
|
||||
# matrix using row and column information
|
||||
pw.dlog(
|
||||
f"Received vector or matrix data: {param.param_raw.hex(sep=',')}"
|
||||
)
|
||||
except ValueError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
except NotImplementedError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
else:
|
||||
pw.dlog(f"unknown subservice {tm_packet.subservice} for parameter service")
|
||||
elif service == 200:
|
||||
tm_packet = Service200FsfwTm.unpack(raw_telemetry=packet)
|
||||
if tm_packet.subservice == ModeSubservices.TM_CANT_REACH_MODE:
|
||||
tm_packet = Service200FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
|
||||
obj_id = tm_packet.object_id
|
||||
obj_id_obj = obj_id_dict.get(obj_id)
|
||||
retval = tm_packet.return_value
|
||||
@ -69,7 +106,7 @@ def pus_factory_hook(
|
||||
else:
|
||||
dedicated_handler = False
|
||||
else:
|
||||
LOGGER.info(f"The service {service} is not implemented in Telemetry Factory")
|
||||
_LOGGER.info(f"The service {service} is not implemented in Telemetry Factory")
|
||||
tm_packet.print_source_data(PrintFormats.HEX)
|
||||
dedicated_handler = True
|
||||
if not dedicated_handler and tm_packet is not None:
|
||||
|
@ -1,43 +1,46 @@
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
import logging
|
||||
|
||||
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_mgm_data
|
||||
from eive_tmtc.pus_tm.devs.plpcdu import handle_plpcdu_hk
|
||||
from eive_tmtc.pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
||||
from eive_tmtc.pus_tm.devs.sus import handle_sus_hk
|
||||
from eive_tmtc.pus_tm.system.tcs import handle_thermal_controller_hk_data
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_raw_mgm_data, handle_acs_ctrl_hk_data
|
||||
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import handle_rad_sensor_data
|
||||
from eive_tmtc.tmtc.acs.sus import handle_sus_hk
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
|
||||
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
|
||||
from tmtccmd.tm.pus_3_fsfw_hk import (
|
||||
Service3Base,
|
||||
HkContentType,
|
||||
Service3FsfwTm,
|
||||
)
|
||||
from tmtccmd.util.obj_id import ObjectIdU32, ObjectIdDictT
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
from eive_tmtc.pus_tm.devs.bpx_bat import handle_bpx_hk_data
|
||||
from eive_tmtc.pus_tm.devs.gps import handle_gps_data
|
||||
from eive_tmtc.pus_tm.devs.gyros import handle_gyros_hk_data
|
||||
from eive_tmtc.tmtc.power.bpx_batt import handle_bpx_hk_data
|
||||
from eive_tmtc.tmtc.acs.gps import handle_gps_data
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyros_hk_data
|
||||
from eive_tmtc.tmtc.power.tm import (
|
||||
handle_pdu_data,
|
||||
handle_p60_hk_data,
|
||||
handle_acu_hk_data,
|
||||
handle_pcdu_hk,
|
||||
)
|
||||
from eive_tmtc.pus_tm.devs.syrlinks import handle_syrlinks_hk_data
|
||||
from eive_tmtc.tmtc.acs.imtq import (
|
||||
ImtqSetIds,
|
||||
ImtqSetId,
|
||||
handle_self_test_data,
|
||||
handle_eng_set,
|
||||
handle_calibrated_mtm_measurement,
|
||||
handle_raw_mtm_measurement,
|
||||
handle_imtq_hk,
|
||||
)
|
||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tm.system.core import handle_core_hk_data
|
||||
from eive_tmtc.pus_tm.devs.mgms import handle_mgm_hk_data
|
||||
from eive_tmtc.tmtc.core import handle_core_hk_data
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_hk_data
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
FORWARD_SENSOR_TEMPS = False
|
||||
@ -74,11 +77,11 @@ def handle_hk_packet(
|
||||
hk_data=hk_data,
|
||||
)
|
||||
except ValueError as e:
|
||||
LOGGER.exception(
|
||||
_LOGGER.exception(
|
||||
f"{e} error when parsing HK data coming from {named_obj_id}"
|
||||
)
|
||||
if tm_packet.subservice == 10 or tm_packet.subservice == 12:
|
||||
LOGGER.warning("HK definitions printout not implemented yet")
|
||||
_LOGGER.warning("HK definitions printout not implemented yet")
|
||||
|
||||
|
||||
def handle_regular_hk_print(
|
||||
@ -91,26 +94,17 @@ def handle_regular_hk_print(
|
||||
set_id = hk_packet.set_id
|
||||
"""This function is called when a Service 3 Housekeeping packet is received."""
|
||||
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||
handle_rw_hk_data(printer, object_id, set_id, hk_data)
|
||||
return handle_rw_hk_data(printer, object_id, set_id, hk_data)
|
||||
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
||||
handle_syrlinks_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
return handle_syrlinks_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
||||
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (
|
||||
set_id <= ImtqSetIds.NEGATIVE_Z_TEST
|
||||
):
|
||||
return handle_self_test_data(printer, hk_data)
|
||||
elif set_id == ImtqSetIds.ENG_HK_SET:
|
||||
return handle_eng_set(printer, hk_data)
|
||||
elif set_id == ImtqSetIds.CAL_MTM_SET:
|
||||
return handle_calibrated_mtm_measurement(printer, hk_data)
|
||||
elif set_id == ImtqSetIds.RAW_MTM_SET:
|
||||
return handle_raw_mtm_measurement(printer, hk_data)
|
||||
else:
|
||||
LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id")
|
||||
return handle_imtq_hk(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.GPS_CONTROLLER:
|
||||
return handle_gps_data(printer=printer, hk_data=hk_data)
|
||||
elif objb == obj_ids.PCDU_HANDLER_ID:
|
||||
return handle_pcdu_hk(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||
elif objb == obj_ids.BPX_HANDLER_ID:
|
||||
handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
|
||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
|
||||
elif objb == obj_ids.CORE_CONTROLLER_ID:
|
||||
return handle_core_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.PDU_1_HANDLER_ID:
|
||||
@ -143,18 +137,18 @@ def handle_regular_hk_print(
|
||||
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
||||
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
||||
]:
|
||||
handle_sus_hk(
|
||||
return handle_sus_hk(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
)
|
||||
elif objb == obj_ids.P60_DOCK_HANDLER:
|
||||
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||
return handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||
elif objb in [
|
||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||
]:
|
||||
handle_gyros_hk_data(
|
||||
return handle_gyros_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
)
|
||||
elif objb in [
|
||||
@ -163,21 +157,23 @@ def handle_regular_hk_print(
|
||||
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||
]:
|
||||
handle_mgm_hk_data(
|
||||
return handle_mgm_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
)
|
||||
elif objb == obj_ids.PL_PCDU_ID:
|
||||
handle_plpcdu_hk(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
return handle_plpcdu_hk(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.THERMAL_CONTROLLER_ID:
|
||||
handle_thermal_controller_hk_data(
|
||||
return handle_thermal_controller_hk_data(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif objb == obj_ids.STAR_TRACKER_ID:
|
||||
return handle_str_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||
handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.ACS_CONTROLLER:
|
||||
handle_acs_ctrl_mgm_data(printer, hk_data)
|
||||
return handle_acs_ctrl_hk_data(printer, set_id, hk_data)
|
||||
else:
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
||||
f"has not been implemented."
|
||||
)
|
||||
|
@ -1,21 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.system.core import SetIds
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetIds.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temperature, ps_voltage, pl_voltage) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
printout = (
|
||||
f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | "
|
||||
f"PL Voltage [mV] {pl_voltage}"
|
||||
)
|
||||
pw.dlog(printout)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
|
@ -1,12 +1,13 @@
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
|
||||
from spacepackets.ccsds import CdsShortTimestamp
|
||||
from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.tm.pus_1_verification import Service1FsfwWrapper
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
@ -15,15 +16,17 @@ def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
"Console logger or file logger not valid. Please set a valid one"
|
||||
)
|
||||
# Error code with length 2 is FSFW specific
|
||||
tm_packet = Service1Tm.unpack(data=raw_tm, params=UnpackParams(1, 2))
|
||||
tm_packet = Service1Tm.unpack(
|
||||
data=raw_tm, params=UnpackParams(CdsShortTimestamp.empty(), 1, 2)
|
||||
)
|
||||
fsfw_wrapper = Service1FsfwWrapper(tm_packet)
|
||||
res = wrapper.verificator.add_tm(tm_packet)
|
||||
if res is None:
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Received Verification TM[{tm_packet.service}, {tm_packet.subservice}] "
|
||||
f"with Request ID {tm_packet.tc_req_id.as_u32():#08x}"
|
||||
)
|
||||
LOGGER.warning(f"No matching telecommand found for {tm_packet.tc_req_id}")
|
||||
_LOGGER.warning(f"No matching telecommand found for {tm_packet.tc_req_id}")
|
||||
else:
|
||||
wrapper.log_to_console(tm_packet, res)
|
||||
wrapper.log_to_file(tm_packet, res)
|
||||
|
@ -1,2 +1,7 @@
|
||||
from .payload.pl_subsystem import add_payload_subsystem_cmds
|
||||
from .payload.subsystem import add_payload_subsystem_cmds
|
||||
from .solar_array_deployment import add_sa_depl_cmds
|
||||
from .test import add_test_defs
|
||||
from .time import add_time_cmds
|
||||
from .health import add_health_cmd_defs
|
||||
from .system import add_system_cmd_defs
|
||||
from .tm_store import add_persistent_tm_store_cmd_defs
|
||||
|
@ -0,0 +1 @@
|
||||
from .gyros import add_gyr_cmd_defs
|
||||
|
@ -6,9 +6,9 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
@ -24,74 +24,78 @@ class AcsOpCodes:
|
||||
ACS_ASS_DUAL_ON = ["6", "do"]
|
||||
|
||||
|
||||
class DualSideSubmodes(enum.IntEnum):
|
||||
class DualSideSubmode(enum.IntEnum):
|
||||
A_SIDE = 0
|
||||
B_SIDE = 1
|
||||
DUAL_SIDE = 2
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_BRD_ASS)
|
||||
def pack_acs_command(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.A_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.A_SIDE,
|
||||
q=q,
|
||||
info="Switching to ACS board assembly A side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.B_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.B_SIDE,
|
||||
q=q,
|
||||
info="Switching to ACS board assembly B side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.DUAL_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.DUAL_SIDE,
|
||||
q=q,
|
||||
info="Switching to ACS board assembly dual mode",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.ON,
|
||||
submode=DualSideSubmodes.A_SIDE,
|
||||
mode=Mode.ON,
|
||||
submode=DualSideSubmode.A_SIDE,
|
||||
q=q,
|
||||
info="Switching ACS board assembly A side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.ON,
|
||||
submode=DualSideSubmodes.B_SIDE,
|
||||
mode=Mode.ON,
|
||||
submode=DualSideSubmode.B_SIDE,
|
||||
q=q,
|
||||
info="Switching ACS board assembly B side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.ON,
|
||||
submode=DualSideSubmodes.B_SIDE,
|
||||
mode=Mode.ON,
|
||||
submode=DualSideSubmode.B_SIDE,
|
||||
q=q,
|
||||
info="Switching ACS board assembly dual side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Modes.OFF,
|
||||
mode=Mode.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info="Switching to ACS board assembly off",
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_BRD_ASS)
|
||||
def pack_acs_command_provider(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
pack_acs_command(q, op_code)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_acs_board_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
File diff suppressed because it is too large
Load Diff
16
eive_tmtc/tmtc/acs/defs.py
Normal file
16
eive_tmtc/tmtc/acs/defs.py
Normal file
@ -0,0 +1,16 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AcsMode(enum.IntEnum):
|
||||
OFF = 0
|
||||
SAFE = 10
|
||||
IDLE = 11
|
||||
PTG_NADIR = 12
|
||||
PTG_TARGET = 13
|
||||
PTG_TARGET_GS = 14
|
||||
PTG_INERTIAL = 15
|
||||
|
||||
|
||||
class SafeSubmode(enum.IntEnum):
|
||||
DEFAULT = 0
|
||||
DETUMBLE = 1
|
113
eive_tmtc/tmtc/acs/gps.py
Normal file
113
eive_tmtc/tmtc/acs/gps.py
Normal file
@ -0,0 +1,113 @@
|
||||
import datetime
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
create_request_one_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval,
|
||||
create_disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
REQ_OS_HK = ["hk"]
|
||||
ENABLE_HK = ["enable_hk"]
|
||||
DISABLE_HK = ["disable_hk"]
|
||||
RESET_GNSS = ["reset"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQ_OS_HK = "Request One-Shot HK"
|
||||
ENABLE_HK = "Enable HK"
|
||||
DISABLE_HK = "Disable HK"
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetId:
|
||||
HK = 0
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
oce.add(keys=OpCode.ENABLE_HK, info=Info.ENABLE_HK)
|
||||
oce.add(keys=OpCode.DISABLE_HK, info=Info.DISABLE_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
sid = make_sid(object_id=object_id, set_id=SetId.HK)
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCode.ENABLE_HK:
|
||||
interval = float(input("Please specify interval in floating point seconds: "))
|
||||
if interval <= 0:
|
||||
raise ValueError("invalid interval")
|
||||
q.add_log_cmd(f"GPS: {Info.ENABLE_HK}")
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=False, sid=sid, interval_seconds=interval
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK:
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_HK}")
|
||||
q.add_pus_tc(create_disable_periodic_hk_command(diag=False, sid=sid))
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GPS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(create_request_one_hk_command(sid=sid))
|
||||
|
||||
|
||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
current_idx = 0
|
||||
fmt_str = "!ddddBBBHBBBBBI"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
lat,
|
||||
long,
|
||||
alt,
|
||||
speed,
|
||||
fix,
|
||||
sats_in_use,
|
||||
sats_in_view,
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
unix_seconds,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
if year == 0:
|
||||
date_string = "No date string, year is 0"
|
||||
else:
|
||||
date_string = datetime.datetime(
|
||||
year=year, month=month, day=day, hour=hours, minute=minutes, second=seconds
|
||||
)
|
||||
pw.dlog(f"Lat: {lat} deg")
|
||||
pw.dlog(f"Long: {long} deg")
|
||||
pw.dlog(f"Altitude: {alt} m | Speed: {speed} m/s")
|
||||
pw.dlog(
|
||||
f"Fix Type: {fix} | Sats in View {sats_in_view} | Sats in Use {sats_in_use}"
|
||||
)
|
||||
pw.dlog(f"GNSS Date: {date_string}")
|
||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=14)
|
196
eive_tmtc/tmtc/acs/gyros.py
Normal file
196
eive_tmtc/tmtc/acs/gyros.py
Normal file
@ -0,0 +1,196 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_201_fsfw_health import pack_set_health_cmd_data, FsfwHealth
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_hk_command, make_sid
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from eive_tmtc.config.object_ids import (
|
||||
GYRO_0_ADIS_HANDLER_ID,
|
||||
GYRO_1_L3G_HANDLER_ID,
|
||||
GYRO_2_ADIS_HANDLER_ID,
|
||||
GYRO_3_L3G_HANDLER_ID,
|
||||
)
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCode:
|
||||
NML = "normal"
|
||||
OFF = "off"
|
||||
CORE_HK = "core_hk"
|
||||
CFG_HK = "cfg_hk"
|
||||
SET_FAULTY = "set_faulty"
|
||||
|
||||
|
||||
class AdisGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class GyrSel(enum.IntEnum):
|
||||
GYR_0_ADIS = 0
|
||||
GYR_1_L3G = 1
|
||||
GYR_2_ADIS = 2
|
||||
GYR_3_L3G = 3
|
||||
|
||||
|
||||
GYR_SEL_DICT = {
|
||||
GyrSel.GYR_0_ADIS: ("GYRO_0_ADIS", GYRO_0_ADIS_HANDLER_ID),
|
||||
GyrSel.GYR_1_L3G: ("GYRO_1_L3G", GYRO_1_L3G_HANDLER_ID),
|
||||
GyrSel.GYR_2_ADIS: ("GYRO_2_ADIS", GYRO_2_ADIS_HANDLER_ID),
|
||||
GyrSel.GYR_3_L3G: ("GYRO_3_L3G", GYRO_3_L3G_HANDLER_ID),
|
||||
}
|
||||
|
||||
|
||||
def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
print("Please select the Gyro Device")
|
||||
for (k, v) in GYR_SEL_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
sel_idx = int(input("Select gyro device by index: "))
|
||||
gyr_info = GYR_SEL_DICT[GyrSel(sel_idx)]
|
||||
gyr_obj_id = gyr_info[1]
|
||||
is_adis = False
|
||||
if sel_idx == GyrSel.GYR_0_ADIS or sel_idx == GyrSel.GYR_2_ADIS:
|
||||
is_adis = True
|
||||
core_hk_id = AdisGyroSetId.CORE_HK
|
||||
else:
|
||||
core_hk_id = L3gGyroSetId.CORE_HK
|
||||
if op_code == OpCode.NML:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} NORMAL mode")
|
||||
q.add_pus_tc(create_mode_command(gyr_obj_id, Mode.NORMAL, 0))
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} OFF mode")
|
||||
q.add_pus_tc(create_mode_command(gyr_obj_id, Mode.OFF, 0))
|
||||
elif op_code == OpCode.CORE_HK:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} Core HK")
|
||||
q.add_pus_tc(create_request_one_hk_command(make_sid(gyr_obj_id, core_hk_id)))
|
||||
elif op_code == OpCode.CFG_HK:
|
||||
if not is_adis:
|
||||
raise ValueError("No config HK for L3 device")
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} CFG HK")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(make_sid(gyr_obj_id, AdisGyroSetId.CFG_HK))
|
||||
)
|
||||
elif op_code == OpCode.SET_FAULTY:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} set faulty")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201,
|
||||
subservice=Subservice.TC_SET_HEALTH,
|
||||
app_data=pack_set_health_cmd_data(
|
||||
object_id=gyr_obj_id, health=FsfwHealth.FAULTY
|
||||
),
|
||||
)
|
||||
)
|
||||
else:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid op code {op_code} for gyro command"
|
||||
)
|
||||
|
||||
|
||||
def handle_gyros_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if object_id.as_bytes in [
|
||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||
]:
|
||||
handle_adis_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif object_id.as_bytes in [
|
||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||
]:
|
||||
handle_l3g_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
|
||||
|
||||
def handle_adis_gyro_hk(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == AdisGyroSetId.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ddddddf"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
ang_veloc_x,
|
||||
ang_veloc_y,
|
||||
ang_veloc_z,
|
||||
accel_x,
|
||||
accel_y,
|
||||
accel_z,
|
||||
temp,
|
||||
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
pw.dlog(f"Received ADIS1650X Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {ang_veloc_x} | "
|
||||
f"Y {ang_veloc_y} | Z {ang_veloc_z}"
|
||||
)
|
||||
pw.dlog(f"Acceleration (m/s^2): X {accel_x} | Y {accel_y} | Z {accel_z}")
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
if set_id == AdisGyroSetId.CFG_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!HBHHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
print(len(hk_data))
|
||||
(
|
||||
diag_stat_reg,
|
||||
filter_setting,
|
||||
range_mdl,
|
||||
msc_ctrl_reg,
|
||||
dec_rate_reg,
|
||||
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
pw.dlog(f"Diagnostic Status Register {diag_stat_reg:#018b}")
|
||||
pw.dlog(f"Range MDL {range_mdl}")
|
||||
pw.dlog(f"Filter Settings {filter_setting:#010b}")
|
||||
pw.dlog(f"Miscellaneous Control Register {msc_ctrl_reg:#018b}")
|
||||
pw.dlog(f"Decimation Rate {dec_rate_reg:#06x}")
|
||||
|
||||
|
||||
def handle_l3g_gyro_hk(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == L3gGyroSetId.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(angVelocX, angVelocY, angVelocZ, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received L3GD20H Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} °C")
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gyr_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.CORE_HK, info="Request Core HK")
|
||||
oce.add(keys=OpCode.CFG_HK, info="Request CFG HK")
|
||||
oce.add(keys=OpCode.NML, info="Normal Mode")
|
||||
oce.add(keys=OpCode.OFF, info="Off Mode")
|
||||
oce.add(keys=OpCode.SET_FAULTY, info="Set Faulty")
|
||||
defs.add_service(CustomServiceList.GYRO, info="Gyro", op_code_entry=oce)
|
@ -5,7 +5,10 @@
|
||||
@author J. Meier
|
||||
@date 25.03.2021
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
from typing import List
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
@ -20,32 +23,62 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_diag_command,
|
||||
generate_one_hk_command,
|
||||
create_request_one_diag_command,
|
||||
create_enable_periodic_hk_command,
|
||||
create_disable_periodic_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCodes:
|
||||
ON = ["on"]
|
||||
NORMAL = ["normal"]
|
||||
OFF = ["off"]
|
||||
SET_DIPOLE = ["set_dipole"]
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ImtqSetIds:
|
||||
ENG_HK_SET = 1
|
||||
CAL_MTM_SET = 2
|
||||
RAW_MTM_SET = 3
|
||||
POSITIVE_X_TEST = 4
|
||||
NEGATIVE_X_TEST = 5
|
||||
POSITIVE_Y_TEST = 6
|
||||
NEGATIVE_Y_TEST = 7
|
||||
POSITIVE_Z_TEST = 8
|
||||
NEGATIVE_Z_TEST = 9
|
||||
class OpCode:
|
||||
ON = "on"
|
||||
NORMAL = "normal"
|
||||
OFF = "off"
|
||||
SET_DIPOLE = "set_dipole"
|
||||
REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk_no_torque"
|
||||
REQUEST_ENG_HK_WITH_TORQUE = "hk_os_eng_hk_with_torque"
|
||||
REQUEST_MGM_RAW_NO_TORQUE = "hk_os_mgm_raw_no_torque"
|
||||
ENABLE_MGM_RAW_NO_TORQUE = "enb_mgm_raw_no_torque"
|
||||
DISABLE_MGM_RAW_NO_TORQUE = "dis_mgm_raw_no_torque"
|
||||
REQUEST_MGM_RAW_WITH_TORQUE = "hk_os_mgm_raw_with_torque"
|
||||
ENABLE_MGM_RAW_WITH_TORQUE = "enb_mgm_raw_with_torque"
|
||||
DISABLE_MGM_RAW_WITH_TORQUE = "dis_mgm_raw_with_torque"
|
||||
ENABLE_ENG_HK_NO_TORQUE = "enb_eng_hk_no_torque"
|
||||
DISABLE_ENG_HK_NO_TORQUE = "dis_eng_hk_no_torque"
|
||||
ENABLE_ENG_HK_WITH_TORQUE = "enb_eng_hk_with_torque"
|
||||
DISABLE_ENG_HK_WITH_TORQUE = "dis_eng_hk_with_torque"
|
||||
POS_X_SELF_TEST = "self_test_pos_x"
|
||||
NEG_X_SELF_TEST = "self_test_neg_x"
|
||||
POS_Y_SELF_TEST = "self_test_pos_y"
|
||||
NEG_Y_SELF_TEST = "self_test_neg_y"
|
||||
POS_Z_SELF_TEST = "self_test_pos_z"
|
||||
NEG_Z_SELF_TEST = "self_test_neg_z"
|
||||
|
||||
|
||||
class ImtqActionIds:
|
||||
class ImtqSetId(enum.IntEnum):
|
||||
ENG_HK_NO_TORQUE = 1
|
||||
RAW_MTM_NO_TORQUE = 2
|
||||
ENG_HK_SET_WITH_TORQUE = 3
|
||||
RAW_MTM_WITH_TORQUE = 4
|
||||
STATUS_SET = 5
|
||||
DIPOLES = 6
|
||||
|
||||
CAL_MTM_SET = 9
|
||||
POSITIVE_X_TEST = 10
|
||||
NEGATIVE_X_TEST = 11
|
||||
POSITIVE_Y_TEST = 12
|
||||
NEGATIVE_Y_TEST = 13
|
||||
POSITIVE_Z_TEST = 14
|
||||
NEGATIVE_Z_TEST = 15
|
||||
|
||||
|
||||
class ImtqActionId:
|
||||
start_actuation_dipole = bytearray([0x0, 0x0, 0x0, 0x02])
|
||||
get_commanded_dipole = bytearray([0x0, 0x0, 0x0, 0x03])
|
||||
perform_positive_x_test = bytearray([0x0, 0x0, 0x0, 0x07])
|
||||
@ -62,20 +95,37 @@ class ImtqActionIds:
|
||||
@tmtc_definitions_provider
|
||||
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, "Mode Off")
|
||||
oce.add(OpCodes.ON, "Mode On")
|
||||
oce.add(OpCodes.NORMAL, "Mode Normal")
|
||||
oce.add("3", "IMTQ perform pos X self test")
|
||||
oce.add("4", "IMTQ perform neg X self test")
|
||||
oce.add("5", "IMTQ perform pos Y self test")
|
||||
oce.add("6", "IMTQ perform neg Y self test")
|
||||
oce.add("7", "IMTQ perform pos Z self test")
|
||||
oce.add("8", "IMTQ perform neg Z self test")
|
||||
oce.add(OpCodes.SET_DIPOLE, "IMTQ command dipole")
|
||||
oce.add(OpCode.OFF, "Mode Off")
|
||||
oce.add(OpCode.ON, "Mode On")
|
||||
oce.add(OpCode.NORMAL, "Mode Normal")
|
||||
oce.add(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot")
|
||||
oce.add(
|
||||
OpCode.REQUEST_ENG_HK_WITH_TORQUE,
|
||||
"Request Engineering HK One Shot during Torque",
|
||||
)
|
||||
oce.add(OpCode.ENABLE_ENG_HK_NO_TORQUE, "Enable ENG HK not torque")
|
||||
oce.add(OpCode.ENABLE_ENG_HK_WITH_TORQUE, "Enable ENG HK with torque")
|
||||
oce.add(OpCode.DISABLE_ENG_HK_NO_TORQUE, "Disable ENG HK not torque")
|
||||
oce.add(OpCode.DISABLE_ENG_HK_WITH_TORQUE, "Disable ENG HK with torque")
|
||||
oce.add(
|
||||
OpCode.REQUEST_MGM_RAW_NO_TORQUE, "Request MGM Raw Without Torque HK One Shot"
|
||||
)
|
||||
oce.add(OpCode.ENABLE_MGM_RAW_NO_TORQUE, "Enable MGM Raw Without Torque HK")
|
||||
oce.add(OpCode.DISABLE_MGM_RAW_NO_TORQUE, "Disable MGM Raw Without Torque HK")
|
||||
oce.add(
|
||||
OpCode.REQUEST_MGM_RAW_WITH_TORQUE, "Request MGM Raw With Torque HK One Shot"
|
||||
)
|
||||
oce.add(OpCode.ENABLE_MGM_RAW_WITH_TORQUE, "Enable MGM Raw With Torque HK")
|
||||
oce.add(OpCode.DISABLE_MGM_RAW_WITH_TORQUE, "Disable MGM Raw With Torque HK")
|
||||
oce.add(OpCode.POS_X_SELF_TEST, "IMTQ perform pos X self test")
|
||||
oce.add(OpCode.NEG_X_SELF_TEST, "IMTQ perform neg X self test")
|
||||
oce.add(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test")
|
||||
oce.add(OpCode.NEG_Y_SELF_TEST, "IMTQ perform neg Y self test")
|
||||
oce.add(OpCode.POS_Z_SELF_TEST, "IMTQ perform pos Z self test")
|
||||
oce.add(OpCode.NEG_Z_SELF_TEST, "IMTQ perform neg Z self test")
|
||||
oce.add(OpCode.SET_DIPOLE, "IMTQ command dipole")
|
||||
oce.add("10", "IMTQ get commanded dipole")
|
||||
oce.add("11", "IMTQ get engineering hk set")
|
||||
oce.add("12", "IMTQ get calibrated MTM measurement one shot")
|
||||
oce.add("13", "IMTQ get raw MTM measurement one shot")
|
||||
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
|
||||
|
||||
|
||||
@ -84,92 +134,92 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
|
||||
if op_code in OpCodes.OFF:
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd("IMTQ: Set mode off")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.ON:
|
||||
if op_code == OpCode.ON:
|
||||
q.add_log_cmd("IMTQ: Set mode on")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.NORMAL:
|
||||
if op_code == OpCode.NORMAL:
|
||||
q.add_log_cmd("IMTQ: Mode Normal")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == "3":
|
||||
if op_code == OpCode.POS_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive x self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_positive_x_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Initiate reading of positive x self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Request dataset with positive x self test results")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_X_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_X_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == "4":
|
||||
if op_code == OpCode.NEG_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative x self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_negative_x_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_log_cmd("IMTQ: Initiate reading of negative x self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
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")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_X_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_X_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == "5":
|
||||
if op_code == OpCode.POS_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive y self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_positive_y_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_log_cmd("IMTQ: Initiate reading of positive y self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Request dataset with positive y self test results")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_Y_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == "6":
|
||||
if op_code == OpCode.NEG_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative y self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_negative_y_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Initiate reading of negative y self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Request dataset with negative y self test results")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_Y_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == "7":
|
||||
if op_code == OpCode.POS_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive z self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_positive_z_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Initiate reading of positive z self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
q.add_log_cmd("IMTQ: Request dataset with positive z self test results")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.POSITIVE_Y_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == "8":
|
||||
if op_code == OpCode.NEG_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative z self test")
|
||||
command = object_id.as_bytes + ImtqActionIds.perform_negative_z_test
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_log_cmd("IMTQ: Initiate reading of negative z self test results")
|
||||
command = object_id.as_bytes + ImtqActionIds.read_self_test_results
|
||||
command = object_id.as_bytes + ImtqActionId.read_self_test_results
|
||||
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")
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_Z_TEST)
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Z_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code in OpCodes.SET_DIPOLE:
|
||||
if op_code in OpCode.SET_DIPOLE:
|
||||
x_dipole = int(input("Specify X dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
y_dipole = int(input("Specify Y dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
z_dipole = int(input("Specify Z dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
@ -189,38 +239,126 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "10":
|
||||
if op_code == "10": # doesnt seem to work anymore
|
||||
q.add_log_cmd("IMTQ: Get commanded dipole")
|
||||
command = object_id.as_bytes + ImtqActionIds.get_commanded_dipole
|
||||
command = object_id.as_bytes + ImtqActionId.get_commanded_dipole
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set")
|
||||
if op_code == OpCode.ENABLE_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable ENG HK")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=True,
|
||||
sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable ENG HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set with torque")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes,
|
||||
set_id=ImtqSetId.ENG_HK_SET_WITH_TORQUE,
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable ENG HK with torque")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=True,
|
||||
sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable ENG HK with Torque")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set (no torque)")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=object_id.as_bytes, set_id=ImtqSetIds.ENG_HK_SET)
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetId.ENG_HK_NO_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("IMTQ: Get calibrated MTM hk set")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(object_id=object_id.as_bytes, set_id=ImtqSetId.CAL_MTM_SET)
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == OpCode.REQUEST_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get raw MTM hk set")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetIds.CAL_MTM_SET
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetId.RAW_MTM_NO_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "13":
|
||||
if op_code == OpCode.DISABLE_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=True,
|
||||
sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.REQUEST_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get raw MTM hk set")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetIds.RAW_MTM_SET
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetId.RAW_MTM_WITH_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=True,
|
||||
sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def pack_dipole_command(
|
||||
@ -235,7 +373,7 @@ def pack_dipole_command(
|
||||
When set to 0, the dipole will be generated until a new dipole actuation
|
||||
command is sent.
|
||||
"""
|
||||
action_id = ImtqActionIds.start_actuation_dipole
|
||||
action_id = ImtqActionId.start_actuation_dipole
|
||||
command = object_id + action_id
|
||||
x_dipole = int(round(x_dipole))
|
||||
y_dipole = int(round(y_dipole))
|
||||
@ -265,21 +403,76 @@ def raise_dipole_error(dipole_str: str, value: int):
|
||||
)
|
||||
|
||||
|
||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
STATUS_HEADERS = [
|
||||
"Status Byte Mode",
|
||||
"Status Byte Error",
|
||||
"Status Byte Config",
|
||||
"Status Byte Uptime [s]",
|
||||
]
|
||||
|
||||
|
||||
ENG_HK_HEADERS = [
|
||||
"Digital Voltage [mV]",
|
||||
"Analog Voltage [mV]",
|
||||
"Digital Current [mA]",
|
||||
"Analog Current [mA]",
|
||||
"Coil Current X [mA]",
|
||||
"Coil Current Y [mA]",
|
||||
"Coil Current Z [mA]",
|
||||
"Coil X Temperature [°C]",
|
||||
"Coil Y Temperature [°C]",
|
||||
"Coil Z Temperature [°C]",
|
||||
"MCU Temperature [°C]",
|
||||
]
|
||||
|
||||
|
||||
def handle_imtq_hk(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int):
|
||||
if (set_id >= ImtqSetId.POSITIVE_X_TEST) and (set_id <= ImtqSetId.NEGATIVE_Z_TEST):
|
||||
return handle_self_test_data(printer, hk_data)
|
||||
elif set_id == ImtqSetId.ENG_HK_NO_TORQUE:
|
||||
return handle_eng_set(printer, hk_data, False)
|
||||
elif set_id == ImtqSetId.ENG_HK_SET_WITH_TORQUE:
|
||||
return handle_eng_set(printer, hk_data, True)
|
||||
elif set_id == ImtqSetId.CAL_MTM_SET:
|
||||
return handle_calibrated_mtm_measurement(printer, hk_data)
|
||||
elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE:
|
||||
return handle_raw_mtm_measurement(printer, hk_data, False)
|
||||
elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE:
|
||||
return handle_raw_mtm_measurement(printer, hk_data, True)
|
||||
elif set_id == ImtqSetId.DIPOLES:
|
||||
return handle_dipole_set(printer, hk_data)
|
||||
elif set_id == ImtqSetId.STATUS_SET:
|
||||
return handle_status_set(printer, hk_data)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
f"IMTQ handler HK reply with unknown or unimplemented set id {set_id}"
|
||||
)
|
||||
|
||||
|
||||
def unpack_status_set(hk_data: bytes) -> List:
|
||||
status_mode = hk_data[0]
|
||||
status_error = hk_data[1]
|
||||
status_conf = hk_data[2]
|
||||
status_uptime = struct.unpack("!I", hk_data[3:7])[0]
|
||||
return [status_mode, status_error, status_conf, status_uptime]
|
||||
|
||||
|
||||
def handle_dipole_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
header_list = [
|
||||
"Digital Voltage [mV]",
|
||||
"Analog Voltage [mV]",
|
||||
"Digital Current [mA]",
|
||||
"Analog Current [mA]",
|
||||
"Coil Current X [mA]",
|
||||
"Coil Current Y [mA]",
|
||||
"Coil Current Z [mA]",
|
||||
"Coil X Temperature [°C]",
|
||||
"Coil Y Temperature [°C]",
|
||||
"Coil Z Temperature [°C]",
|
||||
"MCU Temperature [°C]",
|
||||
]
|
||||
pw.dlog("Received iMTQ dipole set")
|
||||
fmt_str = "!hhhH"
|
||||
fmt_len = struct.calcsize(fmt_str)
|
||||
(dipole_x, dipole_y, dipole_z, current_torque_duration) = struct.unpack(
|
||||
fmt_str, hk_data[0:8]
|
||||
)
|
||||
pw.dlog(f"Dipole X: {dipole_x}")
|
||||
pw.dlog(f"Dipole Y: {dipole_y}")
|
||||
pw.dlog(f"Dipole Z: {dipole_z}")
|
||||
pw.dlog(f"Current torque duration: {current_torque_duration}")
|
||||
pw.printer.print_validity_buffer(hk_data[fmt_len:], 2)
|
||||
|
||||
|
||||
def unpack_eng_hk(hk_data: bytes) -> List:
|
||||
digital_voltage = struct.unpack("!H", hk_data[0:2])[0]
|
||||
analog_voltage = struct.unpack("!H", hk_data[2:4])[0]
|
||||
digital_current = struct.unpack("!f", hk_data[4:8])[0]
|
||||
@ -291,8 +484,6 @@ def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
coil_y_temperature = struct.unpack("!h", hk_data[26:28])[0]
|
||||
coil_z_temperature = struct.unpack("!h", hk_data[28:30])[0]
|
||||
mcu_temperature = struct.unpack("!h", hk_data[30:32])[0]
|
||||
|
||||
validity_buffer = hk_data[32:]
|
||||
content_list = [
|
||||
digital_voltage,
|
||||
analog_voltage,
|
||||
@ -306,9 +497,29 @@ def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
coil_z_temperature,
|
||||
mcu_temperature,
|
||||
]
|
||||
num_of_vars = len(header_list)
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
return content_list
|
||||
|
||||
|
||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes, torque_on: bool):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Found engineering HK. Torque Status: {torque_on}")
|
||||
content_list = unpack_eng_hk(hk_data)
|
||||
validity_buffer = hk_data[32:]
|
||||
|
||||
num_of_vars = len(ENG_HK_HEADERS)
|
||||
for k, v in zip(ENG_HK_HEADERS, content_list):
|
||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
|
||||
|
||||
def handle_status_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
content_list = unpack_status_set(hk_data)
|
||||
validity_buffer = hk_data[7:]
|
||||
|
||||
num_of_vars = 4
|
||||
for k, v in zip(STATUS_HEADERS, content_list):
|
||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
|
||||
|
||||
@ -332,8 +543,11 @@ def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
|
||||
|
||||
def handle_raw_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
def handle_raw_mtm_measurement(
|
||||
printer: FsfwTmTcPrinter, hk_data: bytes, torque_status: bool
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Found raw MTM measurement. Torque Status: {torque_status}")
|
||||
header_list = [
|
||||
"Raw MTM X [nT]",
|
||||
"Raw MTM Y [nT]",
|
||||
|
118
eive_tmtc/tmtc/acs/mgms.py
Normal file
118
eive_tmtc/tmtc/acs/mgms.py
Normal file
@ -0,0 +1,118 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
from eive_tmtc.config.object_ids import (
|
||||
MGM_0_LIS3_HANDLER_ID,
|
||||
MGM_1_RM3100_HANDLER_ID,
|
||||
MGM_2_LIS3_HANDLER_ID,
|
||||
MGM_3_RM3100_HANDLER_ID,
|
||||
)
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCode:
|
||||
NORMAL = "normal"
|
||||
OFF = "off"
|
||||
|
||||
|
||||
class MgmLis3SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmSel(enum.IntEnum):
|
||||
MGM_0_LIS3 = 0
|
||||
MGM_1_RM3100 = 1
|
||||
MGM_2_LIS3 = 2
|
||||
MGM_3_RM3100 = 3
|
||||
|
||||
|
||||
MGM_SEL_DICT = {
|
||||
MgmSel.MGM_0_LIS3: ("MGM_0_LIS3", MGM_0_LIS3_HANDLER_ID),
|
||||
MgmSel.MGM_1_RM3100: ("MGM_1_RM3100", MGM_1_RM3100_HANDLER_ID),
|
||||
MgmSel.MGM_2_LIS3: ("MGM_2_LIS3", MGM_2_LIS3_HANDLER_ID),
|
||||
MgmSel.MGM_3_RM3100: ("MGM_3_RM3100", MGM_3_RM3100_HANDLER_ID),
|
||||
}
|
||||
|
||||
|
||||
def handle_mgm_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
print("Please select the MGM Device")
|
||||
for (k, v) in MGM_SEL_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
sel_idx = int(input("Select MGM device by index: "))
|
||||
mgm_info = MGM_SEL_DICT[MgmSel(sel_idx)]
|
||||
mgm_obj_id = mgm_info[1]
|
||||
if op_code == OpCode.NORMAL:
|
||||
q.add_log_cmd(f"Gyro {mgm_info[0]} NORMAL mode")
|
||||
q.add_pus_tc(create_mode_command(mgm_obj_id, Mode.NORMAL, 0))
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd(f"Gyro {mgm_info[0]} OFF mode")
|
||||
q.add_pus_tc(create_mode_command(mgm_obj_id, Mode.OFF, 0))
|
||||
|
||||
|
||||
def handle_mgm_hk_data(
|
||||
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,
|
||||
]:
|
||||
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,
|
||||
]:
|
||||
handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data)
|
||||
pass
|
||||
|
||||
|
||||
def handle_mgm_lis3_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == MgmLis3SetId.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(field_x, field_y, field_z, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received MGM LIS3 from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
|
||||
|
||||
def handle_mgm_rm3100_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == MgmRm3100SetId.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = f"!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(field_x, field_y, field_z) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
pw.dlog(f"Received MGM RM3100 from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_mgm_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.NORMAL, info="Normal Mode")
|
||||
oce.add(keys=OpCode.OFF, info="Off Mode")
|
||||
defs.add_service(CustomServiceList.MGMS, info="MGMs", op_code_entry=oce)
|
@ -4,6 +4,7 @@
|
||||
@author J. Meier
|
||||
@date 20.06.2021
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
from typing import List
|
||||
|
||||
@ -20,13 +21,13 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
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_mode import pack_mode_data, Mode, Subservice
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCodesDevs:
|
||||
class OpCodesDev:
|
||||
SPEED = ["0", "speed"]
|
||||
ON = ["1", "on"]
|
||||
NML = ["2", "nml"]
|
||||
@ -37,7 +38,7 @@ class OpCodesDevs:
|
||||
DISABLE_STATUS_HK = ["7", "disable_status_hk"]
|
||||
|
||||
|
||||
class InfoDevs:
|
||||
class InfoDev:
|
||||
SPEED = "Set speed"
|
||||
ON = "Set On"
|
||||
NML = "Set Normal"
|
||||
@ -64,14 +65,14 @@ class InfoAss:
|
||||
ALL_SPEED_OFF = "Speed down to 0"
|
||||
|
||||
|
||||
class RwSetIds:
|
||||
class RwSetId(enum.IntEnum):
|
||||
STATUS_SET_ID = 4
|
||||
TEMPERATURE_SET_ID = 8
|
||||
LAST_RESET = 2
|
||||
TM_SET = 9
|
||||
|
||||
|
||||
class RwCommandIds:
|
||||
class RwCommandId:
|
||||
RESET_MCU = bytearray([0x0, 0x0, 0x0, 0x01])
|
||||
# Reads status information from reaction wheel into dataset with id 4
|
||||
GET_RW_STATUS = bytearray([0x0, 0x0, 0x0, 0x04])
|
||||
@ -94,14 +95,14 @@ class RampTime:
|
||||
@tmtc_definitions_provider
|
||||
def add_rw_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=InfoDevs.SPEED, keys=OpCodesDevs.SPEED)
|
||||
oce.add(info=InfoDevs.ON, keys=OpCodesDevs.ON)
|
||||
oce.add(info=InfoDevs.OFF, keys=OpCodesDevs.OFF)
|
||||
oce.add(info=InfoDevs.NML, keys=OpCodesDevs.NML)
|
||||
oce.add(info=InfoDevs.GET_STATUS, keys=OpCodesDevs.GET_STATUS)
|
||||
oce.add(info=InfoDevs.GET_TM, keys=OpCodesDevs.GET_TM)
|
||||
oce.add(info=InfoDevs.ENABLE_STATUS_HK, keys=OpCodesDevs.ENABLE_STATUS_HK)
|
||||
oce.add(info=InfoDevs.DISABLE_STATUS_HK, keys=OpCodesDevs.DISABLE_STATUS_HK)
|
||||
oce.add(info=InfoDev.SPEED, keys=OpCodesDev.SPEED)
|
||||
oce.add(info=InfoDev.ON, keys=OpCodesDev.ON)
|
||||
oce.add(info=InfoDev.OFF, keys=OpCodesDev.OFF)
|
||||
oce.add(info=InfoDev.NML, keys=OpCodesDev.NML)
|
||||
oce.add(info=InfoDev.GET_STATUS, keys=OpCodesDev.GET_STATUS)
|
||||
oce.add(info=InfoDev.GET_TM, keys=OpCodesDev.GET_TM)
|
||||
oce.add(info=InfoDev.ENABLE_STATUS_HK, keys=OpCodesDev.ENABLE_STATUS_HK)
|
||||
oce.add(info=InfoDev.DISABLE_STATUS_HK, keys=OpCodesDev.DISABLE_STATUS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_1.value,
|
||||
info="Reaction Wheel 1",
|
||||
@ -138,80 +139,80 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_single_rw_test_into(
|
||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
if op_code in OpCodesDevs.SPEED:
|
||||
if op_code in OpCodesDev.SPEED:
|
||||
speed, ramp_time = prompt_speed_ramp_time()
|
||||
q.add_log_cmd(
|
||||
f"RW {rw_idx}: {InfoDevs.SPEED} with target "
|
||||
f"RW {rw_idx}: {InfoDev.SPEED} with target "
|
||||
f"speed {speed / 10.0} RPM and {ramp_time} ms ramp time"
|
||||
)
|
||||
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
|
||||
|
||||
if op_code in OpCodesDevs.ON:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.ON}")
|
||||
mode_data = pack_mode_data(object_id, Modes.ON, 0)
|
||||
if op_code in OpCodesDev.ON:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ON}")
|
||||
mode_data = pack_mode_data(object_id, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code in OpCodesDevs.NML:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.NML}")
|
||||
mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
|
||||
if op_code in OpCodesDev.NML:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.NML}")
|
||||
mode_data = pack_mode_data(object_id, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code in OpCodesDevs.OFF:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.OFF}")
|
||||
mode_data = pack_mode_data(object_id, Modes.OFF, 0)
|
||||
if op_code in OpCodesDev.OFF:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.OFF}")
|
||||
mode_data = pack_mode_data(object_id, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code in OpCodesDevs.GET_TM:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.GET_TM}")
|
||||
if op_code in OpCodesDev.GET_TM:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_TM}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetIds.TM_SET)
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetId.TM_SET)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesDevs.GET_STATUS:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.GET_STATUS}")
|
||||
if op_code in OpCodesDev.GET_STATUS:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_STATUS}")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetIds.STATUS_SET_ID)
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetId.STATUS_SET_ID)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesDevs.ENABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.ENABLE_STATUS_HK}")
|
||||
if op_code in OpCodesDev.ENABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ENABLE_STATUS_HK}")
|
||||
interval = float(input("Please enter HK interval in floating point seconds: "))
|
||||
cmds = enable_periodic_hk_command_with_interval(
|
||||
True, make_sid(object_id, RwSetIds.STATUS_SET_ID), interval
|
||||
True, make_sid(object_id, RwSetId.STATUS_SET_ID), interval
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodesDevs.DISABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.DISABLE_STATUS_HK}")
|
||||
if op_code in OpCodesDev.DISABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.DISABLE_STATUS_HK}")
|
||||
q.add_pus_tc(
|
||||
disable_periodic_hk_command(
|
||||
True, make_sid(object_id, RwSetIds.STATUS_SET_ID)
|
||||
True, make_sid(object_id, RwSetId.STATUS_SET_ID)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
|
||||
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=Mode.OFF, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
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=Mode.ON, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
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=Mode.NORMAL, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.ALL_SPEED_UP:
|
||||
@ -264,7 +265,7 @@ def pack_set_speed_command(
|
||||
ramp_time_ms > 0 and (ramp_time_ms > 20000 or ramp_time_ms < 10)
|
||||
):
|
||||
raise ValueError("Invalid Ramp Speed time. Allowed range is [10-20000] ms")
|
||||
command_id = RwCommandIds.SET_SPEED
|
||||
command_id = RwCommandId.SET_SPEED
|
||||
command = bytearray()
|
||||
command += object_id + command_id
|
||||
command = command + struct.pack("!i", speed)
|
||||
@ -279,7 +280,7 @@ def handle_rw_hk_data(
|
||||
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
if set_id == RwSetIds.STATUS_SET_ID:
|
||||
if set_id == RwSetId.STATUS_SET_ID:
|
||||
pw.dlog(
|
||||
f"Received Status HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
||||
)
|
||||
@ -303,7 +304,7 @@ def handle_rw_hk_data(
|
||||
f"1: High Current Mode (0.6 A)"
|
||||
)
|
||||
printer.print_validity_buffer(hk_data[current_idx:], 5)
|
||||
if set_id == RwSetIds.LAST_RESET:
|
||||
if set_id == RwSetId.LAST_RESET:
|
||||
pw.dlog(
|
||||
f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
||||
)
|
||||
@ -317,7 +318,7 @@ def handle_rw_hk_data(
|
||||
f"Last Non-Cleared (Cached) Reset Status {last_not_cleared_reset_status} | "
|
||||
f"Current Reset Status {current_reset_status}"
|
||||
)
|
||||
if set_id == RwSetIds.TM_SET:
|
||||
if set_id == RwSetId.TM_SET:
|
||||
pw.dlog(f"Received TM HK (ID {set_id}) from Reaction Wheel {object_id.name}")
|
||||
fmt_str = "!BiffBBiiIIIIIIIIIIIIIIII"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
|
@ -5,21 +5,26 @@
|
||||
@author J. Meier
|
||||
@date 14.08.2021
|
||||
"""
|
||||
import datetime
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class StarTrackerActionIds:
|
||||
class StarTrackerActionId(enum.IntEnum):
|
||||
PING = 0
|
||||
BOOT = 1
|
||||
REQ_VERSION = 2
|
||||
@ -86,11 +91,25 @@ class StarTrackerActionIds:
|
||||
|
||||
|
||||
class OpCodes:
|
||||
NORMAL = ["2", "nml"]
|
||||
ON_BOOTLOADER = "on_bootloader"
|
||||
ON_FIRMWARE = "on_firmware"
|
||||
NORMAL = "nml"
|
||||
OFF = "off"
|
||||
PING = "ping"
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId(enum.IntEnum):
|
||||
VERSION = 2
|
||||
INTERFACE = 3
|
||||
POWER = 11
|
||||
TEMPERATURE = 25
|
||||
SOLUTION = 24
|
||||
HISTOGRAM = 28
|
||||
CHECKSUM = 50
|
||||
CAMERA = 67
|
||||
LIMITS = 68
|
||||
CENTROIDING = 72
|
||||
LISA = 73
|
||||
|
||||
|
||||
class FileDefs:
|
||||
@ -161,79 +180,79 @@ def pack_star_tracker_commands(
|
||||
f"Generate command for star tracker with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == "0":
|
||||
if op_code == OpCodes.ON_BOOTLOADER:
|
||||
q.add_log_cmd("Star tracker: Mode On, Submode Bootloader")
|
||||
data = pack_mode_data(obyt, Modes.ON, Submode.BOOTLOADER)
|
||||
data = pack_mode_data(obyt, Mode.ON, Submode.BOOTLOADER)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "1":
|
||||
if op_code == OpCodes.ON_FIRMWARE:
|
||||
q.add_log_cmd("Star tracker: Mode On, Submode Firmware")
|
||||
data = pack_mode_data(obyt, Modes.ON, Submode.FIRMWARE)
|
||||
data = pack_mode_data(obyt, Mode.ON, Submode.FIRMWARE)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "2":
|
||||
if op_code == OpCodes.NORMAL:
|
||||
q.add_log_cmd("Star tracker: Mode Normal")
|
||||
data = pack_mode_data(obyt, Modes.NORMAL, 0)
|
||||
data = pack_mode_data(obyt, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "3":
|
||||
if op_code == OpCodes.OFF:
|
||||
q.add_log_cmd("Star tracker: Mode Off")
|
||||
data = pack_mode_data(obyt, Modes.OFF, 0)
|
||||
data = pack_mode_data(obyt, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "4":
|
||||
q.add_log_cmd("Star tracker: Mode Raw")
|
||||
data = pack_mode_data(obyt, Modes.RAW, 0)
|
||||
data = pack_mode_data(obyt, Mode.RAW, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "5":
|
||||
if op_code == OpCodes.PING:
|
||||
q.add_log_cmd("Star tracker: Ping")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.PING)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.PING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "6":
|
||||
q.add_log_cmd("Star tracker: Switch to bootloader program")
|
||||
data = obyt + struct.pack(
|
||||
"!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM
|
||||
"!I", StarTrackerActionId.SWITCH_TO_BOOTLOADER_PROGRAM
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "7":
|
||||
q.add_log_cmd("Star tracker: Temperature request")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TEMPERATURE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("Star tracker: Request version")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_VERSION)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_VERSION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("Star tracker: Request interface")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_INTERFACE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "10":
|
||||
q.add_log_cmd("Star tracker: Request power")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_POWER)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_POWER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("Star tracker: Set subscription parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIPTION)
|
||||
+ struct.pack("!I", StarTrackerActionId.SUBSCRIPTION)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("Star tracker: Boot")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.BOOT)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.BOOT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "13":
|
||||
q.add_log_cmd("Star tracker: Request time")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TIME)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TIME)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "14":
|
||||
q.add_log_cmd("Star tracker: Request solution")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_SOLUTION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "15":
|
||||
q.add_log_cmd("Star tracker: Upload image")
|
||||
image = get_upload_image()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.UPLOAD_IMAGE)
|
||||
+ bytearray(image, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -244,7 +263,7 @@ def pack_star_tracker_commands(
|
||||
path = FileDefs.download_path
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_IMAGE)
|
||||
+ bytearray(path, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -253,7 +272,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.LIMITS)
|
||||
+ struct.pack("!I", StarTrackerActionId.LIMITS)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -262,7 +281,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.TRACKING)
|
||||
+ struct.pack("!I", StarTrackerActionId.TRACKING)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -271,7 +290,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.MOUNTING)
|
||||
+ struct.pack("!I", StarTrackerActionId.MOUNTING)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -280,7 +299,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -289,7 +308,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING)
|
||||
+ struct.pack("!I", StarTrackerActionId.CENTROIDING)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -298,7 +317,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.LISA)
|
||||
+ struct.pack("!I", StarTrackerActionId.LISA)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -307,7 +326,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.MATCHING)
|
||||
+ struct.pack("!I", StarTrackerActionId.MATCHING)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -316,7 +335,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.VALIDATION)
|
||||
+ struct.pack("!I", StarTrackerActionId.VALIDATION)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -325,7 +344,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.ALGO)
|
||||
+ struct.pack("!I", StarTrackerActionId.ALGO)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -334,37 +353,37 @@ def pack_star_tracker_commands(
|
||||
actionid = int(input("Specify parameter ID (take image - 4): "))
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.TAKE_IMAGE)
|
||||
+ struct.pack("!B", actionid)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "28":
|
||||
q.add_log_cmd("Star tracker: Stop str helper")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.STOP_STR_HELPER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "30":
|
||||
q.add_log_cmd("Star tracker: Set name of download image")
|
||||
filename = input("Specify download image name: ")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.CHANGE_DOWNLOAD_IMAGE)
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "31":
|
||||
q.add_log_cmd("Star tracker: Request histogram")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_HISTOGRAM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "32":
|
||||
q.add_log_cmd("Star tracker: Request contrast")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CONTRAST)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "33":
|
||||
q.add_log_cmd("Star tracker: Set json filename")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME)
|
||||
+ struct.pack("!I", StarTrackerActionId.SET_JSON_FILE_NAME)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -377,7 +396,7 @@ def pack_star_tracker_commands(
|
||||
filename = input("Specify filename: ")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.SET_FLASH_READ_FILENAME)
|
||||
+ struct.pack("!I", StarTrackerActionId.SET_FLASH_READ_FILENAME)
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -390,7 +409,7 @@ def pack_star_tracker_commands(
|
||||
unix_time = 1640783543
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.SET_TIME)
|
||||
+ struct.pack("!I", StarTrackerActionId.SET_TIME)
|
||||
+ struct.pack("!Q", unix_time)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -399,7 +418,7 @@ def pack_star_tracker_commands(
|
||||
id = 0
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_CENTROID)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -408,7 +427,7 @@ def pack_star_tracker_commands(
|
||||
id = 0
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_MATCHED_STAR)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -417,7 +436,7 @@ def pack_star_tracker_commands(
|
||||
id = 0
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_DBIMAGE)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -427,7 +446,7 @@ def pack_star_tracker_commands(
|
||||
type = 1 # 0 - normal, 1 - fast
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_BLOBPIXEL)
|
||||
+ struct.pack("!B", id)
|
||||
+ struct.pack("!B", type)
|
||||
)
|
||||
@ -438,7 +457,7 @@ def pack_star_tracker_commands(
|
||||
length = int(input("Size to download: "))
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_FPGA_IMAGE)
|
||||
+ struct.pack("!I", position)
|
||||
+ struct.pack("!I", length)
|
||||
+ bytearray(FileDefs.downloadFpgaImagePath, "utf-8")
|
||||
@ -448,7 +467,7 @@ def pack_star_tracker_commands(
|
||||
q.add_log_cmd("Star tracker: Change donwload FPGA image file name")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE)
|
||||
+ struct.pack("!I", StarTrackerActionId.CHANGE_FPGA_DOWNLOAD_FILE)
|
||||
+ bytearray(FileDefs.downloadFpgaImageName, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -456,7 +475,7 @@ def pack_star_tracker_commands(
|
||||
q.add_log_cmd("Star tracker: Upload FPGA image")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE)
|
||||
+ struct.pack("!I", StarTrackerActionId.UPLOAD_FPGA_IMAGE)
|
||||
+ bytearray(FileDefs.uploadFpgaImageName, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -465,28 +484,28 @@ def pack_star_tracker_commands(
|
||||
id = 3
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.FPGA_ACTION)
|
||||
+ struct.pack("!I", StarTrackerActionId.FPGA_ACTION)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "48":
|
||||
q.add_log_cmd("Star tracker: Unlock")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.UNLOCK)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.UNLOCK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "49":
|
||||
q.add_log_cmd("Star tracker: Request camera parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CAMERA_PARAMS)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CAMERA_PARAMS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "50":
|
||||
q.add_log_cmd("Star tracker: Request limits")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LIMITS)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LIMITS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "51":
|
||||
q.add_log_cmd("Star tracker: Set image processor parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.IMAGE_PROCESSOR)
|
||||
+ struct.pack("!I", StarTrackerActionId.IMAGE_PROCESSOR)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -494,7 +513,7 @@ def pack_star_tracker_commands(
|
||||
q.add_log_cmd("Star tracker: EGSE load ground config camera parameters")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||
+ bytearray(FileDefs.egse_ground_config, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -502,64 +521,64 @@ def pack_star_tracker_commands(
|
||||
q.add_log_cmd("Star tracker: EGSE load flight config camera parameters")
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||
+ bytearray(FileDefs.egse_flight_config, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "54":
|
||||
q.add_log_cmd("Star tracker: Request log level parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LOG_LEVEL)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LOG_LEVEL)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "55":
|
||||
q.add_log_cmd("Star tracker: Request mounting parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_MOUNTING)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_MOUNTING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "56":
|
||||
q.add_log_cmd("Star tracker: Request image processor parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_IMAGE_PROCESSOR)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_IMAGE_PROCESSOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "57":
|
||||
q.add_log_cmd("Star tracker: Request centroiding parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_CENTROIDING)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CENTROIDING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "58":
|
||||
q.add_log_cmd("Star tracker: Request lisa parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LISA)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LISA)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "59":
|
||||
q.add_log_cmd("Star tracker: Request matching parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_MATCHING)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_MATCHING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "60":
|
||||
q.add_log_cmd("Star tracker: Request tracking parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_TRACKING)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TRACKING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "61":
|
||||
q.add_log_cmd("Star tracker: Request validation parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_VALIDATION)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_VALIDATION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "62":
|
||||
q.add_log_cmd("Star tracker: Request algo parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_ALGO)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_ALGO)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "63":
|
||||
q.add_log_cmd("Star tracker: Request subscription parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_SUBSCRIPTION)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_SUBSCRIPTION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "64":
|
||||
q.add_log_cmd("Star tracker: Request log subscription parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_LOG_SUBSCRIPTION)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LOG_SUBSCRIPTION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "65":
|
||||
q.add_log_cmd("Star tracker: Request debug camera parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionIds.REQ_DEBUG_CAMERA)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_DEBUG_CAMERA)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "66":
|
||||
q.add_log_cmd("Star tracker: Set log level parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.LOGLEVEL)
|
||||
+ struct.pack("!I", StarTrackerActionId.LOGLEVEL)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -569,7 +588,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.LOG_SUBSCRIPTION)
|
||||
+ struct.pack("!I", StarTrackerActionId.LOG_SUBSCRIPTION)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -578,7 +597,7 @@ def pack_star_tracker_commands(
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.DEBUG_CAMERA)
|
||||
+ struct.pack("!I", StarTrackerActionId.DEBUG_CAMERA)
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
@ -587,20 +606,20 @@ def pack_star_tracker_commands(
|
||||
firmware = get_firmware()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionIds.FIRMWARE_UPDATE)
|
||||
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE)
|
||||
+ bytearray(firmware, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "70":
|
||||
q.add_log_cmd("Star tracker: Disable timestamp generation")
|
||||
command = obyt + struct.pack(
|
||||
"!I", StarTrackerActionIds.DISBALE_TIMESTAMP_GENERATION
|
||||
"!I", StarTrackerActionId.DISBALE_TIMESTAMP_GENERATION
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "71":
|
||||
q.add_log_cmd("Star tracker: Enable timestamp generation")
|
||||
command = obyt + struct.pack(
|
||||
"!I", StarTrackerActionIds.ENABLE_TIMESTAMP_GENERATION
|
||||
"!I", StarTrackerActionId.ENABLE_TIMESTAMP_GENERATION
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
@ -613,7 +632,7 @@ def pack_read_command(object_id: bytes) -> bytearray:
|
||||
path = FileDefs.download_path
|
||||
data = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.FLASH_READ)
|
||||
+ struct.pack("!I", StarTrackerActionId.FLASH_READ)
|
||||
+ struct.pack("!B", start_region)
|
||||
+ struct.pack("!I", size)
|
||||
+ bytearray(path, "utf-8")
|
||||
@ -627,7 +646,7 @@ def pack_checksum_command(object_id: bytes) -> bytearray:
|
||||
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
||||
data = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM)
|
||||
+ struct.pack("!I", StarTrackerActionId.CHECKSUM)
|
||||
+ struct.pack("!B", start_region)
|
||||
+ struct.pack("!I", address)
|
||||
+ struct.pack("!I", size)
|
||||
@ -636,7 +655,7 @@ def pack_checksum_command(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def get_config_file() -> str:
|
||||
LOGGER.info("Specify json file")
|
||||
_LOGGER.info("Specify json file")
|
||||
input_helper = InputHelper(json_dict)
|
||||
key = input_helper.get_key()
|
||||
json_file = json_dict[key][1]
|
||||
@ -644,7 +663,7 @@ def get_config_file() -> str:
|
||||
|
||||
|
||||
def get_firmware() -> str:
|
||||
LOGGER.info("Specify firmware file")
|
||||
_LOGGER.info("Specify firmware file")
|
||||
input_helper = InputHelper(firmware_dict)
|
||||
key = input_helper.get_key()
|
||||
firmware = firmware_dict[key][1]
|
||||
@ -652,8 +671,156 @@ def get_firmware() -> str:
|
||||
|
||||
|
||||
def get_upload_image() -> str:
|
||||
LOGGER.info("Specify image to upload")
|
||||
_LOGGER.info("Specify image to upload")
|
||||
input_helper = InputHelper(upload_image_dict)
|
||||
key = input_helper.get_key()
|
||||
image = upload_image_dict[key][1]
|
||||
return image
|
||||
|
||||
|
||||
def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
||||
if set_id == SetId.SOLUTION:
|
||||
handle_solution_set(hk_data, pw)
|
||||
else:
|
||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||
|
||||
|
||||
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received solution set")
|
||||
ticks_time_fmt = "!IQ"
|
||||
current_idx = 0
|
||||
fmt_len = struct.calcsize(ticks_time_fmt)
|
||||
(ticks, unix_time) = struct.unpack(
|
||||
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
||||
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
||||
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
|
||||
current_idx += fmt_len
|
||||
calib_quaternions_fmt = "!ffff"
|
||||
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
||||
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
||||
calib_quaternions_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
pw.dlog("Calibrated Quaternions")
|
||||
pw.dlog(f"Quaternion w: {calib_q_w}")
|
||||
pw.dlog(f"Quaternion x: {calib_q_x}")
|
||||
pw.dlog(f"Quaternion y: {calib_q_y}")
|
||||
pw.dlog(f"Quaternion z: {calib_q_z}")
|
||||
current_idx += fmt_len
|
||||
track_fmt = "!fffff"
|
||||
fmt_len = struct.calcsize(track_fmt)
|
||||
(track_confidence, track_q_w, track_q_x, track_q_y, track_q_z) = struct.unpack(
|
||||
track_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
pw.dlog(f"Track Confidence: {track_confidence}")
|
||||
pw.dlog(f"Track QW: {track_q_w}")
|
||||
pw.dlog(f"Track QX: {track_q_x}")
|
||||
pw.dlog(f"Track QY: {track_q_y}")
|
||||
pw.dlog(f"Track QZ: {track_q_z}")
|
||||
current_idx += fmt_len
|
||||
track_removed = hk_data[current_idx]
|
||||
pw.dlog(f"Number of stars removed from tracking solution: {track_removed}")
|
||||
current_idx += 1
|
||||
stars_centroided = hk_data[current_idx]
|
||||
pw.dlog(f"Centroided stars: {stars_centroided}")
|
||||
current_idx += 1
|
||||
stars_matched_database = hk_data[current_idx]
|
||||
pw.dlog(f"Stars matched: {stars_matched_database}")
|
||||
current_idx += 1
|
||||
# Result of LISA: Lost in space algorithm
|
||||
lisa_fmt = "!fffffB"
|
||||
fmt_len = struct.calcsize(track_fmt)
|
||||
(
|
||||
lisa_q_w,
|
||||
lisa_q_x,
|
||||
lisa_q_y,
|
||||
lisa_q_z,
|
||||
lisa_percentage_close_stars,
|
||||
lisa_number_close_stars,
|
||||
) = struct.unpack(lisa_fmt, hk_data[current_idx : current_idx + fmt_len])
|
||||
pw.dlog(f"LISA QW: {lisa_q_w}")
|
||||
pw.dlog(f"LISA QX: {lisa_q_x}")
|
||||
pw.dlog(f"LISA QY: {lisa_q_y}")
|
||||
pw.dlog(f"LISA QZ: {lisa_q_z}")
|
||||
pw.dlog(
|
||||
f"Percentage of close stars in LISA solution: {lisa_percentage_close_stars}"
|
||||
)
|
||||
pw.dlog(f"Number of close stars in LISA solution: {lisa_number_close_stars}")
|
||||
current_idx += fmt_len
|
||||
is_trusworthy = hk_data[current_idx]
|
||||
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
||||
current_idx += 1
|
||||
stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])
|
||||
pw.dlog(f"Stable count: {stable_count}")
|
||||
current_idx += 4
|
||||
solution_strategy = hk_data[current_idx]
|
||||
pw.dlog(f"Solution strategy: {solution_strategy}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 23)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.ON_BOOTLOADER, "Star Tracker: Mode On, Submode Bootloader")
|
||||
oce.add(OpCodes.ON_FIRMWARE, "Star Tracker: Mode On, Submode Firmware")
|
||||
oce.add(OpCodes.NORMAL, "Star Tracker: Mode Normal")
|
||||
oce.add(OpCodes.OFF, "Star Tracker: Mode Off")
|
||||
oce.add("4", "Star Tracker: Mode Raw")
|
||||
oce.add(OpCodes.PING, "Star Tracker: Ping")
|
||||
oce.add("6", "Star Tracker: Switch to bootloader program")
|
||||
oce.add("7", "Star Tracker: Request temperature")
|
||||
oce.add("8", "Star Tracker: Request version")
|
||||
oce.add("9", "Star Tracker: Request interface")
|
||||
oce.add("10", "Star Tracker: Request power")
|
||||
oce.add("11", "Star Tracker: Set subscription parameters")
|
||||
oce.add("12", "Star Tracker: Boot image (requires bootloader mode)")
|
||||
oce.add("13", "Star Tracker: Request time")
|
||||
oce.add("14", "Star Tracker: Request solution")
|
||||
oce.add("15", "Star Tracker: Upload image")
|
||||
oce.add("16", "Star Tracker: Download image")
|
||||
oce.add("17", "Star Tracker: Set limit parameters")
|
||||
oce.add("17", "Star Tracker: Set limit parameters")
|
||||
oce.add("18", "Star Tracker: Set tracking parameters")
|
||||
oce.add("19", "Star Tracker: Set mounting parameters")
|
||||
oce.add("20", "Star Tracker: Set camera parameters")
|
||||
oce.add("22", "Star Tracker: Set centroiding parameters")
|
||||
oce.add("23", "Star Tracker: Set LISA parameters")
|
||||
oce.add("24", "Star Tracker: Set matching parameters")
|
||||
oce.add("25", "Star Tracker: Set validation parameters")
|
||||
oce.add("26", "Star Tracker: Set algo parameters")
|
||||
oce.add("27", "Star Tracker: Take image")
|
||||
oce.add("28", "Star Tracker: Stop str helper")
|
||||
oce.add("30", "Star Tracker: Set name of download image")
|
||||
oce.add("31", "Star Tracker: Request histogram")
|
||||
oce.add("32", "Star Tracker: Request contrast")
|
||||
oce.add("33", "Star Tracker: Set json filename")
|
||||
oce.add("35", "Star Tracker: Flash read")
|
||||
oce.add("36", "Star Tracker: Set flash read filename")
|
||||
oce.add("37", "Star Tracker: Get checksum")
|
||||
oce.add("49", "Star Tracker: Request camera parameter")
|
||||
oce.add("50", "Star Tracker: Request limits")
|
||||
oce.add("51", "Star Tracker: Set image processor parameters")
|
||||
oce.add("52", "Star Tracker: (EGSE only) Load camera ground config")
|
||||
oce.add("53", "Star Tracker: (EGSE only) Load camera flight config")
|
||||
oce.add("54", "Star Tracker: Request log level parameters")
|
||||
oce.add("55", "Star Tracker: Request mounting parameters")
|
||||
oce.add("56", "Star Tracker: Request image processor parameters")
|
||||
oce.add("57", "Star Tracker: Request centroiding parameters")
|
||||
oce.add("58", "Star Tracker: Request lisa parameters")
|
||||
oce.add("59", "Star Tracker: Request matching parameters")
|
||||
oce.add("60", "Star Tracker: Request tracking parameters")
|
||||
oce.add("61", "Star Tracker: Request validation parameters")
|
||||
oce.add("62", "Star Tracker: Request algo parameters")
|
||||
oce.add("63", "Star Tracker: Request subscription parameters")
|
||||
oce.add("64", "Star Tracker: Request log subscription parameters")
|
||||
oce.add("65", "Star Tracker: Request debug camera parameters")
|
||||
oce.add("66", "Star Tracker: Set log level parameters")
|
||||
oce.add("67", "Star Tracker: Set log subscription parameters")
|
||||
oce.add("68", "Star Tracker: Set debug camera parameters")
|
||||
oce.add("69", "Star Tracker: Firmware update")
|
||||
oce.add("70", "Star Tracker: Disable timestamp generation")
|
||||
oce.add("71", "Star Tracker: Enable timestamp generation")
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
@ -1,6 +1,7 @@
|
||||
import enum
|
||||
from typing import Tuple, Dict
|
||||
|
||||
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
||||
@ -10,42 +11,44 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservices as ModeSubservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCodes(str, enum.Enum):
|
||||
class OpCode(str, enum.Enum):
|
||||
OFF = "off"
|
||||
SAFE = "safe"
|
||||
DETUMBLE = "detumble"
|
||||
IDLE = "idle"
|
||||
TARGET_PT = "target"
|
||||
PTG_TARGET = "ptg_target"
|
||||
PTG_TARGET_NADIR = "ptg_nadir"
|
||||
PTG_TARGET_GS = "ptg_target_gs"
|
||||
PTG_TARGET_INERTIAL = "ptg_inertial"
|
||||
REPORT_ALL_MODES = "all_modes"
|
||||
|
||||
|
||||
class AcsModes(enum.IntEnum):
|
||||
OFF = 0
|
||||
SAFE = 1 << 24
|
||||
DETUMBLE = 2 << 24
|
||||
IDLE = 3 << 24
|
||||
TARGET_PT = 4 << 24
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
OFF = "Off Command"
|
||||
SAFE = "Safe Mode Command"
|
||||
DETUMBLE = "Detumble Mode Command"
|
||||
IDLE = "Idle Mode Command"
|
||||
TARGET_PT = "Target Pointing Mode Command"
|
||||
PTG_TARGET_NADIR = "Target Pointing Nadir"
|
||||
PTG_TARGET = "Target Pointing"
|
||||
PTG_TARGET_GS = "Target Pointing Ground Station"
|
||||
PTG_TARGET_INERTIAL = "Target Pointing Inertial"
|
||||
REPORT_ALL_MODES = "Report All Modes Recursively"
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, str]] = {
|
||||
OpCodes.OFF: (AcsModes.OFF, Info.OFF),
|
||||
OpCodes.IDLE: (AcsModes.IDLE, Info.IDLE),
|
||||
OpCodes.SAFE: (AcsModes.SAFE, Info.SAFE),
|
||||
OpCodes.DETUMBLE: (AcsModes.DETUMBLE, Info.DETUMBLE),
|
||||
HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||
OpCode.OFF: (AcsMode.OFF, 0, Info.OFF),
|
||||
OpCode.SAFE: (AcsMode.SAFE, SafeSubmode.DEFAULT, Info.SAFE),
|
||||
OpCode.DETUMBLE: (AcsMode.SAFE, SafeSubmode.DETUMBLE, Info.DETUMBLE),
|
||||
OpCode.IDLE: (AcsMode.IDLE, 0, Info.IDLE),
|
||||
OpCode.PTG_TARGET: (AcsMode.PTG_TARGET, 0, Info.PTG_TARGET),
|
||||
OpCode.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, 0, Info.PTG_TARGET_GS),
|
||||
OpCode.PTG_TARGET_NADIR: (AcsMode.PTG_NADIR, 0, Info.PTG_TARGET_NADIR),
|
||||
OpCode.PTG_TARGET_INERTIAL: (AcsMode.PTG_INERTIAL, 0, Info.PTG_TARGET_INERTIAL),
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +57,7 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
info_prefix = "ACS Subsystem"
|
||||
if op_code in OpCodes.REPORT_ALL_MODES:
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -68,9 +71,9 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
return
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_SUBSYSTEM_ID,
|
||||
info=f"{info_prefix}: {mode_info_tup[1]}",
|
||||
submode=0,
|
||||
info=f"{info_prefix}: {mode_info_tup[2]}",
|
||||
mode=mode_info_tup[0],
|
||||
submode=mode_info_tup[1],
|
||||
q=q,
|
||||
)
|
||||
|
||||
@ -78,8 +81,7 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
@tmtc_definitions_provider
|
||||
def add_acs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.SAFE, Info.SAFE)
|
||||
oce.add(OpCodes.IDLE, Info.IDLE)
|
||||
oce.add(OpCodes.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
for op_code, (_, _, info) in HANDLER_LIST.items():
|
||||
oce.add(op_code, info)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.ACS_SS, "ACS Subsystem", oce)
|
@ -1,17 +1,21 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.devs.sus import SetIds
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
HK = 3
|
||||
|
||||
|
||||
def handle_sus_hk(
|
||||
object_id: ObjectIdU32, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received SUS HK data from {object_id}")
|
||||
if set_id == SetIds.HK:
|
||||
if set_id == SetId.HK:
|
||||
current_idx = 0
|
||||
temperature = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
@ -1,79 +1,83 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID
|
||||
from eive_tmtc.tmtc.acs.acs_board import DualSideSubmodes
|
||||
from eive_tmtc.tmtc.acs.acs_board import DualSideSubmode
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
|
||||
|
||||
class SusOpCodes:
|
||||
class SusOpCode:
|
||||
SUS_ASS_NOM_SIDE = ["0", "nom"]
|
||||
SUS_ASS_RED_SIDE = ["1", "red"]
|
||||
SUS_ASS_DUAL_MODE = ["2", "dual"]
|
||||
SUS_ASS_OFF = ["3", "off"]
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SUS_BRD_ASS)
|
||||
def pack_sus_cmds(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
|
||||
def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in SusOpCode.SUS_ASS_NOM_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=SUS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.A_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.A_SIDE,
|
||||
q=q,
|
||||
info="Switching to SUS board to nominal side",
|
||||
)
|
||||
if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
|
||||
if op_code in SusOpCode.SUS_ASS_RED_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=SUS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.B_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.B_SIDE,
|
||||
q=q,
|
||||
info="Switching to SUS board to redundant side",
|
||||
)
|
||||
if op_code in SusOpCodes.SUS_ASS_OFF:
|
||||
if op_code in SusOpCode.SUS_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=SUS_BOARD_ASS_ID,
|
||||
mode=Modes.OFF,
|
||||
mode=Mode.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info="Switching SUS board off",
|
||||
)
|
||||
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
|
||||
if op_code in SusOpCode.SUS_ASS_DUAL_MODE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=SUS_BOARD_ASS_ID,
|
||||
mode=Modes.NORMAL,
|
||||
submode=DualSideSubmodes.DUAL_SIDE,
|
||||
mode=Mode.NORMAL,
|
||||
submode=DualSideSubmode.DUAL_SIDE,
|
||||
q=q,
|
||||
info="Switching to SUS board to dual side",
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SUS_BRD_ASS)
|
||||
def pack_sus_cmds_prvoider(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
pack_sus_cmds(q, op_code)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_sus_board_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=SusOpCodes.SUS_ASS_NOM_SIDE,
|
||||
keys=SusOpCode.SUS_ASS_NOM_SIDE,
|
||||
info="Switch SUS board to nominal side",
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCodes.SUS_ASS_RED_SIDE,
|
||||
keys=SusOpCode.SUS_ASS_RED_SIDE,
|
||||
info="Switch SUS board to redundant side",
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCodes.SUS_ASS_OFF,
|
||||
keys=SusOpCode.SUS_ASS_OFF,
|
||||
info="Switch off SUS board",
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCodes.SUS_ASS_DUAL_MODE,
|
||||
keys=SusOpCode.SUS_ASS_DUAL_MODE,
|
||||
info="Switch SUS board to dual mode",
|
||||
)
|
||||
defs.add_service(
|
||||
|
1
eive_tmtc/tmtc/com/__init__.py
Normal file
1
eive_tmtc/tmtc/com/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .subsystem import add_com_subsystem_cmds
|
132
eive_tmtc/tmtc/com/ccsds_handler.py
Normal file
132
eive_tmtc/tmtc/com/ccsds_handler.py
Normal file
@ -0,0 +1,132 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file ccsds_handler.py
|
||||
@brief Test commanding of CCSDS Handler
|
||||
@author J. Meier
|
||||
@date 20.11.2021
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from eive_tmtc.config.object_ids import CCSDS_HANDLER_ID
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
# Configures input rate of syrlinks to 400 Khz (results in downlink rate of 200 kbps)
|
||||
# SET_LOW_RATE = 0
|
||||
# Configures input rate of syrlinks to 2000 Khz (results in downlink rate of 1000 kbps)
|
||||
# SET_HIGH_RATE = 1
|
||||
# Enables the syrlinks transmitter (by using RS485 enables lines). Please note that this
|
||||
# is a legacy command. It is recommended to use mode commands instead
|
||||
EN_TRANSMITTER = 2
|
||||
# Disables the syrlinks transmitter (by using RS485 enables lines). Please note that this is
|
||||
# a legacy command. It is recommended to use mode commands instead.
|
||||
DIS_TRANSMITTER = 3
|
||||
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
|
||||
# required
|
||||
ARBITRARY_BITRATE = 4
|
||||
ENABLE_TX_CLK_MANIPULATOR = 5
|
||||
DISABLE_TX_CLK_MANIPULATOR = 6
|
||||
# Tx data will be updated on rising edge of tx clock
|
||||
UPDATE_ON_RISING_EDGE = 7
|
||||
# Tx data will be updated on falling edge of tx clock
|
||||
UPDATE_ON_FALLING_EDGE = 8
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
# Informative, do not command this.
|
||||
UNSET = 0
|
||||
DATARATE_LOW = 1
|
||||
DATARATE_HIGH = 2
|
||||
|
||||
|
||||
class OpCode:
|
||||
ENABLE_WITH_LOW_DATARATE = ["enable_low_datarate"]
|
||||
ENABLE_WITH_HIGH_DATARATE = ["enable_high_datarate"]
|
||||
DISABLE = ["disable"]
|
||||
ENABLE_ACTION = ["legacy_enable_tx"]
|
||||
DISABLE_ACTION = ["legacy_disable_tx"]
|
||||
|
||||
|
||||
class Info:
|
||||
ENABLE_WITH_LOW_DATARATE = "Enable TX with low datarate"
|
||||
ENABLE_WITH_HIGH_DATARATE = "Enable TX with high datarate"
|
||||
DISABLE = "Disable TX"
|
||||
ENABLE_ACTION = "Enable TX (legacy)"
|
||||
DISABLE_ACTION = "Disable TX (legacy)"
|
||||
|
||||
|
||||
def pack_ccsds_handler_test(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "CCSDS Handler"
|
||||
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
||||
if op_code in OpCode.ENABLE_WITH_LOW_DATARATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_LOW_DATARATE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_LOW))
|
||||
if op_code in OpCode.ENABLE_WITH_HIGH_DATARATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_HIGH_DATARATE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_HIGH))
|
||||
if op_code in OpCode.DISABLE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
|
||||
if op_code in OpCode.ENABLE_ACTION:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_ACTION}")
|
||||
command = obyt + struct.pack("!I", ActionId.EN_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCode.DISABLE_ACTION:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_ACTION}")
|
||||
command = obyt + struct.pack("!I", ActionId.DIS_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "4":
|
||||
q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = (
|
||||
obyt
|
||||
+ struct.pack("!I", ActionId.ARBITRARY_BITRATE)
|
||||
+ struct.pack("!I", bitrate)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "5":
|
||||
q.add_log_cmd("CCSDS Handler: Enable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", ActionId.ENABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "6":
|
||||
q.add_log_cmd("CCSDS Handler: Disable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", ActionId.DISABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "7":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on rising edge of tx clock")
|
||||
command = obyt + struct.pack("!I", ActionId.UPDATE_ON_RISING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on falling edge of tx clock")
|
||||
command = obyt + struct.pack("!I", ActionId.UPDATE_ON_FALLING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.ENABLE_WITH_LOW_DATARATE, Info.ENABLE_WITH_LOW_DATARATE)
|
||||
oce.add(OpCode.ENABLE_WITH_HIGH_DATARATE, Info.ENABLE_WITH_HIGH_DATARATE)
|
||||
oce.add(OpCode.DISABLE, Info.DISABLE)
|
||||
oce.add(OpCode.ENABLE_ACTION, Info.ENABLE_ACTION)
|
||||
oce.add(OpCode.DISABLE_ACTION, Info.DISABLE_ACTION)
|
||||
oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
|
||||
oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
|
||||
oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
|
||||
oce.add("7", "CCSDS Handler: Update tx data on rising edge")
|
||||
oce.add("8", "CCSDS Handler: Update tx data on falling edge")
|
||||
defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)
|
100
eive_tmtc/tmtc/com/pdec_handler.py
Normal file
100
eive_tmtc/tmtc/com/pdec_handler.py
Normal file
@ -0,0 +1,100 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file pdec_handler.py
|
||||
@brief Test commanding of PDEC Handler
|
||||
@author J. Meier
|
||||
@date 22.11.2021
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
|
||||
from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
|
||||
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
|
||||
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
|
||||
|
||||
class CommandId:
|
||||
# prints the clcw to the console. Useful for debugging
|
||||
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
|
||||
# Print PDEC monitor register
|
||||
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
|
||||
|
||||
|
||||
class ParameterId:
|
||||
POSITIVE_WINDOW = 0
|
||||
NEGATIVE_WINDOW = 1
|
||||
|
||||
|
||||
class OpCode:
|
||||
PRINT_CLCW = "print_clcw"
|
||||
PRINT_MON_REG = "print_mon_reg"
|
||||
POSITIVE_WINDOW = "positive_window"
|
||||
NEGATIVE_WINDOW = "negative_window"
|
||||
|
||||
|
||||
class Info:
|
||||
PRINT_CLCW = "Will cause the OBSW to print the current CLCW to the debug console"
|
||||
PRINT_MON_REG = (
|
||||
"Will cause the OBSW to print the PDEC monitor register to the console"
|
||||
)
|
||||
POSITIVE_WINDOW = "Change positive window parameter for AD frames"
|
||||
NEGATIVE_WINDOW = "Change negative window parameter for AD frames"
|
||||
|
||||
|
||||
def pack_pdec_handler_test(
|
||||
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
|
||||
prefix = "PDEC Handler "
|
||||
if op_code == OpCode.PRINT_CLCW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.PRINT_CLCW}")
|
||||
command = object_id + CommandId.PRINT_CLCW
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == OpCode.PRINT_MON_REG:
|
||||
q.add_log_cmd(f"{prefix}: {Info.PRINT_MON_REG}")
|
||||
command = object_id + CommandId.PRINT_PDEC_MON
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == OpCode.POSITIVE_WINDOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.POSITIVE_WINDOW}")
|
||||
pw = int(input("Specify positive window to set: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
object_id,
|
||||
0,
|
||||
ParameterId.POSITIVE_WINDOW,
|
||||
pw,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.NEGATIVE_WINDOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NEGATIVE_WINDOW}")
|
||||
nw = int(input("Specify negative window to set: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
object_id,
|
||||
0,
|
||||
ParameterId.NEGATIVE_WINDOW,
|
||||
nw,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pdec_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.PRINT_CLCW, Info.PRINT_CLCW)
|
||||
oce.add(OpCode.PRINT_MON_REG, Info.PRINT_MON_REG)
|
||||
oce.add(OpCode.POSITIVE_WINDOW, Info.POSITIVE_WINDOW)
|
||||
oce.add(OpCode.NEGATIVE_WINDOW, Info.NEGATIVE_WINDOW)
|
||||
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
|
157
eive_tmtc/tmtc/com/subsystem.py
Normal file
157
eive_tmtc/tmtc/com/subsystem.py
Normal file
@ -0,0 +1,157 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import (
|
||||
create_mode_command,
|
||||
create_read_mode_command,
|
||||
create_announce_mode_command,
|
||||
create_announce_mode_recursive_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
pack_scalar_u8_parameter_app_data,
|
||||
)
|
||||
|
||||
from tmtccmd.pus.s20_fsfw_param import create_scalar_u32_parameter
|
||||
|
||||
|
||||
class ParameterId(enum.IntEnum):
|
||||
DATARATE = 0
|
||||
TRANSMITTER_TIMEOUT = 1
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
RX_ONLY = 10
|
||||
RX_AND_TX_DEF_DATARATE = 11
|
||||
RX_AND_TX_LOW_DATARATE = 12
|
||||
RX_AND_TX_HIGH_DATARATE = 13
|
||||
RX_AND_TX_CARRIER_WAVE = 14
|
||||
|
||||
|
||||
class OpCode:
|
||||
RX_ONLY = "rx_only"
|
||||
TX_AND_RX_DEF_RATE = "rx_and_tx_default_rate"
|
||||
TX_AND_RX_LOW_RATE = "rx_and_tx_low_rate"
|
||||
TX_AND_RX_HIGH_RATE = "rx_and_tx_high_rate"
|
||||
TX_AND_RX_CARRIER_WAVE = "rx_and_tx_carrier_wave"
|
||||
UPDATE_DEFAULT_DATARATE_LOW = "update_default_rate_low"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH = "update_default_rate_high"
|
||||
CHANGE_TRANSMITTER_TIMEOUT = "change_transmitter_timeout"
|
||||
READ_MODE = "read_mode"
|
||||
ANNOUNCE_MODE = "announce_mode"
|
||||
ANNOUNCE_MODE_RECURSIVE = "announce_mode_recursive"
|
||||
|
||||
|
||||
class Info:
|
||||
RX_ONLY = "Syrlinks RX Only"
|
||||
TX_AND_RX_DEF_DATARATE = "Syrlinks with TX default datarate"
|
||||
TX_AND_RX_LOW_DATARATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
||||
TX_AND_RX_HIGH_DATARATE = "Syrlinks with TX high datarate (0QPSK modulation)"
|
||||
TX_AND_RX_CARRIER_WAVE = "Syrlinks with TX carrier wave"
|
||||
UPDATE_DEFAULT_DATARATE_LOW = "Configure default low datarate (BPSK modulation)"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH = "Configure default high datarate (0QPSK modulation)"
|
||||
CHANGE_TRANSMITTER_TIMEOUT = "Changes the transmitter timeout"
|
||||
READ_MODE = "Read Mode"
|
||||
ANNOUNCE_MODE = "Announce Mode"
|
||||
ANNOUNCE_MODE_RECURSIVE = "Announce mode recursively"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.COM_SS)
|
||||
def build_com_subsystem_cmd(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
o = p.op_code
|
||||
prefix = "COM Subsystem"
|
||||
if o == OpCode.RX_ONLY:
|
||||
q.add_log_cmd(Info.RX_ONLY)
|
||||
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_ONLY, 0))
|
||||
elif o == OpCode.TX_AND_RX_DEF_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_DEF_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_DEF_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_LOW_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
Datarate.LOW_RATE_MODULATION_BPSK,
|
||||
)
|
||||
)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
Datarate.HIGH_RATE_MODULATION_0QPSK,
|
||||
)
|
||||
)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_CARRIER_WAVE, 0)
|
||||
)
|
||||
elif o == OpCode.CHANGE_TRANSMITTER_TIMEOUT:
|
||||
timeout = int(input("Specify timeout to set [ms]: "))
|
||||
q.add_log_cmd(Info.CHANGE_TRANSMITTER_TIMEOUT)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u32_parameter(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.TRANSMITTER_TIMEOUT,
|
||||
timeout,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
elif o == OpCode.READ_MODE:
|
||||
q.add_log_cmd(Info.READ_MODE)
|
||||
q.add_pus_tc(create_read_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif o == OpCode.ANNOUNCE_MODE:
|
||||
q.add_log_cmd(Info.ANNOUNCE_MODE)
|
||||
q.add_pus_tc(create_announce_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif o == OpCode.ANNOUNCE_MODE_RECURSIVE:
|
||||
q.add_log_cmd(Info.ANNOUNCE_MODE_RECURSIVE)
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(COM_SUBSYSTEM_ID))
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_com_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.RX_ONLY, Info.RX_ONLY)
|
||||
oce.add(OpCode.TX_AND_RX_LOW_RATE, Info.TX_AND_RX_LOW_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_HIGH_RATE, Info.TX_AND_RX_HIGH_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_DEF_RATE, Info.TX_AND_RX_DEF_DATARATE)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_LOW, Info.UPDATE_DEFAULT_DATARATE_LOW)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_HIGH, Info.UPDATE_DEFAULT_DATARATE_HIGH)
|
||||
oce.add(OpCode.CHANGE_TRANSMITTER_TIMEOUT, Info.CHANGE_TRANSMITTER_TIMEOUT)
|
||||
oce.add(OpCode.READ_MODE, Info.READ_MODE)
|
||||
oce.add(OpCode.ANNOUNCE_MODE, Info.ANNOUNCE_MODE)
|
||||
oce.add(OpCode.ANNOUNCE_MODE_RECURSIVE, Info.ANNOUNCE_MODE_RECURSIVE)
|
||||
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)
|
426
eive_tmtc/tmtc/com/syrlinks_handler.py
Normal file
426
eive_tmtc/tmtc/com/syrlinks_handler.py
Normal file
@ -0,0 +1,426 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file syrlinks_hk_handler.py
|
||||
@brief Syrlinks Hk Handler tests
|
||||
@author J. Meier
|
||||
@date 13.12.2020
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import math
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
create_request_one_diag_command,
|
||||
create_enable_periodic_hk_command_with_interval,
|
||||
create_disable_periodic_hk_command,
|
||||
create_request_one_hk_command,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_mode_command
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
import struct
|
||||
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
RX_REGISTERS_DATASET = 1
|
||||
TX_REGISTERS_DATASET = 2
|
||||
TEMPERATURE_SET_ID = 3
|
||||
|
||||
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NORMAL_RX_ONLY = "nml_rx_only"
|
||||
NORMAL_RX_AND_TX_CW = "nml_carrier_wave"
|
||||
NORMAL_RX_AND_TX_DEF_DATARATE = "nml_default_datarate"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
|
||||
HK_RX_REGS = "hk_rx_regs"
|
||||
HK_TEMPS = "hk_temps"
|
||||
ENABLE_HK_RX_REGS = "enable_hk_rx"
|
||||
DISABLE_HK_RX_REGS = "disable_hk_rx"
|
||||
ENABLE_HK_TX_REGS = "enable_hk_tx"
|
||||
DISABLE_HK_TX_REGS = "disable_hk_tx"
|
||||
HK_TX_REGS = "hk_tx_regs"
|
||||
TX_STATUS = "tx_status"
|
||||
RX_STATUS = "rx_status"
|
||||
|
||||
|
||||
class Info:
|
||||
OFF = "Switch OFF"
|
||||
ON = "Switch ON"
|
||||
NORMAL_RX_ONLY = "NORMAL RX Only, set TX to standby"
|
||||
NORMAL_RX_AND_TX_CW = "NORMAL RX and TX, TX Carrier Wave"
|
||||
NORMAL_RX_AND_TX_DEF_DATARATE = "NORMAL RX and TX, TX with default datarate"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "NORMAL RX and TX, TX with low datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high datarate"
|
||||
HK_RX_REGS = "Request RX register set"
|
||||
HK_TX_REGS = "Request TX register set"
|
||||
HK_TEMPS = "Request Temperatures HK"
|
||||
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
|
||||
DISABLE_HK_RX_REGS = "Disable periodic RX register HK"
|
||||
ENABLE_HK_TX_REGS = "Enable periodic TX register HK"
|
||||
DISABLE_HK_TX_REGS = "Disable periodic TX register HK"
|
||||
TX_STATUS = "Read TX status (always read in normal mode)"
|
||||
RX_STATUS = "Read RX status (always read in normal mode)"
|
||||
SET_CW = "Set TX carrier wave"
|
||||
|
||||
|
||||
class CommandId(enum.IntEnum):
|
||||
READ_RX_STATUS_REGISTERS = 2
|
||||
SET_TX_MODE_STANDBY = 3
|
||||
SET_TX_MODE_MODULATION = 4
|
||||
SET_TX_MODE_CW = 5
|
||||
READ_TX_STATUS = 7
|
||||
READ_TX_WAVEFORM = 8
|
||||
READ_TX_AGC_VALUE_HIGH_BYTE = 9
|
||||
READ_TX_AGC_VALUE_LOW_BYTE = 10
|
||||
WRITE_LCL_CONFIG = 11
|
||||
READ_LCL_CONFIG_REGISTER = 12
|
||||
SET_WAVEFORM_OQPSK = 17
|
||||
SET_WAVEFORM_BPSK = 18
|
||||
SET_SECOND_CONFIG = 19
|
||||
ENABLE_DEBUG = 20
|
||||
DISABLE_DEBUG = 21
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
RX_ONLY = 0
|
||||
RX_AND_TX_DEFAULT_DATARATE = 1
|
||||
RX_AND_TX_LOW_DATARATE = 2
|
||||
RX_AND_TX_HIGH_DATARATE = 3
|
||||
RX_AND_TX_CW = 4
|
||||
|
||||
|
||||
class Datarate(enum.IntEnum):
|
||||
LOW_RATE_MODULATION_BPSK = 0
|
||||
HIGH_RATE_MODULATION_0QPSK = 1
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NORMAL_RX_ONLY, Info.NORMAL_RX_ONLY)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_CW, Info.NORMAL_RX_AND_TX_CW)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_DEF_DATARATE, Info.NORMAL_RX_AND_TX_DEF_DATARATE)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_LOW_DATARATE, Info.NORMAL_RX_AND_TX_LOW_DATARATE)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE, Info.NORMAL_RX_AND_TX_HIGH_DATARATE)
|
||||
oce.add(OpCode.HK_RX_REGS, Info.HK_RX_REGS)
|
||||
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
|
||||
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
|
||||
oce.add(OpCode.RX_STATUS, Info.RX_STATUS)
|
||||
oce.add(OpCode.ENABLE_HK_RX_REGS, Info.ENABLE_HK_RX_REGS)
|
||||
oce.add(OpCode.DISABLE_HK_RX_REGS, Info.DISABLE_HK_RX_REGS)
|
||||
oce.add(OpCode.ENABLE_HK_TX_REGS, Info.ENABLE_HK_TX_REGS)
|
||||
oce.add(OpCode.DISABLE_HK_TX_REGS, Info.DISABLE_HK_TX_REGS)
|
||||
oce.add(OpCode.HK_TEMPS, Info.HK_TEMPS)
|
||||
oce.add("7", "Syrlinks Handler: Read TX waveform")
|
||||
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
|
||||
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
|
||||
oce.add("12", "Syrlinks Handler: Write LCL config")
|
||||
oce.add("14", "Syrlinks Handler: Read LCL config register")
|
||||
oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
|
||||
oce.add("16", "Syrlinks Handler: Set waveform BPSK")
|
||||
oce.add("17", "Syrlinks Handler: Set second config")
|
||||
oce.add("18", "Syrlinks Handler: Enable debug output")
|
||||
oce.add("19", "Syrlinks Handler: Disable debug output")
|
||||
defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce)
|
||||
|
||||
|
||||
_PREFIX = "Syrlinks"
|
||||
|
||||
|
||||
def normal_mode_cmd(q: DefaultPusQueueHelper, info: str, submode: int):
|
||||
q.add_log_cmd(f"{_PREFIX}: {info}")
|
||||
q.add_pus_tc(create_mode_command(SYRLINKS_HANDLER_ID, Mode.NORMAL, submode))
|
||||
|
||||
|
||||
def pack_syrlinks_command(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "Syrlinks"
|
||||
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
|
||||
if op_code == OpCode.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, 0))
|
||||
if op_code == OpCode.NORMAL_RX_ONLY:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_ONLY, Submode.RX_ONLY)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, Submode.RX_AND_TX_LOW_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, Submode.RX_AND_TX_DEFAULT_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, Submode.RX_AND_TX_HIGH_DATARATE
|
||||
)
|
||||
if op_code in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, Submode.RX_AND_TX_CW)
|
||||
if op_code in OpCode.HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_request_one_diag_command(sid))
|
||||
if op_code in OpCode.HK_TEMPS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TEMPS}")
|
||||
sid = make_sid(obyt, SetId.TEMPERATURE_SET_ID)
|
||||
q.add_pus_tc(create_request_one_hk_command(sid))
|
||||
if op_code in OpCode.ENABLE_HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
interval = float(input("HK interval in floating point seconds"))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_disable_periodic_hk_command(True, sid))
|
||||
if op_code in OpCode.ENABLE_HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
interval = float(input("HK interval in floating point seconds"))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_disable_periodic_hk_command(True, sid))
|
||||
if op_code in OpCode.HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_request_one_diag_command(sid))
|
||||
if op_code in OpCode.TX_STATUS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.TX_STATUS}")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_STATUS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("Syrlinks: Read TX waveform")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_WAVEFORM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "10":
|
||||
q.add_log_cmd("Syrlinks: Read TX AGC value high byte")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_AGC_VALUE_HIGH_BYTE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("Syrlinks: Read TX AGC value low byte")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_AGC_VALUE_LOW_BYTE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("Syrlinks: Write LCL config")
|
||||
command = obyt + struct.pack("!I", CommandId.WRITE_LCL_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "13":
|
||||
q.add_log_cmd("Syrlinks: Read RX status registers")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_RX_STATUS_REGISTERS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "14":
|
||||
q.add_log_cmd("Syrlinks: Read LCL config register")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_LCL_CONFIG_REGISTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "15":
|
||||
q.add_log_cmd("Syrlinks: Set waveform OQPSK")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_WAVEFORM_OQPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "16":
|
||||
q.add_log_cmd("Syrlinks: Set waveform BPSK")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_WAVEFORM_BPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "17":
|
||||
q.add_log_cmd("Syrlinks: Set second config")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_SECOND_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "18":
|
||||
q.add_log_cmd("Syrlinks: Enable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandId.ENABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "19":
|
||||
q.add_log_cmd("Syrlinks: Disable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandId.DISABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def handle_syrlinks_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(printer, hk_data)
|
||||
elif set_id == SetId.TX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_tx_registers_dataset(printer, hk_data)
|
||||
elif set_id == SetId.TEMPERATURE_SET_ID:
|
||||
return handle_syrlinks_temp_dataset(printer, hk_data)
|
||||
else:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
||||
|
||||
|
||||
def handle_syrlinks_temp_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if len(hk_data) < 8:
|
||||
raise ValueError("expected at least 8 bytes of HK data")
|
||||
temp_power_amplifier = struct.unpack("!f", hk_data[0:4])[0]
|
||||
temp_baseband_board = struct.unpack("!f", hk_data[4:8])[0]
|
||||
pw.dlog(f"Temperatur Power Amplifier [C]: {temp_power_amplifier}")
|
||||
pw.dlog(f"Temperatur Baseband Board [C]: {temp_baseband_board}")
|
||||
printer.print_validity_buffer(hk_data[8:], 2)
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
header_list = [
|
||||
"RX Status",
|
||||
"RX Sensitivity",
|
||||
"RX Frequency Shift",
|
||||
"RX IQ Power",
|
||||
"RX AGC Value (Raw)",
|
||||
"RX Demod Eb",
|
||||
"RX Demod N0",
|
||||
"RX Datarate [kbps]",
|
||||
]
|
||||
rx_status = hk_data[0]
|
||||
carrier_detect = rx_status & 0b1
|
||||
carrier_lock = (rx_status >> 1) & 0b1
|
||||
data_lock = (rx_status >> 2) & 0b1
|
||||
data_valid = (rx_status >> 3) & 0b1
|
||||
rx_sensitivity = struct.unpack("!I", hk_data[1:5])[0]
|
||||
rx_frequency_shift = struct.unpack("!i", hk_data[5:9])[0]
|
||||
freq_shift_hz = rx_frequency_shift / 8.0
|
||||
freq_shift_printout = f"Raw: {rx_frequency_shift}, Eng: {freq_shift_hz} Hz"
|
||||
rx_iq_power = struct.unpack("!H", hk_data[9:11])[0]
|
||||
rx_agc_value = struct.unpack("!H", hk_data[11:13])[0]
|
||||
rx_agc_inhibit = (rx_agc_value >> 15) & 0b1
|
||||
rx_agc = rx_agc_value & 0xFFF
|
||||
rx_demod_eb = struct.unpack("!I", hk_data[13:17])[0] & 0xFFFFFF
|
||||
rx_demod_n0 = struct.unpack("!I", hk_data[17:21])[0] & 0xFFFFFF
|
||||
eb_to_n0 = 20 * math.log10(rx_demod_eb / rx_demod_n0) - 3
|
||||
rx_data_rate_raw = hk_data[21]
|
||||
rx_data_rate = -1
|
||||
if rx_data_rate_raw == 0:
|
||||
rx_data_rate = 256
|
||||
elif rx_data_rate_raw == 1:
|
||||
rx_data_rate = 128
|
||||
elif rx_data_rate_raw == 3:
|
||||
rx_data_rate = 64
|
||||
elif rx_data_rate_raw == 7:
|
||||
rx_data_rate = 32
|
||||
elif rx_data_rate_raw == 15:
|
||||
rx_data_rate = 16
|
||||
elif rx_data_rate_raw == 31:
|
||||
rx_data_rate = 8
|
||||
content_list = [
|
||||
rx_status,
|
||||
rx_sensitivity,
|
||||
freq_shift_printout,
|
||||
rx_iq_power,
|
||||
rx_agc_value,
|
||||
rx_demod_eb,
|
||||
rx_demod_n0,
|
||||
rx_data_rate,
|
||||
]
|
||||
validity_buffer = hk_data[22:]
|
||||
for header, content in zip(header_list, content_list):
|
||||
pw.dlog(f"{header}: {content}")
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
||||
pw.dlog(f"Carrier Detect: {carrier_detect}")
|
||||
pw.dlog(f"Carrier Lock: {carrier_lock}")
|
||||
pw.dlog(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
pw.dlog(f"Data Valid (valid if TEB < 10e-5): {data_valid}")
|
||||
pw.dlog(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
pw.dlog(f"RX AGC Inhibit: {rx_agc_inhibit}")
|
||||
pw.dlog(f"RX AGC: {rx_agc}")
|
||||
pw.dlog(f"Eb / E0RX [dB]: {eb_to_n0}")
|
||||
|
||||
|
||||
class TxConv(enum.IntEnum):
|
||||
NO_CODING = 0b000
|
||||
VITERBI_HALF_G1G2INV = 0b010
|
||||
VITERBI_HALF = 0b111
|
||||
|
||||
|
||||
class TxStatus(enum.IntEnum):
|
||||
NOT_AVAILABLE = 0b00
|
||||
MODULATION = 0b01
|
||||
CW = 0b10
|
||||
STANDBY = 0b11
|
||||
|
||||
|
||||
class TxCfgSet(enum.IntEnum):
|
||||
START_WITH_CURRENT_CFG = 0b00
|
||||
START_WITH_CONF_0 = 0b01
|
||||
START_WITH_CONF_1 = 0b10
|
||||
|
||||
|
||||
WAVEFORM_STRINGS = ["OFF", "CW", "QPSK", "0QPSK", "PCM/PM", "PSK/PM", "BPSK"]
|
||||
|
||||
|
||||
def handle_syrlinks_tx_registers_dataset(
|
||||
printer: FsfwTmTcPrinter,
|
||||
hk_data: bytes,
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
header_list = ["TX Status Raw", "TX Waveform", "TX AGC value"]
|
||||
tx_status = hk_data[0]
|
||||
"""
|
||||
try:
|
||||
tx_conv = TxConv(tx_status & 0b111)
|
||||
except ValueError:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid TX conv value {tx_status & 0b111}"
|
||||
)
|
||||
tx_conv = -1
|
||||
tx_diff_encoder_enable = (tx_status >> 3) & 0b1
|
||||
"""
|
||||
tx_status_status = TxStatus(tx_status & 0b11)
|
||||
try:
|
||||
tx_conf_set = TxCfgSet((tx_status >> 2) & 0b11)
|
||||
except ValueError:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid TX conf set {(tx_status >> 2) & 0b11}"
|
||||
)
|
||||
tx_conf_set = -1
|
||||
tx_clock_detect = (tx_status >> 4) & 0b1
|
||||
tx_waveform = hk_data[1]
|
||||
waveform = tx_waveform & 0b1111
|
||||
try:
|
||||
waveform_str = WAVEFORM_STRINGS[waveform]
|
||||
except IndexError:
|
||||
logging.getLogger(__name__).warning(f"Unknown waveform value {waveform}")
|
||||
waveform_str = "Unknown"
|
||||
pcm_mode = (tx_waveform >> 4) & 0b1
|
||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])[0]
|
||||
tx_agc_inhibit = (tx_agc_value >> 15) & 0b1
|
||||
tx_agc = tx_agc_value & 0xFFF
|
||||
content_list = [tx_status, tx_waveform, tx_agc_value]
|
||||
validity_buffer = hk_data[4:]
|
||||
for header, content in zip(header_list, content_list):
|
||||
pw.dlog(f"{header}: {content}")
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=3)
|
||||
# pw.dlog(f"TX CONV: {tx_conv!r}")
|
||||
# pw.dlog(f"TX DIFF (differential encoder enable): {tx_diff_encoder_enable}")
|
||||
pw.dlog(f"TX Status: {tx_status_status!r}")
|
||||
pw.dlog(f"TX Config Set: {tx_conf_set!r}")
|
||||
pw.dlog(f"TX Clock Detect: {tx_clock_detect}")
|
||||
pw.dlog(f"Waveform: {waveform_str}")
|
||||
pw.dlog(f"PCM Mode: {pcm_mode}")
|
||||
pw.dlog(f"TX AGC Inhibit: {tx_agc_inhibit}")
|
||||
pw.dlog(f"TX AGC: {tx_agc}")
|
@ -2,13 +2,13 @@ from typing import Union
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
def pack_mode_cmd_with_info(
|
||||
object_id: Union[ObjectIdU32, bytes],
|
||||
mode: Union[int, Modes],
|
||||
mode: Union[int, Mode],
|
||||
submode: int,
|
||||
q: DefaultPusQueueHelper,
|
||||
info: str,
|
||||
@ -27,6 +27,6 @@ def pack_mode_cmd_with_info(
|
||||
)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=mode_data
|
||||
)
|
||||
)
|
||||
|
@ -1,22 +1,27 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class ActionIds(enum.IntEnum):
|
||||
class ActionId(enum.IntEnum):
|
||||
LIST_DIR_INTO_FILE = 0
|
||||
ANNOUNCE_VERSION = 1
|
||||
ANNOUNCE_CURRENT_IMAGE = 2
|
||||
SWITCH_REBOOT_FILE_HANDLING = 5
|
||||
RESET_REBOOT_COUNTER = 6
|
||||
SWITCH_IMG_LOCK = 7
|
||||
@ -31,11 +36,13 @@ class ActionIds(enum.IntEnum):
|
||||
FULL_REBOOT = 34
|
||||
|
||||
|
||||
class SetIds(enum.IntEnum):
|
||||
class SetId(enum.IntEnum):
|
||||
HK = 5
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
ANNOUNCE_VERSION = "announce_version"
|
||||
ANNOUNCE_CURRENT_IMAGE = "announce_current_image"
|
||||
REBOOT_XSC = ["0", "reboot_xsc"]
|
||||
XSC_REBOOT_SELF = ["1", "reboot_self"]
|
||||
XSC_REBOOT_0_0 = ["2", "reboot_00"]
|
||||
@ -61,6 +68,8 @@ class OpCodes:
|
||||
|
||||
|
||||
class Info:
|
||||
ANNOUNCE_VERSION = "Announce version"
|
||||
ANNOUNCE_CURRENT_IMAGE = "Announce current image"
|
||||
REBOOT_XSC = "XSC reboot with prompt"
|
||||
REBOOT_FULL = "Full regular reboot"
|
||||
OBSW_UPDATE_FROM_SD_0 = "Update OBSW from SD Card 0"
|
||||
@ -86,193 +95,212 @@ class Copy(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
|
||||
oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
|
||||
oce.add(keys=OpCodes.REBOOT_FULL, info=Info.REBOOT_FULL)
|
||||
oce.add(keys=OpCodes.XSC_REBOOT_SELF, info="Reboot Self")
|
||||
oce.add(keys=OpCodes.XSC_REBOOT_0_0, info="Reboot 0 0")
|
||||
oce.add(keys=OpCodes.XSC_REBOOT_0_1, info="Reboot 0 1")
|
||||
oce.add(keys=OpCodes.XSC_REBOOT_1_0, info="Reboot 1 0")
|
||||
oce.add(keys=OpCodes.XSC_REBOOT_1_1, info="Reboot 1 1")
|
||||
oce.add(keys=OpCode.ANNOUNCE_VERSION, info=Info.ANNOUNCE_VERSION)
|
||||
oce.add(keys=OpCode.ANNOUNCE_CURRENT_IMAGE, info=Info.ANNOUNCE_CURRENT_IMAGE)
|
||||
oce.add(keys=OpCode.REBOOT_XSC, info=Info.REBOOT_XSC)
|
||||
oce.add(keys=OpCode.REBOOT_XSC, info=Info.REBOOT_XSC)
|
||||
oce.add(keys=OpCode.REBOOT_FULL, info=Info.REBOOT_FULL)
|
||||
oce.add(keys=OpCode.XSC_REBOOT_SELF, info="Reboot Self")
|
||||
oce.add(keys=OpCode.XSC_REBOOT_0_0, info="Reboot 0 0")
|
||||
oce.add(keys=OpCode.XSC_REBOOT_0_1, info="Reboot 0 1")
|
||||
oce.add(keys=OpCode.XSC_REBOOT_1_0, info="Reboot 1 0")
|
||||
oce.add(keys=OpCode.XSC_REBOOT_1_1, info="Reboot 1 1")
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1)
|
||||
oce.add(
|
||||
keys=OpCodes.GET_HK,
|
||||
keys=OpCode.GET_HK,
|
||||
info="Request housekeeping set",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
|
||||
keys=OpCode.ENABLE_REBOOT_FILE_HANDLING,
|
||||
info="Enable reboot file handling",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
|
||||
keys=OpCode.DISABLE_REBOOT_FILE_HANDLING,
|
||||
info="Disable reboot file handling",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
|
||||
keys=OpCode.RESET_ALL_REBOOT_COUNTERS,
|
||||
info="Reset all reboot counters",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.RESET_REBOOT_COUNTER_00,
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_00,
|
||||
info="Reset reboot counter 0 0",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.RESET_REBOOT_COUNTER_01,
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_01,
|
||||
info="Reset reboot counter 0 1",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.RESET_REBOOT_COUNTER_10,
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_10,
|
||||
info="Reset reboot counter 1 0",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.RESET_REBOOT_COUNTER_11,
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_11,
|
||||
info="Reset reboot counter 1 1",
|
||||
)
|
||||
oce.add(keys=OpCodes.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0)
|
||||
oce.add(keys=OpCodes.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1)
|
||||
oce.add(keys=OpCodes.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP)
|
||||
oce.add(keys=OpCodes.SWITCH_TO_SD_0, info=Info.SWITCH_TO_SD_0)
|
||||
oce.add(keys=OpCodes.SWITCH_TO_SD_1, info=Info.SWITCH_TO_SD_1)
|
||||
oce.add(keys=OpCodes.SWITCH_TO_BOTH_SD_CARDS, info=Info.SWITCH_TO_BOTH_SD_CARDS)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1)
|
||||
oce.add(keys=OpCode.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP)
|
||||
oce.add(keys=OpCode.SWITCH_TO_SD_0, info=Info.SWITCH_TO_SD_0)
|
||||
oce.add(keys=OpCode.SWITCH_TO_SD_1, info=Info.SWITCH_TO_SD_1)
|
||||
oce.add(keys=OpCode.SWITCH_TO_BOTH_SD_CARDS, info=Info.SWITCH_TO_BOTH_SD_CARDS)
|
||||
defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
|
||||
|
||||
|
||||
def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.REBOOT_XSC:
|
||||
if op_code == OpCode.ANNOUNCE_VERSION:
|
||||
q.add_log_cmd(f"{Info.ANNOUNCE_VERSION}")
|
||||
q.add_pus_tc(create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_VERSION))
|
||||
if op_code == OpCode.ANNOUNCE_CURRENT_IMAGE:
|
||||
q.add_log_cmd(f"{Info.ANNOUNCE_CURRENT_IMAGE}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_CURRENT_IMAGE)
|
||||
)
|
||||
if op_code in OpCode.REBOOT_XSC:
|
||||
reboot_self, chip_select, copy_select = determine_reboot_params()
|
||||
perform_reboot_cmd(
|
||||
add_xsc_reboot_cmd(
|
||||
q=q,
|
||||
reboot_self=reboot_self,
|
||||
chip=chip_select,
|
||||
copy=copy_select,
|
||||
)
|
||||
if op_code in OpCodes.REBOOT_FULL:
|
||||
if op_code in OpCode.REBOOT_FULL:
|
||||
q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.FULL_REBOOT
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.XSC_REBOOT_SELF:
|
||||
perform_reboot_cmd(q=q, reboot_self=True)
|
||||
if op_code in OpCodes.XSC_REBOOT_0_0:
|
||||
perform_reboot_cmd(
|
||||
if op_code in OpCode.XSC_REBOOT_SELF:
|
||||
add_xsc_reboot_cmd(q=q, reboot_self=True)
|
||||
if op_code in OpCode.XSC_REBOOT_0_0:
|
||||
add_xsc_reboot_cmd(
|
||||
q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
|
||||
)
|
||||
if op_code in OpCodes.XSC_REBOOT_0_1:
|
||||
perform_reboot_cmd(
|
||||
if op_code in OpCode.XSC_REBOOT_0_1:
|
||||
add_xsc_reboot_cmd(
|
||||
q=q,
|
||||
reboot_self=False,
|
||||
chip=Chip.CHIP_0,
|
||||
copy=Copy.COPY_1_GOLD,
|
||||
)
|
||||
if op_code in OpCodes.XSC_REBOOT_1_0:
|
||||
perform_reboot_cmd(
|
||||
if op_code in OpCode.XSC_REBOOT_1_0:
|
||||
add_xsc_reboot_cmd(
|
||||
q=q, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
|
||||
)
|
||||
if op_code in OpCodes.XSC_REBOOT_1_1:
|
||||
perform_reboot_cmd(
|
||||
if op_code in OpCode.XSC_REBOOT_1_1:
|
||||
add_xsc_reboot_cmd(
|
||||
q=q,
|
||||
reboot_self=False,
|
||||
chip=Chip.CHIP_1,
|
||||
copy=Copy.COPY_1_GOLD,
|
||||
)
|
||||
if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
|
||||
if op_code in OpCode.DISABLE_REBOOT_FILE_HANDLING:
|
||||
q.add_log_cmd("Disabling reboot file handling")
|
||||
user_data = bytearray([0])
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
|
||||
action_id=ActionId.SWITCH_REBOOT_FILE_HANDLING,
|
||||
user_data=user_data,
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
|
||||
if op_code in OpCode.ENABLE_REBOOT_FILE_HANDLING:
|
||||
q.add_log_cmd("Enabling reboot file handling")
|
||||
user_data = bytearray([1])
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
|
||||
action_id=ActionId.SWITCH_REBOOT_FILE_HANDLING,
|
||||
user_data=user_data,
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
|
||||
if op_code in OpCode.RESET_ALL_REBOOT_COUNTERS:
|
||||
q.add_log_cmd("Resetting all reboot counters")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.RESET_REBOOT_COUNTER,
|
||||
action_id=ActionId.RESET_REBOOT_COUNTER,
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.RESET_REBOOT_COUNTER_00:
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_00:
|
||||
reset_specific_boot_counter(q, 0, 0)
|
||||
if op_code in OpCodes.RESET_REBOOT_COUNTER_01:
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_01:
|
||||
reset_specific_boot_counter(q, 0, 1)
|
||||
if op_code in OpCodes.RESET_REBOOT_COUNTER_10:
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_10:
|
||||
reset_specific_boot_counter(q, 1, 0)
|
||||
if op_code in OpCodes.RESET_REBOOT_COUNTER_11:
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_11:
|
||||
reset_specific_boot_counter(q, 1, 1)
|
||||
if op_code in OpCodes.OBSW_UPDATE_FROM_SD_0:
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_SD_0:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_0)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionIds.UPDATE_OBSW_FROM_SD_0))
|
||||
if op_code in OpCodes.OBSW_UPDATE_FROM_SD_1:
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_0))
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_SD_1:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_1)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionIds.UPDATE_OBSW_FROM_SD_1))
|
||||
if op_code in OpCodes.OBSW_UPDATE_FROM_TMP:
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_1))
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_TMP:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_TMP)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionIds.UPDATE_OBSW_FROM_TMP))
|
||||
if op_code in OpCodes.SWITCH_TO_SD_0:
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_TMP))
|
||||
if op_code in OpCode.SWITCH_TO_SD_0:
|
||||
q.add_log_cmd(Info.SWITCH_TO_SD_0)
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.SWITCH_TO_SD_0
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_0
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.SWITCH_TO_SD_1:
|
||||
if op_code in OpCode.SWITCH_TO_SD_1:
|
||||
q.add_log_cmd(Info.SWITCH_TO_SD_1)
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.SWITCH_TO_SD_1
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_1
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.SWITCH_TO_BOTH_SD_CARDS:
|
||||
if op_code in OpCode.SWITCH_TO_BOTH_SD_CARDS:
|
||||
while True:
|
||||
active_sd_card = int(input("Please specify active SD cqrd [0/1]: "))
|
||||
if active_sd_card not in [0, 1]:
|
||||
LOGGER.warning("Invalid SD card specified. Try again")
|
||||
_LOGGER.warning("Invalid SD card specified. Try again")
|
||||
break
|
||||
q.add_log_cmd(Info.SWITCH_TO_BOTH_SD_CARDS)
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.SWITCH_TO_BOTH_SD_CARDS,
|
||||
action_id=ActionId.SWITCH_TO_BOTH_SD_CARDS,
|
||||
user_data=bytes([active_sd_card]),
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.GET_HK:
|
||||
if op_code in OpCode.GET_HK:
|
||||
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=SetId.HK)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
|
||||
def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):
|
||||
q.add_log_cmd(f"Resetting boot counter {chip} {copy}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.RESET_REBOOT_COUNTER,
|
||||
action_id=ActionId.RESET_REBOOT_COUNTER,
|
||||
user_data=bytes([chip, copy]),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def create_full_reboot_cmds() -> PusTelecommand:
|
||||
return create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.FULL_REBOOT
|
||||
)
|
||||
|
||||
|
||||
def determine_reboot_params() -> (bool, Chip, Copy):
|
||||
chip_select = -1
|
||||
copy_select = -1
|
||||
reboot_self = input("Reboot self? [y/n]: ")
|
||||
if reboot_self in ["y", "yes", "1"]:
|
||||
LOGGER.info("Rebooting currently running image")
|
||||
_LOGGER.info("Rebooting currently running image")
|
||||
return True, chip_select, copy_select
|
||||
LOGGER.info("Rebooting image specified by chip and copy")
|
||||
_LOGGER.info("Rebooting image specified by chip and copy")
|
||||
return False, determine_chip_and_copy()
|
||||
|
||||
|
||||
@ -286,7 +314,7 @@ def determine_chip_and_copy() -> (int, int):
|
||||
chip_select = Chip.CHIP_1
|
||||
break
|
||||
else:
|
||||
LOGGER.warning("Invalid chip select value. Try again")
|
||||
_LOGGER.warning("Invalid chip select value. Try again")
|
||||
while True:
|
||||
copy_select = input("Copy select [0/1]: ")
|
||||
if copy_select in ["0", "1"]:
|
||||
@ -296,37 +324,59 @@ def determine_chip_and_copy() -> (int, int):
|
||||
copy_select = Copy.COPY_1_GOLD
|
||||
break
|
||||
else:
|
||||
LOGGER.warning("Invalid copy select value. Try again")
|
||||
_LOGGER.warning("Invalid copy select value. Try again")
|
||||
return chip_select, copy_select
|
||||
|
||||
|
||||
def pack_obsw_update_cmd(action_id: int) -> PusTelecommand:
|
||||
chip, copy = determine_chip_and_copy()
|
||||
user_data = bytes([chip, copy])
|
||||
return make_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=action_id, user_data=user_data
|
||||
)
|
||||
|
||||
|
||||
def perform_reboot_cmd(
|
||||
def add_xsc_reboot_cmd(
|
||||
q: DefaultPusQueueHelper,
|
||||
reboot_self: bool,
|
||||
chip: Chip = Chip.NONE,
|
||||
copy: Copy = Copy.NONE,
|
||||
):
|
||||
tc_data = bytearray()
|
||||
if reboot_self:
|
||||
q.add_log_cmd("Packing reboot command for current image")
|
||||
else:
|
||||
q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
|
||||
q.add_pus_tc(create_xsc_reboot_cmds(reboot_self, chip, copy))
|
||||
|
||||
|
||||
def create_xsc_reboot_cmds(
|
||||
reboot_self: bool,
|
||||
chip: Chip = Chip.NONE,
|
||||
copy: Copy = Copy.NONE,
|
||||
) -> PusTelecommand:
|
||||
tc_data = bytearray()
|
||||
if reboot_self:
|
||||
tc_data.append(True)
|
||||
else:
|
||||
tc_data.append(False)
|
||||
tc_data.append(chip)
|
||||
tc_data.append(copy)
|
||||
q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.XSC_REBOOT,
|
||||
user_data=tc_data,
|
||||
)
|
||||
return create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.XSC_REBOOT, user_data=tc_data
|
||||
)
|
||||
|
||||
|
||||
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temperature, ps_voltage, pl_voltage) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
printout = (
|
||||
f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | "
|
||||
f"PL Voltage [mV] {pl_voltage}"
|
||||
)
|
||||
pw.dlog(printout)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
|
72
eive_tmtc/tmtc/health.py
Normal file
72
eive_tmtc/tmtc/health.py
Normal file
@ -0,0 +1,72 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.tmtc.obj_prompt import prompt_object
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice, FsfwHealth
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
SET_HEALTH = "set_health"
|
||||
ANNOUNCE_HEALTH_ALL = "read_health_all"
|
||||
ANNOUNCE_HEALTH = "read_health"
|
||||
|
||||
|
||||
class Info:
|
||||
SET_HEALTH = "Set health of specific object"
|
||||
ANNOUNCE_HEALTH_ALL = "Read all health states"
|
||||
ANNOUNCE_HEALTH = "Read health state of one object"
|
||||
|
||||
|
||||
def prompt_health() -> FsfwHealth:
|
||||
for item in FsfwHealth:
|
||||
print(f"{item}: {item.name}")
|
||||
health_idx = int(input("Please enter health by index: "))
|
||||
return FsfwHealth(health_idx)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.HEALTH)
|
||||
def pack_test_command(p: ServiceProviderParams):
|
||||
o = p.op_code
|
||||
q = p.queue_helper
|
||||
if o == OpCode.SET_HEALTH:
|
||||
app_data = bytearray(prompt_object())
|
||||
health = prompt_health()
|
||||
app_data.append(health)
|
||||
q.add_log_cmd(Info.SET_HEALTH)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201, subservice=Subservice.TC_SET_HEALTH, app_data=app_data
|
||||
)
|
||||
)
|
||||
elif o == OpCode.ANNOUNCE_HEALTH:
|
||||
app_data = bytearray(prompt_object())
|
||||
q.add_log_cmd(Info.ANNOUNCE_HEALTH)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201, subservice=Subservice.TC_ANNOUNCE_HEALTH, app_data=app_data
|
||||
)
|
||||
)
|
||||
elif o == OpCode.ANNOUNCE_HEALTH_ALL:
|
||||
q.add_log_cmd(Info.ANNOUNCE_HEALTH_ALL)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(service=201, subservice=Subservice.TC_ANNOUNCE_HEALTH_ALL)
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"unknown op code {o} for service {CustomServiceList.HEALTH}")
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_health_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.ANNOUNCE_HEALTH_ALL, Info.ANNOUNCE_HEALTH_ALL)
|
||||
oce.add(OpCode.ANNOUNCE_HEALTH, Info.ANNOUNCE_HEALTH)
|
||||
oce.add(OpCode.SET_HEALTH, Info.SET_HEALTH)
|
||||
defs.add_service(CustomServiceList.HEALTH, info="Health Service", op_code_entry=oce)
|
@ -7,7 +7,7 @@
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from eive_tmtc.config.object_ids import TEST_DEVICE_ID
|
||||
|
||||
TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
|
||||
@ -19,17 +19,17 @@ def pack_service_200_test_into(q: DefaultPusQueueHelper):
|
||||
obj_id = TEST_DEVICE_OBJ_ID
|
||||
# Set On Mode
|
||||
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, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
# Set Normal mode
|
||||
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, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
# Set Raw Mode
|
||||
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, Mode.RAW, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
# Set Off Mode
|
||||
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, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
43
eive_tmtc/tmtc/obj_prompt.py
Normal file
43
eive_tmtc/tmtc/obj_prompt.py
Normal file
@ -0,0 +1,43 @@
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACS_SUBSYSTEM_ID,
|
||||
ACS_CONTROLLER,
|
||||
IMTQ_HANDLER_ID,
|
||||
GYRO_0_ADIS_HANDLER_ID,
|
||||
GYRO_1_L3G_HANDLER_ID,
|
||||
ACS_BOARD_ASS_ID,
|
||||
RW_ASSEMBLY,
|
||||
SUS_BOARD_ASS_ID,
|
||||
)
|
||||
|
||||
SUBSYSTEM_DICT = {
|
||||
0: "acs",
|
||||
1: "tcs",
|
||||
2: "com",
|
||||
}
|
||||
|
||||
ACS_OBJ_DICT = {
|
||||
0: ("Subsystem", ACS_SUBSYSTEM_ID),
|
||||
1: ("SUS Assembly", SUS_BOARD_ASS_ID),
|
||||
2: ("ACS Board Assembly", ACS_BOARD_ASS_ID),
|
||||
3: ("RW Assembly", RW_ASSEMBLY),
|
||||
4: ("iMTQ MGT", IMTQ_HANDLER_ID),
|
||||
5: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID),
|
||||
6: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID),
|
||||
}
|
||||
|
||||
|
||||
def prompt_object() -> bytes:
|
||||
for k, v in SUBSYSTEM_DICT.items():
|
||||
print(f"{k}: {v}")
|
||||
subsystem_key = int(input("Please specify target subsystem by key: "))
|
||||
subsystem = SUBSYSTEM_DICT[subsystem_key]
|
||||
if subsystem is None:
|
||||
raise ValueError("invalid key")
|
||||
if subsystem == "acs":
|
||||
for k, v in ACS_OBJ_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
obj_key = int(input("Please specify target object by key: "))
|
||||
acs_obj = ACS_OBJ_DICT[obj_key]
|
||||
if acs_obj is None:
|
||||
raise ValueError("invalid key")
|
||||
return acs_obj[1]
|
@ -16,7 +16,7 @@ from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class ActionIds:
|
||||
class ActionId:
|
||||
DUMP_MRAM = 1
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ def pack_ploc_memory_dumper_cmd(
|
||||
def pack_mram_dump_cmd(object_id: bytes) -> bytearray:
|
||||
start = int(input("Start address: 0x"), 16)
|
||||
end = int(input("End address: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM)
|
||||
command = object_id + struct.pack("!I", ActionId.DUMP_MRAM)
|
||||
command = command + struct.pack("!I", start)
|
||||
command = command + struct.pack("!I", end)
|
||||
return bytearray(command)
|
||||
|
@ -6,6 +6,7 @@
|
||||
@author J. Meier
|
||||
@date 06.03.2021
|
||||
"""
|
||||
import logging
|
||||
import struct
|
||||
import enum
|
||||
|
||||
@ -16,14 +17,14 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MANUAL_INPUT = "1"
|
||||
|
||||
@ -37,16 +38,19 @@ mpsoc_file_dict = {
|
||||
"2": ["0:/flash", "0:/flash"],
|
||||
}
|
||||
|
||||
sequence_file_dict = {
|
||||
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
|
||||
SEQ_FILE_DICT = {
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"2": ["0:/EM16/231", "0:/EM16/231"],
|
||||
"3": ["0:/EQ04/E-75", "0:/EQ04/E-75"],
|
||||
"2": [f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"],
|
||||
"3": [f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"],
|
||||
"4": [f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"],
|
||||
}
|
||||
|
||||
|
||||
CARRIAGE_RETURN = 0xD
|
||||
|
||||
|
||||
class CommandIds(enum.IntEnum):
|
||||
class CommandId(enum.IntEnum):
|
||||
TC_MEM_WRITE = 1
|
||||
TC_MEM_READ = 2
|
||||
FLASH_WRITE = 9
|
||||
@ -64,6 +68,30 @@ class CommandIds(enum.IntEnum):
|
||||
RELEASE_UART_TX = 21
|
||||
|
||||
|
||||
class OpCode:
|
||||
ON = ["on"]
|
||||
OFF = ["off"]
|
||||
NORMAL = ["normal"]
|
||||
VERIFY_BOOT = ["verify_boot"]
|
||||
MODE_REPLAY = ["mode_replay"]
|
||||
MODE_IDLE = ["mode_idle"]
|
||||
REPLAY_WRITE_SEQ = ["replay_write"]
|
||||
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
||||
REPLAY_START = ["replay_start"]
|
||||
|
||||
|
||||
class Info:
|
||||
ON = "On"
|
||||
OFF = "Off"
|
||||
NORMAL = "Normal"
|
||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||
MODE_REPLAY = "Switch to REPLAY mode"
|
||||
MODE_IDLE = "Switch to IDLE mode"
|
||||
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||
REPLAY_START = "Replay Start"
|
||||
|
||||
|
||||
class MemAddresses(enum.IntEnum):
|
||||
DEADBEEF = 0x40000004
|
||||
|
||||
@ -76,22 +104,22 @@ class PlocReplyIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "Ploc MPSoC: Set mode off")
|
||||
oce.add("1", "Ploc MPSoC: Set mode on")
|
||||
oce.add("2", "Ploc MPSoC: Set mode normal")
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NORMAL, Info.NORMAL)
|
||||
oce.add("3", "Ploc MPSoC: Memory write")
|
||||
oce.add("4", "Ploc MPSoC: Memory read")
|
||||
oce.add("5", "Ploc MPSoC: Flash write")
|
||||
oce.add("6", "Ploc MPSoC: Flash delete")
|
||||
oce.add("7", "Ploc MPSoC: Replay start")
|
||||
oce.add(OpCode.REPLAY_START, Info.REPLAY_START)
|
||||
oce.add("8", "Ploc MPSoC: Replay stop")
|
||||
oce.add("9", "Ploc MPSoC: Downlink pwr on")
|
||||
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
|
||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
||||
oce.add("11", "Ploc MPSoC: Replay write sequence")
|
||||
oce.add(OpCode.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
|
||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||
oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add("14", "Ploc MPSoC: Mode replay")
|
||||
oce.add("15", "Ploc MPSoC: Mode idle")
|
||||
oce.add(OpCode.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add(OpCode.MODE_REPLAY, Info.MODE_REPLAY)
|
||||
oce.add(OpCode.MODE_IDLE, Info.MODE_IDLE)
|
||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
||||
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
||||
@ -102,22 +130,23 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||
q = p.queue_helper
|
||||
prefix = "PLOC MPSoC"
|
||||
op_code = p.op_code
|
||||
q.add_log_cmd(
|
||||
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode off")
|
||||
command = pack_mode_data(obyt, Modes.OFF, 0)
|
||||
if op_code in OpCode.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
command = pack_mode_data(obyt, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode on")
|
||||
data = pack_mode_data(obyt, Modes.ON, 0)
|
||||
if op_code in OpCode.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
data = pack_mode_data(obyt, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "2":
|
||||
q.add_log_cmd("PLOC MPSoC: Mode Normal")
|
||||
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
if op_code in OpCode.NORMAL:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
|
||||
data = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "3":
|
||||
q.add_log_cmd("PLOC MPSoC: TC mem write test")
|
||||
@ -143,64 +172,64 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("PLOC MPSoC: Flash delete")
|
||||
data = prepare_flash_delete_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "7":
|
||||
q.add_log_cmd("PLOC MPSoC: Replay start")
|
||||
if op_code in OpCode.REPLAY_START:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
|
||||
data = prepare_replay_start_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_REPLAY_STOP)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_REPLAY_STOP)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr on")
|
||||
if op_code in OpCode.DOWNLINK_PWR_ON:
|
||||
q.add_log_cmd(f"{prefix}: {OpCode.DOWNLINK_PWR_ON}")
|
||||
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "10":
|
||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_DOWNLINK_PWR_OFF)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("PLOC MPSoC: Replay write sequence")
|
||||
if op_code in OpCode.REPLAY_WRITE_SEQ:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
|
||||
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.OBSW_RESET_SEQ_COUNT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "13":
|
||||
if op_code in OpCode.VERIFY_BOOT:
|
||||
num_words = 1
|
||||
q.add_log_cmd("PLOC MPSoC: Read DEADBEEF address")
|
||||
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
||||
data = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", CommandIds.TC_MEM_READ)
|
||||
+ struct.pack("!I", CommandId.TC_MEM_READ)
|
||||
+ struct.pack("!I", MemAddresses.DEADBEEF)
|
||||
+ struct.pack("!H", num_words)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "14":
|
||||
if op_code in OpCode.MODE_REPLAY:
|
||||
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_REPLAY)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_REPLAY)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "15":
|
||||
if op_code in OpCode.MODE_IDLE:
|
||||
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_IDLE)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_IDLE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "16":
|
||||
q.add_log_cmd("PLOC MPSoC: Tc cam command send")
|
||||
cam_cmd = input("Specify cam command string: ")
|
||||
data = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", CommandIds.TC_CAM_CMD_SEND)
|
||||
+ struct.pack("!I", CommandId.TC_CAM_CMD_SEND)
|
||||
+ bytearray(cam_cmd, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "17":
|
||||
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.SET_UART_TX_TRISTATE)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.SET_UART_TX_TRISTATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "18":
|
||||
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.RELEASE_UART_TX)
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
|
||||
|
||||
@ -217,7 +246,7 @@ def generate_write_mem_command(
|
||||
"""
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_MEM_WRITE)
|
||||
+ struct.pack("!I", CommandId.TC_MEM_WRITE)
|
||||
+ struct.pack("!I", memory_address)
|
||||
+ struct.pack("!H", mem_len)
|
||||
+ struct.pack("!I", memory_data)
|
||||
@ -230,7 +259,7 @@ def prepare_mem_read_command(object_id: bytes) -> bytearray:
|
||||
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_MEM_READ)
|
||||
+ struct.pack("!I", CommandId.TC_MEM_READ)
|
||||
+ struct.pack("!I", memory_address)
|
||||
+ struct.pack("!H", num_words)
|
||||
)
|
||||
@ -242,7 +271,7 @@ def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
||||
mpsocFile = get_mpsoc_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.FLASH_WRITE)
|
||||
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
||||
+ bytearray(obcFile, "utf-8")
|
||||
+ bytearray(mpsocFile, "utf-8")
|
||||
)
|
||||
@ -253,7 +282,7 @@ def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
|
||||
file = get_mpsoc_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_FLASH_DELETE)
|
||||
+ struct.pack("!I", CommandId.TC_FLASH_DELETE)
|
||||
+ bytearray(file, "utf-8")
|
||||
)
|
||||
return bytearray(command)
|
||||
@ -263,7 +292,7 @@ def prepare_replay_start_cmd(object_id: bytes) -> bytearray:
|
||||
replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_REPLAY_START)
|
||||
+ struct.pack("!I", CommandId.TC_REPLAY_START)
|
||||
+ struct.pack("!B", replay)
|
||||
)
|
||||
return bytearray(command)
|
||||
@ -274,7 +303,7 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
|
||||
lane_rate = int(input("Specify lane rate (0 - 9): "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_ON)
|
||||
+ struct.pack("!I", CommandId.TC_DOWNLINK_PWR_ON)
|
||||
+ struct.pack("!B", mode)
|
||||
+ struct.pack("!B", lane_rate)
|
||||
)
|
||||
@ -282,20 +311,20 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
null_terminator = 0
|
||||
use_decoding = int(input("Use decoding (set to 1): "))
|
||||
file = get_sequence_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandIds.TC_REPLAY_WRITE_SEQUENCE)
|
||||
+ struct.pack("!I", CommandId.TC_REPLAY_WRITE_SEQUENCE)
|
||||
+ struct.pack("!B", use_decoding)
|
||||
+ bytearray(file, "utf-8")
|
||||
# + bytes([0])
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def get_obc_file() -> str:
|
||||
LOGGER.info("Specify OBC file ")
|
||||
_LOGGER.info("Specify OBC file ")
|
||||
input_helper = InputHelper(flash_write_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
@ -306,7 +335,7 @@ def get_obc_file() -> str:
|
||||
|
||||
|
||||
def get_mpsoc_file() -> str:
|
||||
LOGGER.info("Specify MPSoC file")
|
||||
_LOGGER.info("Specify MPSoC file")
|
||||
input_helper = InputHelper(mpsoc_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
@ -317,11 +346,11 @@ def get_mpsoc_file() -> str:
|
||||
|
||||
|
||||
def get_sequence_file() -> str:
|
||||
LOGGER.info("Specify sequence file")
|
||||
input_helper = InputHelper(sequence_file_dict)
|
||||
_LOGGER.info("Specify sequence file")
|
||||
input_helper = InputHelper(SEQ_FILE_DICT)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
file = input("Ploc MPSoC: Specify absolute name file: ")
|
||||
else:
|
||||
file = sequence_file_dict[key][1]
|
||||
file = SEQ_FILE_DICT[key][1]
|
||||
return file
|
||||
|
@ -7,6 +7,7 @@
|
||||
@date 10.07.2021
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.object_ids import PLOC_SUPV_ID, get_object_ids
|
||||
@ -16,15 +17,14 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
latchup_id_dict = {
|
||||
"0": "0.85V",
|
||||
@ -64,7 +64,26 @@ event_buffer_path_dict = {
|
||||
}
|
||||
|
||||
|
||||
class SupvActionIds:
|
||||
FACTORY_RESET_OPS = {
|
||||
0x00: "CLEAR_MRAM_EVENT_BUF",
|
||||
0x01: "CLEAR_MRAM_ADC_BUF",
|
||||
0x02: "FACTORY_DEFAULT_MRAM_SYS_CFG",
|
||||
0x03: "FACTORY_DEFAULT_MRAM_DBG_CFG",
|
||||
0x04: "FACTORY_DEFAULT_BOOTMAN_CFG",
|
||||
0x05: "FACTORY_DEFAULT_DATA_LOGGER",
|
||||
0x06: "DATA_LOGGER_OP_DATA_TO_ZERO",
|
||||
0x07: "FACTORY_DEFAULT_MRAM_LATCHUP_MON",
|
||||
0x08: "FACTORY_DEFAULT_ADC_MON_CFG",
|
||||
0x09: "FACTORY_DEFAULT_WATCHDOG_MON_CFG",
|
||||
0x0A: "FACTORY_DEFAULT_HK_CFG",
|
||||
0x0B: "FACTORY_DEFAULT_MEM_MAN_CFG",
|
||||
0x10: "REDWIRE_TASK_1",
|
||||
0x11: "REDWIRE_TASK_2",
|
||||
0x12: "REDWIRE_TASK_3",
|
||||
}
|
||||
|
||||
|
||||
class SupvActionId:
|
||||
HK_REPORT = 1
|
||||
START_MPSOC = 3
|
||||
SHUTWOWN_MPSOC = 4
|
||||
@ -92,11 +111,8 @@ class SupvActionIds:
|
||||
SET_GPIO = 34
|
||||
READ_GPIO = 35
|
||||
RESTART_SUPERVISOR = 36
|
||||
FACTORY_RESET_CLEAR_ALL = 37
|
||||
LOGGING_REQUEST_COUNTERS = 38
|
||||
UPDATE_IMAGE_DATA = 39
|
||||
FACTORY_RESET_CLEAR_MIRROR = 40
|
||||
FACTORY_RESET_CLEAR_CIRCULAR = 41
|
||||
FACTORY_RESET = 39
|
||||
START_MPSOC_QUIET = 45
|
||||
SET_SHUTDOWN_TIMEOUT = 46
|
||||
FACTORY_FLASH = 47
|
||||
@ -114,7 +130,7 @@ class SupvActionIds:
|
||||
MEM_CHECK = 61
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetIds(enum.IntEnum):
|
||||
HK_REPORT = 102
|
||||
BOOT_STATUS_REPORT = 103
|
||||
|
||||
@ -133,6 +149,7 @@ class OpCodes:
|
||||
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
|
||||
START_UPDATE = ["42", "start_update"]
|
||||
PERFORM_UPDATE = ["update"]
|
||||
FACTORY_RESET = ["factory_reset"]
|
||||
MEM_CHECK = ["mem_check"]
|
||||
|
||||
|
||||
@ -147,6 +164,7 @@ class Info(str, enum.Enum):
|
||||
FACTORY_FLASH = "Factory Flash Mode"
|
||||
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
||||
START_UPDATE = "Start new MPSoC SW update"
|
||||
FACTORY_RESET = "Factory Reset of loggers"
|
||||
REQ_BOOT_STATUS_REPORT = "Request boot status report and HK"
|
||||
MEM_CHECK = "Memory Check"
|
||||
SEL_NVM = "Select NVM"
|
||||
@ -165,6 +183,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add(OpCodes.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
||||
oce.add(OpCodes.SEL_NVM, Info.SEL_NVM)
|
||||
oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF)
|
||||
oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET)
|
||||
oce.add("8", "PLOC Supervisor: Set max restart tries")
|
||||
oce.add("9", "PLOC Supervisor: Reset MPSoC")
|
||||
oce.add("11", "PLOC Supervisor: Set boot timeout")
|
||||
@ -183,9 +202,6 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add("35", "PLOC Supervisor: Set GPIO")
|
||||
oce.add("36", "PLOC Supervisor: Read GPIO")
|
||||
oce.add("37", "PLOC Supervisor: Restart supervisor")
|
||||
oce.add("38", "PLOC Supervisor: Factory reset clear all")
|
||||
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
|
||||
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
|
||||
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
|
||||
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
|
||||
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
|
||||
@ -216,19 +232,19 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
prefix = "PLOC Supervisor"
|
||||
if op_code in OpCodes.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.NORMAL:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NML}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.HK_TO_OBC:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.HK_REPORT)
|
||||
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.REQUEST_HK:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}")
|
||||
@ -237,11 +253,11 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(cmd)
|
||||
elif op_code in OpCodes.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC)
|
||||
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SHUTDOWN_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SHUTWOWN_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SEL_NVM:
|
||||
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
||||
@ -251,40 +267,58 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
bp2 = int(input("BP2 (0 or 1): "))
|
||||
command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.FACTORY_RESET:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
|
||||
key = -1
|
||||
while True:
|
||||
print("Please select the key for a factory reset operation")
|
||||
for key, val in FACTORY_RESET_OPS.items():
|
||||
print(f"{key}: {val}")
|
||||
key = int(input("Key Select: "))
|
||||
if key not in FACTORY_RESET_OPS:
|
||||
print("Key invalid!")
|
||||
break
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=PLOC_SUPV_ID,
|
||||
action_id=SupvActionId.FACTORY_RESET,
|
||||
user_data=bytes([key]),
|
||||
)
|
||||
)
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("PLOC Supervisor: Set max restart tries")
|
||||
restart_tries = int(input("Specify maximum restart tries: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
|
||||
+ struct.pack("!I", SupvActionId.SET_MAX_RESTART_TRIES)
|
||||
+ struct.pack("!B", restart_tries)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("PLOC Supervisor: Reset MPSoC")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_MPSOC)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SET_TIME_REF:
|
||||
q.add_log_cmd("PLOC Supervisor: Set time reference")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SET_TIME_REF)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("PLOC Supervisor: Set boot timeout")
|
||||
boot_timeout = int(input("Specify boot timeout [ms]: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
|
||||
+ struct.pack("!I", SupvActionId.SET_BOOT_TIMEOUT)
|
||||
+ struct.pack("!I", boot_timeout)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("PLOC Supervisor: Disable HK")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_HK)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_HK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.REQ_BOOT_STATUS_REPORT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.GET_BOOT_STATUS_REPORT
|
||||
"!I", SupvActionId.GET_BOOT_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_wait_seconds(2.0)
|
||||
@ -318,13 +352,13 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
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
|
||||
"!I", SupvActionId.GET_LATCHUP_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "27":
|
||||
q.add_log_cmd("PLOC Supervisor: Copy ADC data to MRAM")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM
|
||||
"!I", SupvActionId.COPY_ADC_DATA_TO_MRAM
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "30":
|
||||
@ -346,25 +380,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "37":
|
||||
q.add_log_cmd("PLOC Supervisor: Restart supervisor")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.RESTART_SUPERVISOR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "38":
|
||||
q.add_log_cmd("PLOC Supervisor: Factory reset clear all")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "39":
|
||||
q.add_log_cmd("PLOC Supervisor: Factory reset clear mirror entries")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "40":
|
||||
q.add_log_cmd("PLOC Supervisor: Factory reset clear circular entries")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
|
||||
"!I", SupvActionId.RESTART_SUPERVISOR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.START_UPDATE:
|
||||
@ -378,14 +394,12 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "43":
|
||||
q.add_log_cmd("PLOC Supervisor: Terminate supervisor process")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.TERMINATE_SUPV_HELPER
|
||||
"!I", SupvActionId.TERMINATE_SUPV_HELPER
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "44":
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC quiet")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.START_MPSOC_QUIET
|
||||
)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.START_MPSOC_QUIET)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "45":
|
||||
q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
|
||||
@ -393,15 +407,15 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.FACTORY_FLASH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FACTORY_FLASH}")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.FACTORY_FLASH)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.FACTORY_FLASH)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "47":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable auto TM")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.ENABLE_AUTO_TM)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.ENABLE_AUTO_TM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "48":
|
||||
q.add_log_cmd("PLOC Supervisor: Disable auto TM")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_AUTO_TM)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_AUTO_TM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "51":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging request event buffers")
|
||||
@ -410,7 +424,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
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
|
||||
"!I", SupvActionId.LOGGING_CLEAR_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "53":
|
||||
@ -420,18 +434,18 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
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
|
||||
"!I", SupvActionId.LOGGING_REQUEST_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "55":
|
||||
q.add_log_cmd("PLOC Supervisor: Request ADC report")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.REQUEST_ADC_REPORT
|
||||
"!I", SupvActionId.REQUEST_ADC_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "56":
|
||||
q.add_log_cmd("PLOC Supervisor: Reset PL")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_PL)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_PL)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "57":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable NVMs")
|
||||
@ -439,14 +453,14 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.ENABLE_NVMS)
|
||||
+ struct.pack("!I", SupvActionId.ENABLE_NVMS)
|
||||
+ struct.pack("B", nvm01)
|
||||
+ struct.pack("B", nvm3)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "58":
|
||||
q.add_log_cmd("PLOC Supervisor: Continue update")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.CONTINUE_UPDATE)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.MEM_CHECK:
|
||||
custom_data = bytearray()
|
||||
@ -461,8 +475,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID {memory_id} at start "
|
||||
f"address {start_address}"
|
||||
)
|
||||
command = make_fsfw_action_cmd(
|
||||
object_id.as_bytes, SupvActionIds.MEM_CHECK, custom_data
|
||||
command = create_action_cmd(
|
||||
object_id.as_bytes, SupvActionId.MEM_CHECK, custom_data
|
||||
)
|
||||
q.add_pus_tc(command)
|
||||
|
||||
@ -477,7 +491,7 @@ def pack_sel_boot_image_cmd(
|
||||
@param bp1 Partition pin 1
|
||||
@param bp2 Partition pin 2
|
||||
"""
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = command + struct.pack("!B", mem)
|
||||
command = command + struct.pack("!B", bp0)
|
||||
command = command + struct.pack("!B", bp1)
|
||||
@ -495,7 +509,7 @@ def pack_update_available_cmd(object_id: bytes) -> bytearray:
|
||||
image_size = 222
|
||||
image_crc = 0x0
|
||||
number_of_packets = 150
|
||||
command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.UPDATE_AVAILABLE)
|
||||
command = command + struct.pack("!B", image_select)
|
||||
command = command + struct.pack("!B", image_partition)
|
||||
command = command + struct.pack("!I", image_size)
|
||||
@ -513,9 +527,9 @@ def pack_lachtup_alert_cmd(object_id: bytes, state: bool) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
command = bytearray()
|
||||
if state:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_LATCHUP_ALERT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.ENABLE_LATCHUP_ALERT)
|
||||
else:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.DISABLE_LATCHUP_ALERT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
return bytearray(command)
|
||||
|
||||
@ -544,7 +558,7 @@ def pack_set_alert_limit_cmd(object_id: bytes) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
dutycycle = int(input("Specify dutycycle: "))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ALERT_LIMIT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!I", dutycycle)
|
||||
return bytearray(command)
|
||||
@ -556,7 +570,7 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytes) -> bytearray:
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
"""
|
||||
ch = int(input("Specify ch: 0x"), 16)
|
||||
cmd = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
|
||||
cmd = object_id + struct.pack("!I", SupvActionId.SET_ADC_ENABLED_CHANNELS)
|
||||
cmd = cmd + struct.pack("!H", ch)
|
||||
return bytearray(cmd)
|
||||
|
||||
@ -564,7 +578,7 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_set_adc_window_and_stride_cmd(object_id: bytes) -> bytearray:
|
||||
window_size = int(input("Specify window size: "))
|
||||
striding_step_size = int(input("Specify striding step size: "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = command + struct.pack("!H", window_size)
|
||||
command = command + struct.pack("!H", striding_step_size)
|
||||
return bytearray(command)
|
||||
@ -572,21 +586,21 @@ def pack_set_adc_window_and_stride_cmd(object_id: bytes) -> bytearray:
|
||||
|
||||
def pack_set_adc_threshold_cmd(object_id: bytes) -> bytearray:
|
||||
threshold = int(input("Specify threshold: "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ADC_THRESHOLD)
|
||||
command = command + struct.pack("!I", threshold)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_select_nvm_cmd(object_id: bytes) -> bytearray:
|
||||
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1): "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SELECT_NVM)
|
||||
command = command + struct.pack("!B", mem)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_auto_em_tests_cmd(object_id: bytes) -> bytearray:
|
||||
test = int(input("Specify test (1 - complete, 2 - short): "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
|
||||
command = object_id + struct.pack("!I", SupvActionId.RUN_AUTO_EM_TESTS)
|
||||
command = command + struct.pack("!B", test)
|
||||
return bytearray(command)
|
||||
|
||||
@ -594,7 +608,7 @@ def pack_auto_em_tests_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_mram_wipe_cmd(object_id: bytes) -> bytearray:
|
||||
start = int(input("Start address: 0x"), 16)
|
||||
stop = int(input("Stop address: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
|
||||
command = object_id + struct.pack("!I", SupvActionId.WIPE_MRAM)
|
||||
command = command + struct.pack("!I", start)
|
||||
command = command + struct.pack("!I", stop)
|
||||
return bytearray(command)
|
||||
@ -626,7 +640,7 @@ def pack_update_command(object_id: bytes, new_update: bool) -> bytearray:
|
||||
else:
|
||||
raise ValueError("Invalid input, use y or n")
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
|
||||
command += struct.pack("!I", SupvActionId.PERFORM_UPDATE)
|
||||
command += bytearray(update_file, "utf-8")
|
||||
# Adding null terminator
|
||||
command += struct.pack("!B", 0)
|
||||
@ -641,7 +655,7 @@ def pack_update_command(object_id: bytes, new_update: bool) -> bytearray:
|
||||
def pack_set_shutdown_timeout_command(object_id: bytes) -> bytearray:
|
||||
command = bytearray()
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.SET_SHUTDOWN_TIMEOUT)
|
||||
command += struct.pack("!I", SupvActionId.SET_SHUTDOWN_TIMEOUT)
|
||||
timeout = int(input("Specify shutdown timeout (ms): "))
|
||||
command += struct.pack("!I", timeout)
|
||||
return command
|
||||
@ -650,7 +664,7 @@ def pack_set_shutdown_timeout_command(object_id: bytes) -> bytearray:
|
||||
def pack_logging_buffer_request(object_id: bytes) -> bytearray:
|
||||
command = bytearray()
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
|
||||
command += struct.pack("!I", SupvActionId.LOGGING_REQUEST_EVENT_BUFFERS)
|
||||
path = get_event_buffer_path()
|
||||
command += bytearray(path, "utf-8")
|
||||
return command
|
||||
@ -660,7 +674,7 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
port = int(input("Specify port: 0x"), 16)
|
||||
pin = int(input("Specify pin: 0x"), 16)
|
||||
val = int(input("Specify val: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
command = command + struct.pack("!B", val)
|
||||
@ -670,21 +684,21 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_read_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
port = int(input("Specify port: 0x"), 16)
|
||||
pin = int(input("Specify pin: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
|
||||
command = object_id + struct.pack("!I", SupvActionId.READ_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_logging_set_topic(object_id: bytes) -> bytearray:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.LOGGING_SET_TOPIC)
|
||||
command = object_id + struct.pack("!I", SupvActionId.LOGGING_SET_TOPIC)
|
||||
tpc = int(input("Specify logging topic: "))
|
||||
command += struct.pack("!B", tpc)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def get_update_file() -> str:
|
||||
LOGGER.info("Specify update file ")
|
||||
_LOGGER.info("Specify update file ")
|
||||
input_helper = InputHelper(update_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == HARDCODED:
|
||||
@ -697,7 +711,7 @@ def get_update_file() -> str:
|
||||
|
||||
|
||||
def get_event_buffer_path() -> str:
|
||||
LOGGER.info("Specify path where to store event buffer file ")
|
||||
_LOGGER.info("Specify path where to store event buffer file ")
|
||||
input_helper = InputHelper(event_buffer_path_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
|
@ -8,21 +8,23 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data, Modes
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId:
|
||||
HK = 3
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
ON = ["0", "on"]
|
||||
NORMAL = ["1", "normal"]
|
||||
OFF = ["2", "off"]
|
||||
@ -40,7 +42,7 @@ class Info:
|
||||
DEBUG_OFF = "Switch debug output off"
|
||||
|
||||
|
||||
class CommandIds:
|
||||
class CommandId:
|
||||
START_CONVERSIONS = 2
|
||||
READ_CONVERSIONS = 3
|
||||
ENABLE_DEBUG_OUTPUT = 4
|
||||
@ -50,12 +52,12 @@ class CommandIds:
|
||||
@tmtc_definitions_provider
|
||||
def add_rad_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=Info.ON, keys=OpCodes.ON)
|
||||
oce.add(info=Info.OFF, keys=OpCodes.OFF)
|
||||
oce.add(info=Info.NORMAL, keys=OpCodes.NORMAL)
|
||||
oce.add(info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE)
|
||||
oce.add(info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON)
|
||||
oce.add(info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF)
|
||||
oce.add(info=Info.ON, keys=OpCode.ON)
|
||||
oce.add(info=Info.OFF, keys=OpCode.OFF)
|
||||
oce.add(info=Info.NORMAL, keys=OpCode.NORMAL)
|
||||
oce.add(info=Info.REQ_OS_HK, keys=OpCode.REQ_HK_ONCE)
|
||||
oce.add(info=Info.DEBUG_ON, keys=OpCode.DEBUG_ON)
|
||||
oce.add(info=Info.DEBUG_OFF, keys=OpCode.DEBUG_OFF)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RAD_SENSOR.value,
|
||||
info="Radiation Sensor",
|
||||
@ -68,32 +70,49 @@ def pack_rad_sensor_test_into(
|
||||
):
|
||||
q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
|
||||
|
||||
if op_code in OpCodes.ON:
|
||||
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, q)
|
||||
if op_code in OpCodes.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCodes.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, q)
|
||||
if op_code in OpCodes.REQ_HK_ONCE:
|
||||
if op_code in OpCode.ON:
|
||||
rad_sensor_mode_cmd(object_id, Mode.ON, Info.ON, q)
|
||||
if op_code in OpCode.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Mode.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCode.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Mode.OFF, Info.OFF, q)
|
||||
if op_code in OpCode.REQ_HK_ONCE:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetIds.HK))
|
||||
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetId.HK))
|
||||
)
|
||||
if op_code in OpCodes.DEBUG_ON:
|
||||
if op_code in OpCode.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", CommandId.ENABLE_DEBUG_OUTPUT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.DEBUG_OFF:
|
||||
if op_code in OpCode.DEBUG_OFF:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", CommandIds.DISABLE_DEBUG_OUTPUT
|
||||
)
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandId.DISABLE_DEBUG_OUTPUT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def rad_sensor_mode_cmd(
|
||||
object_id: ObjectIdU32, mode: Modes, info: str, q: DefaultPusQueueHelper
|
||||
object_id: ObjectIdU32, mode: Mode, info: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
q.add_log_cmd(f"Rad sensor: {info}")
|
||||
mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
|
||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received Radiation Sensor HK data")
|
||||
fmt_str = "!fHHHHHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in ain_dict.items():
|
||||
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||
current_idx += inc_len
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
@ -5,10 +5,10 @@ from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
|
||||
@ -16,7 +16,7 @@ from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
USE_SCEX_CONF_FILE = True
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
PING = ["0", "ping"]
|
||||
ION_CMD = ["1", "ion"]
|
||||
TEMP_CMD = ["2", "temp"]
|
||||
@ -30,7 +30,7 @@ class OpCodes:
|
||||
SWITCH_OFF = ["8", "off"]
|
||||
|
||||
|
||||
class ActionIds(enum.IntEnum):
|
||||
class ActionId(enum.IntEnum):
|
||||
PING = 7
|
||||
ION_CMD = 4
|
||||
TEMP_CMD = 3
|
||||
@ -58,16 +58,16 @@ class Info:
|
||||
@tmtc_definitions_provider
|
||||
def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.PING, info=Info.PING)
|
||||
oce.add(keys=OpCodes.ION_CMD, info=Info.ION_CMD)
|
||||
oce.add(keys=OpCodes.TEMP_CMD, info=Info.TEMP_CMD)
|
||||
oce.add(keys=OpCodes.EXP_STATUS_CMD, info=Info.EXP_STATUS_CMD)
|
||||
oce.add(keys=OpCodes.ONE_CELLS_CMD, info=Info.ONE_CELLS_CMD)
|
||||
oce.add(keys=OpCode.PING, info=Info.PING)
|
||||
oce.add(keys=OpCode.ION_CMD, info=Info.ION_CMD)
|
||||
oce.add(keys=OpCode.TEMP_CMD, info=Info.TEMP_CMD)
|
||||
oce.add(keys=OpCode.EXP_STATUS_CMD, info=Info.EXP_STATUS_CMD)
|
||||
oce.add(keys=OpCode.ONE_CELLS_CMD, info=Info.ONE_CELLS_CMD)
|
||||
|
||||
oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCodes.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCode.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCode.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCode.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCode.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
|
||||
@ -78,48 +78,46 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_scex_cmds(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in OpCodes.SWITCH_ON:
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
q.add_log_cmd(Info.SWITCH_ON)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.ON, 0),
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.ON, 0),
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.SWITCH_OFF:
|
||||
if op_code in OpCode.SWITCH_OFF:
|
||||
q.add_log_cmd(Info.SWITCH_OFF)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.OFF, 0),
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.OFF, 0),
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.PING:
|
||||
if op_code in OpCode.PING:
|
||||
q.add_log_cmd(Info.PING)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.PING, app_data))
|
||||
if op_code in OpCodes.ION_CMD:
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.PING, app_data))
|
||||
if op_code in OpCode.ION_CMD:
|
||||
q.add_log_cmd(Info.ION_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ION_CMD, app_data))
|
||||
if op_code in OpCodes.TEMP_CMD:
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.ION_CMD, app_data))
|
||||
if op_code in OpCode.TEMP_CMD:
|
||||
q.add_log_cmd(Info.TEMP_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.TEMP_CMD, app_data)
|
||||
)
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.TEMP_CMD, app_data))
|
||||
|
||||
if op_code in OpCodes.EXP_STATUS_CMD:
|
||||
if op_code in OpCode.EXP_STATUS_CMD:
|
||||
q.add_log_cmd(Info.EXP_STATUS_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.EXP_STATUS_CMD, app_data)
|
||||
create_action_cmd(SCEX_HANDLER_ID, ActionId.EXP_STATUS_CMD, app_data)
|
||||
)
|
||||
|
||||
# one cell
|
||||
if op_code in OpCodes.ONE_CELLS_CMD:
|
||||
if op_code in OpCode.ONE_CELLS_CMD:
|
||||
q.add_log_cmd(Info.ONE_CELLS_CMD)
|
||||
app_data = bytearray([0])
|
||||
|
||||
@ -164,10 +162,10 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
app_data.append(dac_weight3[cn])
|
||||
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ONE_CELLS_CMD, app_data)
|
||||
create_action_cmd(SCEX_HANDLER_ID, ActionId.ONE_CELLS_CMD, app_data)
|
||||
)
|
||||
|
||||
if op_code in OpCodes.ALL_CELLS_CMD:
|
||||
if op_code in OpCode.ALL_CELLS_CMD:
|
||||
q.add_log_cmd(Info.ALL_CELLS_CMD)
|
||||
app_data = bytearray([0])
|
||||
|
||||
@ -196,13 +194,13 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
app_data.append(dac_weight3[cn])
|
||||
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.ALL_CELLS_CMD, app_data)
|
||||
create_action_cmd(SCEX_HANDLER_ID, ActionId.ALL_CELLS_CMD, app_data)
|
||||
)
|
||||
|
||||
if op_code in OpCodes.FRAM:
|
||||
if op_code in OpCode.FRAM:
|
||||
q.add_log_cmd(Info.FRAM)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(make_fsfw_action_cmd(SCEX_HANDLER_ID, ActionIds.FRAM, app_data))
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.FRAM, app_data))
|
||||
|
||||
|
||||
def append_16_bit_val(packet: bytearray, val: int):
|
@ -9,25 +9,30 @@ from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservices as ModeSubservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservice
|
||||
|
||||
|
||||
class OpCodes(str, enum.Enum):
|
||||
class ModeId:
|
||||
OFF = 0
|
||||
SUPV_ONLY = 10
|
||||
MPSOC_STREAM = 11
|
||||
CAM_STREAM = 12
|
||||
EARTH_OBSV = 13
|
||||
SCEX = 14
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
||||
OFF = "off"
|
||||
REPORT_ALL_MODES = "report_modes"
|
||||
|
||||
|
||||
class PayloadModes(enum.IntEnum):
|
||||
OFF = 0
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
OFF = "Off Command"
|
||||
REPORT_ALL_MODES = "Report all modes"
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, str]] = {
|
||||
OpCodes.OFF: (PayloadModes.OFF, Info.OFF),
|
||||
OpCode.OFF: (ModeId.OFF, Info.OFF),
|
||||
}
|
||||
|
||||
|
||||
@ -36,12 +41,12 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
info_prefix = "ACS Subsystem"
|
||||
if op_code in OpCodes.REPORT_ALL_MODES:
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=ModeSubservices.TC_MODE_ANNOUNCE_RECURSIVE,
|
||||
subservice=ModeSubservice.TC_MODE_ANNOUNCE_RECURSIVE,
|
||||
app_data=PL_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
@ -60,6 +65,6 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
@tmtc_definitions_provider
|
||||
def add_payload_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.PL_SS, "Payload Subsystem", oce)
|
@ -12,7 +12,7 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
add_gomspace_cmd_defs,
|
||||
req_hk_cmds,
|
||||
pack_common_power_cmds,
|
||||
SetIds,
|
||||
SetId,
|
||||
OBC_ENDIANNESS,
|
||||
unpack_array_in_data,
|
||||
)
|
||||
@ -42,7 +42,7 @@ class ACUHkTable:
|
||||
wdt_gnd_left = gs.TableEntry(bytearray([0x00, 0x74]), gs.TableEntry.uint32_size)
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
TEST = ["0", "test"]
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ def add_acu_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
add_gomspace_cmd_defs(oce)
|
||||
|
||||
oce.add(keys=OpCodes.TEST, info=Info.TEST)
|
||||
oce.add(keys=OpCode.TEST, info=Info.TEST)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.ACU.value,
|
||||
info="ACU Device",
|
||||
@ -72,7 +72,7 @@ def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
|
||||
|
||||
def acu_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
req_hk_cmds("ACU", q, op_code, ACU_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
|
||||
req_hk_cmds("ACU", q, op_code, ACU_HANDLER_ID, [SetId.CORE, SetId.AUX])
|
||||
|
||||
|
||||
class ACUTestProcedure:
|
||||
|
175
eive_tmtc/tmtc/power/bpx_batt.py
Normal file
175
eive_tmtc/tmtc/power/bpx_batt.py
Normal file
@ -0,0 +1,175 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import BPX_HANDLER_ID
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class BpxSetId(enum.IntEnum):
|
||||
GET_HK_SET = 0
|
||||
GET_CFG_SET = 5
|
||||
|
||||
|
||||
class BpxActionId:
|
||||
REBOOT = 2
|
||||
RESET_COUNTERS = 3
|
||||
SET_CFG = 4
|
||||
GET_CFG = 5
|
||||
|
||||
|
||||
class BpxOpCode:
|
||||
HK = ["0", "hk"]
|
||||
OFF = ["off"]
|
||||
ON = ["on"]
|
||||
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
|
||||
REQUEST_CFG = ["2", "cfg"]
|
||||
REQUEST_CFG_HK = ["3", "cfg_hk"]
|
||||
REBOOT = ["4", "reboot"]
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=BpxOpCode.ON, info="On command")
|
||||
oce.add(keys=BpxOpCode.OFF, info="Off command")
|
||||
oce.add(keys=BpxOpCode.HK, info="Request BPX HK")
|
||||
oce.add(keys=BpxOpCode.RST_BOOT_CNT, info="Reset Boot Count")
|
||||
oce.add(keys=BpxOpCode.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
|
||||
oce.add(
|
||||
keys=BpxOpCode.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
oce.add(keys=BpxOpCode.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.BPX_BATTERY.value)
|
||||
def pack_bpx_commands(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in BpxOpCode.HK:
|
||||
q.add_log_cmd("Requesting BPX battery HK set")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_HK_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCode.OFF:
|
||||
q.add_log_cmd("Off mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.OFF, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=ModeSubservices.TC_MODE_COMMAND,
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCode.ON:
|
||||
q.add_log_cmd("On mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.ON, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=ModeSubservices.TC_MODE_COMMAND,
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCode.RST_BOOT_CNT:
|
||||
q.add_log_cmd("Resetting reboot counters")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionId.RESET_COUNTERS
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCode.REQUEST_CFG:
|
||||
q.add_log_cmd("Requesting configuration struct")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.GET_CFG)
|
||||
)
|
||||
if op_code in BpxOpCode.REQUEST_CFG_HK:
|
||||
q.add_log_cmd("Requesting configuration struct HK")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_CFG_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCode.REBOOT:
|
||||
q.add_log_cmd("Rebooting BPX battery")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)
|
||||
)
|
||||
|
||||
|
||||
HEADER_LIST = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause",
|
||||
]
|
||||
|
||||
|
||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if set_id == BpxSetId.GET_HK_SET:
|
||||
fmt_str = "!HHHHhhhhIB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
) = struct.unpack(fmt_str, hk_data[0:inc_len])
|
||||
content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
]
|
||||
validity_buffer = hk_data[inc_len:]
|
||||
pw.dlog(str(HEADER_LIST))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
||||
elif set_id == BpxSetId.GET_CFG_SET:
|
||||
battheat_mode = hk_data[0]
|
||||
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
||||
battheat_high = struct.unpack("!b", hk_data[2:3])[0]
|
||||
header_list = [
|
||||
"Battery Heater Mode",
|
||||
"Battery Heater Low Limit",
|
||||
"Battery Heater High Limit",
|
||||
]
|
||||
content_list = [battheat_mode, battheat_low, battheat_high]
|
||||
validity_buffer = hk_data[3:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
@ -1,15 +1,17 @@
|
||||
import enum
|
||||
import struct
|
||||
from typing import List
|
||||
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
pack_set_u8_param_command,
|
||||
Channel,
|
||||
GomspaceDeviceActionIds,
|
||||
GomspaceDeviceActionId,
|
||||
prompt_and_pack_set_integer_param_command,
|
||||
prompt_and_pack_get_param_command,
|
||||
pack_request_config_command,
|
||||
pack_gnd_wdt_reset_command,
|
||||
ParamTypes,
|
||||
pack_reboot_command,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import OUT_ENABLE_LIST
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
@ -22,17 +24,18 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
enable_periodic_hk_command_with_interval,
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
class GomspaceOpCodes:
|
||||
class GomspaceOpCode:
|
||||
GET_PARAM = ["get_param"]
|
||||
SET_INTEGER_PARAM = ["set_int_param"]
|
||||
SAVE_TABLE = ["save_table"]
|
||||
RESET_GND_WATCHDOG = ["reset_gnd_wdt"]
|
||||
SAVE_TABLE_DEFAULT = ["save_table_default"]
|
||||
LOAD_TABLE = ["load_table"]
|
||||
REBOOT = ["reboot"]
|
||||
REQUEST_CONFIG_TABLE = ["cfg_table"]
|
||||
|
||||
|
||||
@ -44,12 +47,15 @@ class GsInfo:
|
||||
SAVE_TABLE = "Save table non-volatile (file)"
|
||||
SAVE_TABLE_DEFAULT = "Save table non-volatile (default)"
|
||||
LOAD_TABLE = "Load Table"
|
||||
REBOOT = "Reboot PCDU module"
|
||||
|
||||
|
||||
class PowerInfo:
|
||||
INFO_CORE = "Core Information"
|
||||
INFO_AUX = "Auxiliary Information"
|
||||
SWITCHER_HK = "Switcher State Information"
|
||||
INFO_ALL = "All Information"
|
||||
REQUEST_SWITCHER_SET = "Request Switcher Information"
|
||||
ENABLE_INFO_HK = "Enable Core Info HK"
|
||||
DISABLE_INFO_HK = "Disable Core Info HK"
|
||||
RESET_ALL_GND_WDTS = "Reset all Ground Watchdogs"
|
||||
@ -96,7 +102,9 @@ class PowerOpCodes:
|
||||
PL_CAM_ON = ["cam_on"]
|
||||
PL_CAM_OFF = ["cam_off"]
|
||||
|
||||
REBOOT = ["reboot"]
|
||||
INFO_CORE = ["info"]
|
||||
SWITCHER_HK = ["switcher_states"]
|
||||
ENABLE_INFO_HK = ["info_hk_on"]
|
||||
DISABLE_INFO_HK = ["info_hk_off"]
|
||||
INFO_AUX = ["info_aux"]
|
||||
@ -109,7 +117,7 @@ class PowerOpCodes:
|
||||
PRINT_LATCHUPS = ["print_latchups"]
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId(enum.IntEnum):
|
||||
CORE = 1
|
||||
AUX = 2
|
||||
CONFIG = 3
|
||||
@ -123,13 +131,13 @@ def pack_common_power_cmds(
|
||||
interval = float(input("Specify HK interval in floating point seconds: "))
|
||||
q.add_log_cmd(f"{prefix}: {PowerInfo.ENABLE_INFO_HK} with interval {interval}")
|
||||
cmds = enable_periodic_hk_command_with_interval(
|
||||
True, make_sid(objb, SetIds.CORE), interval
|
||||
True, make_sid(objb, SetId.CORE), interval
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in PowerOpCodes.DISABLE_INFO_HK:
|
||||
q.add_log_cmd(f"{prefix}: {PowerInfo.DISABLE_INFO_HK}")
|
||||
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetIds.CORE)))
|
||||
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetId.CORE)))
|
||||
|
||||
|
||||
def pack_common_gomspace_cmds(
|
||||
@ -139,31 +147,34 @@ def pack_common_gomspace_cmds(
|
||||
if op_code in PowerOpCodes.PRINT_SWITCH_V_I:
|
||||
q.add_log_cmd(f"{prefix}: {PowerInfo.PRINT_SWITCH_V_I}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
create_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionId.PRINT_SWITCH_V_I
|
||||
)
|
||||
)
|
||||
if op_code in PowerOpCodes.REBOOT:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.REBOOT}")
|
||||
q.add_pus_tc(pack_reboot_command(object_id))
|
||||
if op_code in PowerOpCodes.PRINT_LATCHUPS:
|
||||
q.add_log_cmd(f"{prefix}: {PowerInfo.PRINT_LATCHUPS}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
|
||||
create_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionId.PRINT_LATCHUPS
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.SET_INTEGER_PARAM:
|
||||
if op_code in GomspaceOpCode.SET_INTEGER_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.SET_PARAMETER}")
|
||||
print("Please specify the parameter type from index")
|
||||
for idx, v in enumerate(ParamTypes):
|
||||
print(f"{idx}: {v.name}")
|
||||
ptype = int(input("Index: "))
|
||||
prompt_and_pack_set_integer_param_command(q, object_id, ParamTypes(ptype))
|
||||
if op_code in GomspaceOpCodes.GET_PARAM:
|
||||
if op_code in GomspaceOpCode.GET_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.GET_PARAMETER}")
|
||||
prompt_and_pack_get_param_command(q, object_id)
|
||||
if op_code in GomspaceOpCodes.REQUEST_CONFIG_TABLE:
|
||||
if op_code in GomspaceOpCode.REQUEST_CONFIG_TABLE:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.REQUEST_CONFIG_TABLE}")
|
||||
q.add_pus_tc(pack_request_config_command(object_id.as_bytes))
|
||||
if op_code in GomspaceOpCodes.SAVE_TABLE:
|
||||
if op_code in GomspaceOpCode.SAVE_TABLE:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.SAVE_TABLE}")
|
||||
source_table = int(
|
||||
input(
|
||||
@ -180,13 +191,13 @@ def pack_common_gomspace_cmds(
|
||||
))
|
||||
"""
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.SAVE_TABLE,
|
||||
action_id=GomspaceDeviceActionId.SAVE_TABLE,
|
||||
user_data=bytes([source_table]),
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.SAVE_TABLE_DEFAULT:
|
||||
if op_code in GomspaceOpCode.SAVE_TABLE_DEFAULT:
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table [0: Board Config, 1: Module Config, 2: Calibration Parameter]: "
|
||||
@ -195,13 +206,13 @@ def pack_common_gomspace_cmds(
|
||||
if source_table not in [0, 1, 2]:
|
||||
raise ValueError("Invalid source table index")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.SAVE_TABLE_DEFAULT,
|
||||
action_id=GomspaceDeviceActionId.SAVE_TABLE_DEFAULT,
|
||||
user_data=bytes([source_table]),
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.LOAD_TABLE:
|
||||
if op_code in GomspaceOpCode.LOAD_TABLE:
|
||||
target_table = int(
|
||||
input(
|
||||
"Target table ID [0: Board Config, 1: Module Config, 2: Calibration Parameter, "
|
||||
@ -223,13 +234,13 @@ def pack_common_gomspace_cmds(
|
||||
# Will be ignored
|
||||
source_table = 4
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.LOAD_TABLE,
|
||||
action_id=GomspaceDeviceActionId.LOAD_TABLE,
|
||||
user_data=bytes([source_table, target_table]),
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.RESET_GND_WATCHDOG:
|
||||
if op_code in GomspaceOpCode.RESET_GND_WATCHDOG:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
|
||||
q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
|
||||
|
||||
@ -266,12 +277,14 @@ def generic_on_cmd(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
|
||||
):
|
||||
q.add_log_cmd(info_str + " on")
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
object_id,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.on,
|
||||
)
|
||||
q.add_pus_tc(create_generic_on_cmd(object_id, out_idx))
|
||||
|
||||
|
||||
def create_generic_on_cmd(object_id: bytes, out_idx: int):
|
||||
return pack_set_u8_param_command(
|
||||
object_id,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.on,
|
||||
)
|
||||
|
||||
|
||||
@ -279,12 +292,14 @@ def generic_off_cmd(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
|
||||
):
|
||||
q.add_log_cmd(info_str + " off")
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
object_id,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.off,
|
||||
)
|
||||
q.add_pus_tc(create_generic_off_cmd(object_id, out_idx))
|
||||
|
||||
|
||||
def create_generic_off_cmd(object_id: bytes, out_idx: int):
|
||||
return pack_set_u8_param_command(
|
||||
object_id,
|
||||
OUT_ENABLE_LIST[out_idx].parameter_address,
|
||||
Channel.off,
|
||||
)
|
||||
|
||||
|
||||
@ -305,13 +320,14 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
|
||||
info=PowerInfo.REQUEST_AUX_HK_ONCE,
|
||||
)
|
||||
oce.add(keys=PowerOpCodes.PRINT_LATCHUPS, info=PowerInfo.PRINT_LATCHUPS)
|
||||
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.SET_INTEGER_PARAM, info=GsInfo.SET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE, info=GsInfo.SAVE_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT)
|
||||
oce.add(keys=GomspaceOpCodes.LOAD_TABLE, info=GsInfo.LOAD_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG)
|
||||
oce.add(keys=GomspaceOpCode.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCode.REBOOT, info=GsInfo.REBOOT)
|
||||
oce.add(keys=GomspaceOpCode.SET_INTEGER_PARAM, info=GsInfo.SET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCode.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE)
|
||||
oce.add(keys=GomspaceOpCode.SAVE_TABLE, info=GsInfo.SAVE_TABLE)
|
||||
oce.add(keys=GomspaceOpCode.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT)
|
||||
oce.add(keys=GomspaceOpCode.LOAD_TABLE, info=GsInfo.LOAD_TABLE)
|
||||
oce.add(keys=GomspaceOpCode.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG)
|
||||
|
||||
|
||||
OBC_ENDIANNESS = "<"
|
||||
|
@ -9,7 +9,7 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
pack_common_gomspace_cmds,
|
||||
req_hk_cmds,
|
||||
pack_common_power_cmds,
|
||||
SetIds,
|
||||
SetId,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
@ -27,11 +27,11 @@ from eive_tmtc.config.object_ids import P60_DOCK_HANDLER
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class P60OpCodes:
|
||||
STACK_3V3_ON = ["stack-3v3-on", "1"]
|
||||
STACK_3V3_OFF = ["stack-3v3-off", "2"]
|
||||
STACK_5V_ON = ["stack-5v-on", "3"]
|
||||
STACK_5V_OFF = ["stack-5v-off", "4"]
|
||||
class P60OpCode:
|
||||
STACK_3V3_ON = ["stack_3v3_on", "1"]
|
||||
STACK_3V3_OFF = ["stack_3v3_off", "2"]
|
||||
STACK_5V_ON = ["stack_5v_on", "3"]
|
||||
STACK_5V_OFF = ["stack_5v_off", "4"]
|
||||
TEST = ["test", "0"]
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
pack_common_power_cmds("P60 Dock", object_id, q, op_code)
|
||||
pack_common_gomspace_cmds("P60 Dock", object_id, q, op_code)
|
||||
p60_dock_req_hk_cmds(q, op_code)
|
||||
if op_code in P60OpCodes.STACK_3V3_ON:
|
||||
if op_code in P60OpCode.STACK_3V3_ON:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
@ -112,7 +112,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_3V3_OFF:
|
||||
if op_code in P60OpCode.STACK_3V3_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
@ -121,7 +121,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_5V_ON:
|
||||
if op_code in P60OpCode.STACK_5V_ON:
|
||||
q.add_log_cmd(P60Info.STACK_5V_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
@ -130,7 +130,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCodes.STACK_5V_OFF:
|
||||
if op_code in P60OpCode.STACK_5V_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_5V_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
@ -238,4 +238,4 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
|
||||
|
||||
def p60_dock_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
req_hk_cmds("P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetIds.CORE, SetIds.AUX])
|
||||
req_hk_cmds("P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetId.CORE, SetId.AUX])
|
||||
|
@ -12,12 +12,14 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
generic_on_cmd,
|
||||
generic_off_cmd,
|
||||
add_gomspace_cmd_defs,
|
||||
create_generic_on_cmd,
|
||||
create_generic_off_cmd,
|
||||
pack_common_power_cmds,
|
||||
GomspaceOpCodes,
|
||||
GomspaceOpCode,
|
||||
GsInfo,
|
||||
PowerInfo,
|
||||
add_common_power_defs,
|
||||
SetIds,
|
||||
SetId,
|
||||
)
|
||||
|
||||
from eive_tmtc.gomspace.gomspace_common import *
|
||||
@ -89,7 +91,7 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
|
||||
|
||||
def pdu1_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
req_hk_cmds("PDU1", q, op_code, PDU_1_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
|
||||
req_hk_cmds("PDU1", q, op_code, PDU_1_HANDLER_ID, [SetId.CORE, SetId.AUX])
|
||||
|
||||
|
||||
def info_on_pdu1(base: str) -> str:
|
||||
@ -164,7 +166,7 @@ def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
|
||||
keys=PowerOpCodes.PRINT_SWITCH_V_I,
|
||||
info="PDU1: Print Switches, Voltages, Currents",
|
||||
)
|
||||
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCode.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.PDU1.value,
|
||||
@ -173,65 +175,148 @@ def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
PDU1_DICT = {
|
||||
Pdu1ChIndex.TCS: Pdu1InfoBase.TCS,
|
||||
Pdu1ChIndex.STR: Pdu1InfoBase.STR,
|
||||
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
|
||||
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
|
||||
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
|
||||
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
|
||||
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
|
||||
}
|
||||
|
||||
|
||||
def pdu1_on_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
|
||||
|
||||
|
||||
def pdu1_off_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
|
||||
|
||||
|
||||
def tcs_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
|
||||
pdu1_on_cmd(Pdu1ChIndex.TCS, q)
|
||||
|
||||
|
||||
def create_tcs_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
|
||||
|
||||
|
||||
def tcs_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
|
||||
pdu1_off_cmd(Pdu1ChIndex.TCS, q)
|
||||
|
||||
|
||||
def create_tcs_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
|
||||
|
||||
|
||||
def syrlinks_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
|
||||
pdu1_on_cmd(Pdu1ChIndex.SYRLINKS, q)
|
||||
|
||||
|
||||
def create_syrlinks_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
|
||||
|
||||
|
||||
def syrlinks_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
|
||||
pdu1_off_cmd(Pdu1ChIndex.SYRLINKS, q)
|
||||
|
||||
|
||||
def create_syrlinks_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
|
||||
|
||||
|
||||
def startracker_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
|
||||
pdu1_on_cmd(Pdu1ChIndex.STR, q)
|
||||
|
||||
|
||||
def create_startracker_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
|
||||
|
||||
|
||||
def startracker_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
|
||||
pdu1_on_cmd(Pdu1ChIndex.STR, q)
|
||||
|
||||
|
||||
def create_startracker_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
|
||||
|
||||
|
||||
def mgt_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
|
||||
pdu1_on_cmd(Pdu1ChIndex.MGT, q)
|
||||
|
||||
|
||||
def create_mgt_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
|
||||
|
||||
|
||||
def mgt_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
|
||||
pdu1_off_cmd(Pdu1ChIndex.MGT, q)
|
||||
|
||||
|
||||
def create_mgt_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
|
||||
|
||||
|
||||
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
|
||||
pdu1_on_cmd(Pdu1ChIndex.SUS_N, q)
|
||||
|
||||
|
||||
def create_sun_sensor_nominal_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
|
||||
|
||||
|
||||
def sun_sensor_nominal_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
|
||||
pdu1_off_cmd(Pdu1ChIndex.SUS_N, q)
|
||||
|
||||
|
||||
def create_sun_sensor_nominal_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
|
||||
|
||||
|
||||
def solar_cell_experiment_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
|
||||
pdu1_on_cmd(Pdu1ChIndex.SCEX, q)
|
||||
|
||||
|
||||
def create_solar_cell_experiment_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
|
||||
|
||||
|
||||
def solar_cell_experiment_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
|
||||
pdu1_off_cmd(Pdu1ChIndex.SCEX, q)
|
||||
|
||||
|
||||
def create_solar_cell_experiment_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
|
||||
|
||||
|
||||
def ploc_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
|
||||
pdu1_on_cmd(Pdu1ChIndex.PLOC, q)
|
||||
|
||||
|
||||
def create_ploc_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
|
||||
|
||||
|
||||
def ploc_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
|
||||
pdu1_off_cmd(Pdu1ChIndex.PLOC, q)
|
||||
|
||||
|
||||
def create_ploc_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
|
||||
|
||||
|
||||
def acs_board_a_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
|
||||
pdu1_on_cmd(Pdu1ChIndex.ACS_A, q)
|
||||
|
||||
|
||||
def create_acs_board_a_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)
|
||||
|
||||
|
||||
def acs_board_a_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
|
||||
pdu1_off_cmd(Pdu1ChIndex.ACS_A, q)
|
||||
|
||||
|
||||
def create_acs_board_a_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)
|
||||
|
@ -15,7 +15,9 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
generic_off_cmd,
|
||||
add_gomspace_cmd_defs,
|
||||
pack_common_power_cmds,
|
||||
SetIds,
|
||||
create_generic_on_cmd,
|
||||
create_generic_off_cmd,
|
||||
SetId,
|
||||
add_common_power_defs,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_common import *
|
||||
@ -77,7 +79,7 @@ class PDU2TestProcedure:
|
||||
def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
q.add_log_cmd("Testing PDU2")
|
||||
objb = object_id.as_bytes
|
||||
pdu2_cmds(q, op_code)
|
||||
pdu2_switch_cmds(q, op_code)
|
||||
pdu2_req_hk_cmds(q, op_code)
|
||||
pack_common_power_cmds("PDU2", object_id, q, op_code)
|
||||
pack_common_gomspace_cmds("PDU2", object_id, q, op_code)
|
||||
@ -157,7 +159,7 @@ def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pdu2_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
|
||||
pl_pcdu_bat_nom_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:
|
||||
@ -238,7 +240,7 @@ def add_pdu2_common_defs(oce: OpCodeEntry):
|
||||
|
||||
|
||||
def pdu2_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
req_hk_cmds("PDU2", q, op_code, PDU_2_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
|
||||
req_hk_cmds("PDU2", q, op_code, PDU_2_HANDLER_ID, [SetId.CORE, SetId.AUX])
|
||||
|
||||
|
||||
def pl_pcdu_bat_nom_on_cmd(q: DefaultPusQueueHelper):
|
||||
@ -257,61 +259,117 @@ def reaction_wheel_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
|
||||
|
||||
|
||||
def create_reaction_wheel_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.RW)
|
||||
|
||||
|
||||
def reaction_wheel_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
|
||||
|
||||
|
||||
def create_reaction_wheel_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.RW)
|
||||
|
||||
|
||||
def heater_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
|
||||
|
||||
|
||||
def create_heater_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
|
||||
|
||||
|
||||
def heater_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
|
||||
|
||||
|
||||
def create_heater_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
|
||||
|
||||
|
||||
def sus_red_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
|
||||
|
||||
|
||||
def create_sus_red_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SUS_R)
|
||||
|
||||
|
||||
def sus_red_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
|
||||
|
||||
|
||||
def create_sus_red_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SUS_R)
|
||||
|
||||
|
||||
def solar_array_deployment_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(
|
||||
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
|
||||
)
|
||||
|
||||
|
||||
def create_solar_array_deployment_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SOLAR_ARRAY_DEPL)
|
||||
|
||||
|
||||
def solar_array_deployment_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(
|
||||
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
|
||||
)
|
||||
|
||||
|
||||
def create_solar_array_deployment_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SOLAR_ARRAY_DEPL)
|
||||
|
||||
|
||||
def pl_pcdu_bat_red_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(
|
||||
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
|
||||
)
|
||||
|
||||
|
||||
def create_pl_pcdu_bat_red_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_PCDU_BAT_RED)
|
||||
|
||||
|
||||
def pl_pcdu_bat_red_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(
|
||||
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
|
||||
)
|
||||
|
||||
|
||||
def create_pl_pcdu_bat_red_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_PCDU_BAT_RED)
|
||||
|
||||
|
||||
def acs_board_b_side_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
|
||||
|
||||
|
||||
def create_acs_board_b_side_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.ACS_B)
|
||||
|
||||
|
||||
def acs_board_b_side_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
|
||||
|
||||
|
||||
def create_acs_board_b_side_off_cmd() -> PusTelecommand:
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.ACS_B)
|
||||
|
||||
|
||||
def payload_camera_on_cmd(q: DefaultPusQueueHelper):
|
||||
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
|
||||
|
||||
|
||||
def create_payload_camera_on_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
|
||||
|
||||
|
||||
def payload_camera_off_cmd(q: DefaultPusQueueHelper):
|
||||
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
|
||||
|
||||
|
||||
def create_payload_camera_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
|
||||
|
@ -1,9 +1,11 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
import time
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||
@ -15,23 +17,23 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_11_tc_sched import (
|
||||
generate_enable_tc_sched_cmd,
|
||||
generate_time_tagged_cmd,
|
||||
create_enable_tc_sched_cmd,
|
||||
create_time_tagged_cmd,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
|
||||
from tmtccmd.tc.pus_20_params import (
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
pack_scalar_double_param_app_data,
|
||||
pack_fsfw_load_param_cmd,
|
||||
create_load_param_cmd,
|
||||
pack_boolean_parameter_app_data,
|
||||
)
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
SWITCH_HPA_ON_PROC = ["0", "proc_hpa"]
|
||||
SWITCH_ON = ["2", "on"]
|
||||
SWITCH_OFF = ["3", "off"]
|
||||
@ -70,7 +72,7 @@ class Info:
|
||||
DISABLE_HK = "Disable HK"
|
||||
|
||||
|
||||
class SetIds(enum.IntEnum):
|
||||
class SetId(enum.IntEnum):
|
||||
ADC = 0
|
||||
|
||||
|
||||
@ -124,116 +126,116 @@ class ParamIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC)
|
||||
oce.add(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)
|
||||
oce.add(keys=OpCodes.NORMAL_DRO, info=Info.NORMAL_DRO)
|
||||
oce.add(keys=OpCodes.NORMAL_X8, info=Info.NORMAL_X8)
|
||||
oce.add(keys=OpCodes.NORMAL_TX, info=Info.NORMAL_TX)
|
||||
oce.add(keys=OpCodes.NORMAL_MPA, info=Info.NORMAL_MPA)
|
||||
oce.add(keys=OpCodes.NORMAL_HPA, info=Info.NORMAL_HPA)
|
||||
oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_HK, info=Info.ENABLE_HK)
|
||||
oce.add(keys=OpCode.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC)
|
||||
oce.add(keys=OpCode.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCode.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCode.NORMAL_SSR, info=Info.NORMAL_SSR)
|
||||
oce.add(keys=OpCode.NORMAL_DRO, info=Info.NORMAL_DRO)
|
||||
oce.add(keys=OpCode.NORMAL_X8, info=Info.NORMAL_X8)
|
||||
oce.add(keys=OpCode.NORMAL_TX, info=Info.NORMAL_TX)
|
||||
oce.add(keys=OpCode.NORMAL_MPA, info=Info.NORMAL_MPA)
|
||||
oce.add(keys=OpCode.NORMAL_HPA, info=Info.NORMAL_HPA)
|
||||
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
oce.add(keys=OpCode.ENABLE_HK, info=Info.ENABLE_HK)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_SSR_TO_DRO_FAILURE,
|
||||
keys=OpCode.INJECT_SSR_TO_DRO_FAILURE,
|
||||
info="Inject failure SSR to DRO transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_DRO_TO_X8_FAILURE,
|
||||
keys=OpCode.INJECT_DRO_TO_X8_FAILURE,
|
||||
info="Inject failure in DRO to X8 transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_X8_TO_TX_FAILURE,
|
||||
keys=OpCode.INJECT_X8_TO_TX_FAILURE,
|
||||
info="Inject failure in X8 to TX transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_TX_TO_MPA_FAILURE,
|
||||
keys=OpCode.INJECT_TX_TO_MPA_FAILURE,
|
||||
info="Inject failure in TX to MPA transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_MPA_TO_HPA_FAILURE,
|
||||
keys=OpCode.INJECT_MPA_TO_HPA_FAILURE,
|
||||
info="Inject failure in MPA to HPA transition",
|
||||
)
|
||||
oce.add(keys=OpCodes.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
|
||||
oce.add(keys=OpCode.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
|
||||
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
|
||||
|
||||
|
||||
def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.SWITCH_ON:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Modes.ON, submode=0)
|
||||
if op_code in OpCodes.SWITCH_OFF:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_OFF, mode=Modes.OFF, submode=0)
|
||||
if op_code in OpCodes.ENABLE_HK:
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Mode.ON, submode=0)
|
||||
if op_code in OpCode.SWITCH_OFF:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_OFF, mode=Mode.OFF, submode=0)
|
||||
if op_code in OpCode.ENABLE_HK:
|
||||
interval = float(
|
||||
input("Please enter HK collection interval in floating point seconds: ")
|
||||
)
|
||||
cmds = enable_periodic_hk_command_with_interval(
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetIds.ADC), interval_seconds=interval
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetId.ADC), interval_seconds=interval
|
||||
)
|
||||
q.add_log_cmd(f"Enable PL PCDU HK with interval of {interval} seconds")
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodes.DISABLE_HK:
|
||||
if op_code in OpCode.DISABLE_HK:
|
||||
cmd = disable_periodic_hk_command(
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetIds.ADC)
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetId.ADC)
|
||||
)
|
||||
q.add_log_cmd("Disabling PL PCDU HK")
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodes.NORMAL_SSR:
|
||||
if op_code in OpCode.NORMAL_SSR:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_SSR,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(
|
||||
NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_DRO:
|
||||
if op_code in OpCode.NORMAL_DRO:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_DRO,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_X8:
|
||||
if op_code in OpCode.NORMAL_X8:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_X8,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_TX:
|
||||
if op_code in OpCode.NORMAL_TX:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_TX,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_MPA:
|
||||
if op_code in OpCode.NORMAL_MPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_MPA,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_HPA:
|
||||
if op_code in OpCode.NORMAL_HPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_HPA,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
|
||||
)
|
||||
if op_code in OpCodes.REQ_OS_HK:
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"PL PCDU: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetIds.ADC)
|
||||
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetId.ADC)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.SWITCH_HPA_ON_PROC:
|
||||
if op_code in OpCode.SWITCH_HPA_ON_PROC:
|
||||
hpa_on_procedure(q)
|
||||
if op_code in OpCodes.INJECT_ALL_ON_FAILURE:
|
||||
if op_code in OpCode.INJECT_ALL_ON_FAILURE:
|
||||
pack_failure_injection_cmd(
|
||||
q=q,
|
||||
param_id=ParamIds.INJECT_ALL_ON_FAILURE,
|
||||
@ -251,15 +253,15 @@ def hpa_on_procedure(q: DefaultPusQueueHelper):
|
||||
)
|
||||
pl_pcdu_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(object_id=PL_PCDU_ID, mode=Modes.ON, submode=0),
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(object_id=PL_PCDU_ID, mode=Mode.ON, submode=0),
|
||||
)
|
||||
ssr_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(
|
||||
NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
),
|
||||
@ -267,95 +269,95 @@ def hpa_on_procedure(q: DefaultPusQueueHelper):
|
||||
)
|
||||
dro_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
|
||||
),
|
||||
)
|
||||
x8_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
|
||||
),
|
||||
)
|
||||
tx_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
|
||||
),
|
||||
)
|
||||
mpa_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
|
||||
),
|
||||
)
|
||||
hpa_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
|
||||
),
|
||||
)
|
||||
current_time = time.time()
|
||||
|
||||
enb_sched = generate_enable_tc_sched_cmd()
|
||||
enb_sched = create_enable_tc_sched_cmd()
|
||||
|
||||
sched_time = int(round(current_time + 10))
|
||||
q.add_pus_tc(enb_sched)
|
||||
tagged_on_cmd = generate_time_tagged_cmd(
|
||||
tagged_on_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time),
|
||||
tc_to_insert=pl_pcdu_on,
|
||||
)
|
||||
q.add_pus_tc(tagged_on_cmd)
|
||||
|
||||
sched_time += 5
|
||||
tagged_ssr_cmd = generate_time_tagged_cmd(
|
||||
tagged_ssr_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time),
|
||||
tc_to_insert=ssr_on,
|
||||
)
|
||||
q.add_pus_tc(tagged_ssr_cmd)
|
||||
|
||||
sched_time += 5
|
||||
tagged_dro_cmd = generate_time_tagged_cmd(
|
||||
tagged_dro_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time), tc_to_insert=dro_on
|
||||
)
|
||||
q.add_pus_tc(tagged_dro_cmd)
|
||||
|
||||
sched_time += delay_dro_to_x8
|
||||
sched_time = int(round(sched_time))
|
||||
tagged_x8_cmd = generate_time_tagged_cmd(
|
||||
tagged_x8_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time), tc_to_insert=x8_on
|
||||
)
|
||||
q.add_pus_tc(tagged_x8_cmd)
|
||||
|
||||
sched_time += 5
|
||||
tagged_tx_cmd = generate_time_tagged_cmd(
|
||||
tagged_tx_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time), tc_to_insert=tx_on
|
||||
)
|
||||
q.add_pus_tc(tagged_tx_cmd)
|
||||
|
||||
sched_time += 5
|
||||
tagged_mpa_cmd = generate_time_tagged_cmd(
|
||||
tagged_mpa_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time), tc_to_insert=mpa_on
|
||||
)
|
||||
q.add_pus_tc(tagged_mpa_cmd)
|
||||
|
||||
sched_time += 5
|
||||
tagged_hpa_cmd = generate_time_tagged_cmd(
|
||||
tagged_hpa_cmd = create_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", sched_time), tc_to_insert=hpa_on
|
||||
)
|
||||
q.add_pus_tc(tagged_hpa_cmd)
|
||||
@ -369,10 +371,10 @@ def request_wait_time() -> Optional[float]:
|
||||
try:
|
||||
wait_time = float(wait_time)
|
||||
except ValueError:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
continue
|
||||
if wait_time <= 0:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
else:
|
||||
return wait_time
|
||||
|
||||
@ -427,7 +429,7 @@ def pack_wait_time_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||
unique_id=param_id,
|
||||
parameter=wait_time,
|
||||
)
|
||||
q.add_pus_tc(pack_fsfw_load_param_cmd(app_data=param_data))
|
||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
||||
|
||||
|
||||
def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||
@ -435,16 +437,63 @@ def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_st
|
||||
param_data = pack_boolean_parameter_app_data(
|
||||
object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True
|
||||
)
|
||||
q.add_pus_tc(pack_fsfw_load_param_cmd(app_data=param_data))
|
||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
||||
|
||||
|
||||
def pack_pl_pcdu_mode_cmd(
|
||||
q: DefaultPusQueueHelper, info: str, mode: Modes, submode: int
|
||||
q: DefaultPusQueueHelper, info: str, mode: Mode, submode: int
|
||||
):
|
||||
q.add_log_cmd(info)
|
||||
mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=mode, submode=submode)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=mode_data
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
ADC_CHANNELS_NAMED = [
|
||||
"U BAT DIV 6 [V]",
|
||||
"U NEG V FB [V]",
|
||||
"I HPA [mA]",
|
||||
"U HPA DIV 6 [V]",
|
||||
"I MPA [mA]",
|
||||
"U MPA DIV 6 [V]",
|
||||
"I TX [mA]",
|
||||
"U TX DIV 6 [V]",
|
||||
"I X8 [mA]",
|
||||
"U X8 DIV 6 [V]",
|
||||
"I DRO [mA]",
|
||||
"U DRO DIV 6 [V]",
|
||||
]
|
||||
|
||||
|
||||
def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.ADC:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received PL PCDU ADC HK data")
|
||||
channels = []
|
||||
ch_print = "Channels Raw (hex): ["
|
||||
for i in range(12):
|
||||
channels.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
if i < 11:
|
||||
ch_print += f"{channels[i]:06x},"
|
||||
else:
|
||||
ch_print += f"{channels[i]:06x}]"
|
||||
current_idx += 2
|
||||
processed_vals = []
|
||||
for i in range(12):
|
||||
processed_vals.append(
|
||||
struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
temp = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(ch_print)
|
||||
for i in range(12):
|
||||
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=3)
|
@ -1,3 +1,6 @@
|
||||
import enum
|
||||
import logging
|
||||
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
PowerOpCodes,
|
||||
PowerInfo,
|
||||
@ -21,24 +24,41 @@ from eive_tmtc.tmtc.power.pdu1 import (
|
||||
from eive_tmtc.tmtc.power.pdu2 import (
|
||||
pdu2_req_hk_cmds,
|
||||
add_pdu2_common_defs,
|
||||
pdu2_cmds,
|
||||
pdu2_switch_cmds,
|
||||
add_pdu2_cmds,
|
||||
)
|
||||
from tmtccmd import get_console_logger
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from eive_tmtc.config.object_ids import PCDU_HANDLER_ID
|
||||
|
||||
from eive_tmtc.tmtc.power.p60dock import P60OpCodes, P60Info, p60_dock_req_hk_cmds
|
||||
from eive_tmtc.tmtc.power.p60dock import P60OpCode, P60Info, p60_dock_req_hk_cmds
|
||||
from eive_tmtc.tmtc.power.acu import add_acu_cmds, acu_req_hk_cmds
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
create_request_one_diag_command,
|
||||
make_sid,
|
||||
create_request_one_hk_command,
|
||||
)
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
class SetId(enum.IntEnum):
|
||||
SWITCHER_SET = 0
|
||||
|
||||
|
||||
class PcduSetIds(enum.IntEnum):
|
||||
SWITCHER_SET = 0
|
||||
|
||||
|
||||
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
pdu1_switch_cmds(q, op_code)
|
||||
pdu2_cmds(q, op_code)
|
||||
pdu2_switch_cmds(q, op_code)
|
||||
if op_code in PowerOpCodes.SWITCHER_HK:
|
||||
q.add_log_cmd("Requesting switcher state HK")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
make_sid(PCDU_HANDLER_ID, PcduSetIds.SWITCHER_SET)
|
||||
)
|
||||
)
|
||||
if op_code in PowerOpCodes.INFO_CORE:
|
||||
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
pdu2_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
@ -69,18 +89,20 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
pack_reset_gnd_wdt_cmd(q, "PDU2", oids[PDU_2_HANDLER_ID])
|
||||
q.add_wait_seconds(5.0)
|
||||
if q.empty():
|
||||
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
|
||||
logging.getLogger(__name__).info(
|
||||
f"Queue is empty, no stack for op code {op_code}"
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_p60_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=P60OpCodes.STACK_3V3_ON, info=P60Info.STACK_3V3_ON)
|
||||
oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=P60Info.STACK_3V3_OFF)
|
||||
oce.add(keys=P60OpCodes.STACK_5V_ON, info=P60Info.STACK_5V_ON)
|
||||
oce.add(keys=P60OpCodes.STACK_5V_OFF, info=P60Info.STACK_5V_OFF)
|
||||
oce.add(keys=P60OpCode.STACK_3V3_ON, info=P60Info.STACK_3V3_ON)
|
||||
oce.add(keys=P60OpCode.STACK_3V3_OFF, info=P60Info.STACK_3V3_OFF)
|
||||
oce.add(keys=P60OpCode.STACK_5V_ON, info=P60Info.STACK_5V_ON)
|
||||
oce.add(keys=P60OpCode.STACK_5V_OFF, info=P60Info.STACK_5V_OFF)
|
||||
add_gomspace_cmd_defs(oce)
|
||||
oce.add(keys=P60OpCodes.TEST, info="P60 Tests")
|
||||
oce.add(keys=P60OpCode.TEST, info="P60 Tests")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce
|
||||
)
|
||||
@ -91,6 +113,7 @@ def add_power_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
add_pdu1_common_defs(oce)
|
||||
add_pdu2_common_defs(oce)
|
||||
oce.add(keys=PowerOpCodes.SWITCHER_HK, info=PowerInfo.SWITCHER_HK)
|
||||
oce.add(keys=PowerOpCodes.INFO_ALL, info=PowerInfo.INFO_ALL)
|
||||
oce.add(keys=PowerOpCodes.INFO_CORE, info=PowerInfo.INFO_CORE)
|
||||
oce.add(keys=PowerOpCodes.INFO_AUX, info=PowerInfo.INFO_AUX)
|
||||
|
@ -3,14 +3,15 @@ from typing import List, Tuple
|
||||
|
||||
from eive_tmtc.tmtc.power.acu import acu_config_table_handler
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
SetIds,
|
||||
SetId,
|
||||
unpack_array_in_data,
|
||||
OBC_ENDIANNESS,
|
||||
)
|
||||
from eive_tmtc.tmtc.power.power import PcduSetIds
|
||||
from tmtccmd.util import ObjectIdBase
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.gomspace.gomspace_common import GomspaceDeviceActionIds
|
||||
from eive_tmtc.gomspace.gomspace_common import GomspaceDeviceActionId
|
||||
from eive_tmtc.config.object_ids import (
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
@ -151,7 +152,7 @@ def handle_pdu_data(
|
||||
pw = PrintWrapper(printer=printer)
|
||||
current_idx = 0
|
||||
priv_idx = pdu_idx - 1
|
||||
if set_id == SetIds.AUX or set_id == SetIds.AUX:
|
||||
if set_id == SetId.AUX or set_id == SetId.AUX:
|
||||
fmt_str = "!hhBBBIIH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
@ -188,7 +189,7 @@ def handle_pdu_data(
|
||||
wdt.print()
|
||||
pw.dlog(f"PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
|
||||
dev_parser.print(pw=pw)
|
||||
if set_id == SetIds.CORE or set_id == SetIds.CORE:
|
||||
if set_id == SetId.CORE or set_id == SetId.CORE:
|
||||
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
|
||||
current_list = []
|
||||
for idx in range(len(PDU1_CHANNELS_NAMES)):
|
||||
@ -229,7 +230,7 @@ def handle_pdu_data(
|
||||
|
||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer=printer)
|
||||
if set_id == SetIds.CORE:
|
||||
if set_id == SetId.CORE:
|
||||
pw.dlog("Received P60 Core HK. Voltages in mV, currents in mA")
|
||||
current_idx = 0
|
||||
current_list = []
|
||||
@ -276,7 +277,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw.dlog(temps)
|
||||
pw.dlog(batt_info)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
|
||||
if set_id == SetIds.AUX:
|
||||
if set_id == SetId.AUX:
|
||||
pw.dlog("Received P60 AUX HK. Voltages in mV, currents in mA")
|
||||
current_idx = 0
|
||||
latchup_list = []
|
||||
@ -355,7 +356,7 @@ def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[
|
||||
|
||||
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer=printer)
|
||||
if set_id == SetIds.CORE:
|
||||
if set_id == SetId.CORE:
|
||||
mppt_mode = hk_data[0]
|
||||
current_idx = 1
|
||||
current_idx, currents = gen_six_entry_u16_list(
|
||||
@ -399,7 +400,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
printer.print_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=12
|
||||
)
|
||||
if set_id == SetIds.AUX:
|
||||
if set_id == SetId.AUX:
|
||||
current_idx = 0
|
||||
fmt_str = "!BBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
@ -439,7 +440,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
def handle_get_param_data_reply(
|
||||
obj_id: ObjectIdBase, action_id: int, pw: PrintWrapper, custom_data: bytearray
|
||||
):
|
||||
if action_id == GomspaceDeviceActionIds.PARAM_GET:
|
||||
if action_id == GomspaceDeviceActionId.PARAM_GET:
|
||||
pw.dlog(f"Parameter Get Request received for object {obj_id}")
|
||||
header_list = [
|
||||
"Gomspace Request Code",
|
||||
@ -461,7 +462,7 @@ def handle_get_param_data_reply(
|
||||
]
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
elif action_id == GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE:
|
||||
elif action_id == GomspaceDeviceActionId.REQUEST_CONFIG_TABLE:
|
||||
print(f"Received config table with size {len(custom_data)} for object {obj_id}")
|
||||
if obj_id.as_bytes == PDU_1_HANDLER_ID or obj_id.as_bytes == PDU_2_HANDLER_ID:
|
||||
pdu_config_table_handler(pw, custom_data, obj_id)
|
||||
@ -554,3 +555,24 @@ def parse_name_list(data: bytes, name_len: int):
|
||||
idx += len(name)
|
||||
idx += 1
|
||||
return ch_list
|
||||
|
||||
|
||||
def handle_pcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received PCDU HK")
|
||||
if set_id == PcduSetIds.SWITCHER_SET:
|
||||
current_idx = 0
|
||||
pdu1_vals = [hk_data[i] for i in range(len(PDU1_CHANNELS_NAMES))]
|
||||
current_idx += len(PDU1_CHANNELS_NAMES)
|
||||
pdu2_vals = [hk_data[i + current_idx] for i in range(len(PDU2_CHANNELS_NAMES))]
|
||||
current_idx += len(PDU2_CHANNELS_NAMES)
|
||||
p60_stack_val = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
pw.dlog("PDU1 Switcher States")
|
||||
for name, val in zip(PDU1_CHANNELS_NAMES, pdu1_vals):
|
||||
pw.dlog(f"{name.ljust(25)}: {val}")
|
||||
pw.dlog("PDU2 Switcher States")
|
||||
for name, val in zip(PDU2_CHANNELS_NAMES, pdu2_vals):
|
||||
pw.dlog(f"{name.ljust(25)}: {val}")
|
||||
pw.dlog(f"{'P60 Dock 5V Stack'.ljust(25)}: {p60_stack_val}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 3)
|
||||
|
@ -5,39 +5,44 @@
|
||||
@author J. Meier
|
||||
@date 15.02.2021
|
||||
"""
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
from config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
MANUAL_DEPLOYMENT = "man_depl"
|
||||
BURN_SA_0_ONLY = "burn_sa_0"
|
||||
BURN_SA_1_ONLY = "burn_sa_1"
|
||||
|
||||
|
||||
class Info:
|
||||
MANUAL_DEPLOYMENT = "Manual Solar Array Deployment"
|
||||
BURN_SA_0_ONLY = "Only burn SA0"
|
||||
BURN_SA_1_ONLY = "Only burn SA1"
|
||||
|
||||
|
||||
class ActionIds:
|
||||
class ActionId:
|
||||
MANUAL_DEPLOYMENT = 5
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def pack_sa_depl_cmds(defs: TmtcDefinitionWrapper):
|
||||
def add_sa_depl_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.MANUAL_DEPLOYMENT, info=Info.MANUAL_DEPLOYMENT)
|
||||
oce.add(keys=OpCode.MANUAL_DEPLOYMENT, info=Info.MANUAL_DEPLOYMENT)
|
||||
oce.add(keys=OpCode.BURN_SA_0_ONLY, info=Info.BURN_SA_0_ONLY)
|
||||
oce.add(keys=OpCode.BURN_SA_1_ONLY, info=Info.BURN_SA_1_ONLY)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SA_DEPLYOMENT,
|
||||
info="Solar Array Deployment",
|
||||
@ -48,31 +53,102 @@ def pack_sa_depl_cmds(defs: TmtcDefinitionWrapper):
|
||||
@service_provider(CustomServiceList.SA_DEPLYOMENT)
|
||||
def pack_solar_array_deployment_test_into(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
user_data = bytearray()
|
||||
while True:
|
||||
burn_time = int(input("Please specify burn time in seconds [0-120 secs]: "))
|
||||
if burn_time < 0 or burn_time > 120:
|
||||
LOGGER.warning(f"Invalid burn time {burn_time}")
|
||||
continue
|
||||
user_data.extend(struct.pack("!I", burn_time))
|
||||
break
|
||||
while True:
|
||||
dry_run = input("Dry run? [y/n]: ")
|
||||
if dry_run in ["yes", "y", "1"]:
|
||||
dry_run = 1
|
||||
elif dry_run in ["no", "n", "0"]:
|
||||
dry_run = 0
|
||||
op_code = p.op_code
|
||||
switch_interval_ms = 0
|
||||
if op_code == OpCode.MANUAL_DEPLOYMENT:
|
||||
while True:
|
||||
burn_time_secs = prompt_burn_time()
|
||||
if burn_time_secs < 0:
|
||||
continue
|
||||
# Default configuration: Burn each side for half of the burn time.
|
||||
switch_interval_ms = int(round(burn_time_secs * 0.5 * 1000))
|
||||
break
|
||||
while True:
|
||||
dry_run = prompt_dry_run()
|
||||
if dry_run < 0:
|
||||
continue
|
||||
dry_run = bool(dry_run)
|
||||
break
|
||||
if dry_run:
|
||||
dry_run_str = " as dry run"
|
||||
else:
|
||||
LOGGER.warning("Invalid input for dry run parameter")
|
||||
dry_run_str = ""
|
||||
q.add_log_cmd(
|
||||
f"Testing S/A Deployment with burn time {burn_time_secs}{dry_run_str}"
|
||||
)
|
||||
q.add_pus_tc(
|
||||
pack_manual_array_depl_cmd(burn_time_secs, switch_interval_ms, dry_run)
|
||||
)
|
||||
elif op_code in OpCode.BURN_SA_0_ONLY:
|
||||
burn_one_channel_only(q, 0)
|
||||
elif op_code in OpCode.BURN_SA_1_ONLY:
|
||||
burn_one_channel_only(q, 1)
|
||||
|
||||
|
||||
def prompt_burn_time() -> int:
|
||||
burn_time = int(input("Please specify burn time in seconds [0-120 secs]: "))
|
||||
if burn_time < 0 or burn_time > 120:
|
||||
logging.getLogger(__name__).warning(f"Invalid burn time {burn_time}")
|
||||
return -1
|
||||
return burn_time
|
||||
|
||||
|
||||
def prompt_dry_run() -> int:
|
||||
dry_run = input("Dry run? [y/n]: ")
|
||||
if dry_run in ["yes", "y", "1"]:
|
||||
return 1
|
||||
elif dry_run in ["no", "n", "0"]:
|
||||
return 0
|
||||
else:
|
||||
logging.getLogger(__name__).warning("Invalid input for dry run parameter")
|
||||
return -1
|
||||
|
||||
|
||||
def burn_one_channel_only(q: DefaultPusQueueHelper, channel: int):
|
||||
while True:
|
||||
burn_time_secs = prompt_burn_time()
|
||||
if burn_time_secs < 0:
|
||||
continue
|
||||
user_data.append(dry_run)
|
||||
break
|
||||
if dry_run == 1:
|
||||
while True:
|
||||
dry_run = prompt_dry_run()
|
||||
if dry_run < 0:
|
||||
continue
|
||||
dry_run = bool(dry_run)
|
||||
break
|
||||
if dry_run:
|
||||
dry_run_str = " as dry run"
|
||||
else:
|
||||
dry_run_str = ""
|
||||
q.add_log_cmd(f"Testing S/A Deployment with burn time {burn_time}{dry_run_str}")
|
||||
command = make_fsfw_action_cmd(
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID, ActionIds.MANUAL_DEPLOYMENT, user_data
|
||||
q.add_log_cmd(
|
||||
f"Testing S/A Deployment Channel {channel} only with "
|
||||
f"burn time {burn_time_secs}{dry_run_str}"
|
||||
)
|
||||
q.add_pus_tc(pack_one_channel_only_cmd(burn_time_secs, channel, dry_run))
|
||||
|
||||
|
||||
def pack_one_channel_only_cmd(
|
||||
burn_time_seconds: int, channel: int, dry_run: bool
|
||||
) -> PusTelecommand:
|
||||
user_data = bytearray()
|
||||
user_data.extend(struct.pack("!I", burn_time_seconds))
|
||||
# Burn channel for the entire time
|
||||
user_data.extend(struct.pack("!I", round(int((burn_time_seconds + 1) * 1000))))
|
||||
user_data.append(channel)
|
||||
user_data.append(dry_run)
|
||||
return create_action_cmd(
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID, ActionId.MANUAL_DEPLOYMENT, user_data
|
||||
)
|
||||
|
||||
|
||||
def pack_manual_array_depl_cmd(
|
||||
burn_time_seconds: int, channel_switch_interval_ms: int, dry_run: bool
|
||||
) -> PusTelecommand:
|
||||
user_data = bytearray()
|
||||
user_data.extend(struct.pack("!I", burn_time_seconds))
|
||||
user_data.extend(struct.pack("!I", channel_switch_interval_ms))
|
||||
user_data.append(0)
|
||||
user_data.append(dry_run)
|
||||
return create_action_cmd(
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID, ActionId.MANUAL_DEPLOYMENT, user_data
|
||||
)
|
||||
q.add_pus_tc(command)
|
||||
|
57
eive_tmtc/tmtc/system.py
Normal file
57
eive_tmtc/tmtc/system.py
Normal file
@ -0,0 +1,57 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from eive_tmtc.config.object_ids import EIVE_SYSTEM_ID
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import (
|
||||
create_mode_command,
|
||||
Mode,
|
||||
create_announce_mode_recursive_command,
|
||||
)
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
SAFE_MODE = "safe"
|
||||
IDLE_MODE = "idle"
|
||||
ANNOUNCE_MODES = "announce_modes"
|
||||
|
||||
|
||||
class Info:
|
||||
SAFE_MODE = "Command System into Safe Mode"
|
||||
IDLE_MODE = "Command System into Idle Pointing Mode"
|
||||
ANNOUNCE_MODES = "Announce mode recursively"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SYSTEM.value)
|
||||
def build_system_cmds(p: ServiceProviderParams):
|
||||
o = p.op_code
|
||||
q = p.queue_helper
|
||||
prefix = "EIVE System"
|
||||
if o == OpCode.SAFE_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.SAFE_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, AcsMode.SAFE, 0))
|
||||
elif o == OpCode.IDLE_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, AcsMode.IDLE, 0))
|
||||
elif o == OpCode.ANNOUNCE_MODES:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
|
||||
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
|
||||
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SYSTEM.value,
|
||||
info="EIVE system commands",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
pass
|
1
eive_tmtc/tmtc/tcs/__init__.py
Normal file
1
eive_tmtc/tmtc/tcs/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .tm import * # noqa
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user