Compare commits
945 Commits
v2.8.0
...
bump-depen
Author | SHA1 | Date | |
---|---|---|---|
941660a0b5 | |||
ca3c988676 | |||
3c0ac91227 | |||
f61c485979 | |||
2ebbf750bd
|
|||
847fccbe66 | |||
c8292f4ee1 | |||
1cafdc817f
|
|||
5967dede97
|
|||
a8d0143b1e | |||
a0ad5f8948 | |||
20ecef5838 | |||
6d97841cbf | |||
512f0e4530 | |||
e2f0221681 | |||
e9eb45c088 | |||
ea72087d87 | |||
d48c029b85 | |||
b5f4f2ddab
|
|||
64dd19bd12 | |||
102821fc71 | |||
24f3abdd5a | |||
a880db5655 | |||
4e0cbb1034 | |||
96636d59e9 | |||
7dfdd40963 | |||
6282686f2f | |||
b160f079b1 | |||
11d7ad0f8d | |||
5af69eb14e | |||
5a0edbefa8 | |||
5bdba2dbad | |||
3ae6ccfb77 | |||
de84bf112b | |||
d182a9d5ec | |||
c72a04b262 | |||
492d364246 | |||
33cf7b1613 | |||
d8c49aed80 | |||
97afd24e52 | |||
4704616ca7 | |||
92c0172b59 | |||
344f16099e | |||
49b55f01e3 | |||
f87095bf68 | |||
928759d1bc | |||
dc17919108 | |||
5f71f27f0e | |||
f8d63e56cb | |||
c843356c8a | |||
49a614db10 | |||
c90dd92162 | |||
bcb6a8b34e | |||
ed15bcaf35 | |||
89202f2cfe | |||
40c2a4b1f3 | |||
811786fd78 | |||
73a4260f33 | |||
3358de3e3e | |||
211e79c83e | |||
7f10e5c777 | |||
aab35c26c2 | |||
6ade001d3d | |||
098bdcf82b
|
|||
b131415ea7 | |||
b1dd5aa7d0 | |||
0201eb27c4
|
|||
c070f18c5d
|
|||
00876ed0e0
|
|||
68ea889d0f
|
|||
771199e542 | |||
588d7a8079 | |||
83aff8bea5 | |||
1d982785e6 | |||
d062a22a7a | |||
f8c3172e7a | |||
7a56c604a6 | |||
bbde4b5b20
|
|||
85fc106a9b
|
|||
d35bc01397
|
|||
d811735b8d
|
|||
265077a758
|
|||
1cd566a94c | |||
9aa891ef78 | |||
329aa76fbf | |||
4633e0cb13
|
|||
a5ebac6266 | |||
f3c6b509ec | |||
5aefa436f4 | |||
b0b8118dd5 | |||
db384f8e9c | |||
e5fe0ab95a
|
|||
248df1d4df
|
|||
f93f713b0e
|
|||
c6b2edf688
|
|||
5e3b60b3af
|
|||
d69d16c3af
|
|||
6376585c4e | |||
5b4a789c4b | |||
d33013ed58 | |||
7e39a481bd | |||
4744de8a54 | |||
916ce92bdc | |||
bb765ac8a0 | |||
84f0f42783 | |||
ee2dade270 | |||
4f26c34c60 | |||
b5ae7c5f38 | |||
813f92f3d4
|
|||
f3eecfa8ac
|
|||
b94c20dab1
|
|||
84aeaa4b65 | |||
caaf937003
|
|||
bcdd12caf0
|
|||
6440048235
|
|||
c5dcc0b77d | |||
ebd9792fb9
|
|||
9f1d61c3ef | |||
38eb43cf8d | |||
3d007c32a3
|
|||
202a824d31
|
|||
79b3c269e6
|
|||
839da7a224
|
|||
3a6abe1b62 | |||
db70b33bd6
|
|||
d53e9d61b0
|
|||
bac4473aa7 | |||
1831ea8b7a
|
|||
747ad34eec
|
|||
2789453d57 | |||
5456d79965
|
|||
4c54aa7586 | |||
1a132684a6 | |||
f63a834d9a | |||
58def42281
|
|||
ee955e96fb
|
|||
97fb8a166f | |||
d477242881 | |||
451c2c07ee | |||
8de88127c3 | |||
e7e97ff2d3 | |||
35e3f8b572 | |||
77010937b8 | |||
c1f4a3f59d | |||
74e55b16dc | |||
f1f4a1e9a0
|
|||
7c3a72f85b | |||
4e25e2e6ca | |||
eb302e5cf1
|
|||
3da1c2c262
|
|||
1660e27ec1
|
|||
40aa648e6b | |||
098843a74f
|
|||
6f86e72042
|
|||
507c3e3ff3
|
|||
bca2deae61 | |||
1ea255d3e8 | |||
b1caaff672
|
|||
3b047094e6 | |||
56ebfb1000 | |||
a41dc9b691 | |||
1d121c40b2 | |||
0a417a89e9 | |||
35e25bf6d0 | |||
d4147d8402 | |||
3cf312073a | |||
76fee820e9 | |||
d2fc53c1fa | |||
7abce63a56 | |||
af24a95475 | |||
6ea3312b62 | |||
d7e61f1395 | |||
51227100af | |||
fc243b76cf
|
|||
62b16028e6
|
|||
4ae659cb4e
|
|||
228065bf3b
|
|||
947bcf57f5
|
|||
77c2c91539
|
|||
756944cae3
|
|||
2bb917eab7
|
|||
f756df43a2
|
|||
688602e486
|
|||
21a38ae76a
|
|||
af02c106b9
|
|||
ae239031ed
|
|||
d640d547bd
|
|||
02d9d6adfc
|
|||
ba24faefa9
|
|||
b3920524ab
|
|||
1508acb7ae | |||
2642a772ad | |||
7c94ab3404 | |||
38b3166b3f | |||
e285ac1c47 | |||
534d0dc1af
|
|||
7cb5766a7a
|
|||
6e87a0249c
|
|||
c0ab3351c9
|
|||
2259d269dd
|
|||
57a225f926
|
|||
d9e4ff6973 | |||
07b13c153d | |||
02dc6174bf | |||
ce363e3785
|
|||
b3c3363591
|
|||
aad725a4e5 | |||
fd714a118d | |||
4446e471d9
|
|||
3fe51b08a6
|
|||
6a8f48c493
|
|||
0f6e7eb159
|
|||
c4bd355146 | |||
92fe9d92de
|
|||
99c6c8bbd0
|
|||
26552ebeca | |||
76e80c259c | |||
f59c2b9a9e | |||
bf3565f497 | |||
7f119f36d2 | |||
18728731ed | |||
14334dae92
|
|||
0aaf63215b | |||
72460fdb49
|
|||
b08f9d9af6
|
|||
66c1895cd0
|
|||
4e56bd172e | |||
ff73746935
|
|||
5821c60eb4
|
|||
2ca7bc5a70
|
|||
d9530271c3
|
|||
97b529318d
|
|||
c4598ff058
|
|||
b3d903115e | |||
6420bd162a | |||
9680066d0a | |||
d5e923233b | |||
d0b857dfb7 | |||
0c4ab25421 | |||
84f50bab83
|
|||
43d6b98695 | |||
4b7debacc6 | |||
97f99415d6 | |||
c195d03b2e
|
|||
8f8bcde90e | |||
d38fc53701 | |||
e4bc424093 | |||
5a87a17fa2 | |||
9567146ff8
|
|||
b45b0b2271
|
|||
d900a689da
|
|||
70c3f9dcaa
|
|||
9a1a686b9e
|
|||
e18ec86eca
|
|||
f52f4b1ce2 | |||
ad530925d5 | |||
c12dfd06d8 | |||
728b7c647c
|
|||
a5e38a6856
|
|||
f400dea799
|
|||
6bd94cc167
|
|||
7a664eeab8
|
|||
dbfe1dc0d5 | |||
0747b6aa72 | |||
d388676678
|
|||
4b6887e304 | |||
60f7ae5453
|
|||
10e163be75
|
|||
84df438e9d
|
|||
e249f147bc | |||
d5118f0f98
|
|||
39e6a04889
|
|||
eb697befe3
|
|||
0bce6a506c | |||
dcae930895
|
|||
28716209a3 | |||
012e9b148e
|
|||
34a3a67ac7 | |||
aba369f11f
|
|||
1123c4d4df
|
|||
7cd1b0070a
|
|||
ec8febf623
|
|||
c10a926b9f | |||
9711dd9242
|
|||
d82cecbe6e | |||
14820d63ac
|
|||
3d27711abb
|
|||
1d5db0951e
|
|||
d67987745d | |||
bde03fc9c0
|
|||
be1ac09515 | |||
f0860a785d
|
|||
ead9c20888
|
|||
d1fde6f1e5 | |||
caa843fb1a | |||
11f7ed8436 | |||
88b0c33632 | |||
0c4762712b
|
|||
dd74f6c3ca | |||
783bdd297a
|
|||
bf399c3d91 | |||
06a058fc4d
|
|||
b464182df7
|
|||
a30bccc995
|
|||
980242404a
|
|||
a8545211e8
|
|||
fe439b4d3c | |||
f63f4b9193
|
|||
8d28b321d4
|
|||
8b45dd8bff
|
|||
b20abc5bfb | |||
af1474f10c
|
|||
66db12796b
|
|||
2d08fc0bfa
|
|||
9edc819a97
|
|||
d23cc6834a | |||
33cff5e2d2
|
|||
acbcbbe98f
|
|||
c3b0470aa6
|
|||
1860b754ce
|
|||
68138c6e79
|
|||
e56f8732be | |||
af5e81158c
|
|||
baa1d20556 | |||
1faecb09de
|
|||
1ad621e630
|
|||
5fc3d8de99
|
|||
224328cc85
|
|||
d285b1caec | |||
1f49f0c70d
|
|||
649deac81b
|
|||
7fa1196633
|
|||
1b0a7aeabd
|
|||
412d67494d
|
|||
25377ccfa2
|
|||
6657bf072c
|
|||
7f79ef6c12
|
|||
d72b7d9d66
|
|||
c687b1411c
|
|||
c2bed714dc
|
|||
f9f8f9481f
|
|||
8d6ca602f2
|
|||
c0bd5f572c
|
|||
25c7decb1e
|
|||
cc7b1d3331
|
|||
948f3a1a41
|
|||
8743f59b56
|
|||
2cc4a18c1e | |||
b1fbad39e3 | |||
de57b9da5b | |||
55624f0447 | |||
9841076699
|
|||
f1876681fd | |||
14b558b7f7
|
|||
54a7c3566f
|
|||
011be9837e
|
|||
88161ed125
|
|||
f02230804d | |||
8ddcc37c74 | |||
b50c75c13c | |||
36799ef51d
|
|||
772ef5b323
|
|||
2f8bed4581
|
|||
72def77d40
|
|||
bc1a1774a6 | |||
4b08f5dd5b
|
|||
b0562ea9c7
|
|||
f76cd94535
|
|||
8a1e5b7b99
|
|||
0e208629b0
|
|||
403657110b
|
|||
23f21b40eb | |||
a6b3ccb4cc
|
|||
d7b494a950
|
|||
73bc043538
|
|||
02e7e809de
|
|||
d6f6aff139 | |||
d39a49bd4c | |||
f42318bc57 | |||
fd3a799019 | |||
1664e6adb5 | |||
8042f3607d
|
|||
59278447fd | |||
b58977fd65 | |||
beae6b3f05 | |||
12c60ac310 | |||
1acbb8bb43 | |||
051e9e6ffb | |||
6d88746ec3 | |||
5571a6852e | |||
1ddb93410e | |||
b0b186ac1f | |||
f95331742b | |||
c91ad9e08b | |||
fcabaa5b09 | |||
bf9ab7edf7 | |||
957d756d1e | |||
4b054b7628 | |||
9001a28545
|
|||
6b2fbc6917 | |||
ab770a0057 | |||
0cbf28f25c
|
|||
cbcc06ede7 | |||
a55aa4a667
|
|||
d2324dace9
|
|||
1e4e524f95
|
|||
39d6ec73c2 | |||
74cfa2949a
|
|||
ffdb4451f6
|
|||
15716c988b | |||
f5ec50b674 | |||
02b70ee203 | |||
95b6954175 | |||
a82cbff5a8
|
|||
87b766dfb8
|
|||
09b7a01ff6 | |||
fd6b76bfdd
|
|||
40c086086b
|
|||
83e8fe0587 | |||
6cffae4397
|
|||
d73ef3a314
|
|||
0b8bd61e80 | |||
380a02ee94
|
|||
c6e2e2de49 | |||
6479aeda63 | |||
26cf112121 | |||
62bd535622
|
|||
eea7683581 | |||
df6aa80169
|
|||
2fd1a46e66
|
|||
2153aa2842
|
|||
1f2f2aac13
|
|||
9be81f1725 | |||
601adfc9c2 | |||
ac84ac2c3e | |||
7ed18bd570 | |||
e27ad147d4
|
|||
ba47757b50
|
|||
7e9c626ec8
|
|||
8d6dd97d85
|
|||
2fae5613ce
|
|||
fdb14cbdc5
|
|||
0cef3fa924
|
|||
37a35c4446
|
|||
15d25b4c5b
|
|||
069f84d220 | |||
627a16d51a | |||
fcfae1f67f | |||
01ebd356ba | |||
5785bbd0cc
|
|||
d3e6101447
|
|||
6d5bde40db
|
|||
c48f04eed5
|
|||
18304c31fa | |||
8caa408cbd | |||
4a983958bf | |||
03ec5bdc39 | |||
9c5d6a15db | |||
ddc80071e0 | |||
deb0275bb5
|
|||
ec0ebc3653
|
|||
c9f4a8070d | |||
b917358b9f | |||
5db9f383a6 | |||
fe3accb9ad | |||
68d74a4748 | |||
b6ec7da7fa | |||
c7df13fa68 | |||
daceb6bc1d | |||
8239e610cc | |||
b28d938468 | |||
e0457831d7 | |||
96fab88a55 | |||
50f2eb42f3 | |||
1bb8bea8d9 | |||
0a05873f4e | |||
80d231586e | |||
5f44cb96be | |||
96136106c7 | |||
65a2d40614 | |||
7e5539ee05 | |||
698cdb3e1d | |||
91ea3669af | |||
dcf1483c47 | |||
0ad0dc391d | |||
774a291f8c | |||
f27333fa0d | |||
5083c9390c | |||
bb4cc59049 | |||
23e38990a3 | |||
8bbd37cf76 | |||
95511e484e | |||
276862fa6e | |||
4a5c2cdd4f | |||
be09b3475d | |||
8927949c4b | |||
acc58ebef1 | |||
7bc344755f | |||
bde17600af | |||
0b1aff220c | |||
cfbff77da8 | |||
673af7f097 | |||
6f5e70dce2 | |||
9b337d3077 | |||
b333ffe707 | |||
736c12a2f8 | |||
773cf59632 | |||
a3d6fa36e9 | |||
4043e30d34 | |||
0276d3dab4 | |||
1c59ff41c1 | |||
1c1af2c7c7 | |||
d74c3fc241 | |||
2b26f1b106 | |||
9e87142324 | |||
5c903d5b02 | |||
92b0b4189c | |||
8b99fbdc81 | |||
74f090833e | |||
a89ecbf6d7 | |||
5d17a1c2b3 | |||
c7a7ca9f79 | |||
3b34d70c23 | |||
45bd838a13 | |||
ba1bead5ad | |||
dbbd22960e | |||
4603329cf7 | |||
9374e9eaab | |||
b6a88ef08e | |||
fbe54e1a2b | |||
4083a3090f | |||
0c6a9677e1 | |||
7eaf6557eb | |||
3bb0a08e95 | |||
d623e83be8 | |||
5a49c4a6ce | |||
bb463aa05c | |||
77e90328a1 | |||
37bb164cc4 | |||
bebde054f4 | |||
d00e4247f6 | |||
a07f21329a | |||
4157b05288 | |||
e9b8d2658d | |||
07ff920e99 | |||
1f06ea4590 | |||
63c584e061 | |||
183cd85907 | |||
f57342602d | |||
f8da9cff7c | |||
005e15b21b | |||
8993ccdf66 | |||
c9c0b3e6ff | |||
33fd280e51 | |||
a5178e2bb0 | |||
01b3a894e6 | |||
f075d28905 | |||
83f6a22a75 | |||
a38bae16cd | |||
53666bdeda | |||
00281fdc5e | |||
43b530cdb7 | |||
92ce64cd39 | |||
268c9e3f0b | |||
9edbdf1a8d | |||
004b561b7d | |||
98a9601dd7 | |||
91a8a2e895 | |||
e503450dda | |||
ad08276079 | |||
7e5fa2e61a | |||
dcf7d0af71 | |||
50668ca7a7 | |||
6975fae511 | |||
ce155e7629 | |||
1fb50d84c6 | |||
71bc121deb | |||
0202c93252 | |||
de1188c1bb | |||
5f87092465 | |||
fb7b273485 | |||
8a69507d05 | |||
6c367aab32 | |||
f899d169b2 | |||
2b2d920540 | |||
d7e1a69e75 | |||
b72dad49a9 | |||
cef8d623c9 | |||
0f2daf94df | |||
a49ab379af | |||
bc85ccd8ef | |||
523dd9b759 | |||
ce5ae8a713 | |||
5b613f98ee | |||
aab50dce5a | |||
c8282453f4 | |||
1f491a72a3 | |||
e8ccb4700a | |||
1d01d27b17 | |||
c3486c26b8 | |||
63fda2f970 | |||
de4de87667 | |||
e0a31cb992 | |||
6b406b8e9a | |||
4508b5dd54 | |||
f2897fa606 | |||
1ecc34800c | |||
3f3523465a | |||
cd75d35229 | |||
b7ab257ae5 | |||
333faaa5f7 | |||
3c25af39c6 | |||
40b2973d9e | |||
f6fcb2fb28 | |||
4b5c4fecc7 | |||
be7b3f54c7 | |||
7fe45d51dd | |||
3d25a30a11 | |||
3a60266774 | |||
536fd81bf8 | |||
c636c5c3e3 | |||
0bd87497d2 | |||
9bb9a43d45 | |||
5074e9d674 | |||
68cfa92c6a | |||
c2100c2f09 | |||
5e0d33c9a8 | |||
93ad3ada7d | |||
64539a2193 | |||
2e34d5c46f | |||
8115a39d66 | |||
b17c413e8f | |||
996d102a39 | |||
9f17661f52 | |||
67d3cebed8 | |||
d71f043704 | |||
2263938b8b | |||
c171654d2b | |||
47a5dd4523 | |||
e612e086ab | |||
c5b8831b43 | |||
7af0349a87 | |||
934a147caa | |||
c9b269b01a | |||
7296344730 | |||
b32a9273ae | |||
e5a09e148b | |||
d3f9a83af8 | |||
350e5d77b8 | |||
a93381494a | |||
9b56a3ce06 | |||
a3bdfe8b04 | |||
9b503678c9 | |||
298ecba373 | |||
45aa63b4ab | |||
5245cbfdd0 | |||
a54e5a8e14 | |||
4f48c25bf7 | |||
d45c6bce97 | |||
5692d70de1 | |||
3974d4134a | |||
f0c14e21e4 | |||
fe6390fab3 | |||
5e17ea9bf0 | |||
e9bf90e366 | |||
99d2c0e0ca | |||
362be2288f | |||
98617b5ce5 | |||
0efd9ca9c6 | |||
f21ee37a01 | |||
d8367f7e62 | |||
e862df4d06 | |||
fb851b93a0 | |||
5337ac4517 | |||
0ebb237787 | |||
de0ecb44e4 | |||
42c34b310e | |||
c274615aac | |||
e3e74c3f20 | |||
10362f7d30 | |||
21a3813643 | |||
ae2fd8bb37 | |||
ca5b2238bc | |||
d520a0e2f2 | |||
c99a0701d2 | |||
2c7ad5385e | |||
a40c881b9f | |||
432a642422 | |||
abfe923b05 | |||
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 | |||
56630b05c2 | |||
64d0ca491a | |||
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 | |||
8d036bcd4f | |||
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 | |||
24f6a59cf9 | |||
9016d3d992 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,6 +6,7 @@ log
|
||||
/gps_log.txt
|
||||
/config/*.json
|
||||
|
||||
/.tmtc-history.txt
|
||||
/scex_conf.json
|
||||
/tmtc_conf.json
|
||||
/seqcnt*.txt
|
||||
@ -27,3 +28,7 @@ log
|
||||
/.installed.cfg
|
||||
/*.egg
|
||||
/MANIFEST
|
||||
|
||||
# Telemetry database.
|
||||
/tm.db
|
||||
|
||||
|
24
.run/CFDP Downlink Test Large.run.xml
Normal file
24
.run/CFDP Downlink Test Large.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="CFDP Downlink Test Large" 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 -p /tmp/obsw_update.bin /tmp/obsw_update_copy.bin -d 0.1" />
|
||||
<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>
|
24
.run/CFDP Downlink Test Larger.run.xml
Normal file
24
.run/CFDP Downlink Test Larger.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="CFDP Downlink Test Larger" 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 -p /tmp/fake_5kb.bin /tmp/fake_5kb_copy.bin -d 0.1" />
|
||||
<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>
|
24
.run/CFDP Downlink Test.run.xml
Normal file
24
.run/CFDP Downlink Test.run.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="CFDP Downlink Test" 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 -p /tmp/hello.txt /tmp/hello2.txt -d 0.1" />
|
||||
<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>
|
@ -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>
|
581
CHANGELOG.md
581
CHANGELOG.md
@ -10,7 +10,583 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v2.8.0] 2023-01-01
|
||||
## Added
|
||||
|
||||
- Added handling for new clock events.
|
||||
|
||||
# [v6.2.0] 2024-04-10
|
||||
|
||||
## Added
|
||||
|
||||
- Added version set for STR.
|
||||
- Command for relative timeshift.
|
||||
- Health commands for payload components.
|
||||
|
||||
## Fixed
|
||||
|
||||
- EPS power commands working again.
|
||||
- GNSS commands working again.
|
||||
|
||||
## Changed
|
||||
|
||||
- Fixed PLOC commanding
|
||||
|
||||
# [v6.1.1] 2024-03-06
|
||||
|
||||
## Added
|
||||
|
||||
- Added Core Ctrl cmd to update leap seconds.
|
||||
|
||||
# [v6.1.0] 2024-02-29
|
||||
|
||||
## Added
|
||||
|
||||
- Added commands to unlock and use STR secondary firmware slot.
|
||||
- STR BlobStats TM handling
|
||||
- New ACS CTRL commands.
|
||||
|
||||
## Fixed
|
||||
|
||||
- RW commanding
|
||||
|
||||
# [v6.0.0] 2024-02-08
|
||||
|
||||
## Changed
|
||||
|
||||
- Bumped `tmccmd` to `v8.0.0rc1` to introduce new command tree handling.
|
||||
- Added new PLOC SUPV commands to test sets, cleaned up PLOC SUPV commanding.
|
||||
|
||||
# [v5.13.0] 2024-01-30
|
||||
|
||||
## Added
|
||||
|
||||
- First variant of TM handling with a DB which might serve as a foundation for better TM
|
||||
handling with an ORM in the future.
|
||||
- Added new parameter commands for PLOC MPSoC to skip SUPV commanding.
|
||||
|
||||
# [v5.12.1] 2023-12-13
|
||||
|
||||
## Added
|
||||
|
||||
- A few new commands to test the TC scheduler.
|
||||
|
||||
# [v5.12.0] 2023-12-06
|
||||
|
||||
## Added
|
||||
|
||||
- New ACS controller commands.
|
||||
|
||||
# [v5.11.0] 2023-11-30
|
||||
|
||||
## Added
|
||||
|
||||
- Added new commands to disable channel order checks partially for the payload PCDU normal modes.
|
||||
- Core controller auto switch enable and disable command.
|
||||
- Star Tracker JSON reload command. Reboot still required.
|
||||
- PLOC SUPV ADC and Counters report TM handling.
|
||||
|
||||
# [v5.10.1] 2023-10-27
|
||||
|
||||
- Minor improvements, update event translation.
|
||||
|
||||
# [v5.10.0] 2023-10-27
|
||||
|
||||
- Added new STR commands to allow more debugging.
|
||||
|
||||
# [v5.9.0] 2023-10-24
|
||||
|
||||
## Added
|
||||
|
||||
- Added command to update PL PCDU I and V parameter bounds commands.
|
||||
|
||||
# [v5.8.0] 2023-10-11
|
||||
|
||||
## Added
|
||||
|
||||
- Xiphos WDT enable and disable command.
|
||||
|
||||
# [v5.7.1] 2023-10-11
|
||||
|
||||
## Added
|
||||
|
||||
- SCEX normal command
|
||||
|
||||
# [v5.7.0] 2023-10-10
|
||||
|
||||
- `tmtccmd` v6.0.0
|
||||
- `spacepackets` v18.0.0
|
||||
|
||||
## Added
|
||||
|
||||
- Power controller commands.
|
||||
|
||||
# [v5.6.0] 2023-09-14
|
||||
|
||||
- `tmtccmd` v6.0.0
|
||||
- `spacepackets` v18.0.0
|
||||
|
||||
## Added
|
||||
|
||||
- CFDP file downlink support.
|
||||
|
||||
# [v5.5.1] 2023-09-12
|
||||
|
||||
## Fixed
|
||||
|
||||
- Some API usage fixes related to `tmtccmd` update.
|
||||
|
||||
# [v5.5.0] 2023-09-12
|
||||
|
||||
- Version is not specfied dynamically anymore and can be updated in `pyproject.toml`
|
||||
- New events and returnvalues
|
||||
- Bump `tmtccmd` to v6.0.0rc0
|
||||
|
||||
# [v5.4.3] 2023-08-15
|
||||
|
||||
## Added
|
||||
|
||||
- PLOC SUPV HK parsing.
|
||||
|
||||
# [v5.4.2] 2023-08-15
|
||||
|
||||
## Added
|
||||
|
||||
- New NONE entry for PL PCDU submode enum.
|
||||
|
||||
# [v5.4.1] 2023-08-15
|
||||
|
||||
## Added
|
||||
|
||||
- New event TLE_TOO_OLD
|
||||
|
||||
## Changed
|
||||
|
||||
- PL Subsystem mode ID is int enum now.
|
||||
|
||||
# [v5.4.0] 2023-08-15
|
||||
|
||||
## Added
|
||||
|
||||
- New enumeration for PL PCDU commanding.
|
||||
- Some new events
|
||||
|
||||
# [v5.3.1] 2023-07-26
|
||||
|
||||
## Changed
|
||||
|
||||
- Adaptions for ACS CTRL strategy enum to make it compatible to software. Also make it re-usable
|
||||
by putting it in global scope.
|
||||
|
||||
# [v5.3.0] 2023-07-26
|
||||
|
||||
## Added
|
||||
|
||||
- Dataset handling for new ACS fused rot rate dataset.
|
||||
|
||||
# [v5.2.0] 2023-07-13
|
||||
|
||||
- `tmtccmd` v5.0.0
|
||||
|
||||
## Added
|
||||
|
||||
- New TCS controller events
|
||||
|
||||
## Changed
|
||||
|
||||
- HK level can be specified as CLI argument now.
|
||||
|
||||
# [v5.1.0] 2023-06-28
|
||||
|
||||
## Added
|
||||
|
||||
- Internal error reporter dataset handling.
|
||||
|
||||
## Fixed
|
||||
|
||||
- `APP_LOGGER` is the root logger now.
|
||||
|
||||
## Changed
|
||||
|
||||
- HK is only displayed in brief format per default now. This will soon be adaptable by CLI
|
||||
argument.
|
||||
|
||||
# [v5.0.0] 2023-06-22
|
||||
|
||||
## Changed
|
||||
|
||||
- Force flag for copy helper.
|
||||
|
||||
# [v4.1.0] 2023-06-14
|
||||
|
||||
## Added
|
||||
|
||||
- Some BPX battery commands
|
||||
|
||||
# [v4.0.0] 2023-06-10
|
||||
|
||||
`tmtccmd` version: v5.0.0rc0
|
||||
|
||||
## Added
|
||||
|
||||
- Event handling for reboot counter events.
|
||||
- Start adding new MPSoC commands, improve MPSoC commanding module a bit.
|
||||
- Handling for PLOC MPSoC flash content report.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix for PLOC power switching.
|
||||
- Bump `tmtccmd` to v5.0.0rc0 for important bugfix in CFDP header.
|
||||
|
||||
# [v3.1.2] 2023-06-19
|
||||
|
||||
## Fixed
|
||||
|
||||
- Pin `tmtccmd` to v4.1.3 to enforce correct `spacepackets` version on install
|
||||
|
||||
# [v3.1.1] 2023-04-17
|
||||
|
||||
## Added
|
||||
|
||||
- Update generated event file.
|
||||
|
||||
# [v3.1.0] 2023-04-16
|
||||
|
||||
## Added
|
||||
|
||||
- New core controller file system helper commands.
|
||||
|
||||
# [v3.0.0] 2023-04-14
|
||||
|
||||
## Fixed
|
||||
|
||||
- Bugfix for STR solution set format.
|
||||
- Update for STR commands.
|
||||
|
||||
## Added
|
||||
|
||||
- Added core commands to execute `systemctl` commands and to execute arbitrary Linux commands.
|
||||
|
||||
# [v2.22.1] 2023-04-12
|
||||
|
||||
## Added
|
||||
|
||||
- Prompts to specify custom filename for OBSW update
|
||||
|
||||
# [v2.22.0] 2023-04-07
|
||||
|
||||
- Various smaller and helper commands added for tests
|
||||
- Update generated files
|
||||
|
||||
# [v2.21.0] 2023-04-04
|
||||
|
||||
## Added
|
||||
|
||||
- Add boot mode command for EIVE system.
|
||||
|
||||
## Changed
|
||||
|
||||
- PCDU switcher set now includes the 3V3 stack switcher state.
|
||||
|
||||
# [v2.20.1] 2023-04-01
|
||||
|
||||
## Fixed
|
||||
|
||||
- MEKF: Handle NOT_FINITE status (key 5)
|
||||
|
||||
# [v2.20.0] 2023-03-28
|
||||
|
||||
## Changed
|
||||
|
||||
- COM `Submode` enum moved from subsystem module to separate definitions module and renamed
|
||||
to `Mode`. Added re-imports with the name `ComMode` in the subsystem and syrlinks module.
|
||||
- Convert various enums to proper `IntEnum`s
|
||||
- Updates for some enumerations.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/178
|
||||
|
||||
## Fixed
|
||||
|
||||
- Eb to N0 calculation: Improve robustness against division by zero.
|
||||
- Some fixes for PCDU commands: Wrongfully packed command to switch devices off instead of on.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/180.
|
||||
|
||||
## Added
|
||||
|
||||
- Added `PcduSwitches` enum.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/179
|
||||
|
||||
# [v2.19.4] 2023-03-24
|
||||
|
||||
## Fixed
|
||||
|
||||
- Correction for Syrlinks submodes
|
||||
- Update generated files
|
||||
|
||||
# [v2.19.3] 2023-03-21
|
||||
|
||||
- Update generated files
|
||||
- Improve STR commanding a bit
|
||||
|
||||
# [v2.19.2] 2023-03-17
|
||||
|
||||
- Update generated files
|
||||
|
||||
## Added
|
||||
|
||||
- Add a little bit of first time stamp extraction for HK packet handling.
|
||||
|
||||
# [v2.19.1] 2023-03-14
|
||||
|
||||
## Added
|
||||
|
||||
- New `subsystems.csv` file with all subsystem IDs
|
||||
- Update `events.csv` and `returnvalues.csv`
|
||||
|
||||
# [v2.19.0] 2023-03-14
|
||||
|
||||
## Added
|
||||
|
||||
- Added RTD ID enum and Set ID enumeration in the RTD module.
|
||||
- STR Temperature Set
|
||||
- Added some more MPSoC commands
|
||||
- RTD HK set
|
||||
|
||||
## Fixed
|
||||
|
||||
- Import error for STR code
|
||||
- STR HK bugfixes and length check
|
||||
|
||||
# [v2.18.1] 2023-03-11
|
||||
|
||||
## Fixed
|
||||
|
||||
- Missing heater location fix.
|
||||
|
||||
## Added
|
||||
|
||||
- Request to announce reboot counts in core controller commands
|
||||
|
||||
# [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.
|
||||
@ -45,7 +621,6 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
## Added
|
||||
|
||||
- Added command to request switcher set from PCDU handler.
|
||||
- Star Tracker: Add commands to update default datarate.
|
||||
|
||||
## Changed
|
||||
@ -157,4 +732,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)
|
||||
|
43
README.md
43
README.md
@ -4,7 +4,7 @@ This application can be used to test the EIVE On-Board Software. Furthermore, it
|
||||
also be used to retrieve all sorts of telemetry data like housekeeping data.
|
||||
|
||||
It is recommended to use this application with a virtual environment.
|
||||
The [virtual environemnt](#venv) chapter describes how to set one up. The [requirements](#reqs)
|
||||
The [virtual environment](#venv) chapter describes how to set one up. The [requirements](#reqs)
|
||||
describes how to install all required packages.
|
||||
|
||||
The configuration file can currently be found at `tmtc_conf.json`. It caches settings
|
||||
@ -61,42 +61,57 @@ Run GUI mode
|
||||
# <a id="reqs"></a> Install requirements
|
||||
|
||||
There are two ways to install the requirements. One is to install the primary dependency
|
||||
`tmtccmd` interactively. This is the recommended way
|
||||
`tmtccmd` interactively.
|
||||
|
||||
Assuming you are running in a virtual environment:
|
||||
## Installing via PyPI
|
||||
|
||||
1. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
|
||||
It is recommended to install `eive-tmtc` itself interactively, which also installs
|
||||
all required dependencies.
|
||||
|
||||
```sh
|
||||
cd deps/tmtccmd
|
||||
pip install -e .[gui]
|
||||
```
|
||||
```sh
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
Alternatively you can also install the packages from PyPI completely, but the risk of
|
||||
incompatibilities will be high there
|
||||
If you only want to install all dependencies:
|
||||
|
||||
```sh
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Install interactively
|
||||
|
||||
Clone the dependency first inside the `deps` folder
|
||||
|
||||
```sh
|
||||
cd deps
|
||||
./install_tmtccmd.sh
|
||||
```
|
||||
|
||||
Then you can install `tmtccmd` interactively
|
||||
|
||||
```sh
|
||||
cd tmtccmd
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
# Run Linter
|
||||
|
||||
Can be used to quickly check validity of script. Install `flake8` first
|
||||
|
||||
```sh
|
||||
python3 -m pip install flake8
|
||||
python3 -m pip install ruff
|
||||
```
|
||||
|
||||
or on Windows
|
||||
|
||||
```sh
|
||||
py -m pip install flake8
|
||||
py -m pip install ruff
|
||||
```
|
||||
|
||||
and then run the `lint.py` script
|
||||
and then run it
|
||||
|
||||
```sh
|
||||
./lint.py
|
||||
ruff .
|
||||
```
|
||||
|
||||
# Run Auto-Formatter
|
||||
|
9
automation/Dockerfile
Normal file
9
automation/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM python:3
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get --yes upgrade
|
||||
#tzdata is a dependency, won't install otherwise
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
#pip needs a valid user to work
|
||||
RUN adduser --uid 114 jenkins
|
14
automation/Jenkinsfile
vendored
Normal file
14
automation/Jenkinsfile
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'eive-tmtc-ci:d2'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Package') {
|
||||
steps {
|
||||
sh 'pip install .'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 8
|
||||
VERSION_REVISION = 0
|
||||
|
||||
__version__ = "2.8.0"
|
||||
|
||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
||||
|
||||
APP_LOGGER = logging.getLogger()
|
||||
|
0
eive_tmtc/cfdp/__init__.py
Normal file
0
eive_tmtc/cfdp/__init__.py
Normal file
28
eive_tmtc/cfdp/fault_handler.py
Normal file
28
eive_tmtc/cfdp/fault_handler.py
Normal file
@ -0,0 +1,28 @@
|
||||
import logging
|
||||
|
||||
from spacepackets.cfdp import ConditionCode, TransactionId
|
||||
from cfdppy.mib import DefaultFaultHandlerBase
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EiveCfdpFaultHandler(DefaultFaultHandlerBase):
|
||||
def notice_of_suspension_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Received notice of suspension: {cond!r}")
|
||||
|
||||
def notice_of_cancellation_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Received notice of cancellation: {cond!r}")
|
||||
|
||||
def abandoned_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Abandoned transaction: {cond!r}")
|
||||
|
||||
def ignore_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Ignored transaction: {cond!r}")
|
259
eive_tmtc/cfdp/handler.py
Normal file
259
eive_tmtc/cfdp/handler.py
Normal file
@ -0,0 +1,259 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, Tuple
|
||||
|
||||
import deprecation
|
||||
from spacepackets import PacketType, SpacePacket, SpacePacketHeader
|
||||
from spacepackets.cfdp import GenericPduPacket, PduFactory
|
||||
from spacepackets.cfdp.pdu import PduHolder
|
||||
from cfdppy import (
|
||||
CfdpUserBase,
|
||||
LocalEntityCfg,
|
||||
RemoteEntityCfgTable,
|
||||
)
|
||||
from cfdppy.defs import CfdpState
|
||||
from cfdppy.handler import (
|
||||
DestHandler,
|
||||
DestStateWrapper,
|
||||
SourceHandler,
|
||||
SourceStateWrapper,
|
||||
)
|
||||
from cfdppy.handler.common import PacketDestination, get_packet_destination
|
||||
from cfdppy.mib import CheckTimerProvider
|
||||
from cfdppy.request import PutRequest
|
||||
from spacepackets.seqcount import ProvidesSeqCount
|
||||
from tmtccmd.version import get_version
|
||||
|
||||
|
||||
@dataclass
|
||||
class StateWrapper:
|
||||
source_handler_state = SourceStateWrapper()
|
||||
dest_handler_state = DestStateWrapper()
|
||||
|
||||
|
||||
class CfdpHandler:
|
||||
"""Wrapper class which wraps both the :py:class:`tmtccmd.cfdp.handler.source.SourceHandler` and
|
||||
:py:class:`tmtccmd.cfdp.handler.dest.DestHandler` in a sensible way.
|
||||
|
||||
If you have special requirements, for example you want to spawn a new destination handler
|
||||
for each file copy transfer to allow multiple consecutive file transfers, it might be a good
|
||||
idea to write a custom wrapper."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: LocalEntityCfg,
|
||||
user: CfdpUserBase,
|
||||
seq_cnt_provider: ProvidesSeqCount,
|
||||
remote_cfg_table: RemoteEntityCfgTable,
|
||||
check_timer_provider: CheckTimerProvider,
|
||||
):
|
||||
self.remote_cfg_table = remote_cfg_table
|
||||
self.dest_handler = DestHandler(
|
||||
cfg=cfg,
|
||||
user=user,
|
||||
remote_cfg_table=remote_cfg_table,
|
||||
check_timer_provider=check_timer_provider,
|
||||
)
|
||||
self.source_handler = SourceHandler(
|
||||
cfg=cfg,
|
||||
seq_num_provider=seq_cnt_provider,
|
||||
user=user,
|
||||
remote_cfg_table=remote_cfg_table,
|
||||
check_timer_provider=check_timer_provider,
|
||||
)
|
||||
|
||||
def put_request(self, request: PutRequest):
|
||||
if not self.remote_cfg_table.get_cfg(request.destination_id):
|
||||
raise ValueError(
|
||||
f"No remote CFDP config found for entity ID {request.destination_id}"
|
||||
)
|
||||
self.source_handler.put_request(
|
||||
request, self.remote_cfg_table.get_cfg(request.destination_id) # type: ignore
|
||||
)
|
||||
|
||||
def pull_next_source_packet(self) -> Optional[PduHolder]:
|
||||
res = self.source_handler.state_machine()
|
||||
if res.states.num_packets_ready:
|
||||
return self.source_handler.get_next_packet()
|
||||
return None
|
||||
|
||||
def pull_next_dest_packet(self) -> Optional[PduHolder]:
|
||||
res = self.dest_handler.state_machine()
|
||||
if res.states.packets_ready:
|
||||
return self.dest_handler.get_next_packet()
|
||||
return None
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self) -> Tuple[Optional[PduHolder], Optional[PduHolder]]:
|
||||
"""The iterator for this class will returns a tuple of optional PDUs wrapped b a
|
||||
:py:class:`PduHolder`.
|
||||
|
||||
:return: Can be a tuple where the first entry can hold a source packet and the second entry
|
||||
can be a destination packet. If both packets are None, a StopIteration will be raised.
|
||||
"""
|
||||
next_source_packet = self.pull_next_source_packet()
|
||||
next_dest_packet = self.pull_next_dest_packet()
|
||||
if not next_dest_packet and not next_source_packet:
|
||||
raise StopIteration
|
||||
return next_source_packet, next_dest_packet
|
||||
|
||||
def put_request_pending(self) -> bool:
|
||||
return self.source_handler.states.state != CfdpState.IDLE
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="6.0.0rc0",
|
||||
current_version=get_version(),
|
||||
details="Use insert_packet instead",
|
||||
)
|
||||
def pass_packet(self, packet: GenericPduPacket):
|
||||
self.insert_packet(packet)
|
||||
|
||||
def insert_packet(self, packet: GenericPduPacket):
|
||||
"""This function routes the packets based on PDU type and directive type if applicable.
|
||||
|
||||
The routing is based on section 4.5 of the CFDP standard which specifies the PDU forwarding
|
||||
procedure."""
|
||||
if get_packet_destination(packet) == PacketDestination.DEST_HANDLER:
|
||||
self.dest_handler.insert_packet(packet)
|
||||
elif get_packet_destination(packet) == PacketDestination.SOURCE_HANDLER:
|
||||
self.source_handler.insert_packet(packet) # type: ignore
|
||||
|
||||
|
||||
class CfdpInCcsdsHandler:
|
||||
"""Wrapper helper type used to wrap PDU packets into CCSDS packets and to extract PDU
|
||||
packets from CCSDS packets.
|
||||
|
||||
:param cfg: Local CFDP entity configuration.
|
||||
:param user: User wrapper. This contains the indication callback implementations and the
|
||||
virtual filestore implementation.
|
||||
:param cfdp_seq_cnt_provider: Every CFDP file transfer has a transaction sequence number.
|
||||
This provider is used to retrieve that sequence number.
|
||||
:param ccsds_seq_cnt_provider: Each CFDP PDU is wrapped into a CCSDS space packet, and each
|
||||
space packet has a dedicated sequence count. This provider is used to retrieve the
|
||||
sequence count.
|
||||
:param ccsds_apid: APID to use for the CCSDS space packet header wrapped around each PDU.
|
||||
This is important so that the OBSW can distinguish between regular PUS packets and
|
||||
CFDP packets."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: LocalEntityCfg,
|
||||
user: CfdpUserBase,
|
||||
remote_cfg_table: RemoteEntityCfgTable,
|
||||
ccsds_apid: int,
|
||||
cfdp_seq_cnt_provider: ProvidesSeqCount,
|
||||
ccsds_seq_cnt_provider: ProvidesSeqCount,
|
||||
check_timer_provider: CheckTimerProvider,
|
||||
):
|
||||
self.cfdp_handler = CfdpHandler(
|
||||
cfg=cfg,
|
||||
user=user,
|
||||
seq_cnt_provider=cfdp_seq_cnt_provider,
|
||||
remote_cfg_table=remote_cfg_table,
|
||||
check_timer_provider=check_timer_provider,
|
||||
)
|
||||
self.ccsds_seq_cnt_provider = ccsds_seq_cnt_provider
|
||||
self.ccsds_apid = ccsds_apid
|
||||
|
||||
def put_request_pending(self):
|
||||
return self.cfdp_handler.put_request_pending()
|
||||
|
||||
def state_machine(self):
|
||||
self.source_handler.state_machine()
|
||||
self.dest_handler.state_machine()
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="6.0.0rc1",
|
||||
current_version=get_version(),
|
||||
details="Use state_machine instead",
|
||||
)
|
||||
def fsm(self):
|
||||
self.state_machine()
|
||||
|
||||
@property
|
||||
def source_handler(self):
|
||||
return self.cfdp_handler.source_handler
|
||||
|
||||
@property
|
||||
def dest_handler(self):
|
||||
return self.cfdp_handler.dest_handler
|
||||
|
||||
def pull_next_source_packet(self) -> Optional[Tuple[PduHolder, SpacePacket]]:
|
||||
"""Retrieves the next PDU to send and wraps it into a space packet"""
|
||||
next_packet = self.cfdp_handler.pull_next_source_packet()
|
||||
if next_packet is None:
|
||||
return next_packet
|
||||
sp_header = SpacePacketHeader(
|
||||
packet_type=PacketType.TC,
|
||||
apid=self.ccsds_apid,
|
||||
seq_count=self.ccsds_seq_cnt_provider.get_and_increment(),
|
||||
data_len=next_packet.packet_len - 1,
|
||||
)
|
||||
return next_packet, SpacePacket(sp_header, None, next_packet.pack())
|
||||
|
||||
def pull_next_dest_packet(self) -> Optional[Tuple[PduHolder, SpacePacket]]:
|
||||
"""Retrieves the next PDU to send and wraps it into a space packet"""
|
||||
next_packet = self.cfdp_handler.pull_next_dest_packet()
|
||||
if next_packet is None:
|
||||
return next_packet
|
||||
sp_header = SpacePacketHeader(
|
||||
packet_type=PacketType.TC,
|
||||
apid=self.ccsds_apid,
|
||||
seq_count=self.ccsds_seq_cnt_provider.get_and_increment(),
|
||||
data_len=next_packet.packet_len - 1,
|
||||
)
|
||||
return next_packet, SpacePacket(sp_header, None, next_packet.pack())
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="6.0.0rc1",
|
||||
current_version=get_version(),
|
||||
details="Use insert_space_packet instead",
|
||||
)
|
||||
def pass_space_packet(self, space_packet: SpacePacket):
|
||||
self.insert_space_packet(space_packet)
|
||||
|
||||
def insert_space_packet(self, space_packet: SpacePacket) -> bool:
|
||||
if space_packet.user_data is None:
|
||||
raise ValueError(
|
||||
"space packet is empty, expected packet containing a CFDP PDU"
|
||||
)
|
||||
# Unwrap the user data and pass it to the handler
|
||||
pdu_raw = space_packet.user_data
|
||||
pdu_base = PduFactory.from_raw(pdu_raw)
|
||||
if pdu_base:
|
||||
self.insert_pdu_packet(pdu_base)
|
||||
return True
|
||||
return False
|
||||
|
||||
def insert_pdu_packet(self, pdu: GenericPduPacket):
|
||||
self.cfdp_handler.insert_packet(pdu)
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="6.0.0rc1",
|
||||
current_version=get_version(),
|
||||
details="Use insert_pdu_packet instead",
|
||||
)
|
||||
def pass_pdu_packet(self, pdu_base: GenericPduPacket):
|
||||
self.insert_pdu_packet(pdu_base)
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(
|
||||
self,
|
||||
) -> Tuple[
|
||||
Optional[Tuple[PduHolder, SpacePacket]],
|
||||
Optional[Tuple[PduHolder, SpacePacket]],
|
||||
]:
|
||||
"""The iterator for this class will returns a tuple of optional PDUs wrapped b a
|
||||
:py:class:`PduHolder`.
|
||||
|
||||
:return: Can be a tuple where the first entry can hold a source packet and the second entry
|
||||
can be a destination packet. If both packets are None, a StopIteration will be raised.
|
||||
"""
|
||||
next_source_tuple = self.pull_next_source_packet()
|
||||
next_dest_tuple = self.pull_next_dest_packet()
|
||||
if not next_source_tuple and not next_dest_tuple:
|
||||
raise StopIteration
|
||||
return next_source_tuple, next_dest_tuple
|
29
eive_tmtc/cfdp/tm.py
Normal file
29
eive_tmtc/cfdp/tm.py
Normal file
@ -0,0 +1,29 @@
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from eive_tmtc.config.definitions import CFDP_APID
|
||||
from spacepackets.ccsds import SPACE_PACKET_HEADER_SIZE
|
||||
from spacepackets.cfdp import PduFactory, PduType
|
||||
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
|
||||
from tmtccmd.tmtc import SpecificApidHandlerBase
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CfdpInCcsdsWrapper(SpecificApidHandlerBase):
|
||||
def __init__(self, cfdp_in_ccsds_handler: CfdpInCcsdsHandler):
|
||||
self.handler = cfdp_in_ccsds_handler
|
||||
super().__init__(CFDP_APID, None)
|
||||
|
||||
def handle_tm(self, packet: bytes, _user_args: Any):
|
||||
# Ignore the space packet header. Its only purpose is to use the same protocol and
|
||||
# have a seaprate APID for space packets. If this function is called, the APID is correct.
|
||||
pdu = packet[SPACE_PACKET_HEADER_SIZE:]
|
||||
generic_pdu = PduFactory.from_raw(pdu)
|
||||
assert generic_pdu is not None
|
||||
if generic_pdu.pdu_type == PduType.FILE_DATA:
|
||||
_LOGGER.info("Received File Data PDU")
|
||||
else:
|
||||
directive_type = PduFactory.pdu_directive_type(pdu)
|
||||
_LOGGER.info(f"Received File Directive PDU with type {directive_type!r}")
|
||||
self.handler.insert_pdu_packet(generic_pdu)
|
77
eive_tmtc/cfdp/user.py
Normal file
77
eive_tmtc/cfdp/user.py
Normal file
@ -0,0 +1,77 @@
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from spacepackets.cfdp import ConditionCode
|
||||
from spacepackets.util import UnsignedByteField
|
||||
from cfdppy import CfdpUserBase, TransactionId
|
||||
from cfdppy.mib import CheckTimerProvider, Countdown, EntityType
|
||||
from cfdppy.user import (
|
||||
TransactionFinishedParams,
|
||||
MetadataRecvParams,
|
||||
FileSegmentRecvdParams,
|
||||
TransactionParams,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EiveCheckTimerProvider(CheckTimerProvider):
|
||||
def provide_check_timer(
|
||||
self,
|
||||
local_entity_id: UnsignedByteField,
|
||||
remote_entity_id: UnsignedByteField,
|
||||
entity_type: EntityType,
|
||||
) -> Countdown:
|
||||
return Countdown(timedelta(seconds=5.0))
|
||||
|
||||
|
||||
class EiveCfdpUser(CfdpUserBase):
|
||||
def transaction_indication(
|
||||
self,
|
||||
transaction_indication_params: TransactionParams,
|
||||
):
|
||||
_LOGGER.info(
|
||||
f"CFDP User: Start of File {transaction_indication_params.transaction_id}"
|
||||
)
|
||||
|
||||
def eof_sent_indication(self, transaction_id: TransactionId):
|
||||
_LOGGER.info(f"CFDP User: EOF sent for {transaction_id}")
|
||||
|
||||
def transaction_finished_indication(self, params: TransactionFinishedParams):
|
||||
_LOGGER.info(f"CFDP User: {params.transaction_id} finished")
|
||||
_LOGGER.info(f"Delivery Code: {params.finished_params.delivery_code!r}")
|
||||
_LOGGER.info(f"Condition code: {params.finished_params.condition_code!r}")
|
||||
_LOGGER.info(f"File delivery status: {params.finished_params.delivery_code!r}")
|
||||
|
||||
def metadata_recv_indication(self, params: MetadataRecvParams):
|
||||
pass
|
||||
|
||||
def file_segment_recv_indication(self, params: FileSegmentRecvdParams):
|
||||
_LOGGER.info(
|
||||
f"CFDP User: Received File Data PDU for {params.transaction_id} | Offset:"
|
||||
f" {params.offset} | Segment Length: {params.length}"
|
||||
)
|
||||
|
||||
def report_indication(self, transaction_id: TransactionId, status_report: any):
|
||||
pass
|
||||
|
||||
def suspended_indication(
|
||||
self, transaction_id: TransactionId, cond_code: ConditionCode
|
||||
):
|
||||
pass
|
||||
|
||||
def resumed_indication(self, transaction_id: TransactionId, progress: int):
|
||||
pass
|
||||
|
||||
def fault_indication(
|
||||
self, transaction_id: TransactionId, cond_code: ConditionCode, progress: int
|
||||
):
|
||||
pass
|
||||
|
||||
def abandoned_indication(
|
||||
self, transaction_id: TransactionId, cond_code: ConditionCode, progress: int
|
||||
):
|
||||
pass
|
||||
|
||||
def eof_recv_indication(self, transaction_id: TransactionId):
|
||||
_LOGGER.info(f"CFDP User: EOF received for {transaction_id}")
|
@ -0,0 +1 @@
|
||||
from .definitions import * # noqa
|
||||
|
@ -3,6 +3,7 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
|
||||
from tmtccmd import CcsdsTmtcBackend
|
||||
|
@ -9,9 +9,16 @@ import enum
|
||||
from spacepackets import PacketType
|
||||
from spacepackets.ccsds import PacketId
|
||||
from spacepackets.util import UnsignedByteField
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
TM_DB_PATH = "tm.db"
|
||||
# Separate DB or not? Not sure..
|
||||
# RAW_TM_PATH = "raw_tm.db"
|
||||
|
||||
# TODO: The cleanest way would be to load those from the config file..
|
||||
PRINT_RAW_HK_B64_STR = False
|
||||
PRINT_RAW_EVENTS_B64_STR = False
|
||||
|
||||
PUS_APID = 0x65
|
||||
CFDP_APID = 0x66
|
||||
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
||||
@ -29,16 +36,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"
|
||||
@ -52,7 +60,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"
|
||||
@ -65,11 +73,17 @@ class CustomServiceList(str, enum.Enum):
|
||||
PL_SS = "pl_subsystem"
|
||||
ACS_BRD_ASS = "acs_brd_ass"
|
||||
SUS_BRD_ASS = "sus_brd_ass"
|
||||
TCS = "tcs"
|
||||
TCS_SS = "tcs_subsystem"
|
||||
TCS_CTRL = "tcs_ctrl"
|
||||
TCS_ASS = "tcs_ass"
|
||||
TIME = "time"
|
||||
PROCEDURE = "proc"
|
||||
RTD = "rtd"
|
||||
TMP1075 = "tmp1075"
|
||||
TVTTESTPROCEDURE = "tvtestproc"
|
||||
CONTROLLERS = "controllers"
|
||||
SCEX = "scex"
|
||||
TM_STORE = "tm_store"
|
||||
SYSTEM = "system"
|
||||
PWR_CTRL = "pwr_ctrl"
|
||||
EPS_SS = "eps_subsystem"
|
||||
XIPHOS_WDT = "xiphos_wdt"
|
||||
|
@ -1,244 +1,325 @@
|
||||
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
|
||||
4300;0x10cc;SWITCH_WENT_OFF;LOW;No description;fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||
4301;0x10cd;FUSE_CURRENT_HIGH;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4302;0x10ce;FUSE_WENT_OFF;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4304;0x10d0;POWER_ABOVE_HIGH_LIMIT;LOW;No description;fsfw/src/fsfw/power/Fuse.h
|
||||
4305;0x10d1;POWER_BELOW_LOW_LIMIT;LOW;No description;fsfw/src/fsfw/power/Fuse.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;Clock has been set. P1: old timeval seconds. P2: new timeval seconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;Clock dump event. P1: timeval seconds P2: timeval milliseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;Clock could not be set. P1: Returncode.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8903;0x22c7;CLOCK_DUMP;INFO;Clock dump event. P1: timeval seconds P2: timeval microseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8904;0x22c8;CLOCK_DUMP_BEFORE_SETTING_TIME;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8905;0x22c9;CLOCK_DUMP_AFTER_SETTING_TIME;INFO;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
|
||||
11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;;mission/controller/AcsController.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
|
||||
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
|
||||
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
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/devices/ploc/PlocMPSoCHandler.h
|
||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure 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
|
||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. 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
|
||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. 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
|
||||
11704;0x2db8;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. 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
|
||||
11705;0x2db9;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
12503;0x30d7;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;linux/devices/startracker/StrHelper.h
|
||||
12504;0x30d8;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;linux/devices/startracker/StrHelper.h
|
||||
12505;0x30d9;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;linux/devices/startracker/StrHelper.h
|
||||
12506;0x30da;FLASH_READ_FAILED;LOW;Flash read procedure failed;linux/devices/startracker/StrHelper.h
|
||||
12507;0x30db;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;linux/devices/startracker/StrHelper.h
|
||||
12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrHelper.h
|
||||
12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
|
||||
12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
|
||||
12511;0x30df;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent;linux/devices/startracker/StrHelper.h
|
||||
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
|
||||
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
|
||||
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
|
||||
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
|
||||
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
|
||||
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
|
||||
12703;0x319f;I_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12704;0x31a0;U_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12705;0x31a1;I_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12706;0x31a2;U_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12707;0x31a3;I_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
12708;0x31a4;U_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
13600;0x3520;SUPV_UPDATE_FAILED;LOW;update failed;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13601;0x3521;SUPV_UPDATE_SUCCESSFUL;LOW;update successful;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13602;0x3522;SUPV_CONTINUE_UPDATE_FAILED;LOW;Continue update command failed;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13603;0x3523;SUPV_CONTINUE_UPDATE_SUCCESSFUL;LOW;Continue update command successful;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13604;0x3524;TERMINATED_UPDATE_PROCEDURE;LOW;Terminated update procedure by command;linux/devices/ploc/PlocSupvUartMan.h
|
||||
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
|
||||
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
|
||||
13620;0x3534;SUPV_MISSING_EXE;LOW;Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13621;0x3535;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13622;0x3536;SUPV_EXE_FAILURE_REPORT;LOW;Execution report failure P1:;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13623;0x3537;SUPV_ACK_INVALID_APID;LOW;Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
13624;0x3538;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvUartMan.h
|
||||
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
|
||||
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;FDIR_REACTION_IGNORED;MEDIUM;;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;;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
|
||||
14000;0x36b0;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
|
||||
14001;0x36b1;REBOOT_SW;MEDIUM; 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;;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
|
||||
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
|
||||
10805;0x2a35;HANDLING_CFDP_REQUEST_FAILED;LOW;CFDP request handling failed. P2: Returncode.;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;The limits for the rotation in safe mode were violated.;mission/acs/defs.h
|
||||
11201;0x2bc1;RATE_RECOVERY;MEDIUM;The system has recovered from a rate rotation violation.;mission/acs/defs.h
|
||||
11202;0x2bc2;MULTIPLE_RW_INVALID;HIGH;Multiple RWs are invalid, uncommandable and therefore higher ACS modes cannot be maintained.;mission/acs/defs.h
|
||||
11203;0x2bc3;MEKF_INVALID_INFO;INFO;MEKF was not able to compute a solution. P1: MEKF state on exit;mission/acs/defs.h
|
||||
11204;0x2bc4;MEKF_RECOVERY;INFO;MEKF is able to compute a solution again.;mission/acs/defs.h
|
||||
11205;0x2bc5;MEKF_AUTOMATIC_RESET;INFO;MEKF performed an automatic reset after detection of nonfinite values.;mission/acs/defs.h
|
||||
11206;0x2bc6;PTG_CTRL_NO_ATTITUDE_INFORMATION;HIGH;For a prolonged time, no attitude information was available for the Pointing Controller. Falling back to Safe Mode.;mission/acs/defs.h
|
||||
11207;0x2bc7;SAFE_MODE_CONTROLLER_FAILURE;HIGH;The ACS safe mode controller was not able to compute a solution and has failed. P1: Missing information about magnetic field, P2: Missing information about rotational rate;mission/acs/defs.h
|
||||
11208;0x2bc8;TLE_TOO_OLD;INFO;The TLE for the SGP4 Propagator has become too old.;mission/acs/defs.h
|
||||
11209;0x2bc9;TLE_FILE_READ_FAILED;LOW;The TLE could not be read from the filesystem.;mission/acs/defs.h
|
||||
11210;0x2bca;PTG_RATE_VIOLATION;MEDIUM;The limits for the rotation in pointing mode were violated.;mission/acs/defs.h
|
||||
11211;0x2bcb;DETUMBLE_TRANSITION_FAILED;HIGH;The detumble transition has failed. //! P1: Last detumble state before failure.;mission/acs/defs.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/power/defs.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/power/defs.h
|
||||
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/power/defs.h
|
||||
11303;0x2c27;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/power/defs.h
|
||||
11304;0x2c28;DATASET_READ_FAILED;INFO;The dataset read for the inputs of the Power Controller has failed.;mission/power/defs.h
|
||||
11305;0x2c29;VOLTAGE_OUT_OF_BOUNDS;HIGH;No description;mission/power/defs.h
|
||||
11306;0x2c2a;TIMEDELTA_OUT_OF_BOUNDS;LOW;Time difference for Coulomb Counter was too large. P1: time in s * 10;mission/power/defs.h
|
||||
11307;0x2c2b;POWER_LEVEL_LOW;HIGH;The State of Charge is below the limit for payload use. Setting Payload to faulty.;mission/power/defs.h
|
||||
11308;0x2c2c;POWER_LEVEL_CRITICAL;HIGH;The State of Charge is below the limit for higher modes. Setting Reaction Wheels to faulty.;mission/power/defs.h
|
||||
11400;0x2c88;GPIO_PULL_HIGH_FAILED;LOW;No description;mission/tcs/HeaterHandler.h
|
||||
11401;0x2c89;GPIO_PULL_LOW_FAILED;LOW;No description;mission/tcs/HeaterHandler.h
|
||||
11402;0x2c8a;HEATER_WENT_ON;INFO;No description;mission/tcs/HeaterHandler.h
|
||||
11403;0x2c8b;HEATER_WENT_OFF;INFO;No description;mission/tcs/HeaterHandler.h
|
||||
11404;0x2c8c;SWITCH_ALREADY_ON;INFO;No description;mission/tcs/HeaterHandler.h
|
||||
11405;0x2c8d;SWITCH_ALREADY_OFF;INFO;No description;mission/tcs/HeaterHandler.h
|
||||
11406;0x2c8e;MAIN_SWITCH_TIMEOUT;MEDIUM;No description;mission/tcs/HeaterHandler.h
|
||||
11407;0x2c8f;FAULTY_HEATER_WAS_ON;LOW;No description;mission/tcs/HeaterHandler.h
|
||||
11500;0x2cec;BURN_PHASE_START;INFO;P1: Burn duration in milliseconds, P2: Dry run flag;mission/SolarArrayDeploymentHandler.h
|
||||
11501;0x2ced;BURN_PHASE_DONE;INFO;P1: Burn duration in milliseconds, P2: Dry run flag;mission/SolarArrayDeploymentHandler.h
|
||||
11502;0x2cee;MAIN_SWITCH_ON_TIMEOUT;LOW;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11503;0x2cef;MAIN_SWITCH_OFF_TIMEOUT;LOW;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11504;0x2cf0;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11505;0x2cf1;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/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/payload/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/payload/PlocMpsocHandler.h
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
|
||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
|
||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
|
||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure 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/acs/ImtqHandler.h
|
||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. 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/acs/ImtqHandler.h
|
||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. 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/acs/ImtqHandler.h
|
||||
11704;0x2db8;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. 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/acs/ImtqHandler.h
|
||||
11705;0x2db9;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) 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/acs/ImtqHandler.h
|
||||
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/acs/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/acs/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/acs/ImtqHandler.h
|
||||
11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/acs/rwHelpers.h
|
||||
11802;0x2e1a;RESET_OCCURED;LOW;No description;mission/acs/rwHelpers.h
|
||||
11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;mission/acs/str/StarTrackerHandler.h
|
||||
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;mission/acs/str/StarTrackerHandler.h
|
||||
11903;0x2e7f;COM_ERROR_REPLY_RECEIVED;LOW;Received COM error. P1: Communication Error ID (datasheet p32);mission/acs/str/StarTrackerHandler.h
|
||||
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/payload/plocSupvDefs.h
|
||||
12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/payload/plocSupvDefs.h
|
||||
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/payload/plocSupvDefs.h
|
||||
12004;0x2ee4;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/payload/plocSupvDefs.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/payload/plocSupvDefs.h
|
||||
12006;0x2ee6;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/payload/plocSupvDefs.h
|
||||
12007;0x2ee7;SUPV_HELPER_EXECUTING;LOW;Supervisor helper currently executing a command;linux/payload/plocSupvDefs.h
|
||||
12008;0x2ee8;SUPV_MPSOC_SHUTDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/payload/plocSupvDefs.h
|
||||
12009;0x2ee9;SUPV_ACK_UNKNOWN_COMMAND;LOW;Received ACK, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID.;linux/payload/plocSupvDefs.h
|
||||
12010;0x2eea;SUPV_EXE_ACK_UNKNOWN_COMMAND;LOW;Received ACK EXE, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID.;linux/payload/plocSupvDefs.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/payload/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/payload/PlocMemoryDumper.h
|
||||
12302;0x300e;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;linux/payload/PlocMemoryDumper.h
|
||||
12401;0x3071;INVALID_TC_FRAME;HIGH;No description;linux/ipcore/pdec.h
|
||||
12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/ipcore/pdec.h
|
||||
12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/ipcore/pdec.h
|
||||
12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/pdec.h
|
||||
12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/pdec.h
|
||||
12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/pdec.h
|
||||
12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/pdec.h
|
||||
12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/pdec.h
|
||||
12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;HIGH;No description;linux/ipcore/pdec.h
|
||||
12410;0x307a;PDEC_TRYING_RESET_WITH_INIT;LOW;Trying a PDEC reset with complete re-initialization;linux/ipcore/pdec.h
|
||||
12411;0x307b;PDEC_TRYING_RESET_NO_INIT;LOW;Trying a PDEC reset without re-initialization.;linux/ipcore/pdec.h
|
||||
12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h
|
||||
12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h
|
||||
12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h
|
||||
12415;0x307f;PDEC_CONFIG_CORRUPTED;HIGH;The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word;linux/ipcore/pdec.h
|
||||
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h
|
||||
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h
|
||||
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h
|
||||
12503;0x30d7;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;linux/acs/StrComHandler.h
|
||||
12504;0x30d8;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;linux/acs/StrComHandler.h
|
||||
12505;0x30d9;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;linux/acs/StrComHandler.h
|
||||
12506;0x30da;FLASH_READ_FAILED;LOW;Flash read procedure failed;linux/acs/StrComHandler.h
|
||||
12507;0x30db;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;linux/acs/StrComHandler.h
|
||||
12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/acs/StrComHandler.h
|
||||
12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/acs/StrComHandler.h
|
||||
12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/acs/StrComHandler.h
|
||||
12511;0x30df;STR_COM_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/acs/StrComHandler.h
|
||||
12513;0x30e1;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/acs/StrComHandler.h
|
||||
12514;0x30e2;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/acs/StrComHandler.h
|
||||
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/acs/StrComHandler.h
|
||||
12516;0x30e4;STR_HELPER_SENDING_PACKET_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
||||
12517;0x30e5;STR_HELPER_REQUESTING_MSG_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
||||
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;INFO;Flash write successful;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.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/payload/PlocMpsocSpecialComHelper.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/payload/PlocMpsocSpecialComHelper.h
|
||||
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
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/payload/PlocMpsocSpecialComHelper.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/payload/PlocMpsocSpecialComHelper.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/payload/PlocMpsocSpecialComHelper.h
|
||||
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12617;0x3149;MPSOC_READ_TIMEOUT;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
|
||||
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12703;0x319f;I_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12704;0x31a0;U_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12705;0x31a1;I_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12706;0x31a2;U_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12707;0x31a3;I_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12708;0x31a4;U_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12709;0x31a5;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12710;0x31a6;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12711;0x31a7;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;No description;mission/system/acs/AcsBoardAssembly.h
|
||||
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;No description;mission/system/acs/AcsBoardAssembly.h
|
||||
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/acs/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/acs/AcsBoardAssembly.h
|
||||
12804;0x3204;DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY;MEDIUM;This is triggered when the assembly would have normally switched the board side, but the GPS device of the other side was marked faulty. P1: Current submode.;mission/system/acs/AcsBoardAssembly.h
|
||||
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;No description;mission/system/acs/SusAssembly.h
|
||||
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;No description;mission/system/acs/SusAssembly.h
|
||||
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/acs/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/acs/SusAssembly.h
|
||||
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/tcs/TcsBoardAssembly.h
|
||||
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: New fix. P2: Missed fix changes 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;linux/acs/GPSDefinitions.h
|
||||
13101;0x332d;CANT_GET_FIX;MEDIUM;Could not get fix in maximum allowed time. Trying to reset both GNSS devices. P1: Maximum allowed time to get a fix after the GPS was switched on.;linux/acs/GPSDefinitions.h
|
||||
13102;0x332e;RESET_FAIL;HIGH;Failed to reset an GNNS Device. P1: Board-Side.;linux/acs/GPSDefinitions.h
|
||||
13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/power/P60DockHandler.h
|
||||
13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/power/P60DockHandler.h
|
||||
13202;0x3392;BATT_MODE_CHANGED;MEDIUM;Battery mode has changed. P1: Old mode. P2: New mode;mission/power/P60DockHandler.h
|
||||
13600;0x3520;SUPV_UPDATE_FAILED;LOW;update failed;linux/payload/PlocSupvUartMan.h
|
||||
13601;0x3521;SUPV_UPDATE_SUCCESSFUL;LOW;update successful;linux/payload/PlocSupvUartMan.h
|
||||
13602;0x3522;SUPV_CONTINUE_UPDATE_FAILED;LOW;Continue update command failed;linux/payload/PlocSupvUartMan.h
|
||||
13603;0x3523;SUPV_CONTINUE_UPDATE_SUCCESSFUL;LOW;Continue update command successful;linux/payload/PlocSupvUartMan.h
|
||||
13604;0x3524;TERMINATED_UPDATE_PROCEDURE;LOW;Terminated update procedure by command;linux/payload/PlocSupvUartMan.h
|
||||
13605;0x3525;SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL;LOW;Requesting event buffer was successful;linux/payload/PlocSupvUartMan.h
|
||||
13606;0x3526;SUPV_EVENT_BUFFER_REQUEST_FAILED;LOW;Requesting event buffer failed;linux/payload/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/payload/PlocSupvUartMan.h
|
||||
13608;0x3528;SUPV_MEM_CHECK_OK;INFO;No description;linux/payload/PlocSupvUartMan.h
|
||||
13609;0x3529;SUPV_MEM_CHECK_FAIL;INFO;No description;linux/payload/PlocSupvUartMan.h
|
||||
13616;0x3530;SUPV_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/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/payload/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/payload/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/payload/PlocSupvUartMan.h
|
||||
13620;0x3534;SUPV_MISSING_EXE;LOW;Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper;linux/payload/PlocSupvUartMan.h
|
||||
13621;0x3535;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux/payload/PlocSupvUartMan.h
|
||||
13622;0x3536;SUPV_EXE_FAILURE_REPORT;LOW;Execution report failure P1:;linux/payload/PlocSupvUartMan.h
|
||||
13623;0x3537;SUPV_ACK_INVALID_APID;LOW;Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/payload/PlocSupvUartMan.h
|
||||
13624;0x3538;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/payload/PlocSupvUartMan.h
|
||||
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/payload/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/payload/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/payload/PlocSupvUartMan.h
|
||||
13628;0x353c;SUPV_REPLY_SIZE_MISSMATCH;LOW;No description;linux/payload/PlocSupvUartMan.h
|
||||
13629;0x353d;SUPV_REPLY_CRC_MISSMATCH;LOW;No description;linux/payload/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/payload/PlocSupvUartMan.h
|
||||
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/payload/PlocSupvUartMan.h
|
||||
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/payload/PlocSupvUartMan.h
|
||||
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/com/syrlinksDefs.h
|
||||
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/com/syrlinksDefs.h
|
||||
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/payload/scexHelpers.h
|
||||
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;No description;mission/payload/scexHelpers.h
|
||||
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;No description;mission/payload/scexHelpers.h
|
||||
13803;0x35eb;FS_UNUSABLE;LOW;No description;mission/payload/scexHelpers.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;mission/sysDefs.h
|
||||
14001;0x36b1;REBOOT_SW;LOW; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;mission/sysDefs.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;mission/sysDefs.h
|
||||
14003;0x36b3;REBOOT_HW;MEDIUM;No description;mission/sysDefs.h
|
||||
14004;0x36b4;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;mission/sysDefs.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.;mission/sysDefs.h
|
||||
14006;0x36b6;CURRENT_IMAGE_INFO;INFO;P1: Current Chip, P2: Current Copy;mission/sysDefs.h
|
||||
14007;0x36b7;REBOOT_COUNTER;INFO;Total reboot counter, which is the sum of the boot count of all individual images.;mission/sysDefs.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.;mission/sysDefs.h
|
||||
14010;0x36ba;TRYING_I2C_RECOVERY;HIGH;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h
|
||||
14011;0x36bb;I2C_REBOOT;HIGH;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h
|
||||
14012;0x36bc;PDEC_REBOOT;HIGH;PDEC recovery through reset was not possible, performing full reboot.;mission/sysDefs.h
|
||||
14013;0x36bd;FIRMWARE_INFO;INFO;Version information of the firmware (not OBSW). 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.;mission/sysDefs.h
|
||||
14014;0x36be;ACTIVE_SD_INFO;INFO;Active SD card info. SD States: 0: OFF, 1: ON, 2: MOUNTED. P1: Active SD Card Index, 0 if none is active P2: First two bytes: SD state of SD card 0, last two bytes SD state of SD card 1;mission/sysDefs.h
|
||||
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14104;0x3718;OBC_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14105;0x3719;CAMERA_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||
14108;0x371c;MGT_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||
14109;0x371d;TCS_SWITCHING_HEATER_ON;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14110;0x371e;TCS_SWITCHING_HEATER_OFF;INFO;P1: Module index. P2: Heater index;mission/controller/tcsDefs.h
|
||||
14111;0x371f;TCS_HEATER_MAX_BURN_TIME_REACHED;MEDIUM;P1: Heater index. P2: Maximum burn time for heater.;mission/controller/tcsDefs.h
|
||||
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
|
||||
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/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
|
||||
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
|
||||
14310;0x37e6;DUMP_OK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14311;0x37e7;DUMP_NOK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14312;0x37e8;DUMP_MISC_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14313;0x37e9;DUMP_HK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||
14500;0x38a4;TEMPERATURE_ALL_ONES_START;MEDIUM;Detected invalid values, starting invalid message counting;mission/acs/SusHandler.h
|
||||
14501;0x38a5;TEMPERATURE_ALL_ONES_RECOVERY;INFO;Detected valid values for a prolonged time again, resetting all counters. P1: Number of periods with invalid messages. P2: Maximum invalid message counter.;mission/acs/SusHandler.h
|
||||
14600;0x3908;FAULT_HANDLER_TRIGGERED;LOW;P1: CFDP fault handler code. P2: CFDP condition code.;mission/cfdp/defs.h
|
||||
|
|
@ -3,7 +3,7 @@ import os
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.fsfw import parse_fsfw_events_csv
|
||||
from tmtccmd.pus.s5_event import EventDictT
|
||||
from tmtccmd.pus.s5_fsfw_event import EventDictT
|
||||
|
||||
DEFAULT_EVENTS_CSV_PATH = EIVE_TMTC_ROOT / "config/events.csv"
|
||||
__EVENT_DICT = None
|
||||
|
@ -1,33 +1,147 @@
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from tmtccmd import HookBase, CcsdsTmtcBackend
|
||||
from prompt_toolkit.history import FileHistory
|
||||
from tmtccmd import CcsdsTmtcBackend, HookBase
|
||||
from tmtccmd.com import ComInterface
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
from eive_tmtc.pus_tc.cmd_definitions import get_eive_service_op_code_dict
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.config.hook import History
|
||||
from tmtccmd.util import ObjectIdDictT, RetvalDictT
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
from eive_tmtc.tmtc.acs.acs_board import create_acs_board_node
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import create_acs_ctrl_node
|
||||
from eive_tmtc.tmtc.acs.gps import create_gnss_node
|
||||
from eive_tmtc.tmtc.acs.gyros import create_gyros_node
|
||||
from eive_tmtc.tmtc.acs.imtq import create_mgt_node
|
||||
from eive_tmtc.tmtc.acs.mgms import create_mgms_node
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
create_reaction_wheel_assembly_node,
|
||||
create_reaction_wheels_nodes,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.star_tracker import create_str_node
|
||||
from eive_tmtc.tmtc.acs.subsystem import create_acs_subsystem_node
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import create_ccsds_node
|
||||
from eive_tmtc.tmtc.com.subsystem import create_com_subsystem_node
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import create_syrlinks_node
|
||||
from eive_tmtc.tmtc.core import create_core_node
|
||||
from eive_tmtc.tmtc.health import create_global_health_node
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import create_ploc_mpsoc_node
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import create_ploc_supv_node
|
||||
from eive_tmtc.tmtc.payload.plpcdu import create_pl_pcdu_node
|
||||
from eive_tmtc.tmtc.payload.scex import create_scex_node
|
||||
from eive_tmtc.tmtc.payload.subsystem import create_payload_subsystem_node
|
||||
from eive_tmtc.tmtc.power.acu import create_acu_node
|
||||
from eive_tmtc.tmtc.power.bpx_batt import create_bpx_batt_node
|
||||
from eive_tmtc.tmtc.power.p60dock import create_p60_dock_node
|
||||
from eive_tmtc.tmtc.power.pdu1 import create_pdu1_node
|
||||
from eive_tmtc.tmtc.power.pdu2 import create_pdu2_node
|
||||
from eive_tmtc.tmtc.power.power import create_power_node
|
||||
from eive_tmtc.tmtc.power.pwr_ctrl import create_pwr_ctrl_node
|
||||
from eive_tmtc.tmtc.power.subsystem import create_eps_subsystem_node
|
||||
from eive_tmtc.tmtc.system import create_system_node
|
||||
from eive_tmtc.tmtc.tcs.ctrl import create_tcs_ctrl_node
|
||||
from eive_tmtc.tmtc.tcs.heater import create_heater_node
|
||||
from eive_tmtc.tmtc.tcs.rtd import create_rtd_node
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import create_tmp_sens_node
|
||||
from eive_tmtc.tmtc.test import create_test_node
|
||||
from eive_tmtc.tmtc.time import create_time_node
|
||||
from eive_tmtc.tmtc.tm_store import create_persistent_tm_store_node
|
||||
from eive_tmtc.tmtc.wdt import create_wdt_node
|
||||
|
||||
|
||||
class EiveHookObject(HookBase):
|
||||
def __init__(self, json_cfg_path: str):
|
||||
super().__init__(json_cfg_path=json_cfg_path)
|
||||
|
||||
def get_tmtc_definitions(self) -> TmtcDefinitionWrapper:
|
||||
return get_eive_service_op_code_dict()
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_default,
|
||||
create_com_interface_cfg_default,
|
||||
def get_command_definitions(self) -> CmdTreeNode:
|
||||
root_node = CmdTreeNode.root_node()
|
||||
acs_node = create_acs_subsystem_node()
|
||||
acs_brd_assy_node = create_acs_board_node()
|
||||
acs_brd_assy_node.add_child(create_mgms_node())
|
||||
acs_brd_assy_node.add_child(create_gyros_node())
|
||||
acs_ctrl = create_acs_ctrl_node()
|
||||
rw_list = create_reaction_wheels_nodes()
|
||||
rws = CmdTreeNode("rws", "Reaction Wheel Devices")
|
||||
for rw in rw_list:
|
||||
rws.add_child(rw)
|
||||
rws.add_child(create_reaction_wheel_assembly_node())
|
||||
star_tracker = create_str_node()
|
||||
star_tracker_img_helper = CmdTreeNode(
|
||||
"str_img_helper", "Star Tracker Image Helper"
|
||||
)
|
||||
star_tracker.add_child(star_tracker_img_helper)
|
||||
gnss_devs = create_gnss_node()
|
||||
|
||||
acs_node.add_child(acs_brd_assy_node)
|
||||
acs_node.add_child(acs_ctrl)
|
||||
acs_node.add_child(rws)
|
||||
acs_node.add_child(create_mgt_node())
|
||||
acs_node.add_child(star_tracker)
|
||||
acs_node.add_child(gnss_devs)
|
||||
|
||||
tcs_node = CmdTreeNode("tcs", "TCS Subsystem")
|
||||
tmp_1075_node = create_tmp_sens_node()
|
||||
rtds_node = create_rtd_node()
|
||||
heaters_node = create_heater_node()
|
||||
tcs_ctrl = create_tcs_ctrl_node()
|
||||
tcs_node.add_child(rtds_node)
|
||||
tcs_node.add_child(tmp_1075_node)
|
||||
tcs_node.add_child(tcs_ctrl)
|
||||
tcs_node.add_child(heaters_node)
|
||||
tcs_brd_assy = CmdTreeNode("tcs_brd_assy", "TCS Board Assembly")
|
||||
tcs_node.add_child(tcs_brd_assy)
|
||||
|
||||
com_node = create_com_subsystem_node()
|
||||
com_node.add_child(create_syrlinks_node())
|
||||
com_node.add_child(create_ccsds_node())
|
||||
|
||||
eps_node = create_eps_subsystem_node()
|
||||
eps_node.add_child(create_pwr_ctrl_node())
|
||||
eps_node.add_child(create_power_node())
|
||||
eps_node.add_child(create_acu_node())
|
||||
eps_node.add_child(create_pdu1_node())
|
||||
eps_node.add_child(create_pdu2_node())
|
||||
eps_node.add_child(create_p60_dock_node())
|
||||
eps_node.add_child(create_bpx_batt_node())
|
||||
|
||||
payload_node = create_payload_subsystem_node()
|
||||
payload_node.add_child(create_pl_pcdu_node())
|
||||
payload_node.add_child(create_scex_node())
|
||||
payload_node.add_child(create_ploc_mpsoc_node())
|
||||
payload_node.add_child(create_ploc_supv_node())
|
||||
|
||||
obdh_node = CmdTreeNode("obdh", "OBDH Subsystem")
|
||||
obdh_node.add_child(create_wdt_node())
|
||||
obdh_node.add_child(create_core_node())
|
||||
obdh_node.add_child(create_time_node())
|
||||
obdh_node.add_child(create_persistent_tm_store_node())
|
||||
|
||||
root_node.add_child(create_test_node())
|
||||
root_node.add_child(create_system_node())
|
||||
root_node.add_child(create_global_health_node())
|
||||
root_node.add_child(acs_node)
|
||||
root_node.add_child(tcs_node)
|
||||
root_node.add_child(com_node)
|
||||
root_node.add_child(eps_node)
|
||||
root_node.add_child(payload_node)
|
||||
root_node.add_child(obdh_node)
|
||||
return root_node
|
||||
|
||||
def get_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_cfg_default,
|
||||
create_com_interface_default,
|
||||
)
|
||||
|
||||
assert self.cfg_path is not None
|
||||
|
||||
cfg = create_com_interface_cfg_default(
|
||||
com_if_key=com_if_key,
|
||||
json_cfg_path=self.cfg_path,
|
||||
space_packet_ids=SPACE_PACKET_IDS,
|
||||
)
|
||||
assert cfg is not None
|
||||
return create_com_interface_default(cfg)
|
||||
|
||||
def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int):
|
||||
@ -42,3 +156,6 @@ class EiveHookObject(HookBase):
|
||||
|
||||
def get_retval_dict(self) -> RetvalDictT:
|
||||
return get_retval_dict()
|
||||
|
||||
def get_cmd_history(self) -> Optional[History]:
|
||||
return FileHistory(".tmtc-history.txt")
|
||||
|
@ -3,11 +3,13 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
from typing import Dict
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.util.obj_id import ObjectIdDictT
|
||||
from tmtccmd.util.obj_id import ObjectIdU32
|
||||
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
||||
|
||||
|
||||
@ -17,6 +19,7 @@ __OBJECT_ID_DICT = None
|
||||
|
||||
# Core Object IDs
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x00, 0xA2])
|
||||
INTERNAL_ERROR_REPORTER_ID = bytes([0x53, 0x04, 0x00, 0x00])
|
||||
|
||||
# Power Object IDs
|
||||
PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1])
|
||||
@ -30,8 +33,11 @@ SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32])
|
||||
# Thermal Object IDs
|
||||
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])
|
||||
HEATER_CONTROLLER_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])
|
||||
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_PLPCDU_1_ID = bytes([0x44, 0x42, 0x00, 0x07])
|
||||
TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08])
|
||||
|
||||
# Communication Object IDs
|
||||
SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3])
|
||||
@ -46,6 +52,9 @@ GYRO_1_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x11])
|
||||
GYRO_2_ADIS_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x12])
|
||||
GYRO_3_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x13])
|
||||
GPS_CONTROLLER = bytes([0x44, 0x13, 0x00, 0x45])
|
||||
GPS_0_HEALTH_DEV = bytes([0x44, 0x13, 0x00, 0x46])
|
||||
GPS_1_HEALTH_DEV = bytes([0x44, 0x13, 0x00, 0x47])
|
||||
|
||||
RW1_ID = bytes([0x44, 0x12, 0x00, 0x47])
|
||||
RW2_ID = bytes([0x44, 0x12, 0x01, 0x48])
|
||||
RW3_ID = bytes([0x44, 0x12, 0x02, 0x49])
|
||||
@ -68,14 +77,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])
|
||||
@ -123,23 +132,49 @@ 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])
|
||||
EPS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x05])
|
||||
|
||||
# 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])
|
||||
PWR_CONTROLLER = bytes([0x43, 0x00, 0x00, 0x04])
|
||||
XIPHOS_WDT_ID = bytes([0x43, 0x00, 0x00, 0x07])
|
||||
|
||||
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:
|
||||
SUPV_FILTER_SET = [PLOC_SUPV_ID, PDU_2_HANDLER_ID, PDU_1_HANDLER_ID]
|
||||
|
||||
ObjectIdDict = Dict[bytes, ObjectIdU32]
|
||||
|
||||
|
||||
def get_object_ids() -> ObjectIdDict:
|
||||
global __OBJECT_ID_DICT
|
||||
if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
|
||||
logging.getLogger(__name__).warning(
|
||||
|
@ -1,7 +1,9 @@
|
||||
0x00005060;P60DOCK_TEST_TASK
|
||||
0x43000002;ACS_CONTROLLER
|
||||
0x43000003;CORE_CONTROLLER
|
||||
0x43000004;POWER_CONTROLLER
|
||||
0x43000006;GLOBAL_JSON_CFG
|
||||
0x43000007;XIPHOS_WDT
|
||||
0x43400001;THERMAL_CONTROLLER
|
||||
0x44120006;MGM_0_LIS3_HANDLER
|
||||
0x44120010;GYRO_0_ADIS_HANDLER
|
||||
@ -29,6 +31,9 @@
|
||||
0x44120350;RW4
|
||||
0x44130001;STAR_TRACKER
|
||||
0x44130045;GPS_CONTROLLER
|
||||
0x44130046;GPS_0_HEALTH_DEV
|
||||
0x44130047;GPS_1_HEALTH_DEV
|
||||
0x44140013;IMTQ_POLLING
|
||||
0x44140014;IMTQ_HANDLER
|
||||
0x442000A1;PCDU_HANDLER
|
||||
0x44250000;P60DOCK_HANDLER
|
||||
@ -40,10 +45,14 @@
|
||||
0x443200A5;RAD_SENSOR
|
||||
0x44330000;PLOC_UPDATER
|
||||
0x44330001;PLOC_MEMORY_DUMPER
|
||||
0x44330002;STR_HELPER
|
||||
0x44330002;STR_COM_IF
|
||||
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 +64,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
|
||||
@ -73,15 +81,18 @@
|
||||
0x44420030;RTD_14_IC17_TCS_BOARD
|
||||
0x44420031;RTD_15_IC18_IMTQ
|
||||
0x445300A3;SYRLINKS_HANDLER
|
||||
0x445300A4;SYRLINKS_COM_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;TCP_TMTC_SERVER
|
||||
@ -102,6 +113,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
|
||||
@ -132,21 +144,36 @@
|
||||
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
|
||||
0x73000205;CFDP_HANDLER
|
||||
0x73000206;CFDP_DISTRIBUTOR
|
||||
0x73000207;CFDP_FAULT_HANDLER
|
||||
0x73010000;EIVE_SYSTEM
|
||||
0x73010001;ACS_SUBSYSTEM
|
||||
0x73010002;PL_SUBSYSTEM
|
||||
0x73010003;TCS_SUBSYSTEM
|
||||
0x73010004;COM_SUBSYSTEM
|
||||
0x73500000;CCSDS_IP_CORE_BRIDGE
|
||||
0x73010005;EPS_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
|
||||
0x90000003;THERMAL_TEMP_INSERTER
|
||||
0xFFFFFFFF;NO_OBJECT
|
||||
|
|
File diff suppressed because it is too large
Load Diff
64
eive_tmtc/config/subsystems.csv
Normal file
64
eive_tmtc/config/subsystems.csv
Normal file
@ -0,0 +1,64 @@
|
||||
22;MEMORY
|
||||
26;OBSW
|
||||
28;CDH
|
||||
59;TCS_1
|
||||
42;PCDU_1
|
||||
43;POWER_SWITCH_IF
|
||||
50;HEATER
|
||||
52;T_SENSORS
|
||||
70;FDIR
|
||||
71;FDIR_1
|
||||
72;FDIR_2
|
||||
73;HK
|
||||
74;SYSTEM_MANAGER
|
||||
75;SYSTEM_MANAGER_1
|
||||
76;TMTC_DISTRIBUTION
|
||||
79;SYSTEM_1
|
||||
80;PUS_SERVICE_1
|
||||
82;PUS_SERVICE_2
|
||||
83;PUS_SERVICE_3
|
||||
85;PUS_SERVICE_5
|
||||
86;PUS_SERVICE_6
|
||||
88;PUS_SERVICE_8
|
||||
89;PUS_SERVICE_9
|
||||
91;PUS_SERVICE_11
|
||||
97;PUS_SERVICE_17
|
||||
103;PUS_SERVICE_23
|
||||
106;MGM_LIS3MDL
|
||||
107;MGM_RM3100
|
||||
108;CFDP
|
||||
112;ACS_SUBSYSTEM
|
||||
113;PCDU_HANDLER
|
||||
114;HEATER_HANDLER
|
||||
115;SA_DEPL_HANDLER
|
||||
116;PLOC_MPSOC_HANDLER
|
||||
117;IMTQ_HANDLER
|
||||
118;RW_HANDLER
|
||||
119;STR_HANDLER
|
||||
120;PLOC_SUPERVISOR_HANDLER
|
||||
121;FILE_SYSTEM
|
||||
122;PLOC_UPDATER
|
||||
123;PLOC_MEMORY_DUMPER
|
||||
124;PDEC_HANDLER
|
||||
125;STR_HELPER
|
||||
126;PLOC_MPSOC_HELPER
|
||||
127;PL_PCDU_HANDLER
|
||||
128;ACS_BOARD_ASS
|
||||
129;SUS_BOARD_ASS
|
||||
130;TCS_BOARD_ASS
|
||||
131;GPS_HANDLER
|
||||
132;P60_DOCK_HANDLER
|
||||
133;PDU1_HANDLER
|
||||
134;PDU2_HANDLER
|
||||
135;ACU_HANDLER
|
||||
136;PLOC_SUPV_HELPER
|
||||
137;SYRLINKS
|
||||
138;SCEX_HANDLER
|
||||
139;CONFIGHANDLER
|
||||
140;CORE
|
||||
141;TCS_CONTROLLER
|
||||
142;COM_SUBSYSTEM
|
||||
143;PERSISTENT_TM_STORE
|
||||
144;SYRLINKS_COM
|
||||
145;SUS_HANDLER
|
||||
146;CFDP_APP
|
|
@ -11,8 +11,8 @@ import struct
|
||||
from typing import Union
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
@ -74,7 +74,9 @@ def pack_get_param_command(
|
||||
memory_address: Union[int, bytes],
|
||||
parameter_size: int,
|
||||
) -> PusTelecommand:
|
||||
"""Function to generate a command to retrieve parameters like the temperature from a gomspace device.
|
||||
"""Function to generate a command to retrieve parameters like the temperature from a
|
||||
gomspace device.
|
||||
|
||||
@param object_id: The object id of the gomspace device handler.
|
||||
@param table_id: The table id of the gomspace device
|
||||
@param memory_address: Address offset within table of the value to read.
|
||||
@ -218,9 +220,9 @@ def prompt_and_pack_set_integer_param_command(
|
||||
|
||||
def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand:
|
||||
""" " Function to generate the command to ping a gomspace device
|
||||
@param object_id Object Id of the gomspace device handler.
|
||||
@param data Bytearray containing the bytes to send to the gomspace device. For now the on board software
|
||||
supports only the handling of up to 33 bytes.
|
||||
:param object_id: Object Id of the gomspace device handler.
|
||||
:param data: Bytearray containing the bytes to send to the gomspace device. For now the on board
|
||||
software supports only the handling of up to 33 bytes.
|
||||
@note The ping request sends the specified data to a gompsace device. These
|
||||
data are simply copied by the device and then sent back.
|
||||
"""
|
||||
|
@ -1,140 +0,0 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
call_all_definitions_providers,
|
||||
)
|
||||
from tmtccmd.config.globals import get_default_tmtc_defs
|
||||
|
||||
|
||||
def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
|
||||
"""Call all registered TMTC definition providers. They were registered using
|
||||
the :py:func:`tmtc_definitions_provider` decorator.
|
||||
"""
|
||||
def_wrapper = get_default_tmtc_defs()
|
||||
srv_5 = OpCodeEntry()
|
||||
srv_5.add("0", "Event Test")
|
||||
def_wrapper.add_service(
|
||||
name=CoreServiceList.SERVICE_5.value,
|
||||
info="PUS Service 5 Event",
|
||||
op_code_entry=srv_5,
|
||||
)
|
||||
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_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_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
from eive_tmtc.pus_tc.system.time import OpCode, Info
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCode.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.OpCode.THERMAL_CONTROLLER,
|
||||
info=controllers.Info.THERMAL_CONTROLLER,
|
||||
)
|
||||
oce.add(
|
||||
keys=controllers.OpCode.CORE_CONTROLLER,
|
||||
info=controllers.Info.CORE_CONTROLLER,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.CONTROLLERS.value,
|
||||
info="Controllers",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
309
eive_tmtc/pus_tc/cmd_demux.py
Normal file
309
eive_tmtc/pus_tc/cmd_demux.py
Normal file
@ -0,0 +1,309 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import List, cast
|
||||
|
||||
from tmtccmd import TreeCommandingProcedure
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
CCSDS_HANDLER_ID,
|
||||
HEATER_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
PDEC_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
RAD_SENSOR_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RW3_ID,
|
||||
RW4_ID,
|
||||
RW_ASSEMBLY,
|
||||
STAR_TRACKER_ID,
|
||||
STR_IMG_HELPER_ID,
|
||||
SYRLINKS_HANDLER_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
get_object_ids,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_command
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import pack_acs_ctrl_command
|
||||
from eive_tmtc.tmtc.acs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd
|
||||
from eive_tmtc.tmtc.acs.imtq import create_imtq_command
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
create_single_rw_cmd,
|
||||
pack_rw_ass_cmds,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.tmtc.acs.subsystem import build_acs_subsystem_cmd
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command
|
||||
from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_commands
|
||||
from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||
from eive_tmtc.tmtc.core import pack_core_commands
|
||||
from eive_tmtc.tmtc.health import build_health_cmds
|
||||
from eive_tmtc.tmtc.payload.subsystem import create_payload_subsystem_cmd
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import pack_ploc_mpsoc_commands
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import pack_ploc_supv_commands
|
||||
from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import create_rad_sensor_cmd
|
||||
from eive_tmtc.tmtc.payload.scex import pack_scex_cmds
|
||||
from eive_tmtc.tmtc.power.acu import pack_acu_commands
|
||||
from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds
|
||||
from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands
|
||||
from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.tmtc.power.pwr_ctrl import pack_power_ctrl_command
|
||||
from eive_tmtc.tmtc.system import build_system_cmds
|
||||
from eive_tmtc.tmtc.tcs.ctrl import pack_tcs_ctrl_commands
|
||||
from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.tmtc.test import build_test_commands
|
||||
from eive_tmtc.tmtc.time import pack_time_management_cmd
|
||||
from eive_tmtc.tmtc.tm_store import pack_tm_store_commands
|
||||
from eive_tmtc.tmtc.wdt import pack_wdt_commands
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
def handle_pus_procedure(
|
||||
info: TreeCommandingProcedure,
|
||||
queue_helper: DefaultPusQueueHelper,
|
||||
):
|
||||
cmd_path = info.cmd_path
|
||||
assert cmd_path is not None
|
||||
cmd_path_list = cmd_path.split("/")
|
||||
if cmd_path_list[0] == "":
|
||||
cmd_path_list = cmd_path_list[1:]
|
||||
if len(cmd_path_list) == 0:
|
||||
raise ValueError(
|
||||
"command path list empty. Full command path {cmd_path} might have invalid format"
|
||||
)
|
||||
if cmd_path_list[0] == "system":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_system_cmds(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "health":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_health_cmds(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "eps":
|
||||
return handle_eps_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "tcs":
|
||||
return handle_tcs_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "acs":
|
||||
return handle_acs_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "payload":
|
||||
return handle_payload_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "obdh":
|
||||
return handle_obdh_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "test":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_test_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "com":
|
||||
return handle_com_procedure(queue_helper, cmd_path_list[1:])
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid or unimplemented command path {cmd_path}"
|
||||
)
|
||||
|
||||
|
||||
def handle_eps_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
assert len(cmd_path_list) >= 1
|
||||
if cmd_path_list[0] == "power":
|
||||
return pack_power_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "pwr_ctrl":
|
||||
return pack_power_ctrl_command(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "p60_dock":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(P60_DOCK_HANDLER))
|
||||
return pack_p60dock_cmds(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pdu1":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_1_HANDLER_ID))
|
||||
return pack_pdu1_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pdu2":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_2_HANDLER_ID))
|
||||
return pack_pdu2_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acu":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(ACU_HANDLER_ID))
|
||||
return pack_acu_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
|
||||
def handle_tcs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return pack_tcs_sys_commands(q=queue_helper, cmd_str=cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "tcs_brd_assy":
|
||||
return pack_tcs_sys_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "rtd_devs":
|
||||
assert len(cmd_path_list) >= 2
|
||||
return pack_rtd_commands(
|
||||
object_id=None, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "tcs_ctrl":
|
||||
assert len(cmd_path_list) >= 2
|
||||
return pack_tcs_ctrl_commands(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[0] == "tmp1075_devs":
|
||||
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),
|
||||
"3": ("TMP1075 PL PCDU 1", oids.TMP1075_HANDLER_PLPCDU_1_ID),
|
||||
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
input_helper = InputHelper(menu_dict)
|
||||
tmp_select = input_helper.get_key()
|
||||
assert len(cmd_path_list) >= 2
|
||||
object_id = obj_id_man.get(menu_dict[tmp_select][1])
|
||||
assert object_id is not None
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "heaters":
|
||||
object_id = HEATER_CONTROLLER_ID
|
||||
return pack_heater_cmds(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
|
||||
def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return build_acs_subsystem_cmd(queue_helper, cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "mgt":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID))
|
||||
return create_imtq_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "str":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STAR_TRACKER_ID))
|
||||
return pack_star_tracker_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
if cmd_path_list[0] == "rws":
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[1] == "rw_assy":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return pack_rw_ass_cmds(
|
||||
q=queue_helper, object_id=RW_ASSEMBLY, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_1":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW1_ID, rw_idx=1, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_2":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW2_ID, rw_idx=2, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_3":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW3_ID, rw_idx=3, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_4":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
|
||||
if cmd_path_list[0] == "gnss_devs":
|
||||
return pack_gps_command(
|
||||
object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acs_brd_assy":
|
||||
if len(cmd_path_list) == 2:
|
||||
return pack_acs_board_command(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
else:
|
||||
if cmd_path_list[1] == "mgm_devs":
|
||||
return handle_mgm_cmd(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[1] == "gyro_devs":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return handle_gyr_cmd(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[0] == "str_img_helper":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STR_IMG_HELPER_ID))
|
||||
return pack_str_img_helper_command(
|
||||
object_id=object_id, q=queue_helper, op_code=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acs_ctrl":
|
||||
return pack_acs_ctrl_command(queue_helper, cmd_path_list[1])
|
||||
|
||||
|
||||
def handle_payload_procedure(
|
||||
queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]
|
||||
):
|
||||
obj_id_man = get_object_ids()
|
||||
if cmd_path_list[0] == "subsystem":
|
||||
return create_payload_subsystem_cmd(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "ploc_mpsoc":
|
||||
return pack_ploc_mpsoc_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "ploc_supv":
|
||||
return pack_ploc_supv_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "rad_sensor":
|
||||
assert len(cmd_path_list) >= 3
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(RAD_SENSOR_ID))
|
||||
return create_rad_sensor_cmd(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pl_pcdu":
|
||||
return pack_pl_pcdu_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "scex":
|
||||
return pack_scex_cmds(
|
||||
cmd_str=cmd_path_list[1],
|
||||
q=queue_helper,
|
||||
)
|
||||
|
||||
|
||||
def handle_obdh_procedure(
|
||||
queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]
|
||||
):
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "core":
|
||||
return pack_core_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "xiphos_wdt":
|
||||
return pack_wdt_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "time":
|
||||
return pack_time_management_cmd(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "tm_store":
|
||||
return pack_tm_store_commands(queue_helper, cmd_path_list[1])
|
||||
|
||||
|
||||
def handle_com_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return build_com_subsystem_procedure(queue_helper, cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "ccsds":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
||||
return pack_ccsds_handler_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[0] == "pdec":
|
||||
return pack_pdec_handler_commands(
|
||||
object_id=PDEC_HANDLER_ID, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[0] == "syrlinks":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(SYRLINKS_HANDLER_ID))
|
||||
return pack_syrlinks_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
@ -1,217 +0,0 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.payload.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.subsystem import pack_tcs_sys_commands
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
from tmtccmd.config import CoreServiceList
|
||||
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 eive_tmtc.pus_tc.service_200_mode 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.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.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
||||
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.acs.acs_board import pack_acs_command
|
||||
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_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RW3_ID,
|
||||
RW4_ID,
|
||||
RAD_SENSOR_ID,
|
||||
STAR_TRACKER_ID,
|
||||
PLOC_MEMORY_DUMPER_ID,
|
||||
CCSDS_HANDLER_ID,
|
||||
PDEC_HANDLER_ID,
|
||||
STR_IMG_HELPER_ID,
|
||||
SYRLINKS_HANDLER_ID,
|
||||
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
|
||||
|
||||
|
||||
def handle_default_procedure(
|
||||
tc_base: TcHandlerBase,
|
||||
info: DefaultProcedureInfo,
|
||||
queue_helper: DefaultPusQueueHelper,
|
||||
):
|
||||
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:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(P60_DOCK_HANDLER))
|
||||
return pack_p60dock_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RTD.value:
|
||||
return pack_rtd_commands(object_id=None, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PDU1.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_1_HANDLER_ID))
|
||||
return pack_pdu1_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PDU2.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_2_HANDLER_ID))
|
||||
return pack_pdu2_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.ACU.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(ACU_HANDLER_ID))
|
||||
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))
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.HEATER.value:
|
||||
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))
|
||||
return pack_imtq_test_into(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.REACTION_WHEEL_1.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW1_ID, rw_idx=1, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_2.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW2_ID, rw_idx=2, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_3.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW3_ID, rw_idx=3, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_4.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW4_ID, rw_idx=4, 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(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.STAR_TRACKER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STAR_TRACKER_ID))
|
||||
return pack_star_tracker_commands(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.STR_IMG_HELPER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STR_IMG_HELPER_ID))
|
||||
return pack_str_img_helper_command(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.CORE.value:
|
||||
return pack_core_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PLOC_MEMORY_DUMPER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PLOC_MEMORY_DUMPER_ID))
|
||||
return pack_ploc_memory_dumper_cmd(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.POWER.value:
|
||||
return pack_power_commands(queue_helper, op_code)
|
||||
if service == CustomServiceList.ACS.value:
|
||||
return pack_acs_command(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.GPS_CTRL.value:
|
||||
return pack_gps_command(
|
||||
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=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PDEC_HANDLER.value:
|
||||
return pack_ccsds_handler_test(
|
||||
object_id=PDEC_HANDLER_ID, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.SYRLINKS.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(SYRLINKS_HANDLER_ID))
|
||||
return pack_syrlinks_command(
|
||||
object_id=object_id, 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:
|
||||
return pack_pl_pcdu_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS_ASS.value:
|
||||
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(
|
||||
handler_base=tc_base,
|
||||
op_code=op_code,
|
||||
info=info,
|
||||
queue_helper=queue_helper,
|
||||
)
|
||||
)
|
||||
if not route_to_registered_service_handlers(
|
||||
service,
|
||||
ServiceProviderParams(
|
||||
handler_base=tc_base,
|
||||
op_code=op_code,
|
||||
info=info,
|
||||
queue_helper=queue_helper,
|
||||
),
|
||||
):
|
||||
logging.getLogger(__name__).warning(f"Invalid Service {service}")
|
@ -10,14 +10,11 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from PyQt5 import QtCore
|
||||
|
||||
from tmtccmd.config import CoreModeList
|
||||
from tmtccmd.core.globals_manager import get_global
|
||||
|
||||
|
||||
class Parameter:
|
||||
def __init__(self, name: str, defaultValue: str, widget: QLineEdit):
|
||||
def __init__(self, name: str, default_value: str, widget: QLineEdit):
|
||||
self.name = name
|
||||
self.defaultValue = defaultValue
|
||||
self.defaultValue = default_value
|
||||
self.widget = widget
|
||||
self.value = self.defaultValue
|
||||
self.widget.setPlaceholderText(self.defaultValue)
|
||||
@ -34,9 +31,9 @@ class ParameterDialog(QDialog):
|
||||
|
||||
self.setWindowTitle("Enter Parameters")
|
||||
|
||||
Buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset
|
||||
buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset
|
||||
|
||||
self.buttonBox = QDialogButtonBox(Buttons)
|
||||
self.buttonBox = QDialogButtonBox(buttons)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self._reset)
|
||||
@ -54,14 +51,14 @@ class ParameterDialog(QDialog):
|
||||
|
||||
self.parameters = {}
|
||||
|
||||
def addParameter(self, name: str, defaultValue: str):
|
||||
def add_parameter(self, name: str, default_value: str):
|
||||
row = self.groupLayout.rowCount() + 1
|
||||
description = QLabel(name)
|
||||
self.groupLayout.addWidget(description, row, 0)
|
||||
valueWidget = QLineEdit()
|
||||
self.groupLayout.addWidget(valueWidget, row, 1)
|
||||
value_widget = QLineEdit()
|
||||
self.groupLayout.addWidget(value_widget, row, 1)
|
||||
|
||||
parameter = Parameter(name, defaultValue, valueWidget)
|
||||
parameter = Parameter(name, default_value, value_widget)
|
||||
|
||||
self.parameters[name] = parameter
|
||||
|
||||
@ -69,10 +66,10 @@ class ParameterDialog(QDialog):
|
||||
for value in self.parameters.values():
|
||||
value.reset()
|
||||
|
||||
def getParameters(self):
|
||||
def get_parameters(self):
|
||||
output = {}
|
||||
for key, parameter in self.parameters.items():
|
||||
if parameter.widget != None:
|
||||
if parameter.widget is not None:
|
||||
if parameter.widget.text() != "":
|
||||
parameter.value = parameter.widget.text()
|
||||
output[key] = parameter.value
|
||||
@ -103,9 +100,9 @@ def prompt_parameters_cli(param_list) -> dict:
|
||||
def _gui_prompt(param_list) -> dict:
|
||||
dialog = ParameterDialog()
|
||||
for parameter in param_list:
|
||||
dialog.addParameter(parameter["name"], parameter["defaultValue"])
|
||||
dialog.add_parameter(parameter["name"], parameter["defaultValue"])
|
||||
dialog.exec_()
|
||||
return dialog.getParameters()
|
||||
return dialog.get_parameters()
|
||||
|
||||
|
||||
def _cli_prompt(param_list) -> dict:
|
||||
|
@ -1 +0,0 @@
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import Union
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
@ -86,9 +86,8 @@ def pack_cmd_ctrl_to_nml(
|
||||
def get_object_from_op_code(op_code: str):
|
||||
try:
|
||||
return bytes.fromhex(op_code)
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if op_code in OpCode.THERMAL_CONTROLLER:
|
||||
return obj_ids.THERMAL_CONTROLLER_ID
|
||||
if op_code in OpCode.CORE_CONTROLLER:
|
||||
|
@ -1,20 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
import time
|
||||
from datetime import timedelta
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
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.tmtc.tcs.brd_assy import OpCodeAssy as TcsOpCodes
|
||||
@ -33,9 +34,9 @@ from eive_tmtc.pus_tc.system.controllers import (
|
||||
pack_cmd_ctrl_to_off,
|
||||
pack_cmd_ctrl_to_nml,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_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.tmtc.acs.imtq import create_imtq_command, pack_dipole_command
|
||||
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
|
||||
|
||||
@ -49,6 +50,11 @@ from eive_tmtc.tmtc.acs.gyros import (
|
||||
L3gGyroSetId as L3gGyroSetIds_1_3,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.gps import SetId as GpsSetIds
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
disable_periodic_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval,
|
||||
)
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -154,7 +160,7 @@ def add_proc_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pack_generic_hk_listening_cmds(
|
||||
def pack_generic_hk_listening_cmds( # noqa C901: Complexity okay here.
|
||||
q: DefaultPusQueueHelper,
|
||||
proc_key: str,
|
||||
sid_list: list[bytearray],
|
||||
@ -222,7 +228,9 @@ def pack_generic_hk_listening_cmds(
|
||||
diag_list.clear()
|
||||
|
||||
|
||||
def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
q: DefaultPusQueueHelper, op_code: str
|
||||
): # noqa C901: Complexity okay here.
|
||||
sid_list = []
|
||||
obj_id_dict = get_object_ids()
|
||||
if op_code in OpCode.RESET_SCHED:
|
||||
@ -304,7 +312,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
# Enable scheduling
|
||||
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_tcs_sys_commands(q=q, cmd_str=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 OpCode.TV_TEARDOWN_TCS_FT_OFF:
|
||||
@ -329,7 +337,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
]
|
||||
d_side_pairs = a_side_pairs + b_side_pairs
|
||||
diag_list = [False, False, True, False, False]
|
||||
pack_acs_command(q=q, op_code="acs-a")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-a")
|
||||
|
||||
for a_side_dev in a_side_pairs:
|
||||
oid = a_side_dev[0]
|
||||
@ -343,9 +351,9 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-b")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-b")
|
||||
|
||||
sid_list.clear()
|
||||
diag_list = [False, False, True, False, False]
|
||||
@ -362,9 +370,9 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-d")
|
||||
|
||||
sid_list.clear()
|
||||
|
||||
@ -392,14 +400,14 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
|
||||
if op_code in OpCode.MGT_FT:
|
||||
key = KAI.MGT_FT[0]
|
||||
imtq_pairs = [
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.ENG_HK_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_SET),
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.RAW_MTM_NO_TORQUE),
|
||||
]
|
||||
diag_list = [
|
||||
True,
|
||||
@ -408,10 +416,10 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
]
|
||||
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="1")
|
||||
q.add_wait_seconds(5.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="2")
|
||||
|
||||
for imtq_dev in imtq_pairs:
|
||||
oid = imtq_dev[0]
|
||||
@ -425,7 +433,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="0")
|
||||
|
||||
if op_code in OpCode.MGT_FT_DP:
|
||||
key = KAI.MGT_FT_DP[0]
|
||||
@ -444,9 +452,9 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
(oids.GPS_CONTROLLER, GpsSetIds.HK),
|
||||
]
|
||||
imtq_pairs = [
|
||||
(oids.IMTQ_HANDLER_ID, ImtqSetId.ENG_HK_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_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 = [
|
||||
@ -464,12 +472,12 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
True,
|
||||
True,
|
||||
]
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-d")
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="1")
|
||||
q.add_wait_seconds(20.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="2")
|
||||
|
||||
for d_side_and_imtq_dev in d_side_and_imtq_pairs:
|
||||
oid = d_side_and_imtq_dev[0]
|
||||
@ -486,8 +494,8 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=cfg,
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="0")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
|
||||
if op_code in OpCode.SUS_FT:
|
||||
key = KAI.SUS_FT[0]
|
||||
@ -530,7 +538,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-red")
|
||||
|
||||
@ -554,7 +562,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-d")
|
||||
|
||||
@ -585,7 +593,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
|
||||
if op_code in OpCode.SYRLINKS_FT:
|
||||
key = KAI.SYRLINKS_FT[0]
|
||||
@ -604,7 +612,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
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")
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, cmd_str="2")
|
||||
|
||||
# STR
|
||||
sid_list.append(make_sid(oids.STAR_TRACKER_ID, StrSetIds.TEMPERATURE))
|
||||
@ -617,7 +625,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="3")
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, cmd_str="3")
|
||||
|
||||
if op_code in OpCode.RW_FT_ONE_RW:
|
||||
key = KAI.RW_FT_ONE_RW[0]
|
||||
@ -650,7 +658,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="nml")
|
||||
|
||||
# RW HK für alle RWs nur einzeln
|
||||
for rw_dev in rw_pairs:
|
||||
@ -665,7 +673,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=True, two_rws=False),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="off")
|
||||
|
||||
# ass command with 2 rws to speed
|
||||
if op_code in OpCode.RW_FT_TWO_RWS:
|
||||
@ -707,7 +715,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="nml")
|
||||
|
||||
# RW
|
||||
for rw_dev in rw_pairs:
|
||||
@ -722,7 +730,7 @@ def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=False, two_rws=True),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="off")
|
||||
|
||||
|
||||
def enable_listen_to_hk_for_x_seconds(
|
||||
@ -733,7 +741,7 @@ def enable_listen_to_hk_for_x_seconds(
|
||||
interval_seconds: float,
|
||||
):
|
||||
q.add_log_cmd(f"Enabling periodic HK for {device}")
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(
|
||||
cmd_tuple = create_enable_periodic_hk_command_with_interval(
|
||||
diag=diag, sid=sid, interval_seconds=interval_seconds
|
||||
)
|
||||
for cmd in cmd_tuple:
|
||||
@ -757,7 +765,6 @@ def gen_disable_listen_to_hk_for_x_seconds(
|
||||
def activate_mgts_alternately(
|
||||
q: DefaultPusQueueHelper,
|
||||
):
|
||||
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
|
@ -1,28 +0,0 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
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")
|
||||
logging.getLogger(__name__).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))
|
161
eive_tmtc/pus_tc/tc_handler.py
Normal file
161
eive_tmtc/pus_tc/tc_handler.py
Normal file
@ -0,0 +1,161 @@
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.config.definitions import (
|
||||
CFDP_REMOTE_ENTITY_ID,
|
||||
PUS_APID,
|
||||
CFDP_LOCAL_ENTITY_ID,
|
||||
)
|
||||
from eive_tmtc.pus_tc.cmd_demux import handle_pus_procedure
|
||||
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
|
||||
from tmtccmd import TcHandlerBase, ProcedureWrapper
|
||||
from cfdppy.defs import CfdpRequestType
|
||||
from tmtccmd.logging import get_current_time_string
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.tmtc import (
|
||||
DefaultPusQueueHelper,
|
||||
QueueWrapper,
|
||||
FeedWrapper,
|
||||
TcProcedureType,
|
||||
SendCbParams,
|
||||
TcQueueEntryType,
|
||||
)
|
||||
from tmtccmd.config.cfdp import generic_cfdp_params_to_put_request
|
||||
from spacepackets.ecss import PusVerificator
|
||||
from spacepackets.seqcount import FileSeqCountProvider
|
||||
from spacepackets.cfdp import PduHolder, DirectiveType
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TcHandler(TcHandlerBase):
|
||||
def __init__(
|
||||
self,
|
||||
seq_count_provider: FileSeqCountProvider,
|
||||
cfdp_in_ccsds_handler: CfdpInCcsdsHandler,
|
||||
pus_verificator: PusVerificator,
|
||||
high_level_file_logger: logging.Logger,
|
||||
raw_pus_logger: RawTmtcTimedLogWrapper,
|
||||
gui: bool,
|
||||
):
|
||||
super().__init__()
|
||||
self.cfdp_handler_started = False
|
||||
self.seq_count_provider = seq_count_provider
|
||||
self.pus_verificator = pus_verificator
|
||||
self.high_level_file_logger = high_level_file_logger
|
||||
self.pus_raw_logger = raw_pus_logger
|
||||
self.gui = gui
|
||||
self.proxy_op = True
|
||||
self.queue_helper = DefaultPusQueueHelper(
|
||||
queue_wrapper=QueueWrapper.empty(),
|
||||
default_pus_apid=PUS_APID,
|
||||
seq_cnt_provider=seq_count_provider,
|
||||
pus_verificator=pus_verificator,
|
||||
tc_sched_timestamp_len=4,
|
||||
)
|
||||
self.cfdp_in_ccsds_handler = cfdp_in_ccsds_handler
|
||||
|
||||
def cfdp_done(self) -> bool:
|
||||
if self.cfdp_handler_started:
|
||||
if (
|
||||
not self.cfdp_in_ccsds_handler.put_request_pending()
|
||||
and not self.proxy_op
|
||||
):
|
||||
self.cfdp_handler_started = False
|
||||
return True
|
||||
return False
|
||||
|
||||
def feed_cb(self, info: ProcedureWrapper, wrapper: FeedWrapper):
|
||||
self.queue_helper.queue_wrapper = wrapper.queue_wrapper
|
||||
if info.proc_type == TcProcedureType.DEFAULT:
|
||||
handle_pus_procedure(info.to_def_procedure(), self.queue_helper)
|
||||
elif info.proc_type == TcProcedureType.CFDP:
|
||||
self.handle_cfdp_procedure(info)
|
||||
|
||||
def send_cb(self, send_params: SendCbParams):
|
||||
entry_helper = send_params.entry
|
||||
if entry_helper.is_tc:
|
||||
if entry_helper.entry_type == TcQueueEntryType.PUS_TC:
|
||||
pus_tc_wrapper = entry_helper.to_pus_tc_entry()
|
||||
# pus_tc_wrapper.pus_tc.apid = PUS_APID
|
||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||
self.pus_raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
||||
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
||||
_LOGGER.info(tc_info_string)
|
||||
self.high_level_file_logger.info(
|
||||
f"{get_current_time_string(True)}: {tc_info_string}"
|
||||
)
|
||||
# with open("tc.bin", "wb") as of:
|
||||
# of.write(raw_tc)
|
||||
send_params.com_if.send(raw_tc)
|
||||
elif entry_helper.entry_type == TcQueueEntryType.CCSDS_TC:
|
||||
cfdp_packet_in_ccsds = entry_helper.to_space_packet_entry()
|
||||
send_params.com_if.send(cfdp_packet_in_ccsds.space_packet.pack())
|
||||
# TODO: Log raw CFDP packets similarly to how PUS packets are logged.
|
||||
# - Log full raw format including space packet wrapper
|
||||
# - Log context information: Transaction ID, and PDU type and directive
|
||||
# Could re-use file logger. Should probably do that
|
||||
# print(f"sending packet: [{cfdp_packet_in_ccsds.space_packet.pack()}]")
|
||||
# with open(f"cfdp_packet_{self.cfdp_counter}", "wb") as of:
|
||||
# of.write(cfdp_packet_in_ccsds.space_packet.pack())
|
||||
# self.cfdp_counter += 1
|
||||
elif entry_helper.entry_type == TcQueueEntryType.LOG:
|
||||
log_entry = entry_helper.to_log_entry()
|
||||
_LOGGER.info(log_entry.log_str)
|
||||
self.high_level_file_logger.info(log_entry.log_str)
|
||||
|
||||
def handle_cfdp_procedure(self, info: ProcedureWrapper):
|
||||
cfdp_procedure = info.to_cfdp_procedure()
|
||||
if cfdp_procedure.cfdp_request_type == CfdpRequestType.PUT:
|
||||
if (
|
||||
not self.cfdp_in_ccsds_handler.put_request_pending()
|
||||
and not self.cfdp_handler_started
|
||||
):
|
||||
put_req_cfg_wrapper = cfdp_procedure.request_wrapper.to_put_request()
|
||||
if put_req_cfg_wrapper.cfg.proxy_op:
|
||||
self.proxy_op = True
|
||||
put_req = generic_cfdp_params_to_put_request(
|
||||
params=put_req_cfg_wrapper.cfg,
|
||||
local_id=CFDP_LOCAL_ENTITY_ID,
|
||||
remote_id=CFDP_REMOTE_ENTITY_ID,
|
||||
dest_id_proxy_put_req=CFDP_LOCAL_ENTITY_ID,
|
||||
)
|
||||
_LOGGER.info(
|
||||
f"CFDP: Starting file put request with parameters:\n{put_req}"
|
||||
)
|
||||
assert put_req is not None
|
||||
self.cfdp_in_ccsds_handler.cfdp_handler.put_request(put_req)
|
||||
self.cfdp_handler_started = True
|
||||
|
||||
for source_pair, _ in self.cfdp_in_ccsds_handler:
|
||||
if source_pair is not None:
|
||||
pdu, sp = source_pair
|
||||
pdu = cast(PduHolder, pdu)
|
||||
if pdu.is_file_directive:
|
||||
if pdu.pdu_directive_type == DirectiveType.METADATA_PDU:
|
||||
metadata = pdu.to_metadata_pdu()
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending Metadata PDU for file with size "
|
||||
f"{metadata.file_size}"
|
||||
)
|
||||
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending EOF PDU"
|
||||
)
|
||||
else:
|
||||
fd_pdu = pdu.to_file_data_pdu()
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending File Data PDU for segment at offset "
|
||||
f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}"
|
||||
)
|
||||
self.queue_helper.add_ccsds_tc(sp)
|
||||
self.cfdp_in_ccsds_handler.source_handler.state_machine()
|
||||
|
||||
def queue_finished_cb(self, info: ProcedureWrapper):
|
||||
if info is not None:
|
||||
if info.proc_type == TcQueueEntryType.PUS_TC:
|
||||
def_proc = info.to_def_procedure()
|
||||
_LOGGER.info(f"Finished queue for command {def_proc.cmd_path}")
|
||||
elif info.proc_type == TcProcedureType.CFDP:
|
||||
_LOGGER.info("Finished CFDP queue")
|
@ -1,14 +1,29 @@
|
||||
import logging
|
||||
import struct
|
||||
from eive_tmtc.config.object_ids import *
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
PLOC_MPSOC_ID,
|
||||
PLOC_SUPV_ID,
|
||||
CORE_CONTROLLER_ID,
|
||||
STAR_TRACKER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
ACS_CONTROLLER,
|
||||
)
|
||||
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.core import handle_core_ctrl_action_replies
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_mpsoc_data_reply
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import handle_star_tracker_action_replies
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_action_replies
|
||||
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
||||
from tmtccmd.tm import Service8FsfwTm
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s8_fsfw_action import Service8FsfwTm
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from tmtccmd.util import ObjectIdDictT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -22,9 +37,8 @@ def handle_action_reply(
|
||||
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)
|
||||
pw = PrintWrapper(printer.file_logger)
|
||||
custom_data = tm_packet.custom_data
|
||||
action_id = tm_packet.action_id
|
||||
generic_print_str = printer.generic_action_packet_tm_print(
|
||||
@ -32,13 +46,17 @@ def handle_action_reply(
|
||||
)
|
||||
pw.dlog(generic_print_str)
|
||||
if object_id.as_bytes == IMTQ_HANDLER_ID:
|
||||
return handle_imtq_replies(action_id, printer, custom_data)
|
||||
return handle_imtq_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_MPSOC_ID:
|
||||
return handle_ploc_replies(action_id, printer, custom_data)
|
||||
return handle_mpsoc_data_reply(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_SUPV_ID:
|
||||
return handle_supervisor_replies(action_id, printer, custom_data)
|
||||
return handle_supervisor_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == CORE_CONTROLLER_ID:
|
||||
return handle_core_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == STAR_TRACKER_ID:
|
||||
return handle_startracker_replies(action_id, printer, custom_data)
|
||||
return handle_star_tracker_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == ACS_CONTROLLER:
|
||||
return handle_acs_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes in [
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
@ -51,9 +69,7 @@ def handle_action_reply(
|
||||
pw.dlog(f"Raw Data: {tm_packet.custom_data.hex(sep=',')}")
|
||||
|
||||
|
||||
def handle_imtq_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
def handle_imtq_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||
if action_id == struct.unpack("!I", ImtqActionId.get_commanded_dipole)[0]:
|
||||
header_list = [
|
||||
"Commanded X-Dipole",
|
||||
@ -62,75 +78,18 @@ def handle_imtq_replies(
|
||||
]
|
||||
[x_dipole, y_dipole, z_dipole] = struct.unpack("!HHH", custom_data[0:6])
|
||||
content_list = [x_dipole, y_dipole, z_dipole]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
|
||||
|
||||
def handle_ploc_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
if action_id == PlocReplyIds.TM_MEM_READ_RPT:
|
||||
header_list = [
|
||||
"PLOC Memory Address",
|
||||
"PLOC Mem Len",
|
||||
"PLOC Read Memory Data",
|
||||
]
|
||||
content_list = [
|
||||
"0x" + custom_data[:4].hex(),
|
||||
struct.unpack("!H", custom_data[4:6])[0],
|
||||
"0x" + custom_data[6:10].hex(),
|
||||
]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
elif action_id == PlocReplyIds.TM_CAM_CMD_RPT:
|
||||
header_list = ["Camera reply string", "ACK"]
|
||||
content_list = [
|
||||
custom_data[: len(custom_data) - 1].decode("utf-8"),
|
||||
hex(custom_data[-1]),
|
||||
]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
|
||||
|
||||
def handle_supervisor_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
def handle_supervisor_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||
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)
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
elif action_id == SupvActionId.READ_GPIO:
|
||||
header_list = ["GPIO state"]
|
||||
content_list = [struct.unpack("!H", custom_data[:2])[0]]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
|
||||
|
||||
def handle_startracker_replies(
|
||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
||||
):
|
||||
if action_id == StarTrackerActionId.CHECKSUM:
|
||||
if len(custom_data) != 5:
|
||||
_LOGGER.warning(
|
||||
"Star tracker reply has invalid length {0}".format(len(custom_data))
|
||||
)
|
||||
return
|
||||
header_list = ["Checksum", "Checksum valid"]
|
||||
print(custom_data[4])
|
||||
checksum_valid_flag = custom_data[4] >> 8
|
||||
content_list = ["0x" + custom_data[:4].hex(), checksum_valid_flag]
|
||||
print(header_list)
|
||||
print(content_list)
|
||||
printer.file_logger.info(header_list)
|
||||
printer.file_logger.info(content_list)
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
|
@ -1,13 +1,27 @@
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class PrintWrapper:
|
||||
def __init__(self, printer: FsfwTmTcPrinter):
|
||||
self.printer = printer
|
||||
def __init__(self, file_logger: Optional[logging.Logger]):
|
||||
self.file_logger = file_logger
|
||||
|
||||
def dlog(self, string: str):
|
||||
print(string)
|
||||
self.printer.file_logger.info(string)
|
||||
if self.file_logger:
|
||||
self.file_logger.info(string)
|
||||
|
||||
def wlog(self, logger: logging.Logger, string: str):
|
||||
logger.warning(string)
|
||||
if self.file_logger:
|
||||
self.file_logger.warning(string)
|
||||
|
||||
def ilog(self, logger: logging.Logger, string: str):
|
||||
logger.info(string)
|
||||
if self.file_logger:
|
||||
self.file_logger.info(string)
|
||||
|
||||
|
||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||
|
@ -1,24 +1,31 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
import sys
|
||||
import base64
|
||||
|
||||
from eive_tmtc.config.definitions import PRINT_RAW_EVENTS_B64_STR
|
||||
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.subsystem import AcsMode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from eive_tmtc.tmtc.core import SdState, SdCardSelect
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.pus.s201_fsfw_health import FsfwHealth
|
||||
|
||||
from tmtccmd.tm import Service5Tm
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s5_fsfw_event import Service5Tm
|
||||
from tmtccmd.fsfw import EventInfo
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
tm = Service5Tm.unpack(raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
def handle_event_packet( # noqa C901: Complexity okay here
|
||||
raw_tm: bytes, pw: PrintWrapper
|
||||
): # noqa C901: Complexity okay here
|
||||
if PRINT_RAW_EVENTS_B64_STR:
|
||||
print(f"PUS Event TM Base64: {base64.b64encode(raw_tm)}")
|
||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
event_dict = get_event_dict()
|
||||
event_def = tm.event_definition
|
||||
info = event_dict.get(event_def.event_id)
|
||||
@ -33,38 +40,43 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
obj_name = event_def.reporter_id.hex(sep=",")
|
||||
else:
|
||||
obj_name = obj_id_obj.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()}"
|
||||
pw.printer.file_logger.info(
|
||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
assert tm.time_provider is not None
|
||||
generic_event_string = (
|
||||
f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x})"
|
||||
f" at {tm.time_provider.as_date_time()}"
|
||||
)
|
||||
_LOGGER.info(generic_event_string)
|
||||
specific_handler = True
|
||||
pw.file_logger.info(
|
||||
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:"
|
||||
f" {generic_event_string}"
|
||||
)
|
||||
specific_handler = False
|
||||
if info.name == "MODE_TRANSITION_FAILED":
|
||||
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: {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: {event_def.param1 >> 24 & 0xff} | Sequence Count: {event_def.param1 & 0xffff} "
|
||||
f"| Bytes Written: {event_def.param2}"
|
||||
f"Progress Percent: {event_def.param1 >> 24 & 0xff} | Sequence Count:"
|
||||
f" {event_def.param1 & 0xffff} | 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 event_def.param1 == Mode.OFF:
|
||||
mode_name = "Off"
|
||||
elif event_def.param1 == AcsMode.IDLE:
|
||||
mode_name = "Idle"
|
||||
elif event_def.param1 == AcsMode.DETUMBLE:
|
||||
mode_name = "Detumble"
|
||||
elif event_def.param1 == AcsMode.SAFE:
|
||||
mode_name = "Safe"
|
||||
elif event_def.param1 == AcsMode.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 event_def.param1 == Mode.OFF:
|
||||
mode_name = "Off"
|
||||
@ -74,13 +86,92 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
mode_name = "Normal"
|
||||
elif event_def.param1 == Mode.RAW:
|
||||
mode_name = "Raw"
|
||||
pw.dlog(f"Mode Number {event_def.param1}, Mode Name {mode_name}")
|
||||
pw.dlog(f"Submode: {event_def.param2}")
|
||||
else:
|
||||
specific_handler = False
|
||||
if info.info != "":
|
||||
additional_event_info = f"Additional info: {info.info} | P1: {event_def.param1} | P2: {event_def.param2}"
|
||||
pw.dlog(additional_event_info)
|
||||
pw.dlog(
|
||||
f"Mode Number {event_def.param1}, Mode Name {mode_name}, "
|
||||
f"Submode: {event_def.param2}"
|
||||
)
|
||||
if info.name == "INDIVIDUAL_BOOT_COUNTS":
|
||||
boot_count_00 = (event_def.param1 >> 16) & 0xFFFF
|
||||
boot_count_01 = event_def.param1 & 0xFFFF
|
||||
boot_count_10 = (event_def.param2 >> 16) & 0xFFFF
|
||||
boot_count_11 = event_def.param2 & 0xFFFF
|
||||
pw.dlog(f"Boot count 0 0: {boot_count_00}")
|
||||
pw.dlog(f"Boot count 0 1: {boot_count_01}")
|
||||
pw.dlog(f"Boot count 1 0: {boot_count_10}")
|
||||
pw.dlog(f"Boot count 1 1: {boot_count_11}")
|
||||
if info.name == "REBOOT_COUNTER":
|
||||
boot_count = (event_def.param1 << 32) | event_def.param2
|
||||
pw.dlog(f"Total boot count: {boot_count}")
|
||||
if info.name == "VERSION_INFO" or info.name == "FIRMWARE_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")
|
||||
if info.name == "VERSION_INFO":
|
||||
name = "OBSW version: "
|
||||
else:
|
||||
name = "Firmware version: "
|
||||
pw.dlog(f"{name} v{ver_major}.{ver_minor}.{ver_rev}")
|
||||
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_LEGACY":
|
||||
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 == "CLOCK_DUMP"
|
||||
or info.name == "CLOCK_DUMP_BEFORE_SETTING_TIME"
|
||||
or info.name == "CLOCK_DUMP_AFTER_SETTING_TIME"
|
||||
):
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond microseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Clock dump event {info.name}. Current time: {time_dt}")
|
||||
if info.name == "ACTIVE_SD_INFO":
|
||||
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
|
||||
sd_1_state = event_def.param2 & 0xFFFF
|
||||
active_sd = event_def.param1
|
||||
try:
|
||||
active_sd = SdCardSelect(event_def.param1)
|
||||
sd_0_state = SdState((event_def.param2 >> 16) & 0xFFFF)
|
||||
sd_1_state = SdState(event_def.param2 & 0xFFFF)
|
||||
except IndexError:
|
||||
_LOGGER.error(f"Received invalid event fields for event {event_def}")
|
||||
finally:
|
||||
pw.dlog(
|
||||
f"Active SD card {active_sd!r} | SD 0 State {sd_0_state!r} | SD 1 "
|
||||
f"State {sd_1_state!r}"
|
||||
)
|
||||
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:
|
||||
additional_event_info = (
|
||||
f"Additional info: {info.info} | P1: {event_def.param1} | "
|
||||
f"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,114 +0,0 @@
|
||||
"""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 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_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
|
||||
|
||||
from .event_handler import handle_event_packet
|
||||
from .verification_handler import handle_service_1_fsfw_packet, generic_retval_printout
|
||||
from .hk_handling import handle_hk_packet
|
||||
from .action_reply_handler import handle_action_reply
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pus_factory_hook(
|
||||
packet: bytes,
|
||||
verif_wrapper: VerificationWrapper,
|
||||
printer: FsfwTmTcPrinter,
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
):
|
||||
if len(packet) < 8:
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
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}")
|
||||
return
|
||||
service = tm_packet.service
|
||||
obj_id_dict = get_object_ids()
|
||||
pw = PrintWrapper(printer)
|
||||
dedicated_handler = True
|
||||
if service == 1:
|
||||
handle_service_1_fsfw_packet(wrapper=verif_wrapper, raw_tm=packet)
|
||||
elif service == 3:
|
||||
handle_hk_packet(printer=printer, raw_tm=packet, obj_id_dict=obj_id_dict)
|
||||
elif service == 5:
|
||||
handle_event_packet(raw_tm=packet, printer=printer)
|
||||
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, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == 2:
|
||||
verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
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, 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
|
||||
string_list = generic_retval_printout(retval)
|
||||
pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.")
|
||||
for string in string_list:
|
||||
pw.dlog(f"Reason: {string}")
|
||||
dedicated_handler = True
|
||||
else:
|
||||
dedicated_handler = False
|
||||
else:
|
||||
_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:
|
||||
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||
raw_logger.log_tm(tm_packet)
|
21
eive_tmtc/pus_tm/hk.py
Normal file
21
eive_tmtc/pus_tm/hk.py
Normal file
@ -0,0 +1,21 @@
|
||||
import uuid
|
||||
import dataclasses
|
||||
import datetime
|
||||
import sqlite3
|
||||
from tmtccmd.pus.tm.s3_fsfw_hk import Service3FsfwTm
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class HkTmInfo:
|
||||
packet_uuid: uuid.UUID
|
||||
hk_packet: Service3FsfwTm
|
||||
db_con: sqlite3.Connection
|
||||
hk_data: bytes
|
||||
|
||||
@property
|
||||
def packet_datetime(self) -> datetime.datetime:
|
||||
return self.hk_packet.pus_tm.time_provider.as_datetime()
|
||||
|
||||
@property
|
||||
def set_id(self) -> int:
|
||||
return self.hk_packet.set_id
|
245
eive_tmtc/pus_tm/hk_handler.py
Normal file
245
eive_tmtc/pus_tm/hk_handler.py
Normal file
@ -0,0 +1,245 @@
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
|
||||
import dataclasses
|
||||
import logging
|
||||
import base64 # noqa
|
||||
import sqlite3
|
||||
from typing import List, cast
|
||||
from uuid import UUID
|
||||
from eive_tmtc.config.definitions import PRINT_RAW_HK_B64_STR
|
||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
||||
from eive_tmtc.tmtc.internal_err_reporter import handle_ier_hk_data
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_ploc_mpsoc_hk_data
|
||||
from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk
|
||||
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
|
||||
from eive_tmtc.tmtc.payload.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.power.pwr_ctrl import handle_pwr_ctrl_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 eive_tmtc.tmtc.tcs.tmp1075 import handle_tmp_1075_hk_data
|
||||
from tmtccmd.pus.tm.s3_fsfw_hk import (
|
||||
Service3FsfwTm,
|
||||
)
|
||||
from tmtccmd.pus.tm.s3_hk_base import HkContentType
|
||||
from tmtccmd.util.obj_id import ObjectIdU32, ObjectIdDictT
|
||||
|
||||
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.tmtc.acs.imtq import (
|
||||
handle_imtq_hk,
|
||||
)
|
||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter, PrintWrapper
|
||||
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 = logging.getLogger(__name__)
|
||||
|
||||
|
||||
FORWARD_SENSOR_TEMPS = False
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class HkFilter:
|
||||
object_ids: List[bytes]
|
||||
set_ids: List[int]
|
||||
|
||||
|
||||
def handle_hk_packet(
|
||||
raw_tm: bytes,
|
||||
packet_uuid: UUID,
|
||||
obj_id_dict: ObjectIdDictT,
|
||||
printer: FsfwTmTcPrinter,
|
||||
hk_filter: HkFilter,
|
||||
hk_level: int,
|
||||
db_con: sqlite3.Connection,
|
||||
):
|
||||
tm_packet = Service3FsfwTm.unpack(raw_telemetry=raw_tm, custom_hk_handling=False)
|
||||
named_obj_id = cast(ObjectIdU32, obj_id_dict.get(tm_packet.object_id.as_bytes))
|
||||
if named_obj_id is None:
|
||||
named_obj_id = tm_packet.object_id
|
||||
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||
hk_data = tm_packet.tm_data[8:]
|
||||
if named_obj_id.as_bytes in hk_filter.object_ids:
|
||||
if PRINT_RAW_HK_B64_STR:
|
||||
print(f"PUS TM Base64: {base64.b64encode(raw_tm)}")
|
||||
handle_regular_hk_print(
|
||||
printer=printer,
|
||||
packet_uuid=packet_uuid,
|
||||
object_id=named_obj_id,
|
||||
hk_packet=tm_packet,
|
||||
hk_data=hk_data,
|
||||
db=db_con,
|
||||
)
|
||||
return
|
||||
try:
|
||||
if hk_level >= 1:
|
||||
printer.generic_hk_tm_print(
|
||||
HkContentType.HK, named_obj_id, tm_packet.set_id, hk_data
|
||||
)
|
||||
if hk_level >= 1:
|
||||
handle_regular_hk_print(
|
||||
printer=printer,
|
||||
packet_uuid=packet_uuid,
|
||||
object_id=named_obj_id,
|
||||
hk_packet=tm_packet,
|
||||
hk_data=hk_data,
|
||||
db=db_con,
|
||||
)
|
||||
except ValueError as e:
|
||||
_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")
|
||||
|
||||
|
||||
def handle_regular_hk_print( # noqa C901: Complexity okay here
|
||||
hk_packet: Service3FsfwTm,
|
||||
packet_uuid: UUID,
|
||||
hk_data: bytes,
|
||||
db: sqlite3.Connection,
|
||||
object_id: ObjectIdU32,
|
||||
printer: FsfwTmTcPrinter,
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
set_id = hk_packet.set_id
|
||||
hk_info = HkTmInfo(
|
||||
packet_uuid=packet_uuid, hk_packet=hk_packet, db_con=db, hk_data=hk_data
|
||||
)
|
||||
assert hk_packet.pus_tm.time_provider is not None
|
||||
packet_dt = hk_packet.pus_tm.time_provider.as_date_time()
|
||||
pw = PrintWrapper(printer.file_logger)
|
||||
"""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]:
|
||||
return handle_rw_hk_data(pw, object_id, set_id, hk_data)
|
||||
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
||||
return handle_syrlinks_hk_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
)
|
||||
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
||||
return handle_imtq_hk(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.GPS_CONTROLLER:
|
||||
return handle_gps_data(
|
||||
pw=pw,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
packet_time=packet_dt,
|
||||
)
|
||||
elif objb == obj_ids.PCDU_HANDLER_ID:
|
||||
return handle_pcdu_hk(pw=pw, set_id=set_id, hk_data=hk_data)
|
||||
elif objb == obj_ids.BPX_HANDLER_ID:
|
||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, pw=pw)
|
||||
elif objb == obj_ids.CORE_CONTROLLER_ID:
|
||||
return handle_core_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.PDU_1_HANDLER_ID:
|
||||
return handle_pdu_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
pdu_idx=1,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
elif objb == obj_ids.PDU_2_HANDLER_ID:
|
||||
return handle_pdu_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
pdu_idx=2,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
elif objb == obj_ids.PLOC_MPSOC_ID:
|
||||
return handle_ploc_mpsoc_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.ACU_HANDLER_ID:
|
||||
return handle_acu_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.INTERNAL_ERROR_REPORTER_ID:
|
||||
return handle_ier_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.RAD_SENSOR_ID:
|
||||
return handle_rad_sensor_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||
return handle_rw_hk_data(
|
||||
pw=pw, object_id=object_id, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
if objb in [
|
||||
obj_ids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||
obj_ids.SUS_1_N_LOC_XBYFZM_PT_XB,
|
||||
obj_ids.SUS_2_N_LOC_XFYBZB_PT_YB,
|
||||
obj_ids.SUS_3_N_LOC_XFYBZF_PT_YF,
|
||||
obj_ids.SUS_4_N_LOC_XMYFZF_PT_ZF,
|
||||
obj_ids.SUS_5_N_LOC_XFYMZB_PT_ZB,
|
||||
obj_ids.SUS_6_R_LOC_XFYBZM_PT_XF,
|
||||
obj_ids.SUS_7_R_LOC_XBYBZM_PT_XB,
|
||||
obj_ids.SUS_8_R_LOC_XBYBZB_PT_YB,
|
||||
obj_ids.SUS_9_R_LOC_XBYBZB_PT_YF,
|
||||
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
||||
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
||||
]:
|
||||
return handle_sus_hk(object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id)
|
||||
elif objb in RTD_NAMES.keys():
|
||||
return handle_rtd_hk(object_id=objb, hk_data=hk_data, pw=pw)
|
||||
elif objb == obj_ids.P60_DOCK_HANDLER:
|
||||
return handle_p60_hk_data(pw=pw, 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,
|
||||
]:
|
||||
return handle_gyros_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id
|
||||
)
|
||||
elif objb in [
|
||||
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_1_RM3100_HANDLER_ID,
|
||||
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||
]:
|
||||
return handle_mgm_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id
|
||||
)
|
||||
elif objb == obj_ids.PL_PCDU_ID:
|
||||
return handle_plpcdu_hk(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||
elif objb == obj_ids.THERMAL_CONTROLLER_ID:
|
||||
return handle_thermal_controller_hk_data(
|
||||
object_id=object_id, pw=pw, 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, pw=pw)
|
||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||
elif objb in [
|
||||
obj_ids.TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
obj_ids.TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
obj_ids.TMP1075_HANDLER_IF_BRD_ID,
|
||||
obj_ids.TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
obj_ids.TMP1075_HANDLER_PLPCDU_1_ID,
|
||||
]:
|
||||
return handle_tmp_1075_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||
elif objb == obj_ids.ACS_CONTROLLER:
|
||||
return handle_acs_ctrl_hk_data(
|
||||
pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
||||
)
|
||||
elif objb == obj_ids.PWR_CONTROLLER:
|
||||
return handle_pwr_ctrl_hk_data(
|
||||
pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
||||
)
|
||||
else:
|
||||
_LOGGER.info(
|
||||
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
||||
"has not been implemented."
|
||||
)
|
@ -1,184 +0,0 @@
|
||||
"""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_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 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,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.imtq import (
|
||||
ImtqSetId,
|
||||
handle_self_test_data,
|
||||
handle_eng_set,
|
||||
handle_calibrated_mtm_measurement,
|
||||
handle_raw_mtm_measurement,
|
||||
)
|
||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
||||
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 = logging.getLogger(__name__)
|
||||
|
||||
|
||||
FORWARD_SENSOR_TEMPS = False
|
||||
|
||||
|
||||
def handle_hk_packet(
|
||||
raw_tm: bytes,
|
||||
obj_id_dict: ObjectIdDictT,
|
||||
printer: FsfwTmTcPrinter,
|
||||
):
|
||||
tm_packet = Service3FsfwTm.unpack(raw_telemetry=raw_tm, custom_hk_handling=False)
|
||||
named_obj_id = obj_id_dict.get(tm_packet.object_id.as_bytes)
|
||||
if named_obj_id is None:
|
||||
named_obj_id = tm_packet.object_id
|
||||
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||
hk_data = tm_packet.tm_data[8:]
|
||||
if FORWARD_SENSOR_TEMPS:
|
||||
# TODO: Maybe use singleton?
|
||||
# TCP_SEVER_SENSOR_TEMPERATURES.report_raw_hk_data(
|
||||
# object_id=named_obj_id, set_id=tm_packet.set_id, hk_data=hk_data
|
||||
# )
|
||||
pass
|
||||
printer.generic_hk_tm_print(
|
||||
content_type=HkContentType.HK,
|
||||
object_id=named_obj_id,
|
||||
set_id=tm_packet.set_id,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
try:
|
||||
handle_regular_hk_print(
|
||||
printer=printer,
|
||||
object_id=named_obj_id,
|
||||
hk_packet=tm_packet,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
except ValueError as e:
|
||||
_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")
|
||||
|
||||
|
||||
def handle_regular_hk_print(
|
||||
printer: FsfwTmTcPrinter,
|
||||
object_id: ObjectIdU32,
|
||||
hk_packet: Service3Base,
|
||||
hk_data: bytes,
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
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)
|
||||
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
||||
handle_syrlinks_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
||||
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_SET:
|
||||
return handle_eng_set(printer, hk_data)
|
||||
elif set_id == ImtqSetId.CAL_MTM_SET:
|
||||
return handle_calibrated_mtm_measurement(printer, hk_data)
|
||||
elif set_id == ImtqSetId.RAW_MTM_SET:
|
||||
return handle_raw_mtm_measurement(printer, hk_data)
|
||||
else:
|
||||
_LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id")
|
||||
elif objb == obj_ids.GPS_CONTROLLER:
|
||||
return handle_gps_data(printer=printer, 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)
|
||||
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:
|
||||
return handle_pdu_data(
|
||||
printer=printer, pdu_idx=1, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif objb == obj_ids.PDU_2_HANDLER_ID:
|
||||
return handle_pdu_data(
|
||||
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif objb == obj_ids.ACU_HANDLER_ID:
|
||||
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.RAD_SENSOR_ID:
|
||||
return handle_rad_sensor_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
||||
elif objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||
return handle_rw_hk_data(
|
||||
printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
if objb in [
|
||||
obj_ids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||
obj_ids.SUS_1_N_LOC_XBYFZM_PT_XB,
|
||||
obj_ids.SUS_2_N_LOC_XFYBZB_PT_YB,
|
||||
obj_ids.SUS_3_N_LOC_XFYBZF_PT_YF,
|
||||
obj_ids.SUS_4_N_LOC_XMYFZF_PT_ZF,
|
||||
obj_ids.SUS_5_N_LOC_XFYMZB_PT_ZB,
|
||||
obj_ids.SUS_6_R_LOC_XFYBZM_PT_XF,
|
||||
obj_ids.SUS_7_R_LOC_XBYBZM_PT_XB,
|
||||
obj_ids.SUS_8_R_LOC_XBYBZB_PT_YB,
|
||||
obj_ids.SUS_9_R_LOC_XBYBZB_PT_YF,
|
||||
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
||||
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
||||
]:
|
||||
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)
|
||||
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(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
)
|
||||
elif objb in [
|
||||
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_1_RM3100_HANDLER_ID,
|
||||
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||
]:
|
||||
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)
|
||||
elif objb == obj_ids.THERMAL_CONTROLLER_ID:
|
||||
handle_thermal_controller_hk_data(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||
handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.ACS_CONTROLLER:
|
||||
handle_acs_ctrl_hk_data(printer, set_id, hk_data)
|
||||
else:
|
||||
_LOGGER.info(
|
||||
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
||||
f"has not been implemented."
|
||||
)
|
211
eive_tmtc/pus_tm/pus_handler.py
Normal file
211
eive_tmtc/pus_tm/pus_handler.py
Normal file
@ -0,0 +1,211 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sqlite3
|
||||
import uuid
|
||||
from typing import Any
|
||||
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||
from spacepackets.util import PrintFormats
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||
from tmtccmd.pus.s200_fsfw_mode import Service200FsfwTm
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||
from tmtccmd.tmtc import GenericApidHandlerBase, SpecificApidHandlerBase
|
||||
from eive_tmtc.config.definitions import TM_DB_PATH, PUS_APID
|
||||
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
|
||||
from .action_reply_handler import handle_action_reply
|
||||
from .defs import PrintWrapper
|
||||
from .event_handler import handle_event_packet
|
||||
from .hk_handler import HkFilter, handle_hk_packet
|
||||
from .verification_handler import generic_retval_printout, handle_service_1_fsfw_packet
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PusHandler(SpecificApidHandlerBase):
|
||||
def __init__(
|
||||
self,
|
||||
wrapper: VerificationWrapper,
|
||||
printer: FsfwTmTcPrinter,
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
hk_level: int,
|
||||
):
|
||||
super().__init__(PUS_APID, None)
|
||||
self.printer = printer
|
||||
self.verif_wrapper = wrapper
|
||||
self.raw_logger = raw_logger
|
||||
self.hk_level = hk_level
|
||||
self.these_objs_hk_only = []
|
||||
self.hk_filter = HkFilter(object_ids=self.these_objs_hk_only, set_ids=[])
|
||||
self.obj_id_dict = get_object_ids()
|
||||
self.pw = PrintWrapper(printer.file_logger)
|
||||
|
||||
def handle_tm(self, packet: bytes, _user_args: Any):
|
||||
self.pus_handler(
|
||||
packet,
|
||||
)
|
||||
|
||||
def pus_handler( # noqa C901 : Complexity okay here
|
||||
self,
|
||||
packet: bytes,
|
||||
):
|
||||
packet_uuid = uuid.uuid4()
|
||||
if len(packet) < 8:
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
||||
# _LOGGER.info(f"Sequence count: {tm_packet.seq_count}")
|
||||
except ValueError as value_error:
|
||||
_LOGGER.warning(f"{value_error}")
|
||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
db_con = sqlite3.connect(TM_DB_PATH)
|
||||
self._store_packet_in_db(db_con, packet, tm_packet, packet_uuid)
|
||||
service = tm_packet.service
|
||||
dedicated_handler = True
|
||||
if service == 1:
|
||||
handle_service_1_fsfw_packet(wrapper=self.verif_wrapper, raw_tm=packet)
|
||||
elif service == 3:
|
||||
handle_hk_packet(
|
||||
db_con=db_con,
|
||||
packet_uuid=packet_uuid,
|
||||
printer=self.printer,
|
||||
raw_tm=packet,
|
||||
obj_id_dict=self.obj_id_dict,
|
||||
hk_level=self.hk_level,
|
||||
hk_filter=self.hk_filter,
|
||||
)
|
||||
elif service == 5:
|
||||
handle_event_packet(raw_tm=packet, pw=self.pw)
|
||||
elif service == 8:
|
||||
handle_action_reply(
|
||||
raw_tm=packet, printer=self.printer, obj_id_dict=self.obj_id_dict
|
||||
)
|
||||
elif service == 17:
|
||||
pus17_tm = Service17Tm.unpack(
|
||||
data=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if pus17_tm.subservice == 2:
|
||||
self.verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
self._handle_param_packet(packet, tm_packet)
|
||||
elif service == 200:
|
||||
dedicated_handler = self._handle_mode_packet(packet, tm_packet)
|
||||
else:
|
||||
_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:
|
||||
_LOGGER.info(
|
||||
f"TM [{service},{tm_packet.subservice}] does not have a dedicated handler"
|
||||
)
|
||||
self.raw_logger.log_tm(tm_packet)
|
||||
|
||||
def _store_packet_in_db(
|
||||
self,
|
||||
db_con: sqlite3.Connection,
|
||||
packet: bytes,
|
||||
tm_packet: PusTelemetry,
|
||||
packet_uuid: uuid.UUID,
|
||||
):
|
||||
cursor = db_con.cursor()
|
||||
assert tm_packet.time_provider is not None
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS pus_tm(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
service NUM,
|
||||
subservice NUM,
|
||||
data_len NUM,
|
||||
raw_data BLOB
|
||||
)"""
|
||||
)
|
||||
cursor.execute(
|
||||
"INSERT INTO pus_tm VALUES(?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
str(packet_uuid),
|
||||
tm_packet.time_provider.as_datetime(),
|
||||
tm_packet.service,
|
||||
tm_packet.subservice,
|
||||
len(packet),
|
||||
packet,
|
||||
),
|
||||
)
|
||||
db_con.commit()
|
||||
|
||||
def _handle_param_packet(self, raw_data: bytes, tm_packet: PusTelemetry):
|
||||
param_packet = Service20FsfwTm.unpack(
|
||||
raw_telemetry=raw_data, 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 = self.obj_id_dict.get(param_wrapper.param_tm.object_id)
|
||||
self.pw.dlog(f"Received parameter dump TM from {obj}")
|
||||
self.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):
|
||||
self.pw.dlog(f"Scalar integer parameter: {scalar_param}")
|
||||
elif isinstance(scalar_param, float):
|
||||
self.pw.dlog(
|
||||
f"Scalar floating point parameter: {scalar_param}"
|
||||
)
|
||||
except ValueError as e:
|
||||
self.pw.dlog(f"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
|
||||
self.pw.dlog(
|
||||
"Received vector or matrix data:"
|
||||
f" {param.param_raw.hex(sep=',')}"
|
||||
)
|
||||
except ValueError as e:
|
||||
self.pw.dlog(f"received {e} when trying to parse parameters")
|
||||
except NotImplementedError as e:
|
||||
self.pw.dlog(f"received {e} when trying to parse parameters")
|
||||
else:
|
||||
self.pw.dlog(
|
||||
f"unknown subservice {tm_packet.subservice} for parameter service"
|
||||
)
|
||||
|
||||
def _handle_mode_packet(self, raw_data: bytes, _: PusTelemetry) -> bool:
|
||||
tm_packet = Service200FsfwTm.unpack(
|
||||
raw_telemetry=raw_data, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
|
||||
obj_id = tm_packet.object_id
|
||||
obj_id_obj = self.obj_id_dict.get(obj_id)
|
||||
retval = tm_packet.return_value
|
||||
string_list = generic_retval_printout(retval)
|
||||
self.pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.")
|
||||
for string in string_list:
|
||||
self.pw.dlog(f"Reason: {string}")
|
||||
return True
|
||||
if tm_packet.subservice == ModeSubservice.TM_WRONG_MODE_REPLY:
|
||||
self.pw.dlog(f"Received Mode TM wrong mode reply, mode: {tm_packet.mode}")
|
||||
return False
|
||||
|
||||
|
||||
class UnknownApidHandler(GenericApidHandlerBase):
|
||||
def handle_tm(self, apid: int, packet: bytes, _user_args: Any):
|
||||
_LOGGER.warning(
|
||||
f"Packet with unknown APID {apid} detected: {packet.hex(sep=',')}"
|
||||
)
|
@ -1,18 +1,17 @@
|
||||
import logging
|
||||
import socket
|
||||
from typing import Optional
|
||||
import json
|
||||
import base64
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.util.obj_id import ObjectIdU32
|
||||
from dle_encoder import DleEncoder
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TmTcpServer:
|
||||
def __init__(self, ip_address: str, port: int):
|
||||
|
||||
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
self.server_socket.bind((ip_address, port))
|
||||
@ -29,8 +28,8 @@ class TmTcpServer:
|
||||
def __del__(self):
|
||||
try:
|
||||
self.close()
|
||||
except:
|
||||
LOGGER.warning("Could not close sockets!")
|
||||
except IOError:
|
||||
_LOGGER.warning("Could not close sockets!")
|
||||
|
||||
def close(self):
|
||||
self.server_socket.close()
|
||||
@ -45,8 +44,7 @@ class TmTcpServer:
|
||||
(self.client_connection, _) = self.server_socket.accept()
|
||||
self.client_connection.setblocking(False)
|
||||
print("Client connected")
|
||||
except:
|
||||
# no client waiting
|
||||
except IOError:
|
||||
return
|
||||
|
||||
data_json_bytes = json.dumps(dictionary).encode()
|
||||
@ -57,7 +55,7 @@ class TmTcpServer:
|
||||
|
||||
try:
|
||||
sent_length = self.client_connection.send(data_json_bytes)
|
||||
except:
|
||||
except IOError:
|
||||
self.client_connection = None
|
||||
return
|
||||
if sent_length == 0:
|
||||
@ -65,7 +63,6 @@ class TmTcpServer:
|
||||
self.client_connection = None
|
||||
|
||||
def report_raw_hk_data(self, object_id: ObjectIdU32, set_id: int, hk_data: bytes):
|
||||
|
||||
data_dict = {
|
||||
"type": "TM",
|
||||
"tmType": "Raw HK",
|
||||
|
@ -4,7 +4,7 @@ from typing import List, Optional
|
||||
from spacepackets.ccsds import CdsShortTimestamp
|
||||
from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.tm.pus_1_verification import Service1FsfwWrapper
|
||||
from tmtccmd.pus.s1_verification import Service1FsfwWrapper
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -48,7 +48,7 @@ def generic_retval_printout(
|
||||
if retval_info is None:
|
||||
raw_err = retval
|
||||
return [
|
||||
f"No returnvalue information found for error code with "
|
||||
"No returnvalue information found for error code with "
|
||||
f"subsystem ID {(raw_err >> 8) & 0xff} and unique ID {raw_err & 0xff}"
|
||||
]
|
||||
else:
|
||||
@ -58,9 +58,9 @@ def generic_retval_printout(
|
||||
)
|
||||
string_list = [retval_string]
|
||||
if p1:
|
||||
error_param_1_str = f"Error Parameter 1: hex {p1:#010x} " f"dec {p1} "
|
||||
error_param_1_str = f"Error Parameter 1: hex {p1:#010x} dec {p1} "
|
||||
string_list.append(error_param_1_str)
|
||||
if p2:
|
||||
error_param_2_str = f"Error Parameter 2: hex {p2:#010x} " f"dec {p2}"
|
||||
error_param_2_str = f"Error Parameter 2: hex {p2:#010x} dec {p2}"
|
||||
string_list.append(error_param_2_str)
|
||||
return string_list
|
||||
|
@ -1,3 +1,4 @@
|
||||
from .payload.subsystem import add_payload_subsystem_cmds
|
||||
from .solar_array_deployment import add_sa_depl_cmds
|
||||
from .test import add_test_defs
|
||||
from .system import add_system_cmd_defs
|
||||
from .tm_store import add_persistent_tm_store_cmd_defs
|
||||
from .tcs import add_tmp_sens_cmds
|
||||
from .wdt import add_xiphos_wdt_defs
|
||||
|
@ -0,0 +1 @@
|
||||
from .gyros import add_gyr_cmd_defs
|
||||
|
@ -1,16 +1,16 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
CmdTreeNode,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
tmtc_definitions_provider,
|
||||
)
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
@ -30,8 +30,8 @@ class DualSideSubmode(enum.IntEnum):
|
||||
DUAL_SIDE = 2
|
||||
|
||||
|
||||
def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
|
||||
def pack_acs_board_command(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_A_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -39,7 +39,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly A side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_B_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -47,7 +47,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly B side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -55,7 +55,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly dual mode",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_A_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -63,7 +63,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly A side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_B_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -71,7 +71,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly B side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_DUAL_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -79,7 +79,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly dual side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_OFF:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.OFF,
|
||||
@ -89,11 +89,51 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
|
||||
|
||||
@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)
|
||||
def create_acs_board_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("acs_brd", "ACS Board", hide_children_which_are_leaves=True)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_A_SIDE[1],
|
||||
"Switch to ACS board A side",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_B_SIDE[1],
|
||||
"Switch to ACS board B side",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_DUAL_MODE[1],
|
||||
"Switch to ACS board dual mode",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_A_ON[1],
|
||||
"Switch ACS board A side on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_B_ON[1],
|
||||
"Switch ACS board B side on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_DUAL_ON[1],
|
||||
"Switch ACS board dual mode on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_OFF[1],
|
||||
"Switch off ACS board",
|
||||
)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
|
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
|
@ -1,57 +1,169 @@
|
||||
import datetime
|
||||
import enum
|
||||
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, generate_one_hk_command
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.pus.s200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
create_request_one_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
)
|
||||
from tmtccmd.pus.tc.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GpsInfo:
|
||||
MAX_SATELLITES = 30
|
||||
|
||||
|
||||
class GnssChip(enum.IntEnum):
|
||||
A_SIDE = 0
|
||||
B_SIDE = 1
|
||||
|
||||
|
||||
class OpCode:
|
||||
REQ_OS_HK = ["0", "hk-os"]
|
||||
RESET_GNSS = ["5", "reset"]
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
REQ_CORE_HK = "core_hk_request"
|
||||
ENABLE_CORE_HK = "core_hk_enable"
|
||||
DISABLE_CORE_HK = "core_hk_disable"
|
||||
REQ_SKYVIEW_HK = "skyview_hk_request"
|
||||
ENABLE_SKYVIEW_HK = "skyview_hk_enable"
|
||||
DISABLE_SKYVIEW_HK = "skyview_hk_disable"
|
||||
RESET_GNSS = "reset"
|
||||
|
||||
|
||||
class Info:
|
||||
REQ_OS_HK = "Request One-Shot HK"
|
||||
OFF = "Off"
|
||||
ON = "On"
|
||||
REQ_CORE_HK = "Request Core HK"
|
||||
ENABLE_CORE_HK = "Enable Core HK"
|
||||
DISABLE_CORE_HK = "Disable Core HK"
|
||||
REQ_SKYVIEW_HK = "Request Skyview HK"
|
||||
ENABLE_SKYVIEW_HK = "Enable Skyview HK"
|
||||
DISABLE_SKYVIEW_HK = "Disable Skyview HK"
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetId:
|
||||
HK = 0
|
||||
class SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
SKYVIEW_HK = 1
|
||||
|
||||
|
||||
@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)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
def create_gnss_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("gnss_devs", "GNSS Controller", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
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.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
def pack_gps_command( # noqa: C901
|
||||
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa: C901:
|
||||
if cmd_str == OpCode.RESET_GNSS:
|
||||
for val in GnssChip:
|
||||
print("{:<2}: {:<20}".format(val, val.name))
|
||||
chip: str = ""
|
||||
while chip not in ["0", "1"]:
|
||||
chip = input("Please specify which chip to reset: ")
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.HK))
|
||||
create_action_cmd(object_id=object_id, action_id=5, user_data=chip.encode())
|
||||
)
|
||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if cmd_str == OpCode.ENABLE_CORE_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_CORE_HK}")
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
diag=False,
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if cmd_str == OpCode.DISABLE_CORE_HK:
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.REQ_CORE_HK:
|
||||
q.add_log_cmd(f"GPS: {Info.REQ_CORE_HK}")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.ENABLE_SKYVIEW_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_SKYVIEW_HK}")
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
diag=False,
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if cmd_str == OpCode.DISABLE_SKYVIEW_HK:
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_SKYVIEW_HK}")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.REQ_SKYVIEW_HK:
|
||||
q.add_log_cmd(f"GPS: {Info.REQ_SKYVIEW_HK}")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.ON:
|
||||
q.add_log_cmd(f"GPS: {Info.ON}")
|
||||
q.add_pus_tc(create_mode_command(object_id, Mode.ON, 0))
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"GPS: {Info.OFF}")
|
||||
q.add_pus_tc(create_mode_command(object_id, Mode.OFF, 0))
|
||||
|
||||
|
||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
def handle_gps_data(
|
||||
pw: PrintWrapper,
|
||||
set_id: int,
|
||||
hk_data: bytes,
|
||||
packet_time: datetime.datetime,
|
||||
):
|
||||
pw.ilog(_LOGGER, f"Received GPS CTRL HK with packet time {packet_time}")
|
||||
match set_id:
|
||||
case SetId.CORE_HK:
|
||||
handle_core_data(pw, hk_data)
|
||||
case SetId.SKYVIEW_HK:
|
||||
handle_skyview_data(pw, hk_data)
|
||||
|
||||
|
||||
def handle_core_data(pw: PrintWrapper, hk_data: bytes):
|
||||
if len(hk_data) < 4 * 8 + 4 + 2 + 8:
|
||||
pw.dlog(
|
||||
f"GPS Core dataset with size {len(hk_data)} does not have expected size"
|
||||
f" of {4*8+4+2+8} bytes"
|
||||
)
|
||||
return
|
||||
current_idx = 0
|
||||
fmt_str = "!ddddBBBHBBBBBI"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
@ -72,7 +184,12 @@ def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
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}"
|
||||
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")
|
||||
@ -81,4 +198,68 @@ def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
)
|
||||
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)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=14
|
||||
)
|
||||
|
||||
|
||||
def handle_skyview_data(pw: PrintWrapper, hk_data: bytes):
|
||||
data_length = 8 + GpsInfo.MAX_SATELLITES * (8 + 3 * 2 + 1)
|
||||
if len(hk_data) < data_length:
|
||||
pw.dlog(
|
||||
f"GPS Skyview dataset with size {len(hk_data)} does not have expected size"
|
||||
f" of {data_length} bytes"
|
||||
)
|
||||
return
|
||||
current_idx = 0
|
||||
fmt_str_unix = "!d"
|
||||
fmt_str_int16 = "!" + "h" * GpsInfo.MAX_SATELLITES
|
||||
fmt_str_double = "!" + "d" * GpsInfo.MAX_SATELLITES
|
||||
fmt_str_uint8 = "!" + "B" * GpsInfo.MAX_SATELLITES
|
||||
inc_len_unix = struct.calcsize(fmt_str_unix)
|
||||
inc_len_int16 = struct.calcsize(fmt_str_int16)
|
||||
inc_len_double = struct.calcsize(fmt_str_double)
|
||||
inc_len_uint8 = struct.calcsize(fmt_str_uint8)
|
||||
unix = struct.unpack(
|
||||
fmt_str_unix, hk_data[current_idx : current_idx + inc_len_unix]
|
||||
)[0]
|
||||
current_idx += inc_len_unix
|
||||
prn_id = struct.unpack(
|
||||
fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16]
|
||||
)
|
||||
current_idx += inc_len_int16
|
||||
azimuth = struct.unpack(
|
||||
fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16]
|
||||
)
|
||||
current_idx += inc_len_int16
|
||||
elevation = struct.unpack(
|
||||
fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16]
|
||||
)
|
||||
current_idx += inc_len_int16
|
||||
signal_to_noise = struct.unpack(
|
||||
fmt_str_double, hk_data[current_idx : current_idx + inc_len_double]
|
||||
)
|
||||
current_idx += inc_len_double
|
||||
used = struct.unpack(
|
||||
fmt_str_uint8, hk_data[current_idx : current_idx + inc_len_uint8]
|
||||
)
|
||||
current_idx += inc_len_uint8
|
||||
pw.dlog(f"Skyview Time: {unix} unix-sec")
|
||||
pw.dlog(
|
||||
"{:<8} {:<8} {:<8} {:<8} {:<8}".format(
|
||||
"PRN_ID", "AZ [°]", "EL [°]", "S2N [dBHz]", "USED"
|
||||
)
|
||||
)
|
||||
for idx in range(GpsInfo.MAX_SATELLITES):
|
||||
pw.dlog(
|
||||
"{:<8} {:<8} {:<8} {:<8} {:<8}".format(
|
||||
prn_id[idx],
|
||||
azimuth[idx],
|
||||
elevation[idx],
|
||||
signal_to_noise[idx],
|
||||
used[idx],
|
||||
)
|
||||
)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=6
|
||||
)
|
||||
|
@ -1,11 +1,39 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s201_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.pus.s200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.pus.tc.s3_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):
|
||||
@ -17,60 +45,126 @@ 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, cmd_str: 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 cmd_str == 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 cmd_str == 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 cmd_str == 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 cmd_str == 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 cmd_str == 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 {cmd_str} for gyro command"
|
||||
)
|
||||
|
||||
|
||||
def handle_gyros_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, 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
|
||||
)
|
||||
handle_adis_gyro_hk(object_id=object_id, pw=pw, 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
|
||||
)
|
||||
handle_l3g_gyro_hk(object_id=object_id, pw=pw, set_id=set_id, hk_data=hk_data)
|
||||
|
||||
|
||||
def handle_adis_gyro_hk(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == AdisGyroSetId.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]
|
||||
)
|
||||
(
|
||||
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 {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
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 {accelX} | Y {accelY} | Z {accelZ}")
|
||||
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 = "!HBHH"
|
||||
fmt_str = "!HBHHH"
|
||||
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]
|
||||
)
|
||||
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
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, 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(
|
||||
@ -82,3 +176,24 @@ def handle_l3g_gyro_hk(
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} °C")
|
||||
|
||||
|
||||
def create_gyros_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("gyros", "Gyroscope devices")
|
||||
node.add_child(CmdTreeNode(OpCode.CORE_HK, "Request Core HK"))
|
||||
node.add_child(CmdTreeNode(OpCode.CFG_HK, "Request CFG HK"))
|
||||
node.add_child(CmdTreeNode(OpCode.NML, "Normal Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Off Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.SET_FAULTY, "Set Faulty"))
|
||||
return node
|
||||
|
||||
|
||||
@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,9 +5,13 @@
|
||||
@author J. Meier
|
||||
@date 25.03.2021
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
from typing import List
|
||||
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
@ -16,34 +20,63 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_diag_command,
|
||||
generate_one_hk_command,
|
||||
create_request_one_diag_command,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
ON = ["on"]
|
||||
NORMAL = ["normal"]
|
||||
OFF = ["off"]
|
||||
SET_DIPOLE = ["set_dipole"]
|
||||
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 ImtqSetId:
|
||||
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 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:
|
||||
@ -60,44 +93,131 @@ class ImtqActionId:
|
||||
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
|
||||
|
||||
|
||||
CTN = CmdTreeNode
|
||||
|
||||
|
||||
def create_mgt_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"mgt", "iMTQ MGT device node", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Mode OFF"))
|
||||
node.add_child(CmdTreeNode(OpCode.ON, "Mode ON"))
|
||||
node.add_child(CmdTreeNode(OpCode.NORMAL, "Mode Normal"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Mode OFF"))
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_ENG_HK_WITH_TORQUE,
|
||||
"Request Engineering HK One Shot during Torque",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_ENG_HK_NO_TORQUE, "Enable ENG HK not torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_ENG_HK_WITH_TORQUE, "Enable ENG HK with torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.DISABLE_ENG_HK_NO_TORQUE, "Disable ENG HK not torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.DISABLE_ENG_HK_WITH_TORQUE, "Disable ENG HK with torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_MGM_RAW_NO_TORQUE,
|
||||
"Request MGM Raw Without Torque HK One Shot",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_MGM_RAW_NO_TORQUE, "Enable MGM Raw Without Torque HK")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.DISABLE_MGM_RAW_NO_TORQUE, "Disable MGM Raw Without Torque HK"
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_MGM_RAW_WITH_TORQUE,
|
||||
"Request MGM Raw With Torque HK One Shot",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_MGM_RAW_WITH_TORQUE, "Enable MGM Raw With Torque HK")
|
||||
)
|
||||
node.add_child(
|
||||
CTN(OpCode.DISABLE_MGM_RAW_WITH_TORQUE, "Disable MGM Raw With Torque HK")
|
||||
)
|
||||
node.add_child(CTN(OpCode.POS_X_SELF_TEST, "IMTQ perform pos X self test"))
|
||||
node.add_child(CTN(OpCode.NEG_X_SELF_TEST, "IMTQ perform neg X self test"))
|
||||
node.add_child(CTN(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test"))
|
||||
node.add_child(CTN(OpCode.NEG_Y_SELF_TEST, "IMTQ perform neg Y self test"))
|
||||
node.add_child(CTN(OpCode.POS_Z_SELF_TEST, "IMTQ perform pos Z self test"))
|
||||
node.add_child(CTN(OpCode.NEG_Z_SELF_TEST, "IMTQ perform neg Z self test"))
|
||||
node.add_child(CTN(OpCode.SET_DIPOLE, "IMTQ command dipole"))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, "Mode Off")
|
||||
oce.add(OpCode.ON, "Mode On")
|
||||
oce.add(OpCode.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(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)
|
||||
|
||||
|
||||
def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
def create_imtq_command( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
|
||||
if op_code in OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd("IMTQ: Set mode off")
|
||||
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 OpCode.ON:
|
||||
if cmd_str == OpCode.ON:
|
||||
q.add_log_cmd("IMTQ: Set mode on")
|
||||
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 OpCode.NORMAL:
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd("IMTQ: Mode Normal")
|
||||
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 cmd_str == OpCode.POS_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive x self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -110,7 +230,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
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 cmd_str == OpCode.NEG_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative x self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -121,7 +241,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
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 cmd_str == OpCode.POS_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive y self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -133,7 +253,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
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 cmd_str == OpCode.NEG_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative y self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -146,7 +266,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
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 cmd_str == OpCode.POS_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive z self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -159,7 +279,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
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 cmd_str == OpCode.NEG_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative z self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -170,19 +290,20 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Z_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code in OpCode.SET_DIPOLE:
|
||||
if cmd_str 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]: "))
|
||||
duration = int(
|
||||
input(
|
||||
f"Specify torque duration [range [0, {pow(2, 16) - 1}, "
|
||||
f"0 for continuous generation until update]: "
|
||||
"0 for continuous generation until update]: "
|
||||
)
|
||||
)
|
||||
dur_str = "infinite" if duration == 0 else str(duration)
|
||||
q.add_log_cmd(
|
||||
f"IMTQ: Commanding dipole X={x_dipole}, Y={y_dipole}, Z={y_dipole}, duration={dur_str}"
|
||||
f"IMTQ: Commanding dipole X={x_dipole}, Y={y_dipole}, Z={y_dipole},"
|
||||
f" duration={dur_str}"
|
||||
)
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
@ -190,32 +311,124 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "10":
|
||||
if cmd_str == "10": # doesnt seem to work anymore
|
||||
q.add_log_cmd("IMTQ: 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 cmd_str == 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_with_diag(
|
||||
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 cmd_str == 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_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if cmd_str == 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 cmd_str == 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_with_diag(
|
||||
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 cmd_str == 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_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
if cmd_str == 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=ImtqSetId.ENG_HK_SET)
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetId.ENG_HK_NO_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "12":
|
||||
if cmd_str == "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 == "13":
|
||||
if cmd_str == OpCode.REQUEST_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get raw MTM hk set")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=object_id.as_bytes, set_id=ImtqSetId.RAW_MTM_SET)
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes, set_id=ImtqSetId.RAW_MTM_NO_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if cmd_str == 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_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if cmd_str == 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_with_diag(
|
||||
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 cmd_str == OpCode.REQUEST_MGM_RAW_WITH_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=ImtqSetId.RAW_MTM_WITH_TORQUE
|
||||
)
|
||||
)
|
||||
)
|
||||
if cmd_str == 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_with_diag(
|
||||
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 cmd_str == 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_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
|
||||
@ -246,7 +459,8 @@ def pack_dipole_command(
|
||||
duration = int(round(duration))
|
||||
if duration < 0 or duration > pow(2, 16) - 1:
|
||||
raise ValueError(
|
||||
f"Duration in ms of {duration} smaller than 0 or larger than allowed {pow(2, 16) - 1}"
|
||||
f"Duration in ms of {duration} smaller than 0 or larger than allowed"
|
||||
f" {pow(2, 16) - 1}"
|
||||
)
|
||||
command += struct.pack("!h", x_dipole)
|
||||
command += struct.pack("!h", y_dipole)
|
||||
@ -258,10 +472,19 @@ def pack_dipole_command(
|
||||
|
||||
def raise_dipole_error(dipole_str: str, value: int):
|
||||
raise ValueError(
|
||||
f"{dipole_str} {value} negative or larger than maximum allowed 2000 * 10^-4*Am^2"
|
||||
f"{dipole_str} {value} negative or larger than maximum allowed 2000 *"
|
||||
" 10^-4*Am^2"
|
||||
)
|
||||
|
||||
|
||||
STATUS_HEADERS = [
|
||||
"Status Byte Mode",
|
||||
"Status Byte Error",
|
||||
"Status Byte Config",
|
||||
"Status Byte Uptime [s]",
|
||||
]
|
||||
|
||||
|
||||
ENG_HK_HEADERS = [
|
||||
"Digital Voltage [mV]",
|
||||
"Analog Voltage [mV]",
|
||||
@ -277,6 +500,52 @@ ENG_HK_HEADERS = [
|
||||
]
|
||||
|
||||
|
||||
def handle_imtq_hk(pw: PrintWrapper, 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(pw, hk_data)
|
||||
elif set_id == ImtqSetId.ENG_HK_NO_TORQUE:
|
||||
return handle_eng_set(pw, hk_data, False)
|
||||
elif set_id == ImtqSetId.ENG_HK_SET_WITH_TORQUE:
|
||||
return handle_eng_set(pw, hk_data, True)
|
||||
elif set_id == ImtqSetId.CAL_MTM_SET:
|
||||
return handle_calibrated_mtm_measurement(pw, hk_data)
|
||||
elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE:
|
||||
return handle_raw_mtm_measurement(pw, hk_data, False)
|
||||
elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE:
|
||||
return handle_raw_mtm_measurement(pw, hk_data, True)
|
||||
elif set_id == ImtqSetId.DIPOLES:
|
||||
return handle_dipole_set(pw, hk_data)
|
||||
elif set_id == ImtqSetId.STATUS_SET:
|
||||
return handle_status_set(pw, hk_data)
|
||||
else:
|
||||
pw.wlog(
|
||||
_LOGGER,
|
||||
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(pw: PrintWrapper, hk_data: bytes):
|
||||
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}")
|
||||
FsfwTmTcPrinter.get_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]
|
||||
@ -305,19 +574,36 @@ def unpack_eng_hk(hk_data: bytes) -> List:
|
||||
return content_list
|
||||
|
||||
|
||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_eng_set(pw: PrintWrapper, hk_data: bytes, torque_on: bool):
|
||||
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)
|
||||
pw.dlog(str(ENG_HK_HEADERS))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
for k, v in zip(ENG_HK_HEADERS, content_list):
|
||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_status_set(pw: PrintWrapper, hk_data: bytes):
|
||||
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}")
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def handle_calibrated_mtm_measurement(pw: PrintWrapper, hk_data: bytes):
|
||||
header_list = [
|
||||
"Calibrated MTM X [nT]",
|
||||
"Calibrated MTM Y [nT]",
|
||||
@ -333,11 +619,15 @@ def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
num_of_vars = len(header_list)
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def handle_raw_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_raw_mtm_measurement(pw: PrintWrapper, hk_data: bytes, torque_status: bool):
|
||||
pw.dlog(f"Found raw MTM measurement. Torque Status: {torque_status}")
|
||||
header_list = [
|
||||
"Raw MTM X [nT]",
|
||||
"Raw MTM Y [nT]",
|
||||
@ -353,11 +643,14 @@ def handle_raw_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
num_of_vars = 2
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_self_test_data(pw: PrintWrapper, hk_data: bytes):
|
||||
header_list = [
|
||||
"Init Err",
|
||||
"Init Raw Mag X [nT]",
|
||||
@ -461,7 +754,7 @@ def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
init_coil_z_temperature,
|
||||
err,
|
||||
raw_mag_x,
|
||||
init_raw_mag_y,
|
||||
raw_mag_y,
|
||||
raw_mag_z,
|
||||
cal_mag_x,
|
||||
cal_mag_y,
|
||||
@ -489,4 +782,8 @@ def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
num_of_vars = len(header_list)
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
)
|
||||
|
@ -1,11 +1,27 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import CmdTreeNode, 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.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_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):
|
||||
@ -16,27 +32,56 @@ 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, cmd_str: 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 cmd_str == 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 cmd_str == 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
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, 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)
|
||||
handle_mgm_lis3_hk_data(object_id, pw, 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)
|
||||
handle_mgm_rm3100_hk_data(object_id, pw, set_id, hk_data)
|
||||
pass
|
||||
|
||||
|
||||
def handle_mgm_lis3_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, 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(
|
||||
@ -50,14 +95,28 @@ def handle_mgm_lis3_hk_data(
|
||||
|
||||
|
||||
def handle_mgm_rm3100_hk_data(
|
||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == MgmRm3100SetId.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = f"!fff"
|
||||
fmt_str = "!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"Received MGM RM3100 from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
|
||||
)
|
||||
|
||||
|
||||
def create_mgms_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("mgms", "Magnetometer devices")
|
||||
node.add_child(CmdTreeNode(OpCode.NORMAL, "Normal Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Off Mode"))
|
||||
return node
|
||||
|
||||
|
||||
@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,37 +4,38 @@
|
||||
@author J. Meier
|
||||
@date 20.06.2021
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.config.object_ids import RW1_ID, RW2_ID, RW3_ID, RW4_ID
|
||||
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 (
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
generate_one_hk_command,
|
||||
generate_one_diag_command,
|
||||
make_sid,
|
||||
enable_periodic_hk_command_with_interval,
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCodesDev:
|
||||
SPEED = ["0", "speed"]
|
||||
ON = ["1", "on"]
|
||||
NML = ["2", "nml"]
|
||||
OFF = ["3", "off"]
|
||||
GET_STATUS = ["4", "status"]
|
||||
GET_TM = ["5", "tm"]
|
||||
ENABLE_STATUS_HK = ["6", "enable_status_hk"]
|
||||
DISABLE_STATUS_HK = ["7", "disable_status_hk"]
|
||||
SPEED = "speed"
|
||||
ON = "on"
|
||||
NML = "nml"
|
||||
OFF = "off"
|
||||
GET_STATUS = "status"
|
||||
GET_TM = "get_tm_set"
|
||||
REQ_TM = "req_tm_set"
|
||||
ENABLE_STATUS_HK = "enable_status_hk"
|
||||
DISABLE_STATUS_HK = "disable_status_hk"
|
||||
|
||||
|
||||
class InfoDev:
|
||||
@ -44,16 +45,21 @@ class InfoDev:
|
||||
OFF = "Set Off"
|
||||
GET_STATUS = "Get Status HK"
|
||||
GET_TM = "Get TM HK"
|
||||
REQ_TM = "Request TM HK"
|
||||
ENABLE_STATUS_HK = "Enable Status HK"
|
||||
DISABLE_STATUS_HK = "Disable Status HK"
|
||||
|
||||
|
||||
class OpCodesAss:
|
||||
ON = ["0", "on"]
|
||||
NML = ["1", "nml"]
|
||||
OFF = ["2", "off"]
|
||||
ALL_SPEED_UP = ["3", "speed_up"]
|
||||
ALL_SPEED_OFF = ["4", "speed_off"]
|
||||
ON = "on"
|
||||
NML = "nml"
|
||||
OFF = "off"
|
||||
ALL_SPEED_UP = "speed_up"
|
||||
ALL_SPEED_OFF = "speed_off"
|
||||
|
||||
|
||||
class ActionId:
|
||||
REQUEST_TM = 9
|
||||
|
||||
|
||||
class InfoAss:
|
||||
@ -64,7 +70,7 @@ class InfoAss:
|
||||
ALL_SPEED_OFF = "Speed down to 0"
|
||||
|
||||
|
||||
class RwSetId:
|
||||
class RwSetId(enum.IntEnum):
|
||||
STATUS_SET_ID = 4
|
||||
TEMPERATURE_SET_ID = 8
|
||||
LAST_RESET = 2
|
||||
@ -91,54 +97,45 @@ class RampTime:
|
||||
MS_1000 = 1000
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_rw_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_2.value,
|
||||
info="Reaction Wheel 2",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_3.value,
|
||||
info="Reaction Wheel 3",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_4.value,
|
||||
info="Reaction Wheel 4",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=InfoAss.ON, keys=OpCodesAss.ON)
|
||||
oce.add(info=InfoAss.NML, keys=OpCodesAss.NML)
|
||||
oce.add(info=InfoAss.OFF, keys=OpCodesAss.OFF)
|
||||
oce.add(info=InfoAss.ALL_SPEED_UP, keys=OpCodesAss.ALL_SPEED_UP)
|
||||
oce.add(info=InfoAss.ALL_SPEED_OFF, keys=OpCodesAss.ALL_SPEED_OFF)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RW_ASSEMBLY.value,
|
||||
info="Reaction Wheel Assembly",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
def create_reaction_wheels_nodes() -> List[CmdTreeNode]:
|
||||
nodes = []
|
||||
for i in range(4):
|
||||
next_node = CmdTreeNode(
|
||||
f"rw_{i}", f"Reaction Wheel {i}", hide_children_which_are_leaves=True
|
||||
)
|
||||
next_node.add_child(CmdTreeNode(InfoDev.SPEED, OpCodesDev.SPEED))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.ON, OpCodesDev.ON))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.OFF, OpCodesDev.OFF))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.NML, OpCodesDev.NML))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.REQ_TM, OpCodesDev.REQ_TM))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.GET_STATUS, OpCodesDev.GET_STATUS))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.GET_TM, OpCodesDev.GET_TM))
|
||||
next_node.add_child(
|
||||
CmdTreeNode(InfoDev.ENABLE_STATUS_HK, OpCodesDev.ENABLE_STATUS_HK)
|
||||
)
|
||||
next_node.add_child(
|
||||
CmdTreeNode(InfoDev.DISABLE_STATUS_HK, OpCodesDev.DISABLE_STATUS_HK)
|
||||
)
|
||||
nodes.append(next_node)
|
||||
return nodes
|
||||
|
||||
|
||||
def pack_single_rw_test_into(
|
||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
|
||||
def create_reaction_wheel_assembly_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"rw_assy", "Reaction Wheels Assembly", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ON, InfoAss.ON))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.NML, InfoAss.NML))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.OFF, InfoAss.OFF))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_UP, InfoAss.ALL_SPEED_UP))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_OFF, InfoAss.ALL_SPEED_OFF))
|
||||
return node
|
||||
|
||||
|
||||
def create_single_rw_cmd( # noqa C901: Complexity is okay here.
|
||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
if op_code in OpCodesDev.SPEED:
|
||||
if cmd_str == OpCodesDev.SPEED:
|
||||
speed, ramp_time = prompt_speed_ramp_time()
|
||||
q.add_log_cmd(
|
||||
f"RW {rw_idx}: {InfoDev.SPEED} with target "
|
||||
@ -146,36 +143,41 @@ def pack_single_rw_test_into(
|
||||
)
|
||||
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
|
||||
|
||||
if op_code in OpCodesDev.ON:
|
||||
if cmd_str == 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 OpCodesDev.NML:
|
||||
if cmd_str == 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 OpCodesDev.OFF:
|
||||
if cmd_str == 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 OpCodesDev.GET_TM:
|
||||
if cmd_str == 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=RwSetId.TM_SET)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesDev.GET_STATUS:
|
||||
if cmd_str == OpCodesDev.REQ_TM:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.REQ_TM}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.REQUEST_TM)
|
||||
)
|
||||
if cmd_str == 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=RwSetId.STATUS_SET_ID)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesDev.ENABLE_STATUS_HK:
|
||||
if cmd_str == 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(
|
||||
@ -183,7 +185,7 @@ def pack_single_rw_test_into(
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodesDev.DISABLE_STATUS_HK:
|
||||
if cmd_str == OpCodesDev.DISABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.DISABLE_STATUS_HK}")
|
||||
q.add_pus_tc(
|
||||
disable_periodic_hk_command(
|
||||
@ -192,38 +194,38 @@ def pack_single_rw_test_into(
|
||||
)
|
||||
|
||||
|
||||
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
|
||||
if op_code in OpCodesAss.OFF:
|
||||
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, cmd_str: str):
|
||||
if cmd_str in OpCodesAss.OFF:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.OFF, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.ON:
|
||||
if cmd_str in OpCodesAss.ON:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.ON, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.NML:
|
||||
if cmd_str in OpCodesAss.NML:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.NORMAL, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.ALL_SPEED_UP:
|
||||
if cmd_str in OpCodesAss.ALL_SPEED_UP:
|
||||
speed, ramp_time = prompt_speed_ramp_time()
|
||||
rw_speed_up_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], speed, ramp_time)
|
||||
if op_code in OpCodesAss.ALL_SPEED_OFF:
|
||||
if cmd_str in OpCodesAss.ALL_SPEED_OFF:
|
||||
rw_speed_down_cmd_consec(
|
||||
q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], prompt_ramp_time()
|
||||
)
|
||||
|
||||
|
||||
def prompt_speed_ramp_time() -> (int, int):
|
||||
def prompt_speed_ramp_time() -> Tuple[int, int]:
|
||||
speed = int(
|
||||
input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: ")
|
||||
)
|
||||
@ -247,14 +249,12 @@ def pack_set_speed_command(
|
||||
if speed > 0:
|
||||
if speed < 1000 or speed > 65000:
|
||||
raise ValueError(
|
||||
"Invalid RW speed specified. "
|
||||
"Allowed range is [1000, 65000] 0.1 * RPM"
|
||||
"Invalid RW speed specified. Allowed range is [1000, 65000] 0.1 * RPM"
|
||||
)
|
||||
elif speed < 0:
|
||||
if speed < -65000 or speed > -1000:
|
||||
raise ValueError(
|
||||
"Invalid RW speed specified. "
|
||||
"Allowed range is [-65000, -1000] 0.1 * RPM"
|
||||
"Invalid RW speed specified. Allowed range is [-65000, -1000] 0.1 * RPM"
|
||||
)
|
||||
else:
|
||||
# Speed is 0
|
||||
@ -274,10 +274,8 @@ def pack_set_speed_command(
|
||||
|
||||
|
||||
def handle_rw_hk_data(
|
||||
printer: FsfwTmTcPrinter, object_id: ObjectIdU32, set_id: int, hk_data: bytes
|
||||
pw: PrintWrapper, object_id: ObjectIdU32, set_id: int, hk_data: bytes
|
||||
):
|
||||
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
if set_id == RwSetId.STATUS_SET_ID:
|
||||
pw.dlog(
|
||||
@ -292,17 +290,18 @@ def handle_rw_hk_data(
|
||||
speed_rpm = speed / 10.0
|
||||
ref_speed_rpm = ref_speed / 10.0
|
||||
pw.dlog(
|
||||
f"Temperature {temp} C | Speed {speed_rpm} rpm | Reference Speed {ref_speed_rpm} rpm"
|
||||
f"Temperature {temp} C | Speed {speed_rpm} rpm | Reference Speed"
|
||||
f" {ref_speed_rpm} rpm"
|
||||
)
|
||||
pw.dlog(
|
||||
f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
|
||||
f"4: Running, speed changing"
|
||||
"4: Running, speed changing"
|
||||
)
|
||||
pw.dlog(
|
||||
f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
|
||||
f"1: High Current Mode (0.6 A)"
|
||||
"1: High Current Mode (0.6 A)"
|
||||
)
|
||||
printer.print_validity_buffer(hk_data[current_idx:], 5)
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5))
|
||||
if set_id == RwSetId.LAST_RESET:
|
||||
pw.dlog(
|
||||
f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
||||
@ -349,22 +348,24 @@ def handle_rw_hk_data(
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
|
||||
pw.dlog(
|
||||
f"MCU Temperature {mcu_temp} | Pressure Sensore Temperature {pressure_sens_temp} C"
|
||||
f"MCU Temperature {mcu_temp} | Pressure Sensore Temperature"
|
||||
f" {pressure_sens_temp} C"
|
||||
)
|
||||
pw.dlog(f"Last Reset Status {last_reset_status}")
|
||||
pw.dlog(
|
||||
f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
|
||||
f"1: High Current Mode (0.6 A)"
|
||||
"1: High Current Mode (0.6 A)"
|
||||
)
|
||||
pw.dlog(f"Speed {current_speed} rpm | Reference Speed {ref_speed} rpm")
|
||||
pw.dlog(
|
||||
f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
|
||||
f"4: Running, speed changing"
|
||||
"4: Running, speed changing"
|
||||
)
|
||||
pw.dlog(f"Number Of Invalid Packets:")
|
||||
pw.dlog("Number Of Invalid Packets:")
|
||||
pw.dlog("CRC | Length | CMD")
|
||||
pw.dlog(
|
||||
f"{num_invalid_crc_packets} | {num_invalid_len_packets} | {num_invalid_cmd_packets}"
|
||||
f"{num_invalid_crc_packets} | {num_invalid_len_packets} |"
|
||||
f" {num_invalid_cmd_packets}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"Num Of CMD Executed Requests {num_of_cmd_executed_requests} | "
|
||||
@ -372,23 +373,26 @@ def handle_rw_hk_data(
|
||||
)
|
||||
pw.dlog("UART COM information:")
|
||||
pw.dlog(
|
||||
f"NumBytesWritten | NumBytesRead | ParityErrs | NoiseErrs | FrameErrs | "
|
||||
f"RegOverrunErrs | TotalErrs"
|
||||
"NumBytesWritten | NumBytesRead | ParityErrs | NoiseErrs | FrameErrs | "
|
||||
"RegOverrunErrs | TotalErrs"
|
||||
)
|
||||
pw.dlog(
|
||||
f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} | {uart_num_parity_errors} | "
|
||||
f"{uart_num_noise_errors} | {uart_num_frame_errors} | {uart_num_reg_overrun_errors} | "
|
||||
f"{uart_total_num_errors}"
|
||||
f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} |"
|
||||
f" {uart_num_parity_errors} | {uart_num_noise_errors} |"
|
||||
f" {uart_num_frame_errors} | {uart_num_reg_overrun_errors} |"
|
||||
f" {uart_total_num_errors}"
|
||||
)
|
||||
pw.dlog("SPI COM Info:")
|
||||
pw.dlog(f"NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs")
|
||||
pw.dlog("NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs")
|
||||
pw.dlog(
|
||||
f"{spi_num_bytes_written} | {spi_num_bytes_read} | {spi_num_reg_overrun_errors} | "
|
||||
f"{spi_total_num_errors}"
|
||||
f"{spi_num_bytes_written} | {spi_num_bytes_read} |"
|
||||
f" {spi_num_reg_overrun_errors} | {spi_total_num_errors}"
|
||||
)
|
||||
if current_idx > 0:
|
||||
printer.print_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,14 +4,15 @@
|
||||
@brief Commanding of the star tracker image helper object which is responsible for uploading
|
||||
and downloading images to/from the star tracker.
|
||||
@details Images to uplaod must be previously transferred to the OBC with the CFDP protocol.
|
||||
Also downloaded images will be stored on the filesystem of the OBC and can be transferred via CFDP.
|
||||
Also downloaded images will be stored on the filesystem of the OBC and can be
|
||||
transferred via CFDP.
|
||||
@author J. Meier
|
||||
@date 29.11.2021
|
||||
"""
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
|
@ -1,60 +1,57 @@
|
||||
import enum
|
||||
from typing import Tuple, Dict
|
||||
from typing import Dict, Tuple
|
||||
|
||||
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
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
||||
class CmdStr(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 AcsMode(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]] = {
|
||||
OpCode.OFF: (AcsMode.OFF, Info.OFF),
|
||||
OpCode.IDLE: (AcsMode.IDLE, Info.IDLE),
|
||||
OpCode.SAFE: (AcsMode.SAFE, Info.SAFE),
|
||||
OpCode.DETUMBLE: (AcsMode.DETUMBLE, Info.DETUMBLE),
|
||||
HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||
CmdStr.OFF: (AcsMode.OFF, 0, Info.OFF),
|
||||
CmdStr.SAFE: (AcsMode.SAFE, SafeSubmode.DEFAULT, Info.SAFE),
|
||||
CmdStr.DETUMBLE: (AcsMode.SAFE, SafeSubmode.DETUMBLE, Info.DETUMBLE),
|
||||
CmdStr.IDLE: (AcsMode.IDLE, 0, Info.IDLE),
|
||||
CmdStr.PTG_TARGET: (AcsMode.PTG_TARGET, 0, Info.PTG_TARGET),
|
||||
CmdStr.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, 0, Info.PTG_TARGET_GS),
|
||||
CmdStr.PTG_TARGET_NADIR: (AcsMode.PTG_NADIR, 0, Info.PTG_TARGET_NADIR),
|
||||
CmdStr.PTG_TARGET_INERTIAL: (AcsMode.PTG_INERTIAL, 0, Info.PTG_TARGET_INERTIAL),
|
||||
}
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_SS.value)
|
||||
def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
def build_acs_subsystem_cmd(q: DefaultPusQueueHelper, cmd_path: str):
|
||||
info_prefix = "ACS Subsystem"
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
if cmd_path in CmdStr.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -63,23 +60,21 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
app_data=ACS_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
mode_info_tup = HANDLER_LIST.get(op_code)
|
||||
mode_info_tup = HANDLER_LIST.get(cmd_path)
|
||||
if mode_info_tup is None:
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_acs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.SAFE, Info.SAFE)
|
||||
oce.add(OpCode.IDLE, Info.IDLE)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.ACS_SS, "ACS Subsystem", oce)
|
||||
def create_acs_subsystem_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("acs", "ACS Subsystem", hide_children_which_are_leaves=True)
|
||||
for cmd_str, (_, _, info) in HANDLER_LIST.items():
|
||||
node.add_child(CmdTreeNode(cmd_str, info))
|
||||
node.add_child(CmdTreeNode(CmdStr.REPORT_ALL_MODES, Info.REPORT_ALL_MODES))
|
||||
return node
|
||||
|
@ -1,18 +1,18 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId:
|
||||
class SetId(enum.IntEnum):
|
||||
HK = 3
|
||||
|
||||
|
||||
def handle_sus_hk(
|
||||
object_id: ObjectIdU32, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
|
||||
object_id: ObjectIdU32, hk_data: bytes, pw: PrintWrapper, set_id: int
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received SUS HK data from {object_id}")
|
||||
if set_id == SetId.HK:
|
||||
current_idx = 0
|
||||
@ -23,7 +23,9 @@ def handle_sus_hk(
|
||||
channels.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2]))
|
||||
current_idx += 2
|
||||
pw.dlog(f"Temperature: {temperature} C")
|
||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
pw.dlog("AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in enumerate(channels):
|
||||
pw.dlog(f"{idx} | {val[0]:#06x} |" + str(val[0]).ljust(5))
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=7
|
||||
)
|
||||
|
@ -1,22 +1,19 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID
|
||||
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, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
|
||||
|
||||
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"]
|
||||
SUS_ASS_NOM_SIDE = "nom"
|
||||
SUS_ASS_RED_SIDE = "red"
|
||||
SUS_ASS_DUAL_MODE = "dual"
|
||||
SUS_ASS_OFF = "off"
|
||||
|
||||
|
||||
def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
@ -54,34 +51,16 @@ def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
|
||||
|
||||
@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=SusOpCode.SUS_ASS_NOM_SIDE,
|
||||
info="Switch SUS board to nominal side",
|
||||
def create_sus_board_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("sus_brd_assy", "SUS board assembly")
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to nominal side")
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_RED_SIDE,
|
||||
info="Switch SUS board to redundant side",
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to redundant side")
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_OFF,
|
||||
info="Switch off SUS board",
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_DUAL_MODE,
|
||||
info="Switch SUS board to dual mode",
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SUS_BRD_ASS.value,
|
||||
info="SUS Board Assembly",
|
||||
op_code_entry=oce,
|
||||
node.add_child(CmdTreeNode(SusOpCode.SUS_ASS_OFF, "Switch SUS board off"))
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_DUAL_MODE, "Switch SUS board to dual mode")
|
||||
)
|
||||
return node
|
||||
|
@ -1 +0,0 @@
|
||||
from .subsystem import add_com_subsystem_cmds
|
||||
|
@ -8,6 +8,8 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
@ -15,10 +17,9 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_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):
|
||||
@ -48,14 +49,15 @@ class Submode(enum.IntEnum):
|
||||
UNSET = 0
|
||||
DATARATE_LOW = 1
|
||||
DATARATE_HIGH = 2
|
||||
DATARATE_DEFAULT = 3
|
||||
|
||||
|
||||
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"]
|
||||
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:
|
||||
@ -66,30 +68,30 @@ class Info:
|
||||
DISABLE_ACTION = "Disable TX (legacy)"
|
||||
|
||||
|
||||
def pack_ccsds_handler_test(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
def pack_ccsds_handler_command( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: 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:
|
||||
if cmd_str 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:
|
||||
if cmd_str 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:
|
||||
if cmd_str 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:
|
||||
if cmd_str 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:
|
||||
if cmd_str 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":
|
||||
if cmd_str == "4":
|
||||
q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = (
|
||||
@ -98,24 +100,36 @@ def pack_ccsds_handler_test(
|
||||
+ struct.pack("!I", bitrate)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "5":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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))
|
||||
|
||||
|
||||
def create_ccsds_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("ccsds", "CCSDS Handler", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
10
eive_tmtc/tmtc/com/defs.py
Normal file
10
eive_tmtc/tmtc/com/defs.py
Normal file
@ -0,0 +1,10 @@
|
||||
import enum
|
||||
|
||||
|
||||
class Mode(enum.IntEnum):
|
||||
NONE = 0
|
||||
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
|
@ -5,8 +5,22 @@
|
||||
@author J. Meier
|
||||
@date 22.11.2021
|
||||
"""
|
||||
import enum
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_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:
|
||||
@ -16,15 +30,94 @@ class CommandId:
|
||||
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
|
||||
|
||||
|
||||
def pack_pdec_handler_test(
|
||||
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
|
||||
class ParameterId(enum.IntEnum):
|
||||
POSITIVE_WINDOW = 0
|
||||
NEGATIVE_WINDOW = 1
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
RESET_NO_INIT = 2
|
||||
RESET_WITH_INIT = 3
|
||||
|
||||
|
||||
class OpCode:
|
||||
PRINT_CLCW = "print_clcw"
|
||||
PRINT_MON_REG = "print_mon_reg"
|
||||
POSITIVE_WINDOW = "positive_window"
|
||||
NEGATIVE_WINDOW = "negative_window"
|
||||
RESET_WITH_INIT = "reset_with_init"
|
||||
RESET_NO_INIT = "reset_no_init"
|
||||
|
||||
|
||||
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"
|
||||
RESET_WITH_INIT = "Reset with full initialization"
|
||||
RESET_NO_INIT = "Reset with mandatory initialization"
|
||||
|
||||
|
||||
def pack_pdec_handler_commands(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: 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")
|
||||
prefix = "PDEC Handler "
|
||||
if cmd_str == 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 == "1":
|
||||
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
|
||||
if cmd_str == 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 cmd_str == 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,
|
||||
)
|
||||
)
|
||||
)
|
||||
if cmd_str == 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,
|
||||
)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.RESET_NO_INIT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.RESET_NO_INIT}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_NO_INIT)
|
||||
)
|
||||
if cmd_str == OpCode.RESET_WITH_INIT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.RESET_WITH_INIT}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_WITH_INIT)
|
||||
)
|
||||
|
||||
|
||||
@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)
|
||||
oce.add(OpCode.RESET_WITH_INIT, Info.RESET_WITH_INIT)
|
||||
oce.add(OpCode.RESET_NO_INIT, Info.RESET_NO_INIT)
|
||||
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
|
||||
|
@ -1,32 +1,30 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
create_scalar_u32_parameter,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
|
||||
from tmtccmd.pus.s200_fsfw_mode import (
|
||||
create_announce_mode_command,
|
||||
create_announce_mode_recursive_command,
|
||||
create_mode_command,
|
||||
create_read_mode_command,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
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
|
||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
pack_scalar_u8_parameter_app_data,
|
||||
)
|
||||
|
||||
from .defs import Mode as ComMode
|
||||
|
||||
|
||||
class ParameterId(enum.IntEnum):
|
||||
DATARATE = 0
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
RX_ONLY = 0
|
||||
RX_AND_TX_DEF_DATARATE = 1
|
||||
RX_AND_TX_LOW_DATARATE = 2
|
||||
RX_AND_TX_HIGH_DATARATE = 3
|
||||
RX_AND_TX_CARRIER_WAVE = 4
|
||||
TRANSMITTER_TIMEOUT = 1
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -37,46 +35,51 @@ class OpCode:
|
||||
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_DEF_RATE = "Syrlinks with TX default datarate"
|
||||
TX_AND_RX_LOW_RATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
||||
TX_AND_RX_HIGH_RATE = "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
|
||||
def build_com_subsystem_procedure(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
prefix = "COM Subsystem"
|
||||
if o == OpCode.RX_ONLY:
|
||||
if cmd_str == 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, ComMode.RX_ONLY, 0))
|
||||
elif cmd_str == OpCode.TX_AND_RX_DEF_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_DEF_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_DEF_DATARATE, 0)
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_DEF_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_DATARATE)
|
||||
elif cmd_str == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_LOW_DATARATE, 0)
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_LOW_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_DATARATE)
|
||||
elif cmd_str == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_HIGH_DATARATE, 0)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
|
||||
if cmd_str == 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(
|
||||
create_scalar_u8_parameter(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
@ -84,11 +87,11 @@ def build_com_subsystem_cmd(p: ServiceProviderParams):
|
||||
)
|
||||
)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
|
||||
if cmd_str == 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(
|
||||
create_scalar_u8_parameter(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
@ -96,20 +99,42 @@ def build_com_subsystem_cmd(p: ServiceProviderParams):
|
||||
)
|
||||
)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||
elif cmd_str == 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)
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_CARRIER_WAVE, 0)
|
||||
)
|
||||
elif cmd_str == 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,
|
||||
)
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.READ_MODE:
|
||||
q.add_log_cmd(Info.READ_MODE)
|
||||
q.add_pus_tc(create_read_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif cmd_str == OpCode.ANNOUNCE_MODE:
|
||||
q.add_log_cmd(Info.ANNOUNCE_MODE)
|
||||
q.add_pus_tc(create_announce_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif cmd_str == 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)
|
||||
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)
|
||||
def create_com_subsystem_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("com", "COM Subsystem", hide_children_which_are_leaves=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
@ -6,32 +6,37 @@
|
||||
@date 13.12.2020
|
||||
"""
|
||||
import enum
|
||||
|
||||
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,
|
||||
)
|
||||
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 logging
|
||||
import math
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
tmtc_definitions_provider,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, create_mode_command
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||
from eive_tmtc.tmtc.com.defs import Mode as ComMode
|
||||
|
||||
|
||||
class SetId:
|
||||
class SetId(enum.IntEnum):
|
||||
RX_REGISTERS_DATASET = 1
|
||||
TX_REGISTERS_DATASET = 2
|
||||
TEMPERATURE_SET_ID = 3
|
||||
@ -46,6 +51,7 @@ class OpCode:
|
||||
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"
|
||||
@ -53,6 +59,7 @@ class OpCode:
|
||||
HK_TX_REGS = "hk_tx_regs"
|
||||
TX_STATUS = "tx_status"
|
||||
RX_STATUS = "rx_status"
|
||||
SET_CW = "tx_cw"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -65,6 +72,7 @@ class Info:
|
||||
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"
|
||||
@ -92,19 +100,23 @@ class CommandId(enum.IntEnum):
|
||||
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
|
||||
|
||||
|
||||
def create_syrlinks_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("syrlinks", "Syrlinks Device", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -123,6 +135,7 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
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")
|
||||
@ -144,146 +157,200 @@ def normal_mode_cmd(q: DefaultPusQueueHelper, info: str, submode: int):
|
||||
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
|
||||
def pack_syrlinks_command( # noqa C901: Complexity okay here.
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: 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:
|
||||
if cmd_str == 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:
|
||||
if cmd_str == 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:
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, ComMode.RX_ONLY))
|
||||
if cmd_str == OpCode.NORMAL_RX_ONLY:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_ONLY, ComMode.RX_ONLY)
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, Submode.RX_AND_TX_LOW_DATARATE
|
||||
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, ComMode.RX_AND_TX_LOW_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, Submode.RX_AND_TX_DEFAULT_DATARATE
|
||||
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, ComMode.RX_AND_TX_DEF_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, Submode.RX_AND_TX_HIGH_DATARATE
|
||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, ComMode.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:
|
||||
if cmd_str in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, ComMode.RX_AND_TX_CARRIER_WAVE)
|
||||
if cmd_str 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.ENABLE_HK_RX_REGS:
|
||||
if cmd_str 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 cmd_str 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)
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
True, sid, interval
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_RX_REGS:
|
||||
if cmd_str 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_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid))
|
||||
if cmd_str 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)
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
True, sid, interval
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_TX_REGS:
|
||||
if cmd_str 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_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid))
|
||||
if cmd_str 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:
|
||||
if cmd_str 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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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":
|
||||
if cmd_str == "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)
|
||||
def handle_syrlinks_hk_data(
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
):
|
||||
if hk_info.set_id == SetId.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(hk_info, pw)
|
||||
elif hk_info.set_id == SetId.TX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_tx_registers_dataset(hk_info, pw)
|
||||
elif hk_info.set_id == SetId.TEMPERATURE_SET_ID:
|
||||
return handle_syrlinks_temp_dataset(hk_info, pw)
|
||||
else:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
||||
pw.dlog(
|
||||
f"Service 3 TM: Syrlinks handler reply with unknown set ID {hk_info.set_id}"
|
||||
)
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_syrlinks_temp_dataset(hk_info: HkTmInfo, pw: PrintWrapper):
|
||||
hk_data = hk_info.hk_data
|
||||
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}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[8:], 2))
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
):
|
||||
hk_data = hk_info.hk_data
|
||||
header_list = [
|
||||
"RX Status",
|
||||
"RX Sensitivity",
|
||||
"RX Frequency Shift",
|
||||
"RX IQ Power",
|
||||
"RX AGC Value",
|
||||
"RX AGC Value (Raw)",
|
||||
"RX Demod Eb",
|
||||
"RX Demod N0",
|
||||
"RX Datarate",
|
||||
"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_demod_eb = struct.unpack("!I", hk_data[13:17])[0]
|
||||
rx_demod_n0 = struct.unpack("!I", hk_data[17:21])[0]
|
||||
rx_data_rate = hk_data[21]
|
||||
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
|
||||
if rx_demod_n0 > 0:
|
||||
eb_to_n0 = 20 * math.log10(rx_demod_eb / rx_demod_n0) - 3
|
||||
else:
|
||||
logging.getLogger(__name__).warning(
|
||||
"RX Demod N0 is 0, can not calculate Eb to N0"
|
||||
)
|
||||
eb_to_n0 = 0
|
||||
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,
|
||||
@ -297,20 +364,157 @@ def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: byte
|
||||
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(
|
||||
FsfwTmTcPrinter.get_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
||||
)
|
||||
print(f"Carrier Detect: {carrier_detect}")
|
||||
print(f"Carrier Lock: {carrier_lock}")
|
||||
print(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
print(f"Data Valid (valid if TEB < 10e-5): {data_valid}")
|
||||
print(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
print(f"RX AGC Inhibit: {rx_agc_inhibit}")
|
||||
print(f"RX AGC: {rx_agc}")
|
||||
print(f"Eb / E0RX [dB]: {eb_to_n0}")
|
||||
cursor = hk_info.db_con.cursor()
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS syrlinks_rx_regs(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
carrier_detect NUM,
|
||||
carrier_lock NUM,
|
||||
data_lock NUM,
|
||||
data_valid NUM,
|
||||
rx_agc_inhibit NUM,
|
||||
rx_agc NUM,
|
||||
eb_to_e0_rx NUM
|
||||
)"""
|
||||
)
|
||||
cursor.execute(
|
||||
"INSERT INTO syrlinks_rx_regs VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
str(hk_info.packet_uuid),
|
||||
hk_info.hk_packet.pus_tm.time_provider.as_datetime(), # type: ignore
|
||||
carrier_detect,
|
||||
carrier_lock,
|
||||
data_lock,
|
||||
data_valid,
|
||||
rx_agc_inhibit,
|
||||
rx_agc,
|
||||
eb_to_n0,
|
||||
),
|
||||
)
|
||||
hk_info.db_con.commit()
|
||||
|
||||
|
||||
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,
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
):
|
||||
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])[0]
|
||||
header_list = ["TX Status Raw", "TX Waveform", "TX AGC value"]
|
||||
tx_status = hk_info.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}"
|
||||
)
|
||||
# Hack to make DB insertion work.
|
||||
tx_conf_set = TxCfgSet.START_WITH_CURRENT_CFG
|
||||
tx_clock_detect = (tx_status >> 4) & 0b1
|
||||
tx_waveform = hk_info.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_info.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:]
|
||||
validity_buffer = hk_info.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(
|
||||
FsfwTmTcPrinter.get_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}")
|
||||
print(f"TX Status: {tx_status_status!r}")
|
||||
print(f"TX Config Set: {tx_conf_set!r}")
|
||||
print(f"TX Clock Detect: {tx_clock_detect}")
|
||||
print(f"Waveform: {waveform_str}")
|
||||
print(f"PCM Mode: {pcm_mode}")
|
||||
print(f"TX AGC Inhibit: {tx_agc_inhibit}")
|
||||
print(f"TX AGC: {tx_agc}")
|
||||
cursor = hk_info.db_con.cursor()
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS syrlinks_tx_regs(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
tx_status NUM,
|
||||
tx_status_str TEXT,
|
||||
tx_cfg_set NUM,
|
||||
tx_cfg_set_str TEXT,
|
||||
tx_clock_detect NUM,
|
||||
waveform NUM,
|
||||
waveform_str TEXT,
|
||||
pcm_mode NUM,
|
||||
tx_agc_inhibut NUM,
|
||||
tx_agc NUM
|
||||
)"""
|
||||
)
|
||||
cursor.execute(
|
||||
"INSERT INTO syrlinks_tx_regs VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
str(hk_info.packet_uuid),
|
||||
hk_info.hk_packet.pus_tm.time_provider.as_datetime(), # type: ignore
|
||||
tx_status_status,
|
||||
tx_status_status.name,
|
||||
tx_conf_set,
|
||||
tx_conf_set.name,
|
||||
tx_clock_detect,
|
||||
waveform,
|
||||
waveform_str,
|
||||
pcm_mode,
|
||||
tx_agc_inhibit,
|
||||
tx_agc,
|
||||
),
|
||||
)
|
||||
hk_info.db_con.commit()
|
||||
|
@ -1,8 +1,8 @@
|
||||
from typing import Union
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
|
@ -1,38 +1,79 @@
|
||||
import enum
|
||||
import logging
|
||||
import os
|
||||
import struct
|
||||
from pathlib import Path
|
||||
from typing import Tuple
|
||||
|
||||
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.config import CmdTreeNode
|
||||
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.pus.s20_fsfw_param import (
|
||||
create_scalar_u8_parameter,
|
||||
create_load_param_cmd,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s11_tc_sched import (
|
||||
create_enable_tc_sched_cmd,
|
||||
create_disable_tc_sched_cmd,
|
||||
)
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.logging import get_console_logger
|
||||
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
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SdState(enum.IntEnum):
|
||||
OFF = 0
|
||||
ON = 1
|
||||
MOUNTED = 2
|
||||
|
||||
|
||||
class SdCardSelect(enum.IntEnum):
|
||||
SD_0 = 0
|
||||
SD_1 = 1
|
||||
BOTH = 2
|
||||
NONE = 3
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
LIST_DIR_INTO_FILE = 0
|
||||
ANNOUNCE_VERSION = 1
|
||||
ANNOUNCE_CURRENT_IMAGE = 2
|
||||
ANNOUNCE_BOOT_COUNTS = 3
|
||||
SWITCH_REBOOT_FILE_HANDLING = 5
|
||||
RESET_REBOOT_COUNTER = 6
|
||||
SWITCH_IMG_LOCK = 7
|
||||
SET_MAX_REBOOT_CNT = 8
|
||||
READ_REBOOT_MECHANISM_INFO = 9
|
||||
UPDATE_OBSW_FROM_SD_0 = 10
|
||||
UPDATE_OBSW_FROM_SD_1 = 11
|
||||
UPDATE_OBSW_FROM_TMP = 12
|
||||
SWITCH_TO_SD_0 = 16
|
||||
SWITCH_TO_SD_1 = 17
|
||||
SWITCH_TO_BOTH_SD_CARDS = 18
|
||||
AUTO_SWITCH_ENABLE = 19
|
||||
AUTO_SWITCH_DISABLE = 20
|
||||
XSC_REBOOT = 32
|
||||
FULL_REBOOT = 34
|
||||
EXECUTE_SHELL_CMD_BLOCKING = 40
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = 41
|
||||
SYSTEMCTL_CMD_EXECUTOR = 42
|
||||
LIST_DIR_INTO_FILE = 50
|
||||
LIST_DIR_DUMP_DIRECTLY = 51
|
||||
CP_HELPER = 52
|
||||
MV_HELPER = 53
|
||||
RM_HELPER = 54
|
||||
MKDIR_HELPER = 55
|
||||
ENABLE_SCHEDULER = 56
|
||||
UPDATE_LEAP_SECONRS = 60
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
PREF_SD = 0
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -40,39 +81,91 @@ class SetId(enum.IntEnum):
|
||||
|
||||
|
||||
class OpCode:
|
||||
REBOOT_XSC = ["0", "reboot_xsc"]
|
||||
XSC_REBOOT_SELF = ["1", "reboot_self"]
|
||||
XSC_REBOOT_0_0 = ["2", "reboot_00"]
|
||||
XSC_REBOOT_0_1 = ["3", "reboot_01"]
|
||||
XSC_REBOOT_1_0 = ["4", "reboot_10"]
|
||||
XSC_REBOOT_1_1 = ["5", "reboot_11"]
|
||||
REBOOT_FULL = ["6", "reboot_regular"]
|
||||
GET_HK = ["7", "get_hk"]
|
||||
OBSW_UPDATE_FROM_SD_0 = ["obsw_update_sd0"]
|
||||
OBSW_UPDATE_FROM_SD_1 = ["obsw_update_sd1"]
|
||||
OBSW_UPDATE_FROM_TMP = ["obsw_update_tmp"]
|
||||
SWITCH_TO_SD_0 = ["switch_to_sd_0"]
|
||||
SWITCH_TO_SD_1 = ["switch_to_sd_1"]
|
||||
SWITCH_TO_BOTH_SD_CARDS = ["switch_to_both_sd_cards"]
|
||||
ENABLE_REBOOT_FILE_HANDLING = ["32", "rbh_off"]
|
||||
DISABLE_REBOOT_FILE_HANDLING = ["33", "rbh_on"]
|
||||
RESET_ALL_REBOOT_COUNTERS = ["34", "rbh_reset_a"]
|
||||
RESET_REBOOT_COUNTER_00 = ["35", "rbh_reset_00"]
|
||||
RESET_REBOOT_COUNTER_01 = ["36", "rbh_reset_01"]
|
||||
RESET_REBOOT_COUNTER_10 = ["37", "rbh_reset_10"]
|
||||
RESET_REBOOT_COUNTER_11 = ["38", "rbh_reset_11"]
|
||||
SET_MAX_REBOOT_CNT = ["39", "rbh_max_cnt"]
|
||||
ANNOUNCE_VERSION = "announce_version"
|
||||
ANNOUNCE_CURRENT_IMAGE = "announce_current_image"
|
||||
ANNOUNCE_BOOT_COUNTS = "announce_boot_counts"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "exec_cmd_blocking"
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = "exec_cmd_non_blocking"
|
||||
SYSTEMCTL_CMD_EXECUTOR = "systemctl_cmd"
|
||||
LIST_DIR_INTO_FILE = "list_dir_into_file"
|
||||
LIST_DIR_DUMP_DIRECTLY = "list_dir_dump_directly"
|
||||
CP_HELPER = "cp_helper"
|
||||
MV_HELPER = "mv_helper"
|
||||
RM_HELPER = "rm_helper"
|
||||
MKDIR_HELPER = "mkdir_helper"
|
||||
SET_PREF_SD = "set_pref_sd"
|
||||
REBOOT_XSC = "reboot_xsc"
|
||||
XSC_REBOOT_SELF = "reboot_self"
|
||||
XSC_REBOOT_0_0 = "reboot_00"
|
||||
XSC_REBOOT_0_1 = "reboot_01"
|
||||
XSC_REBOOT_1_0 = "reboot_10"
|
||||
XSC_REBOOT_1_1 = "reboot_11"
|
||||
REBOOT_FULL = "reboot_regular"
|
||||
GET_HK = "get_hk"
|
||||
OBSW_UPDATE_FROM_SD_0 = "obsw_update_sd0"
|
||||
OBSW_UPDATE_FROM_SD_1 = "obsw_update_sd1"
|
||||
OBSW_UPDATE_FROM_TMP = "obsw_update_tmp"
|
||||
SWITCH_TO_SD_0 = "switch_to_sd_0"
|
||||
SWITCH_TO_SD_1 = "switch_to_sd_1"
|
||||
SWITCH_TO_BOTH_SD_CARDS = "switch_to_both_sd_cards"
|
||||
READ_REBOOT_MECHANISM_INFO = "rbh_info"
|
||||
ENABLE_REBOOT_FILE_HANDLING = "rwd_on"
|
||||
DISABLE_REBOOT_FILE_HANDLING = "rwd_off"
|
||||
RESET_ALL_REBOOT_COUNTERS = "rwd_reset_a"
|
||||
RWD_RESET_REBOOT_COUNTER_00 = "rwd_reset_00"
|
||||
RWD_RESET_REBOOT_COUNTER_01 = "rwd_reset_01"
|
||||
RWD_RESET_REBOOT_COUNTER_10 = "rwd_reset_10"
|
||||
RWD_RESET_REBOOT_COUNTER_11 = "rwd_reset_11"
|
||||
RWD_SET_MAX_REBOOT_CNT = "rwd_max_cnt"
|
||||
AUTO_SWITCH_ENABLE = "auto_switch_enable"
|
||||
AUTO_SWITCH_DISABLE = "auto_switch_disable"
|
||||
ENABLE_SCHEDULER = "enable_scheduler"
|
||||
DISABLE_SCHEDULER = "disable_scheduler"
|
||||
UPDATE_LEAP_SECONDS = "leap_seconds_update"
|
||||
|
||||
|
||||
class Info:
|
||||
ANNOUNCE_VERSION = "Announce version"
|
||||
ANNOUNCE_CURRENT_IMAGE = "Announce current image"
|
||||
ANNOUNCE_BOOT_COUNTS = "Announce boot counts"
|
||||
SYSTEMCTL_CMD_EXECUTOR = "Perform systemctl command"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "Execute shell command blocking"
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = "Execute shell command non-blocking"
|
||||
SET_PREF_SD = "Set preferred SD card"
|
||||
REBOOT_XSC = "XSC reboot with prompt"
|
||||
REBOOT_FULL = "Full regular reboot"
|
||||
XSC_REBOOT_SELF = "Reboot Self"
|
||||
XSC_REBOOT_0_0 = "Reboot to 0 0"
|
||||
XSC_REBOOT_0_1 = "Reboot to 0 1"
|
||||
XSC_REBOOT_1_0 = "Reboot to 1 0"
|
||||
XSC_REBOOT_1_1 = "Reboot to 1 1"
|
||||
OBSW_UPDATE_FROM_SD_0 = "Update OBSW from SD Card 0"
|
||||
OBSW_UPDATE_FROM_SD_1 = "Update OBSW from SD Card 1"
|
||||
OBSW_UPDATE_FROM_TMP = "Update OBSW from tmp folder"
|
||||
READ_REBOOT_MECHANISM_INFO = "Read reboot mechansm information"
|
||||
SWITCH_TO_SD_0 = "Switch to SD card 0"
|
||||
SWITCH_TO_SD_1 = "Switch to SD card 1"
|
||||
SWITCH_TO_BOTH_SD_CARDS = "Switch to both SD cards with specified active card"
|
||||
LIST_DIR_INTO_FILE = "List directory, dump output into file"
|
||||
LIST_DIR_DUMP_DIRECTLY = "List directory, dump content directly"
|
||||
CP_HELPER = "Filesystem Copy Helper"
|
||||
MV_HELPER = "Filesystem Move Helper"
|
||||
RM_HELPER = "Filesystem Removal Helper"
|
||||
MKDIR_HELPER = "Filesystem Directory Creation Helper"
|
||||
ENABLE_REBOOT_FILE_HANDLING = "Enable reboot file handling"
|
||||
DISABLE_REBOOT_FILE_HANDLING = "Disable reboot file handling"
|
||||
RESET_ALL_REBOOT_COUNTERS = "Reset all reboot counters"
|
||||
RWD_RESET_REBOOT_COUNTER_00 = "Reset reboot counter 0 0"
|
||||
RWD_RESET_REBOOT_COUNTER_01 = "Reset reboot counter 0 0"
|
||||
RWD_RESET_REBOOT_COUNTER_10 = "Reset reboot counter 1 0"
|
||||
GET_HK = "Get HK set"
|
||||
RWD_RESET_REBOOT_COUNTER_11 = "Reset reboot counter 1 1"
|
||||
RWD_SET_MAX_REBOOT_CNT = "rwd_max_cnt"
|
||||
AUTO_SWITCH_ENABLE = "Enable Auto-Switch Feature with a specific target image"
|
||||
AUTO_SWITCH_DISABLE = "Disable Auto-Switch Feature"
|
||||
ENABLE_SCHEDULER = "Enable scheduler"
|
||||
DISABLE_SCHEDULER = "Disable scheduler"
|
||||
UPDATE_LEAP_SECONDS = "Updates the Leap Seconds"
|
||||
|
||||
|
||||
class Chip(enum.IntEnum):
|
||||
@ -87,63 +180,41 @@ class Copy(enum.IntEnum):
|
||||
NONE = 2
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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=OpCode.GET_HK,
|
||||
info="Request housekeeping set",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.ENABLE_REBOOT_FILE_HANDLING,
|
||||
info="Enable reboot file handling",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.DISABLE_REBOOT_FILE_HANDLING,
|
||||
info="Disable reboot file handling",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.RESET_ALL_REBOOT_COUNTERS,
|
||||
info="Reset all reboot counters",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_00,
|
||||
info="Reset reboot counter 0 0",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_01,
|
||||
info="Reset reboot counter 0 1",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_10,
|
||||
info="Reset reboot counter 1 0",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCode.RESET_REBOOT_COUNTER_11,
|
||||
info="Reset reboot counter 1 1",
|
||||
)
|
||||
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)
|
||||
class SystemctlCmd(enum.IntEnum):
|
||||
START = 0
|
||||
STOP = 1
|
||||
RESTART = 2
|
||||
|
||||
|
||||
def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCode.REBOOT_XSC:
|
||||
def create_core_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("core", "Core Controller", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
def pack_core_commands( # noqa C901
|
||||
q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa: C901 , complexity okay here
|
||||
if cmd_str == OpCode.ANNOUNCE_VERSION:
|
||||
q.add_log_cmd(f"{Info.ANNOUNCE_VERSION}")
|
||||
q.add_pus_tc(create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_VERSION))
|
||||
elif cmd_str == 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)
|
||||
)
|
||||
elif cmd_str == OpCode.ANNOUNCE_BOOT_COUNTS:
|
||||
q.add_log_cmd(f"{Info.ANNOUNCE_BOOT_COUNTS}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_BOOT_COUNTS)
|
||||
)
|
||||
elif cmd_str == OpCode.REBOOT_XSC:
|
||||
reboot_self, chip_select, copy_select = determine_reboot_params()
|
||||
add_xsc_reboot_cmd(
|
||||
q=q,
|
||||
@ -151,38 +222,73 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
chip=chip_select,
|
||||
copy=copy_select,
|
||||
)
|
||||
if op_code in OpCode.REBOOT_FULL:
|
||||
elif cmd_str == OpCode.REBOOT_FULL:
|
||||
q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.FULL_REBOOT
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.XSC_REBOOT_SELF:
|
||||
elif cmd_str == OpCode.XSC_REBOOT_SELF:
|
||||
add_xsc_reboot_cmd(q=q, reboot_self=True)
|
||||
if op_code in OpCode.XSC_REBOOT_0_0:
|
||||
elif cmd_str == OpCode.SYSTEMCTL_CMD_EXECUTOR:
|
||||
print("systemctl command types: ")
|
||||
for entry in SystemctlCmd:
|
||||
print(f"{entry}: {entry.name}")
|
||||
systemctl_cmd = SystemctlCmd(
|
||||
int(input("Specify systemctl command type by key: "))
|
||||
)
|
||||
unit_name = input("Specify unit name: ")
|
||||
q.add_pus_tc(create_systemctl_cmd(systemctl_cmd, unit_name))
|
||||
elif cmd_str == OpCode.EXECUTE_SHELL_CMD_BLOCKING:
|
||||
custom_cmd = input("Please specify command to execute: ")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.EXECUTE_SHELL_CMD_BLOCKING,
|
||||
user_data=custom_cmd.encode(),
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.EXECUTE_SHELL_CMD_NON_BLOCKING:
|
||||
custom_cmd = input("Please specify command to execute: ")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.EXECUTE_SHELL_CMD_NON_BLOCKING,
|
||||
user_data=custom_cmd.encode(),
|
||||
)
|
||||
)
|
||||
elif cmd_str == 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 OpCode.XSC_REBOOT_0_1:
|
||||
elif cmd_str == 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 OpCode.XSC_REBOOT_1_0:
|
||||
elif cmd_str == 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 OpCode.XSC_REBOOT_1_1:
|
||||
elif cmd_str == 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 OpCode.DISABLE_REBOOT_FILE_HANDLING:
|
||||
elif cmd_str == OpCode.READ_REBOOT_MECHANISM_INFO:
|
||||
q.add_log_cmd(Info.READ_REBOOT_MECHANISM_INFO)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.READ_REBOOT_MECHANISM_INFO,
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.DISABLE_REBOOT_FILE_HANDLING:
|
||||
q.add_log_cmd("Disabling reboot file handling")
|
||||
user_data = bytearray([0])
|
||||
q.add_pus_tc(
|
||||
@ -192,7 +298,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
user_data=user_data,
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.ENABLE_REBOOT_FILE_HANDLING:
|
||||
elif cmd_str == OpCode.ENABLE_REBOOT_FILE_HANDLING:
|
||||
q.add_log_cmd("Enabling reboot file handling")
|
||||
user_data = bytearray([1])
|
||||
q.add_pus_tc(
|
||||
@ -202,7 +308,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
user_data=user_data,
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.RESET_ALL_REBOOT_COUNTERS:
|
||||
elif cmd_str == OpCode.RESET_ALL_REBOOT_COUNTERS:
|
||||
q.add_log_cmd("Resetting all reboot counters")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
@ -210,40 +316,65 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
action_id=ActionId.RESET_REBOOT_COUNTER,
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_00:
|
||||
elif cmd_str == OpCode.RWD_RESET_REBOOT_COUNTER_00:
|
||||
reset_specific_boot_counter(q, 0, 0)
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_01:
|
||||
elif cmd_str == OpCode.RWD_RESET_REBOOT_COUNTER_01:
|
||||
reset_specific_boot_counter(q, 0, 1)
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_10:
|
||||
elif cmd_str == OpCode.RWD_RESET_REBOOT_COUNTER_10:
|
||||
reset_specific_boot_counter(q, 1, 0)
|
||||
if op_code in OpCode.RESET_REBOOT_COUNTER_11:
|
||||
elif cmd_str == OpCode.RWD_RESET_REBOOT_COUNTER_11:
|
||||
reset_specific_boot_counter(q, 1, 1)
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_SD_0:
|
||||
elif cmd_str == OpCode.RWD_SET_MAX_REBOOT_CNT:
|
||||
max_count = int(input("Set new maximum reboot threshold [1, 50]: "))
|
||||
if max_count < 1 or max_count > 50:
|
||||
raise ValueError("Invalid value, must be in range 1 to 50")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID,
|
||||
ActionId.SET_MAX_REBOOT_CNT,
|
||||
user_data=bytes([max_count]),
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.OBSW_UPDATE_FROM_SD_0:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_0)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_0))
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_SD_1:
|
||||
elif cmd_str == OpCode.OBSW_UPDATE_FROM_SD_1:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_1)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_SD_1))
|
||||
if op_code in OpCode.OBSW_UPDATE_FROM_TMP:
|
||||
elif cmd_str == OpCode.OBSW_UPDATE_FROM_TMP:
|
||||
q.add_log_cmd(Info.OBSW_UPDATE_FROM_TMP)
|
||||
q.add_pus_tc(pack_obsw_update_cmd(ActionId.UPDATE_OBSW_FROM_TMP))
|
||||
if op_code in OpCode.SWITCH_TO_SD_0:
|
||||
elif cmd_str == OpCode.AUTO_SWITCH_ENABLE:
|
||||
q.add_log_cmd(Info.AUTO_SWITCH_ENABLE)
|
||||
chip, copy = determine_chip_and_copy()
|
||||
user_data = bytes([chip, copy])
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID, ActionId.AUTO_SWITCH_ENABLE, user_data
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.AUTO_SWITCH_DISABLE:
|
||||
q.add_log_cmd(Info.AUTO_SWITCH_DISABLE)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.AUTO_SWITCH_DISABLE)
|
||||
)
|
||||
elif cmd_str == OpCode.SWITCH_TO_SD_0:
|
||||
q.add_log_cmd(Info.SWITCH_TO_SD_0)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_0
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.SWITCH_TO_SD_1:
|
||||
elif cmd_str == OpCode.SWITCH_TO_SD_1:
|
||||
q.add_log_cmd(Info.SWITCH_TO_SD_1)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionId.SWITCH_TO_SD_1
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.SWITCH_TO_BOTH_SD_CARDS:
|
||||
elif cmd_str == OpCode.SWITCH_TO_BOTH_SD_CARDS:
|
||||
while True:
|
||||
active_sd_card = int(input("Please specify active SD cqrd [0/1]: "))
|
||||
active_sd_card = int(input("Please specify active SD card [0/1]: "))
|
||||
if active_sd_card not in [0, 1]:
|
||||
_LOGGER.warning("Invalid SD card specified. Try again")
|
||||
break
|
||||
@ -255,10 +386,145 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
user_data=bytes([active_sd_card]),
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.GET_HK:
|
||||
elif cmd_str == OpCode.GET_HK:
|
||||
q.add_log_cmd("Requesting housekeeping set")
|
||||
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetId.HK)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
elif cmd_str == OpCode.SET_PREF_SD:
|
||||
q.add_log_cmd("Set preferred SD card")
|
||||
pref_sd = int(
|
||||
input("Specify which SD card to set as the preferred one (0/1): ")
|
||||
)
|
||||
if pref_sd not in [0, 1]:
|
||||
raise ValueError("Only 0 or 1 allowed for preferred SD card")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.PREF_SD,
|
||||
parameter=pref_sd,
|
||||
)
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.CP_HELPER:
|
||||
cp_recursive = int(input("Copy recursively (0/1) ?: "))
|
||||
if cp_recursive not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
cp_force = int(input("Copy with force option(0/1) ?: "))
|
||||
if cp_force not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
user_data = bytearray([cp_recursive, cp_force])
|
||||
user_data.extend(packet_source_dest_path("Copy"))
|
||||
q.add_log_cmd(Info.CP_HELPER)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.CP_HELPER, user_data)
|
||||
)
|
||||
elif cmd_str == OpCode.MV_HELPER:
|
||||
user_data = packet_source_dest_path("Move")
|
||||
q.add_log_cmd(Info.MV_HELPER)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.MV_HELPER, user_data)
|
||||
)
|
||||
elif cmd_str == OpCode.RM_HELPER:
|
||||
rm_recursive = int(input("Remove with recursive (-r) option (0/1) ?: "))
|
||||
if rm_recursive not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
rm_force = int(input("Remove with force (-f) option (0/1) ?: "))
|
||||
if rm_force not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
user_data = bytearray([rm_recursive, rm_force])
|
||||
removed_file_or_dir = input("Specify absolute path to be removed: ")
|
||||
user_data.extend(removed_file_or_dir.encode())
|
||||
user_data.append(0)
|
||||
q.add_log_cmd(Info.RM_HELPER)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.RM_HELPER, user_data)
|
||||
)
|
||||
elif cmd_str == OpCode.LIST_DIR_INTO_FILE:
|
||||
q.add_log_cmd(Info.LIST_DIR_INTO_FILE)
|
||||
user_data = list_directory_base_user_data()
|
||||
dest_file_path = input("Destination file path: ")
|
||||
user_data.extend(dest_file_path.encode())
|
||||
user_data.append(0)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID, ActionId.LIST_DIR_INTO_FILE, user_data
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.LIST_DIR_DUMP_DIRECTLY:
|
||||
q.add_log_cmd(Info.LIST_DIR_DUMP_DIRECTLY)
|
||||
user_data = list_directory_base_user_data()
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID, ActionId.LIST_DIR_DUMP_DIRECTLY, user_data
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.MKDIR_HELPER:
|
||||
q.add_log_cmd(Info.MKDIR_HELPER)
|
||||
user_data = input("Specify absolute path of newly created directory: ")
|
||||
user_data = bytearray(user_data.encode())
|
||||
user_data.append(0)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.MKDIR_HELPER, user_data)
|
||||
)
|
||||
elif cmd_str == OpCode.ENABLE_SCHEDULER:
|
||||
q.add_log_cmd(Info.ENABLE_SCHEDULER)
|
||||
q.add_pus_tc(create_enable_tc_sched_cmd())
|
||||
elif cmd_str == OpCode.DISABLE_SCHEDULER:
|
||||
q.add_log_cmd(Info.DISABLE_SCHEDULER)
|
||||
q.add_pus_tc(create_disable_tc_sched_cmd())
|
||||
elif cmd_str == OpCode.UPDATE_LEAP_SECONDS:
|
||||
q.add_log_cmd(Info.UPDATE_LEAP_SECONDS)
|
||||
leap_seconds = int(input("Specify new Leap Seconds Value: ")).to_bytes(
|
||||
length=2, signed=False, byteorder="big"
|
||||
)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
CORE_CONTROLLER_ID, ActionId.UPDATE_LEAP_SECONRS, leap_seconds
|
||||
)
|
||||
)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
f"Unknown operation code {cmd_str} for core controller commands"
|
||||
)
|
||||
|
||||
|
||||
def create_systemctl_cmd(systemctl_cmd: SystemctlCmd, unit_name: str):
|
||||
cmd_data = bytearray([systemctl_cmd])
|
||||
cmd_data.extend(unit_name.encode())
|
||||
return create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR,
|
||||
user_data=cmd_data,
|
||||
)
|
||||
|
||||
|
||||
def list_directory_base_user_data() -> bytearray:
|
||||
all_opt = int(input("Use all (-a) option (0/1) ?: "))
|
||||
if all_opt not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
recursive_opt = int(input("Use recursive (-R) option (0/1) ?: "))
|
||||
if recursive_opt not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
compression_opt = int(input("Compress target file (0/1) ?: "))
|
||||
if compression_opt not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
listing_path = input("Specify listing path (absolute path): ")
|
||||
user_data = bytearray([all_opt, recursive_opt, compression_opt])
|
||||
user_data.extend(listing_path.encode())
|
||||
user_data.append(0)
|
||||
return user_data
|
||||
|
||||
|
||||
def packet_source_dest_path(context: str) -> bytes:
|
||||
source = input(f"Specify {context} source file: ")
|
||||
dest = input(f"Specify {context} destination file: ")
|
||||
raw_src_dest = bytearray(source.encode())
|
||||
raw_src_dest.append(0)
|
||||
raw_src_dest.extend(dest.encode())
|
||||
raw_src_dest.append(0)
|
||||
return raw_src_dest
|
||||
|
||||
|
||||
def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):
|
||||
@ -278,18 +544,17 @@ def create_full_reboot_cmds() -> PusTelecommand:
|
||||
)
|
||||
|
||||
|
||||
def determine_reboot_params() -> (bool, Chip, Copy):
|
||||
chip_select = -1
|
||||
copy_select = -1
|
||||
def determine_reboot_params() -> Tuple[bool, Chip, Copy]:
|
||||
reboot_self = input("Reboot self? [y/n]: ")
|
||||
if reboot_self in ["y", "yes", "1"]:
|
||||
_LOGGER.info("Rebooting currently running image")
|
||||
return True, chip_select, copy_select
|
||||
return True, Chip.NONE, Copy.NONE
|
||||
_LOGGER.info("Rebooting image specified by chip and copy")
|
||||
return False, determine_chip_and_copy()
|
||||
chip, copy = determine_chip_and_copy()
|
||||
return False, chip, copy
|
||||
|
||||
|
||||
def determine_chip_and_copy() -> (int, int):
|
||||
def determine_chip_and_copy() -> Tuple[Chip, Copy]:
|
||||
while True:
|
||||
chip_select = input("Chip select [0/1]: ")
|
||||
if chip_select in ["0", "1"]:
|
||||
@ -315,7 +580,11 @@ def determine_chip_and_copy() -> (int, int):
|
||||
|
||||
def pack_obsw_update_cmd(action_id: int) -> PusTelecommand:
|
||||
chip, copy = determine_chip_and_copy()
|
||||
user_data = bytes([chip, copy])
|
||||
user_data = bytearray([chip, copy])
|
||||
custom_file_name = input("Use custom filename [y/n] ?: ")
|
||||
if custom_file_name.lower() in ["y", "yes", "1"]:
|
||||
custom_file_name = input("Specify custom filename: ")
|
||||
user_data.extend(custom_file_name.encode())
|
||||
return create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=action_id, user_data=user_data
|
||||
)
|
||||
@ -351,9 +620,8 @@ def create_xsc_reboot_cmds(
|
||||
)
|
||||
|
||||
|
||||
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
def handle_core_hk_data(pw: PrintWrapper, 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(
|
||||
@ -364,4 +632,93 @@ def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
f"PL Voltage [mV] {pl_voltage}"
|
||||
)
|
||||
pw.dlog(printout)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[inc_len:], num_vars=3
|
||||
)
|
||||
|
||||
|
||||
def handle_core_ctrl_action_replies(
|
||||
action_id: int, pw: PrintWrapper, custom_data: bytes
|
||||
):
|
||||
if action_id == ActionId.READ_REBOOT_MECHANISM_INFO:
|
||||
handle_reboot_mechanism_info_reply(pw, custom_data)
|
||||
elif action_id == ActionId.LIST_DIR_DUMP_DIRECTLY:
|
||||
handle_list_dir_dump_reply(pw, custom_data)
|
||||
|
||||
|
||||
def handle_reboot_mechanism_info_reply(pw: PrintWrapper, custom_data: bytes):
|
||||
pw.dlog("Received reboot mechansm information")
|
||||
fmt_str = "!BIIIIIBBBBBBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
if len(custom_data) < inc_len:
|
||||
raise ValueError(f"Received custom data shorter than expected {inc_len}")
|
||||
(
|
||||
enabled,
|
||||
max_count,
|
||||
img00_count,
|
||||
img01_count,
|
||||
img10_count,
|
||||
img11_count,
|
||||
img00_lock,
|
||||
img01_lock,
|
||||
img10_lock,
|
||||
img11_lock,
|
||||
last_chip,
|
||||
last_copy,
|
||||
next_chip,
|
||||
next_copy,
|
||||
) = struct.unpack(fmt_str, custom_data[:inc_len])
|
||||
pw.dlog(f"Enabled: {enabled}")
|
||||
pw.dlog(f"Max Count: {max_count}")
|
||||
pw.dlog(f"Count 00: {img00_count}")
|
||||
pw.dlog(f"Count 01: {img01_count}")
|
||||
pw.dlog(f"Count 10: {img10_count}")
|
||||
pw.dlog(f"Count 11: {img11_count}")
|
||||
pw.dlog(f"Lock 00: {img00_lock}")
|
||||
pw.dlog(f"Lock 01: {img01_lock}")
|
||||
pw.dlog(f"Lock 10: {img10_lock}")
|
||||
pw.dlog(f"Lock 11: {img11_lock}")
|
||||
pw.dlog(f"Last Chip: {last_chip}")
|
||||
pw.dlog(f"Last Copy: {last_copy}")
|
||||
pw.dlog(f"Next Chip: {next_chip}")
|
||||
pw.dlog(f"Next Copy: {next_copy}")
|
||||
|
||||
|
||||
def handle_list_dir_dump_reply(pw: PrintWrapper, custom_data: bytes):
|
||||
if len(custom_data) < 4:
|
||||
_LOGGER.warning("Data unexpectedly small")
|
||||
return
|
||||
seq_idx = struct.unpack("!I", custom_data[0:4])[0]
|
||||
total_chunks = struct.unpack("!I", custom_data[4:8])[0]
|
||||
compressed = custom_data[8]
|
||||
ls_cmd = custom_data[9:].split(b"\x00")[0].decode()
|
||||
# Include length of NULL termination
|
||||
file_data_offset = 9 + len(ls_cmd) + 1
|
||||
pw.dlog(
|
||||
f"Received directory listing dump for ls command {ls_cmd}. "
|
||||
f"Chunk {seq_idx + 1}/{total_chunks}"
|
||||
)
|
||||
|
||||
def remove_if_exists_and_new(seq_idx_: int, path_: Path):
|
||||
if seq_idx_ == 0 and path_.exists():
|
||||
os.remove(path_)
|
||||
|
||||
if compressed:
|
||||
path = Path("dir_listing.txt.gz")
|
||||
remove_if_exists_and_new(seq_idx, path)
|
||||
pw.dlog(
|
||||
f"Compression option: {compressed}. Dumping file into dir_listing.txt.gz"
|
||||
)
|
||||
with open(path, "ab") as listing_file:
|
||||
listing_file.write(custom_data[file_data_offset:])
|
||||
else:
|
||||
path = Path("dir_listing.txt")
|
||||
remove_if_exists_and_new(seq_idx, path)
|
||||
pw.dlog(f"Compression option: {compressed}. Dumping file into dir_listing.txt")
|
||||
with open(path, "a") as listing_file:
|
||||
listing_file_str = custom_data[file_data_offset:].decode()
|
||||
listing_file.write(listing_file_str)
|
||||
if seq_idx + 1 == total_chunks:
|
||||
pw.dlog("Full directory listing: ")
|
||||
with open("dir_listing.txt", "r") as listing_file:
|
||||
print(listing_file.read())
|
||||
|
68
eive_tmtc/tmtc/health.py
Normal file
68
eive_tmtc/tmtc/health.py
Normal file
@ -0,0 +1,68 @@
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s201_fsfw_health import FsfwHealth, Subservice
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.tmtc.obj_prompt import prompt_object
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
def build_health_cmds(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == 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 cmd_str == 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 cmd_str == 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 command string {cmd_str} for service {CustomServiceList.HEALTH}"
|
||||
)
|
||||
|
||||
|
||||
def create_global_health_node() -> CmdTreeNode:
|
||||
health_node = CmdTreeNode("health", "Health Commands")
|
||||
health_node.add_child(
|
||||
CmdTreeNode(OpCode.ANNOUNCE_HEALTH_ALL, Info.ANNOUNCE_HEALTH_ALL)
|
||||
)
|
||||
health_node.add_child(CmdTreeNode(OpCode.ANNOUNCE_HEALTH, Info.ANNOUNCE_HEALTH))
|
||||
health_node.add_child(CmdTreeNode(OpCode.SET_HEALTH, Info.SET_HEALTH))
|
||||
return health_node
|
24
eive_tmtc/tmtc/internal_err_reporter.py
Normal file
24
eive_tmtc/tmtc/internal_err_reporter.py
Normal file
@ -0,0 +1,24 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
ERROR_ID = 0
|
||||
|
||||
|
||||
def handle_ier_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int):
|
||||
pw.dlog(f"Received internal error reporter HK data with set ID {set_id}")
|
||||
if set_id == SetId.ERROR_ID:
|
||||
fmt_str = "!III"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(tm_errors, queue_errors, store_hits) = struct.unpack(
|
||||
fmt_str, hk_data[:inc_len]
|
||||
)
|
||||
pw.dlog(f"TM Errors: {tm_errors}")
|
||||
pw.dlog(f"Queue Errors: {queue_errors}")
|
||||
pw.dlog(f"Store Errors: {store_hits}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 3))
|
0
eive_tmtc/tmtc/misc/__init__.py
Normal file
0
eive_tmtc/tmtc/misc/__init__.py
Normal file
@ -6,8 +6,8 @@
|
||||
@date 02.05.2020
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from eive_tmtc.config.object_ids import TEST_DEVICE_ID
|
||||
|
||||
TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
|
96
eive_tmtc/tmtc/obj_prompt.py
Normal file
96
eive_tmtc/tmtc/obj_prompt.py
Normal file
@ -0,0 +1,96 @@
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACS_SUBSYSTEM_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
GPS_0_HEALTH_DEV,
|
||||
GYRO_0_ADIS_HANDLER_ID,
|
||||
GYRO_1_L3G_HANDLER_ID,
|
||||
GYRO_2_ADIS_HANDLER_ID,
|
||||
ACS_BOARD_ASS_ID,
|
||||
PLOC_MPSOC_ID,
|
||||
PLOC_SUPV_ID,
|
||||
RW_ASSEMBLY,
|
||||
SUS_BOARD_ASS_ID,
|
||||
MGM_0_LIS3_HANDLER_ID,
|
||||
MGM_1_RM3100_HANDLER_ID,
|
||||
SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||
SUS_6_R_LOC_XFYBZM_PT_XF,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RTD_0_PLOC_HSPD,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_PLPCDU_1_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
STR_ASSEMBLY,
|
||||
STAR_TRACKER_ID,
|
||||
)
|
||||
|
||||
SUBSYSTEM_DICT = {
|
||||
0: "acs",
|
||||
1: "tcs",
|
||||
2: "com",
|
||||
3: "payload",
|
||||
}
|
||||
|
||||
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: ("STR Assembly", STR_ASSEMBLY),
|
||||
5: ("iMTQ MGT", IMTQ_HANDLER_ID),
|
||||
6: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID),
|
||||
7: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID),
|
||||
8: ("GYR 2 ADIS", GYRO_2_ADIS_HANDLER_ID),
|
||||
9: ("MGM 0 LIS3", MGM_0_LIS3_HANDLER_ID),
|
||||
10: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID),
|
||||
11: ("GPS 0 Health Device", GPS_0_HEALTH_DEV),
|
||||
12: ("SUS 0", SUS_0_N_LOC_XFYFZM_PT_XF),
|
||||
13: ("SUS 6", SUS_6_R_LOC_XFYBZM_PT_XF),
|
||||
14: ("RW 1", RW1_ID),
|
||||
15: ("RW 2", RW2_ID),
|
||||
16: ("STR", STAR_TRACKER_ID),
|
||||
}
|
||||
|
||||
TCS_OBJ_DICT = {
|
||||
0: ("RTD 0", RTD_0_PLOC_HSPD),
|
||||
1: ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
|
||||
2: ("TMP1075 PL PCDU 1", TMP1075_HANDLER_PLPCDU_1_ID),
|
||||
3: ("TMP1075 TCS 0", TMP1075_HANDLER_TCS_BRD_0_ID),
|
||||
4: ("TMP1075 TCS 1", TMP1075_HANDLER_TCS_BRD_1_ID),
|
||||
5: ("TMP1075 IF BOARD", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
|
||||
PAYLOAD_OBJ_DICT = {
|
||||
0: ("Payload MPSoC", PLOC_MPSOC_ID),
|
||||
1: ("Payload Supervisor", PLOC_SUPV_ID),
|
||||
}
|
||||
|
||||
|
||||
def get_obj_if_from_dict(lut: dict) -> bytes:
|
||||
for k, v in lut.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
obj_key = int(input("Please specify target object by key: "))
|
||||
name_and_obj_id = lut[obj_key]
|
||||
if name_and_obj_id is None:
|
||||
raise ValueError("invalid key")
|
||||
return name_and_obj_id[1]
|
||||
|
||||
|
||||
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":
|
||||
return get_obj_if_from_dict(ACS_OBJ_DICT)
|
||||
elif subsystem == "tcs":
|
||||
return get_obj_if_from_dict(TCS_OBJ_DICT)
|
||||
elif subsystem == "payload":
|
||||
return get_obj_if_from_dict(PAYLOAD_OBJ_DICT)
|
||||
else:
|
||||
print(f"No object for subsystem {subsystem}")
|
||||
return bytes()
|
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file ploc_memory_dumper.py
|
||||
@brief This file implements the command to dump memory sectors of the PLOC. Memories of the PLOC which can be dumped
|
||||
are one MRAM, two flash memories and the SRAM.
|
||||
@brief This file implements the command to dump memory sectors of the PLOC. Memories of the PLOC
|
||||
which can be dumped are one MRAM, two flash memories and the SRAM.
|
||||
@author J. Meier
|
||||
@date 31.08.2021
|
||||
"""
|
||||
@ -12,7 +12,7 @@ from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
|
@ -6,54 +6,72 @@
|
||||
@author J. Meier
|
||||
@date 06.03.2021
|
||||
"""
|
||||
import dataclasses
|
||||
import logging
|
||||
import struct
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
tmtc_definitions_provider,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd, create_scalar_u8_parameter
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MANUAL_INPUT = "1"
|
||||
|
||||
flash_write_file_dict = {
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"],
|
||||
OBC_WRITE_FILE_DICT = {
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
|
||||
}
|
||||
|
||||
mpsoc_file_dict = {
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"2": ["0:/flash", "0:/flash"],
|
||||
OBC_READ_FILE_DICT = {
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("/mnt/sd0/ploc/mpsoc/flash_read.bin", "/mnt/sd0/ploc/mpsoc/flash_read.bin"),
|
||||
}
|
||||
|
||||
MPSOC_WRITE_FILE_DICT = {
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("0:/", "0:/"),
|
||||
}
|
||||
|
||||
MPSOC_READ_FILE_DICT = {
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("0:/PICA", "0:/PICA"),
|
||||
}
|
||||
|
||||
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
|
||||
SEQ_FILE_DICT = {
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"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]}"],
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"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 CommandId(enum.IntEnum):
|
||||
class SetId(enum.IntEnum):
|
||||
HK_ID = 0
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
TC_MEM_WRITE = 1
|
||||
TC_MEM_READ = 2
|
||||
FLASH_WRITE = 9
|
||||
TM_MEM_READ_RPT = 6
|
||||
TC_FLASH_WRITE_FULL_FILE = 9
|
||||
TC_FLASH_DELETE = 10
|
||||
TC_REPLAY_START = 11
|
||||
TC_REPLAY_STOP = 12
|
||||
@ -64,20 +82,46 @@ class CommandId(enum.IntEnum):
|
||||
TC_MODE_REPLAY = 16
|
||||
TC_CAM_CMD_SEND = 17
|
||||
TC_MODE_IDLE = 18
|
||||
TM_CAM_CMD_RPT = 19
|
||||
SET_UART_TX_TRISTATE = 20
|
||||
RELEASE_UART_TX = 21
|
||||
TC_CAM_TAKE_PIC = 22
|
||||
TC_SIMPLEX_SEND_FILE = 23
|
||||
TC_DOWNLINK_DATA_MODULATE = 24
|
||||
TC_MODE_SNAPSHOT = 25
|
||||
TC_FLASH_DIR_GET_CONTENT = 28
|
||||
TM_FLASH_DIRECTORY_CONTENT = 29
|
||||
TC_FLASH_READ_FULL_FILE = 30
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
PLOC_SUPV_SKIP_CMD_TO_ON = 1
|
||||
|
||||
|
||||
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"]
|
||||
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"
|
||||
MEM_WRITE = "memory_write"
|
||||
MEM_READ = "memory_read"
|
||||
DOWNLINK_PWR_OFF = "downlink_pwr_off"
|
||||
FLASH_WRITE_FILE = "flash_write_file"
|
||||
FLASH_READ_FILE = "flash_read_file"
|
||||
FLASH_DELETE_FILE = "flash_delete_file"
|
||||
FLASH_GET_DIR_CONTENT = "flash_get_dir_content"
|
||||
REPLAY_STOP = "replay_stop"
|
||||
REPLAY_START = "replay_start"
|
||||
CAM_TAKE_PIC = "cam_take_pic"
|
||||
SIMPLEX_SEND_FILE = "simplex_send_file"
|
||||
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
|
||||
MODE_SNAPSHOT = "mode_snapshot"
|
||||
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
|
||||
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -86,69 +130,106 @@ class Info:
|
||||
NORMAL = "Normal"
|
||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||
MODE_REPLAY = "Switch to REPLAY mode"
|
||||
REPLAY_STOP = "Stop Replay"
|
||||
MODE_IDLE = "Switch to IDLE mode"
|
||||
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||
DOWNLINK_PWR_OFF = "Downlink Power Off"
|
||||
MEM_WRITE = "Write to Memory"
|
||||
MEM_READ = "Read from Memory"
|
||||
REPLAY_START = "Replay Start"
|
||||
CAM_TAKE_PIC = "Cam Take Picture"
|
||||
SIMPLEX_SEND_FILE = "Simplex Send File"
|
||||
FLASH_READ_FILE = "Copy file from MPSoC to OBC"
|
||||
FLASH_WRITE_FILE = "Copy file from OBC to MPSoC"
|
||||
FLASH_DELETE_FILE = "Delete file on MPSoC"
|
||||
FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC"
|
||||
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
|
||||
MODE_SNAPSHOT = "Mode Snapshot"
|
||||
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "Enable PLOC SUPV commanding when switching ON"
|
||||
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
|
||||
"Disable PLOC SUPV commanding when switching ON"
|
||||
)
|
||||
|
||||
|
||||
class MemAddresses(enum.IntEnum):
|
||||
DEADBEEF = 0x40000004
|
||||
|
||||
|
||||
class PlocReplyIds(enum.IntEnum):
|
||||
TM_MEM_READ_RPT = 6
|
||||
TM_CAM_CMD_RPT = 19
|
||||
def create_ploc_mpsoc_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("ploc_mpsoc", "PLOC MPSoC", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
# Legacy command definitions.
|
||||
@tmtc_definitions_provider
|
||||
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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(OpCode.MEM_WRITE, "Ploc MPSoC: Memory write")
|
||||
oce.add(OpCode.MEM_READ, "Ploc MPSoC: Memory read")
|
||||
oce.add(OpCode.FLASH_WRITE_FILE, Info.FLASH_WRITE_FILE)
|
||||
oce.add(OpCode.FLASH_READ_FILE, Info.FLASH_READ_FILE)
|
||||
oce.add(OpCode.FLASH_DELETE_FILE, Info.FLASH_DELETE_FILE)
|
||||
oce.add(OpCode.FLASH_GET_DIR_CONTENT, Info.FLASH_GET_DIR_CONTENT)
|
||||
oce.add(OpCode.REPLAY_START, Info.REPLAY_START)
|
||||
oce.add("8", "Ploc MPSoC: Replay stop")
|
||||
oce.add(OpCode.REPLAY_STOP, Info.REPLAY_STOP)
|
||||
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
|
||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
||||
oce.add(OpCode.DOWNLINK_PWR_OFF, Info.DOWNLINK_PWR_OFF)
|
||||
oce.add(OpCode.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
|
||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||
oce.add(OpCode.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add(OpCode.VERIFY_BOOT, Info.VERIFY_BOOT)
|
||||
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")
|
||||
oce.add(OpCode.CAM_TAKE_PIC, Info.CAM_TAKE_PIC)
|
||||
oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
|
||||
oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
|
||||
oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
|
||||
oce.add(
|
||||
OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON, Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON
|
||||
)
|
||||
oce.add(
|
||||
OpCode.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
|
||||
Info.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
|
||||
)
|
||||
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.PLOC_MPSOC)
|
||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
def pack_ploc_mpsoc_commands(
|
||||
q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa C901: Complexity okay here.
|
||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||
q = p.queue_helper
|
||||
assert object_id is not None
|
||||
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 in OpCode.OFF:
|
||||
if cmd_str == 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 in OpCode.ON:
|
||||
if cmd_str == 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 in OpCode.NORMAL:
|
||||
if cmd_str == 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":
|
||||
if cmd_str == OpCode.MEM_WRITE:
|
||||
q.add_log_cmd("PLOC MPSoC: TC mem write test")
|
||||
memory_address = int(
|
||||
input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16
|
||||
@ -160,77 +241,123 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
object_id.as_bytes, memory_address, memory_data, mem_len
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "4":
|
||||
q.add_log_cmd("PLOC MPSoC: TC mem read test")
|
||||
data = prepare_mem_read_command(object_id=object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "5":
|
||||
q.add_log_cmd("PLOC MPSoC: Flash write")
|
||||
if cmd_str == OpCode.FLASH_WRITE_FILE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FLASH_WRITE_FILE}")
|
||||
data = prepare_flash_write_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "6":
|
||||
if cmd_str == OpCode.FLASH_READ_FILE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FLASH_READ_FILE}")
|
||||
data = prepare_flash_read_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.FLASH_DELETE_FILE:
|
||||
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 in OpCode.REPLAY_START:
|
||||
if cmd_str 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":
|
||||
if cmd_str == OpCode.REPLAY_STOP:
|
||||
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_REPLAY_STOP)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_REPLAY_STOP)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code in OpCode.DOWNLINK_PWR_ON:
|
||||
if cmd_str == 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":
|
||||
if cmd_str == OpCode.DOWNLINK_PWR_OFF:
|
||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_DOWNLINK_PWR_OFF)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_DOWNLINK_PWR_OFF)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code in OpCode.REPLAY_WRITE_SEQ:
|
||||
if cmd_str == OpCode.FLASH_GET_DIR_CONTENT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FLASH_GET_DIR_CONTENT}")
|
||||
dir_name = input("Please specify MPSoC directory name to get information for: ")
|
||||
dir_name = bytearray(dir_name.encode("utf-8"))
|
||||
dir_name.append(0)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=ActionId.TC_FLASH_DIR_GET_CONTENT,
|
||||
user_data=dir_name,
|
||||
)
|
||||
)
|
||||
if cmd_str == 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":
|
||||
if cmd_str == "12":
|
||||
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.OBSW_RESET_SEQ_COUNT)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.OBSW_RESET_SEQ_COUNT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code in OpCode.VERIFY_BOOT:
|
||||
if cmd_str == OpCode.VERIFY_BOOT:
|
||||
num_words = 1
|
||||
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
||||
data = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", CommandId.TC_MEM_READ)
|
||||
+ struct.pack("!I", ActionId.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 in OpCode.MODE_REPLAY:
|
||||
if cmd_str == OpCode.MODE_REPLAY:
|
||||
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_REPLAY)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_REPLAY)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code in OpCode.MODE_IDLE:
|
||||
if cmd_str == OpCode.MODE_IDLE:
|
||||
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_IDLE)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_IDLE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "16":
|
||||
if cmd_str == "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", CommandId.TC_CAM_CMD_SEND)
|
||||
+ struct.pack("!I", ActionId.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":
|
||||
if cmd_str == "17":
|
||||
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.SET_UART_TX_TRISTATE)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "18":
|
||||
if cmd_str == "18":
|
||||
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.RELEASE_UART_TX)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.CAM_TAKE_PIC:
|
||||
q.add_log_cmd("PLOC MPSoC: Cam take picture")
|
||||
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.SIMPLEX_SEND_FILE:
|
||||
q.add_log_cmd("PLOC MPSoC: Simplex send file")
|
||||
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.DOWNLINK_DATA_MODULATE:
|
||||
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
||||
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.MODE_SNAPSHOT:
|
||||
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
|
||||
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON:
|
||||
q.add_log_cmd(Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
object_id.as_bytes, 0, ParamId.PLOC_SUPV_SKIP_CMD_TO_ON, 0
|
||||
)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.DISABLE_PLOC_SUPV_COMMANDING_TO_ON:
|
||||
q.add_log_cmd(Info.DISABLE_PLOC_SUPV_COMMANDING_TO_ON)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
object_id.as_bytes, 0, ParamId.PLOC_SUPV_SKIP_CMD_TO_ON, 1
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def generate_write_mem_command(
|
||||
@ -246,7 +373,7 @@ def generate_write_mem_command(
|
||||
"""
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_MEM_WRITE)
|
||||
+ struct.pack("!I", ActionId.TC_MEM_WRITE)
|
||||
+ struct.pack("!I", memory_address)
|
||||
+ struct.pack("!H", mem_len)
|
||||
+ struct.pack("!I", memory_data)
|
||||
@ -259,31 +386,48 @@ 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", CommandId.TC_MEM_READ)
|
||||
+ struct.pack("!I", ActionId.TC_MEM_READ)
|
||||
+ struct.pack("!I", memory_address)
|
||||
+ struct.pack("!H", num_words)
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_flash_base_cmd(
|
||||
obc_filename: str, mpsoc_filename: str, action_id: int, object_id: bytes
|
||||
) -> bytearray:
|
||||
command = bytearray(object_id)
|
||||
command.extend(struct.pack("!I", action_id))
|
||||
command.extend(obc_filename.encode("utf-8"))
|
||||
command.append(0)
|
||||
command.extend(mpsoc_filename.encode("utf-8"))
|
||||
command.append(0)
|
||||
return command
|
||||
|
||||
|
||||
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
||||
obcFile = get_obc_file()
|
||||
mpsocFile = get_mpsoc_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
||||
+ bytearray(obcFile, "utf-8")
|
||||
+ bytearray(mpsocFile, "utf-8")
|
||||
obc_file = get_obc_file(OBC_WRITE_FILE_DICT)
|
||||
mpsoc_file = get_mpsoc_file(MPSOC_WRITE_FILE_DICT)
|
||||
return prepare_flash_base_cmd(
|
||||
obc_file, mpsoc_file, ActionId.TC_FLASH_WRITE_FULL_FILE, object_id
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_flash_read_cmd(object_id: bytes) -> bytearray:
|
||||
mpsoc_file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
|
||||
obc_file = get_obc_file(OBC_READ_FILE_DICT)
|
||||
cmd = prepare_flash_base_cmd(
|
||||
obc_file, mpsoc_file, ActionId.TC_FLASH_READ_FULL_FILE, object_id
|
||||
)
|
||||
file_size = get_mpsoc_file_size()
|
||||
cmd.extend(struct.pack("!I", file_size))
|
||||
return cmd
|
||||
|
||||
|
||||
def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
|
||||
file = get_mpsoc_file()
|
||||
file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_FLASH_DELETE)
|
||||
+ bytearray(file, "utf-8")
|
||||
object_id + struct.pack("!I", ActionId.TC_FLASH_DELETE) + file.encode("utf-8")
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
@ -292,7 +436,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", CommandId.TC_REPLAY_START)
|
||||
+ struct.pack("!I", ActionId.TC_REPLAY_START)
|
||||
+ struct.pack("!B", replay)
|
||||
)
|
||||
return bytearray(command)
|
||||
@ -303,7 +447,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", CommandId.TC_DOWNLINK_PWR_ON)
|
||||
+ struct.pack("!I", ActionId.TC_DOWNLINK_PWR_ON)
|
||||
+ struct.pack("!B", mode)
|
||||
+ struct.pack("!B", lane_rate)
|
||||
)
|
||||
@ -315,7 +459,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
file = get_sequence_file()
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", CommandId.TC_REPLAY_WRITE_SEQUENCE)
|
||||
+ struct.pack("!I", ActionId.TC_REPLAY_WRITE_SEQUENCE)
|
||||
+ struct.pack("!B", use_decoding)
|
||||
+ bytearray(file, "utf-8")
|
||||
# + bytes([0])
|
||||
@ -323,28 +467,98 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def get_obc_file() -> str:
|
||||
_LOGGER.info("Specify OBC file ")
|
||||
input_helper = InputHelper(flash_write_file_dict)
|
||||
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
||||
selection = input("Use default parameter? (Y/N): ")
|
||||
if selection.lower() in ["y", "1", "yes"]:
|
||||
filename = "0:/test"
|
||||
encoder_setting_y = 7
|
||||
quantization_y = 0
|
||||
encoder_setting_cb = 7
|
||||
quantization_cb = 0
|
||||
encoder_setting_cr = 7
|
||||
quantization_cr = 0
|
||||
bypass_compressor = 0
|
||||
else:
|
||||
filename = input("Specify filename: ")
|
||||
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
|
||||
quantization_y = int(input("Specify quantization_Y: "))
|
||||
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
|
||||
quantization_cb = int(input("Specify quantization_Cb: "))
|
||||
encoder_setting_cr = int(input("Specify encoderSetting_Cr: "))
|
||||
quantization_cr = int(input("Specify quantization_Cr: "))
|
||||
bypass_compressor = int(input("Specify bypassCompressor: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
|
||||
+ bytearray(filename, "utf-8")
|
||||
+ bytes([0])
|
||||
+ struct.pack("!B", encoder_setting_y)
|
||||
+ struct.pack("!Q", quantization_y)
|
||||
+ struct.pack("!B", encoder_setting_cb)
|
||||
+ struct.pack("!Q", quantization_cb)
|
||||
+ struct.pack("!B", encoder_setting_cr)
|
||||
+ struct.pack("!Q", quantization_cr)
|
||||
+ struct.pack("!B", bypass_compressor)
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
|
||||
filename = input("Specify filename: ")
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE)
|
||||
+ bytearray(filename, "utf-8")
|
||||
+ bytes([0])
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
|
||||
format = int(input("Specify format: "))
|
||||
src_mem_addr = int(input("Specify srcMemAddr: "))
|
||||
src_mem_len = int(input("Specify srcMemLen: "))
|
||||
dest_mem_addr = int(input("Specify destMemAddr: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", ActionId.TC_DOWNLINK_DATA_MODULATE)
|
||||
+ struct.pack("!B", format)
|
||||
+ struct.pack("!I", src_mem_addr)
|
||||
+ struct.pack("!H", src_mem_len)
|
||||
+ struct.pack("!I", dest_mem_addr)
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def get_obc_file(input_dict: dict) -> str:
|
||||
_LOGGER.info("Specify OBC filename")
|
||||
input_helper = InputHelper(input_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
file = input("Ploc MPSoC: Specify absolute name of flash file: ")
|
||||
else:
|
||||
file = flash_write_file_dict[key][1]
|
||||
file = input_dict[key][1]
|
||||
return file
|
||||
|
||||
|
||||
def get_mpsoc_file() -> str:
|
||||
_LOGGER.info("Specify MPSoC file")
|
||||
input_helper = InputHelper(mpsoc_file_dict)
|
||||
def get_mpsoc_file(input_dict: dict) -> str:
|
||||
_LOGGER.info("Specify MPSoC filename")
|
||||
input_helper = InputHelper(input_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
file = input("Ploc MPSoC: Specify absolute name file: ")
|
||||
else:
|
||||
file = mpsoc_file_dict[key][1]
|
||||
file = input_dict[key][1]
|
||||
return file
|
||||
|
||||
|
||||
def get_mpsoc_file_size() -> int:
|
||||
file_size = int(input("Specify MPSoC file size: "))
|
||||
if file_size <= 0:
|
||||
raise ValueError("Invalid file size")
|
||||
return file_size
|
||||
|
||||
|
||||
def get_sequence_file() -> str:
|
||||
_LOGGER.info("Specify sequence file")
|
||||
input_helper = InputHelper(SEQ_FILE_DICT)
|
||||
@ -354,3 +568,184 @@ def get_sequence_file() -> str:
|
||||
else:
|
||||
file = SEQ_FILE_DICT[key][1]
|
||||
return file
|
||||
|
||||
|
||||
def handle_ploc_mpsoc_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int):
|
||||
if set_id == SetId.HK_ID:
|
||||
fmt_str = "!IBBBBBBB"
|
||||
current_idx = 0
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
status,
|
||||
mode,
|
||||
downlink_pwr_on,
|
||||
downlink_reply_active,
|
||||
downlink_jesd_sync_status,
|
||||
downlink_dac_status,
|
||||
cam_status,
|
||||
cam_sdi_status,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
pw.ilog(_LOGGER, "Received MPSoC HK")
|
||||
pw.dlog(f"Status: {status}")
|
||||
pw.dlog(f"Mode: {mode}")
|
||||
pw.dlog(f"Downlink Power On: {downlink_pwr_on}")
|
||||
pw.dlog(f"Downlink Reply Active: {downlink_reply_active}")
|
||||
pw.dlog(f"Downlink JESD Sync Status: {downlink_jesd_sync_status}")
|
||||
pw.dlog(f"Downlink DAC Status: {downlink_dac_status}")
|
||||
pw.dlog(f"CAM Status: {cam_status}")
|
||||
pw.dlog(f"CAM SDI Status: {cam_sdi_status}")
|
||||
|
||||
fmt_str = "!fffffffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
cam_fpga_temp,
|
||||
cam_soc_temp,
|
||||
sysmon_temp,
|
||||
sysmon_vcc_int,
|
||||
sysmon_vcc_aux,
|
||||
sysmon_vcc_bram,
|
||||
sysmon_vcc_paux,
|
||||
sysmon_vcc_pint,
|
||||
sysmon_vcc_pdro,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
|
||||
pw.dlog(f"CAM FPGA Temperature: {cam_fpga_temp}")
|
||||
pw.dlog(f"CAM SoC Temperature: {cam_soc_temp}")
|
||||
pw.dlog(f"System Monitor Temperature: {sysmon_temp}")
|
||||
pw.dlog(
|
||||
f"SYSMON VCC INT {sysmon_vcc_int:.3f} | SYSMON VCC AUX"
|
||||
f" {sysmon_vcc_aux:.3f} | SYSMON VCC BRAM {sysmon_vcc_bram:.3f}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"SYSMON VCC PAUX {sysmon_vcc_paux:.3f} | SYSMON VCC PINT"
|
||||
f" {sysmon_vcc_pint:.3f} | SYSMON VCC PDRO {sysmon_vcc_pdro:.3f}"
|
||||
)
|
||||
|
||||
fmt_str = "!fffffffffffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
sysmon_mb_12v,
|
||||
sysmon_mb_3v3,
|
||||
sysmon_mb_1v8,
|
||||
sysmon_vcc_12v,
|
||||
sysmon_vcc_5v,
|
||||
sysmon_vcc_3v3,
|
||||
sysmon_vcc_3v3va,
|
||||
sysmon_vcc_2v5ddr,
|
||||
sysmon_vcc_1v2ddr,
|
||||
sysmon_vcc_0v9,
|
||||
sysmon_vcc_0v6vtt,
|
||||
sysmon_safe_cotr_cur,
|
||||
sysmon_nvm4_xo_cur,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
|
||||
pw.dlog(
|
||||
f"SYSMON MB 12V {sysmon_mb_12v:.3f} | SYSMON MB 3V3 {sysmon_mb_3v3:.3f} | "
|
||||
f"SYSMON MBA 1V8 {sysmon_mb_1v8:.3f}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"SYSMON VCC 12V {sysmon_vcc_12v:.3f} | SYSMON VCC 5V {sysmon_vcc_5v:.3f} |"
|
||||
f" SYSMON VCC 3V3 {sysmon_vcc_3v3:.3f} | SYSMON VCC 3V3VA"
|
||||
f" {sysmon_vcc_3v3va}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"SYSMON VCC 2V5DDR {sysmon_vcc_2v5ddr:.3f} | "
|
||||
f"SYSMON VCC 1V2DDR {sysmon_vcc_1v2ddr:.3f} | "
|
||||
f"SYSMON VCC 0V9 {sysmon_vcc_0v9:.3f} | "
|
||||
f"SYSMON VCC 0V6VTT {sysmon_vcc_0v6vtt}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"SYSMON SAFE COTS CURR: {sysmon_safe_cotr_cur} | "
|
||||
f"SYSMON NVM4XO CURR {sysmon_nvm4_xo_cur}"
|
||||
)
|
||||
fmt_str = "!HHBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
sem_uncorrectable_errs,
|
||||
sem_correctable_errs,
|
||||
sem_status,
|
||||
reboot_mpsoc_required,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
|
||||
pw.dlog(f"SEM IP Uncorrectable Errors: {sem_uncorrectable_errs}")
|
||||
pw.dlog(f"SEM IP Correctable Errors: {sem_correctable_errs}")
|
||||
pw.dlog(f"SEM IP Status: {sem_status}")
|
||||
pw.dlog(f"Reboot MPSoC required: {reboot_mpsoc_required}")
|
||||
else:
|
||||
_LOGGER.warning(f"Unknown set ID {set_id} for MPSoC HK")
|
||||
pass
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class DirElement:
|
||||
name: str
|
||||
attr: int
|
||||
size: int
|
||||
|
||||
|
||||
def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||
if action_id == ActionId.TM_MEM_READ_RPT:
|
||||
header_list = [
|
||||
"PLOC Memory Address",
|
||||
"PLOC Mem Len",
|
||||
"PLOC Read Memory Data",
|
||||
]
|
||||
content_list = [
|
||||
"0x" + custom_data[:4].hex(),
|
||||
struct.unpack("!H", custom_data[4:6])[0],
|
||||
"0x" + custom_data[6:10].hex(),
|
||||
]
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
elif action_id == ActionId.TM_CAM_CMD_RPT:
|
||||
header_list = ["Camera reply string", "ACK"]
|
||||
content_list = [
|
||||
custom_data[: len(custom_data) - 1].decode("utf-8"),
|
||||
hex(custom_data[-1]),
|
||||
]
|
||||
pw.dlog(f"{header_list}")
|
||||
pw.dlog(f"{content_list}")
|
||||
elif action_id == ActionId.TM_FLASH_DIRECTORY_CONTENT:
|
||||
if len(custom_data) < 16:
|
||||
_LOGGER.warning(
|
||||
"PLOC MPSoC flash directory data shorter than minimum 16 bytes"
|
||||
)
|
||||
current_idx = 0
|
||||
dir_name_short = custom_data[current_idx : current_idx + 12].decode("utf-8")
|
||||
current_idx += 12
|
||||
num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[
|
||||
0
|
||||
]
|
||||
elem_names = []
|
||||
elem_attrs = []
|
||||
elem_sizes = []
|
||||
expected_size = 16 + num_elements * 17
|
||||
if len(custom_data) < expected_size:
|
||||
_LOGGER.warning(
|
||||
f"PLOC MPSoC flash directory data shorter than expected {expected_size}"
|
||||
)
|
||||
pw.dlog(
|
||||
f"Received PLOC MPSoC flash directory content for path {dir_name_short} "
|
||||
f"with {num_elements} elements"
|
||||
)
|
||||
# It is as weird as it looks..
|
||||
for _ in range(num_elements):
|
||||
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
|
||||
elem_name = custom_data[current_idx : current_idx + end_of_str].decode(
|
||||
"utf-8"
|
||||
)
|
||||
current_idx += 12
|
||||
elem_names.append(elem_name)
|
||||
for _ in range(num_elements):
|
||||
elem_attrs.append(custom_data[current_idx])
|
||||
current_idx += 1
|
||||
for _ in range(num_elements):
|
||||
elem_sizes.append(
|
||||
struct.unpack("!I", custom_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
for i in range(num_elements):
|
||||
pw.dlog(f"{DirElement(elem_names[i], elem_attrs[i], elem_sizes[i])}")
|
||||
|
@ -6,27 +6,25 @@
|
||||
@author J. Meier
|
||||
@date 10.07.2021
|
||||
"""
|
||||
from datetime import datetime
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.object_ids import PLOC_SUPV_ID, get_object_ids
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
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.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.config.tmtc import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
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 tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
latchup_id_dict = {
|
||||
LATCHUP_ID_DICT = {
|
||||
"0": "0.85V",
|
||||
"1": "1.8V",
|
||||
"2": "MISC",
|
||||
@ -40,27 +38,15 @@ HARDCODED = "0"
|
||||
MANUAL_INPUT = "1"
|
||||
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
|
||||
|
||||
update_file_dict = {
|
||||
HARDCODED: ["hardcoded", ""],
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"],
|
||||
"3": [
|
||||
"/mnt/sd0/ploc/supervisor/update-large.bin",
|
||||
"/mnt/sd0/ploc/supervisor/update-large.bin",
|
||||
],
|
||||
"4": [
|
||||
"/mnt/sd0/ploc/supervisor/update-small.bin",
|
||||
"/mnt/sd0/ploc/supervisor/update-small.bin",
|
||||
],
|
||||
"5": [
|
||||
"/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
|
||||
"/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
|
||||
],
|
||||
UPDATE_FILE_DICT = {
|
||||
HARDCODED: ("hardcoded", ""),
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("/mnt/sd0/ploc/mpsoc/image.bin", "/mnt/sd0/ploc/mpsoc/image.bin"),
|
||||
}
|
||||
|
||||
event_buffer_path_dict = {
|
||||
MANUAL_INPUT: ["manual input", ""],
|
||||
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"],
|
||||
EVENT_BUFFER_PATH_DICT = {
|
||||
MANUAL_INPUT: ("manual input", ""),
|
||||
"2": ("/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"),
|
||||
}
|
||||
|
||||
|
||||
@ -83,8 +69,8 @@ FACTORY_RESET_OPS = {
|
||||
}
|
||||
|
||||
|
||||
class SupvActionId:
|
||||
HK_REPORT = 1
|
||||
class SupvActionId(enum.IntEnum):
|
||||
REQUEST_HK_REPORT = 1
|
||||
START_MPSOC = 3
|
||||
SHUTWOWN_MPSOC = 4
|
||||
SEL_MPSOC_BOOT_IMAGE = 5
|
||||
@ -111,7 +97,7 @@ class SupvActionId:
|
||||
SET_GPIO = 34
|
||||
READ_GPIO = 35
|
||||
RESTART_SUPERVISOR = 36
|
||||
LOGGING_REQUEST_COUNTERS = 38
|
||||
REQUEST_LOGGING_COUNTERS = 38
|
||||
FACTORY_RESET = 39
|
||||
START_MPSOC_QUIET = 45
|
||||
SET_SHUTDOWN_TIMEOUT = 46
|
||||
@ -130,136 +116,141 @@ class SupvActionId:
|
||||
MEM_CHECK = 61
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId(enum.IntEnum):
|
||||
HK_REPORT = 102
|
||||
BOOT_STATUS_REPORT = 103
|
||||
LATCHUP_REPORT = 104
|
||||
COUNTERS_REPORT = 105
|
||||
ADC_REPORT = 106
|
||||
UPDATE_STATUS_REPORT = 107
|
||||
|
||||
|
||||
class OpCodes:
|
||||
OFF = ["0", "off"]
|
||||
ON = ["1", "on"]
|
||||
NORMAL = ["2", "nml"]
|
||||
HK_TO_OBC = ["3", "hk_to_obc"]
|
||||
REQUEST_HK = ["4", "req_hk"]
|
||||
START_MPSOC = ["5", "start_mpsoc"]
|
||||
SHUTDOWN_MPSOC = ["6", "stop_mpsoc"]
|
||||
SEL_NVM = ["7", "sel_nvm"]
|
||||
SET_TIME_REF = ["set_time_ref"]
|
||||
FACTORY_FLASH = ["factory_flash"]
|
||||
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
|
||||
START_UPDATE = ["42", "start_update"]
|
||||
PERFORM_UPDATE = ["update"]
|
||||
FACTORY_RESET = ["factory_reset"]
|
||||
MEM_CHECK = ["mem_check"]
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NORMAL = "nml"
|
||||
HK_TO_OBC = "hk_to_obc"
|
||||
REQUEST_GENERIC_HK_SET = "req_generic_hk"
|
||||
START_MPSOC = "start_mpsoc"
|
||||
SHUTDOWN_MPSOC = "stop_mpsoc"
|
||||
SEL_NVM = "sel_nvm"
|
||||
SET_TIME_REF = "set_time_ref"
|
||||
FACTORY_FLASH = "factory_flash"
|
||||
START_UPDATE = "start_update"
|
||||
PERFORM_UPDATE = "update"
|
||||
FACTORY_RESET = "factory_reset"
|
||||
MEM_CHECK = "mem_check"
|
||||
RESET_MPSOC = "reset_mpsoc"
|
||||
SET_GPIO = "set_gpio"
|
||||
READ_GPIO = "read_gpio"
|
||||
READ_STATUS_REPORT = "read_status_report"
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
value: str
|
||||
OFF = "Switch Off"
|
||||
ON = "Switch On"
|
||||
NML = "Switch Normal"
|
||||
NORMAL = "Switch Normal"
|
||||
HK_TO_OBC = "Request HK from PLOC SUPV"
|
||||
REQUEST_HK = "Request HK set from PLOC Handler"
|
||||
REQUEST_GENERIC_HK_SET = "Request prompted HK set from PLOC Handler"
|
||||
START_MPSOC = "Start MPSoC"
|
||||
SHUTDOWN_MPSOC = "Shutdown MPSoC"
|
||||
SET_TIME_REF = "Set time reference"
|
||||
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"
|
||||
RESET_MPSOC = "Reset MPSoC"
|
||||
SET_GPIO = "Set GPIO"
|
||||
READ_GPIO = "Read GPIO"
|
||||
READ_STATUS_REPORT = "Read HK status report"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.ON, Info.ON)
|
||||
oce.add(OpCodes.NORMAL, Info.NML)
|
||||
oce.add(OpCodes.HK_TO_OBC, Info.HK_TO_OBC)
|
||||
oce.add(OpCodes.REQUEST_HK, Info.REQUEST_HK)
|
||||
oce.add(OpCodes.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
||||
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")
|
||||
oce.add("12", "PLOC Supervisor: Disable Hk")
|
||||
oce.add(OpCodes.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT)
|
||||
oce.add("17", "PLOC Supervisor: Enable latchup alert")
|
||||
oce.add("18", "PLOC Supervisor: Disable latchup alert")
|
||||
oce.add("20", "PLOC Supervisor: Set alert limit")
|
||||
oce.add("23", "PLOC Supervisor: Set ADC enabled channels")
|
||||
oce.add("24", "PLOC Supervisor: Set ADC window and stride")
|
||||
oce.add("25", "PLOC Supervisor: Set ADC threshold")
|
||||
oce.add("26", "PLOC Supervisor: Request latchup status report")
|
||||
oce.add("27", "PLOC Supervisor: Copy ADC data to MRAM")
|
||||
oce.add("30", "PLOC Supervisor: Run auto EM tests")
|
||||
oce.add("31", "PLOC Supervisor: MRAM Wipe")
|
||||
oce.add("35", "PLOC Supervisor: Set GPIO")
|
||||
oce.add("36", "PLOC Supervisor: Read GPIO")
|
||||
oce.add("37", "PLOC Supervisor: Restart supervisor")
|
||||
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
|
||||
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
|
||||
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
|
||||
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
|
||||
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
|
||||
oce.add(OpCodes.FACTORY_FLASH, Info.FACTORY_FLASH)
|
||||
oce.add("47", "PLOC Supervisor: Enable auto TM")
|
||||
oce.add("48", "PLOC Supervisor: Disable auto TM")
|
||||
oce.add("51", "PLOC Supervisor: Logging request event buffers")
|
||||
oce.add("52", "PLOC Supervisor: Logging clear counters")
|
||||
oce.add("53", "PLOC Supervisor: Logging set topic")
|
||||
oce.add("54", "PLOC Supervisor: Logging request counters")
|
||||
oce.add("55", "PLOC Supervisor: Request ADC Report")
|
||||
oce.add("56", "PLOC Supervisor: Reset PL")
|
||||
oce.add("57", "PLOC Supervisor: Enable NVMs")
|
||||
oce.add("58", "PLOC Supervisor: Continue update")
|
||||
oce.add(OpCodes.MEM_CHECK, Info.MEM_CHECK)
|
||||
defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
|
||||
def create_ploc_supv_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("ploc_supv", "PLOC Supervisor", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.PLOC_SUPV)
|
||||
def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
op_code = p.op_code
|
||||
def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
||||
assert object_id is not None
|
||||
q.add_log_cmd(f"Testing PLOC Supervisor with object id: {object_id.as_hex_string}")
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "PLOC Supervisor"
|
||||
if op_code in OpCodes.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
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 cmd_str == OpCode.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
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}")
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
|
||||
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:
|
||||
if cmd_str == OpCode.HK_TO_OBC:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
||||
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT)
|
||||
command = obyt + struct.pack("!I", SupvActionId.REQUEST_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}")
|
||||
sid = make_sid(object_id.as_bytes, SetIds.HK_REPORT)
|
||||
cmd = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(cmd)
|
||||
elif op_code in OpCodes.START_MPSOC:
|
||||
if cmd_str == OpCode.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: 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:
|
||||
if cmd_str == OpCode.SHUTDOWN_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Shutdown 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:
|
||||
if cmd_str == OpCode.READ_STATUS_REPORT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.READ_STATUS_REPORT}")
|
||||
set_id = prompt_set_id()
|
||||
action_cmd = None
|
||||
# First read the set from the device.
|
||||
if set_id == SetId.HK_REPORT:
|
||||
action_cmd = create_action_cmd(PLOC_SUPV_ID, SupvActionId.REQUEST_HK_REPORT)
|
||||
if set_id == SetId.ADC_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.REQUEST_ADC_REPORT
|
||||
)
|
||||
if set_id == SetId.COUNTERS_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.REQUEST_LOGGING_COUNTERS
|
||||
)
|
||||
if set_id == SetId.LATCHUP_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.GET_LATCHUP_STATUS_REPORT
|
||||
)
|
||||
if set_id == SetId.BOOT_STATUS_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.GET_BOOT_STATUS_REPORT
|
||||
)
|
||||
if action_cmd is None:
|
||||
_LOGGER.warning(f"invalid set ID {set_id!r} for PLOC SUPV")
|
||||
return
|
||||
# Now dump the HK set.
|
||||
sid = make_sid(object_id.as_bytes, set_id)
|
||||
req_hk = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(action_cmd)
|
||||
q.add_wait_seconds(2.0)
|
||||
q.add_pus_tc(req_hk)
|
||||
assert action_cmd is not None
|
||||
elif cmd_str == OpCode.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if cmd_str == OpCode.SHUTDOWN_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Shutdown 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 cmd_str == OpCode.SEL_NVM:
|
||||
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
||||
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
|
||||
bp0 = int(input("BP0 (0 or 1): "))
|
||||
@ -267,9 +258,8 @@ 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:
|
||||
if cmd_str == OpCode.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():
|
||||
@ -285,7 +275,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
user_data=bytes([key]),
|
||||
)
|
||||
)
|
||||
if op_code == "8":
|
||||
if cmd_str == "8":
|
||||
q.add_log_cmd("PLOC Supervisor: Set max restart tries")
|
||||
restart_tries = int(input("Specify maximum restart tries: "))
|
||||
command = (
|
||||
@ -294,15 +284,15 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
+ 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")
|
||||
if cmd_str == OpCode.RESET_MPSOC:
|
||||
q.add_log_cmd(Info.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:
|
||||
if cmd_str == OpCode.SET_TIME_REF:
|
||||
q.add_log_cmd("PLOC Supervisor: Set time reference")
|
||||
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":
|
||||
if cmd_str == "11":
|
||||
q.add_log_cmd("PLOC Supervisor: Set boot timeout")
|
||||
boot_timeout = int(input("Specify boot timeout [ms]: "))
|
||||
command = (
|
||||
@ -311,143 +301,63 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
+ 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", 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", SupvActionId.GET_BOOT_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_wait_seconds(2.0)
|
||||
sid = make_sid(object_id.as_bytes, SetIds.BOOT_STATUS_REPORT)
|
||||
req_hk = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(req_hk)
|
||||
if op_code == "17":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable latchup alert")
|
||||
command = pack_lachtup_alert_cmd(object_id.as_bytes, True)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "18":
|
||||
q.add_log_cmd("PLOC Supervisor: Disable latchup alert")
|
||||
command = pack_lachtup_alert_cmd(object_id.as_bytes, False)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "20":
|
||||
q.add_log_cmd("PLOC Supervisor: Set alert limit")
|
||||
command = pack_set_alert_limit_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "23":
|
||||
if cmd_str == "23":
|
||||
q.add_log_cmd("PLOC Supervisor: Set ADC enabled channels")
|
||||
command = pack_set_adc_enabled_channels_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "24":
|
||||
if cmd_str == "24":
|
||||
q.add_log_cmd("PLOC Supervisor: Set ADC window and stride")
|
||||
command = pack_set_adc_window_and_stride_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "25":
|
||||
if cmd_str == "25":
|
||||
q.add_log_cmd("PLOC Supervisor: Set ADC threshold")
|
||||
command = pack_set_adc_threshold_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "26":
|
||||
q.add_log_cmd("PLOC Supervisor: Request latchup status report")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", 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", SupvActionId.COPY_ADC_DATA_TO_MRAM
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "30":
|
||||
q.add_log_cmd("PLOC Supervisor: Run auto EM tests")
|
||||
command = pack_auto_em_tests_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "31":
|
||||
q.add_log_cmd("PLOC Supervisor: Wipe MRAM")
|
||||
command = pack_mram_wipe_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "35":
|
||||
if cmd_str == OpCode.SET_GPIO:
|
||||
q.add_log_cmd("PLOC Supervisor: Set GPIO command")
|
||||
command = pack_set_gpio_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "36":
|
||||
if cmd_str == OpCode.READ_GPIO:
|
||||
q.add_log_cmd("PLOC Supervisor: Read GPIO command")
|
||||
command = pack_read_gpio_cmd(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "37":
|
||||
if cmd_str == "37":
|
||||
q.add_log_cmd("PLOC Supervisor: Restart supervisor")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionId.RESTART_SUPERVISOR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.START_UPDATE:
|
||||
if cmd_str in OpCode.START_UPDATE:
|
||||
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
||||
command = pack_update_command(object_id.as_bytes, True)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.PERFORM_UPDATE:
|
||||
if cmd_str in OpCode.PERFORM_UPDATE:
|
||||
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
||||
command = pack_update_command(object_id.as_bytes, False)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "43":
|
||||
if cmd_str == "43":
|
||||
q.add_log_cmd("PLOC Supervisor: Terminate supervisor process")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionId.TERMINATE_SUPV_HELPER
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "44":
|
||||
if cmd_str == "44":
|
||||
q.add_log_cmd("PLOC Supervisor: 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":
|
||||
if cmd_str == "45":
|
||||
q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
|
||||
command = pack_set_shutdown_timeout_command(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.FACTORY_FLASH:
|
||||
if cmd_str in OpCode.FACTORY_FLASH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.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", 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", 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")
|
||||
command = pack_logging_buffer_request(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "52":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging clear counters")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionId.LOGGING_CLEAR_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "53":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging set topic")
|
||||
command = pack_logging_set_topic(object_id.as_bytes)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "54":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging request counters")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!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", SupvActionId.REQUEST_ADC_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "56":
|
||||
if cmd_str == "56":
|
||||
q.add_log_cmd("PLOC Supervisor: 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":
|
||||
if cmd_str == "57":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable NVMs")
|
||||
nvm01 = int(input("Enable (1) or disable(0) NVM 0 and 1: "))
|
||||
nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
|
||||
@ -458,11 +368,11 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
+ struct.pack("B", nvm3)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "58":
|
||||
if cmd_str == "58":
|
||||
q.add_log_cmd("PLOC Supervisor: 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:
|
||||
if cmd_str == OpCode.MEM_CHECK:
|
||||
custom_data = bytearray()
|
||||
update_file = get_update_file()
|
||||
memory_id = int(input("Specify memory ID: "))
|
||||
@ -472,8 +382,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
custom_data.extend(struct.pack("!B", memory_id))
|
||||
custom_data.extend(struct.pack("!I", start_address))
|
||||
q.add_log_cmd(
|
||||
f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID {memory_id} at start "
|
||||
f"address {start_address}"
|
||||
f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID"
|
||||
f" {memory_id} at start address {start_address}"
|
||||
)
|
||||
command = create_action_cmd(
|
||||
object_id.as_bytes, SupvActionId.MEM_CHECK, custom_data
|
||||
@ -481,10 +391,26 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(command)
|
||||
|
||||
|
||||
def prompt_set_id() -> SetId:
|
||||
for set_id in SetId:
|
||||
print(f"{set_id}: {set_id.name}")
|
||||
while True:
|
||||
set_id = int(input("Please select the set ID to request: "))
|
||||
try:
|
||||
set_id_typed = SetId(set_id)
|
||||
except ValueError:
|
||||
_LOGGER.warning("invalid set ID, try again")
|
||||
continue
|
||||
break
|
||||
return set_id_typed
|
||||
|
||||
|
||||
def pack_sel_boot_image_cmd(
|
||||
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
||||
) -> bytearray:
|
||||
"""This function can be used to generate the command to select the image from which the MPSoC will boot
|
||||
"""This function can be used to generate the command to select the image from which the MPSoC
|
||||
will boot.
|
||||
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
|
||||
@param bp0 Partition pin 0
|
||||
@ -543,9 +469,9 @@ def get_latchup_id() -> int:
|
||||
description_string = "Description".ljust(description_column_width)
|
||||
print(f"{key_string} | {description_string}")
|
||||
print(separator_string)
|
||||
for key in latchup_id_dict:
|
||||
for key in LATCHUP_ID_DICT:
|
||||
key_string = key.ljust(key_column_width)
|
||||
description_string = latchup_id_dict[key].ljust(description_column_width)
|
||||
description_string = LATCHUP_ID_DICT[key].ljust(description_column_width)
|
||||
print(f"{key_string} | {description_string}")
|
||||
return int(input("Specify latchup ID: "))
|
||||
|
||||
@ -674,10 +600,10 @@ 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", SupvActionId.SET_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
command = command + struct.pack("!B", val)
|
||||
command = bytearray(object_id + struct.pack("!I", SupvActionId.SET_GPIO))
|
||||
command.append(port)
|
||||
command.append(pin)
|
||||
command.append(val)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
@ -699,60 +625,234 @@ def pack_logging_set_topic(object_id: bytes) -> bytearray:
|
||||
|
||||
def get_update_file() -> str:
|
||||
_LOGGER.info("Specify update file ")
|
||||
input_helper = InputHelper(update_file_dict)
|
||||
input_helper = InputHelper(UPDATE_FILE_DICT)
|
||||
key = input_helper.get_key()
|
||||
if key == HARDCODED:
|
||||
file = HARDCODED_FILE
|
||||
elif key == MANUAL_INPUT:
|
||||
file = input("Ploc Supervisor: Specify absolute name of update file: ")
|
||||
else:
|
||||
file = update_file_dict[key][1]
|
||||
file = UPDATE_FILE_DICT[key][1]
|
||||
return file
|
||||
|
||||
|
||||
def get_event_buffer_path() -> str:
|
||||
_LOGGER.info("Specify path where to store event buffer file ")
|
||||
input_helper = InputHelper(event_buffer_path_dict)
|
||||
input_helper = InputHelper(EVENT_BUFFER_PATH_DICT)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
file = input("Ploc Supervisor: Specify path: ")
|
||||
else:
|
||||
file = event_buffer_path_dict[key][1]
|
||||
file = EVENT_BUFFER_PATH_DICT[key][1]
|
||||
return file
|
||||
|
||||
|
||||
def handle_supv_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
if set_id == SetIds.HK_REPORT:
|
||||
pass
|
||||
elif set_id == SetIds.BOOT_STATUS_REPORT:
|
||||
fmt_str = "!BBIIBBBBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
soc_state,
|
||||
power_cycles,
|
||||
boot_after_ms,
|
||||
boot_timeout_ms,
|
||||
active_nvm,
|
||||
bp_0_state,
|
||||
bp_1_state,
|
||||
bp_2_state,
|
||||
boot_state,
|
||||
boot_cycles,
|
||||
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
current_idx += inc_len
|
||||
pw.dlog(
|
||||
f"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset): {soc_state}"
|
||||
)
|
||||
pw.dlog(f"Power Cycles {power_cycles}")
|
||||
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
|
||||
pw.dlog(f"Active NVM: {active_nvm}")
|
||||
pw.dlog(
|
||||
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
|
||||
)
|
||||
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 10)
|
||||
class SocState(enum.IntEnum):
|
||||
OFF = 0
|
||||
BOOTING = 1
|
||||
OPERATIONAL = 2
|
||||
SHUTDOWN = 3
|
||||
|
||||
|
||||
def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
||||
if set_id == SetId.HK_REPORT:
|
||||
handle_hk_report(hk_data, pw)
|
||||
elif set_id == SetId.BOOT_STATUS_REPORT:
|
||||
handle_boot_report(hk_data, pw)
|
||||
elif set_id == SetId.ADC_REPORT:
|
||||
handle_adc_report(hk_data)
|
||||
elif set_id == SetId.COUNTERS_REPORT:
|
||||
handle_counters_report(hk_data)
|
||||
elif set_id == SetId.LATCHUP_REPORT:
|
||||
handle_latchup_status_report(hk_data)
|
||||
else:
|
||||
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
||||
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
||||
|
||||
|
||||
def handle_hk_report(hk_data: bytes, pw: PrintWrapper):
|
||||
fmt_str = "!IIIQIIIIIBBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
temp_ps,
|
||||
temp_pl,
|
||||
temp_sup,
|
||||
uptime,
|
||||
cpu_load,
|
||||
avail_heap,
|
||||
num_tcs,
|
||||
num_tms,
|
||||
soc_state,
|
||||
nvm_0_1_state,
|
||||
nvm_3_state,
|
||||
mission_io_state,
|
||||
fmc_state,
|
||||
) = struct.unpack(fmt_str, hk_data[:inc_len])
|
||||
pw.dlog(f"Temp PS {temp_ps} C | Temp PL {temp_pl} C | Temp SUP {temp_sup} C")
|
||||
pw.dlog(f"Uptime {uptime} | CPU Load {cpu_load} | Avail Heap {avail_heap}")
|
||||
pw.dlog(f"Number TCs {num_tcs} | Number TMs {num_tms}")
|
||||
pw.dlog(f"SOC state {SocState(soc_state)}")
|
||||
pw.dlog(f"NVM 01 State {nvm_0_1_state}")
|
||||
pw.dlog(f"NVM 3 State {nvm_3_state}")
|
||||
pw.dlog(f"Mission IO state {mission_io_state}")
|
||||
pw.dlog(f"FMC state {fmc_state}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 13))
|
||||
|
||||
|
||||
def handle_boot_report(hk_data: bytes, pw: PrintWrapper):
|
||||
current_idx = 0
|
||||
fmt_str = "!BBIIBBBBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
soc_state,
|
||||
power_cycles,
|
||||
boot_after_ms,
|
||||
boot_timeout_ms,
|
||||
active_nvm,
|
||||
bp_0_state,
|
||||
bp_1_state,
|
||||
bp_2_state,
|
||||
boot_state,
|
||||
boot_cycles,
|
||||
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
current_idx += inc_len
|
||||
pw.dlog(
|
||||
"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset):"
|
||||
f" {soc_state}"
|
||||
)
|
||||
pw.dlog(f"Power Cycles {power_cycles}")
|
||||
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
|
||||
pw.dlog(f"Active NVM: {active_nvm}")
|
||||
pw.dlog(f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}")
|
||||
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10)
|
||||
|
||||
|
||||
def handle_adc_report(hk_data: bytes):
|
||||
if len(hk_data) < 64:
|
||||
_LOGGER.warning("ADC report smaller than 64 bytes")
|
||||
current_idx = 0
|
||||
adc_raw = []
|
||||
adc_eng = []
|
||||
for _ in range(16):
|
||||
adc_raw.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
for _ in range(16):
|
||||
adc_eng.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
|
||||
print(f"{'Index'.ljust(10)} | {'ADC RAW'.ljust(10)} | {'ADC ENG'.ljust(10)}")
|
||||
for i in range(16):
|
||||
print(f"{i: >10} | {adc_raw[i]: >10} | {adc_eng[i]: >10}")
|
||||
|
||||
|
||||
def handle_counters_report(hk_data: bytes):
|
||||
current_idx = 0
|
||||
signature = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
||||
latchup_counters = []
|
||||
for _ in range(7):
|
||||
latchup_counters.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
fmt_str = "!IIIIIIIIIIIIIIIIIIII"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
adc_deviation_triggers_cnt,
|
||||
tc_received_cnt,
|
||||
tm_available_cnt,
|
||||
supervisor_boots,
|
||||
mpsoc_boots,
|
||||
mpsoc_boot_failed_attempts,
|
||||
mpsoc_powerup,
|
||||
mpsoc_updates,
|
||||
mpsoc_heartbeat_resets,
|
||||
cpu_wdt_resets,
|
||||
ps_heartbeats_lost,
|
||||
pl_heartbeats_lost,
|
||||
eb_task_lost,
|
||||
bm_task_lost,
|
||||
lm_task_lost,
|
||||
am_task_lost,
|
||||
tctmm_task_lost,
|
||||
mm_task_lost,
|
||||
hk_task_lost,
|
||||
dl_task_lost,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
_redwire_tasks_lost = []
|
||||
for _ in range(3):
|
||||
_redwire_tasks_lost.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
print(f"Signature: {signature}")
|
||||
print(f"Latchup Counters: {latchup_counters}")
|
||||
print(f"ADC Deviation Triggers Count: {adc_deviation_triggers_cnt}")
|
||||
print(f"TCs received: {tc_received_cnt} | TMs Available: {tm_available_cnt}")
|
||||
print(f"Supervisor Boots: {supervisor_boots} | MPSoC boots: {mpsoc_boots}")
|
||||
print(f"MPSoC boot failed attempts: {mpsoc_boot_failed_attempts}")
|
||||
print(f"MPSoC powerup: {mpsoc_powerup}")
|
||||
print(f"MPSoC updates: {mpsoc_updates}")
|
||||
print(f"MPSoC heartbeat resets: {mpsoc_heartbeat_resets}")
|
||||
print(f"CPU WDT resets: {cpu_wdt_resets}")
|
||||
print(f"PS heartbeats lost: {ps_heartbeats_lost}")
|
||||
print(f"PL heartbeats lost: {pl_heartbeats_lost}")
|
||||
print(f"EB task lost: {eb_task_lost}")
|
||||
print(f"BM task lost: {bm_task_lost}")
|
||||
print(f"LM task lost: {lm_task_lost}")
|
||||
print(f"AM task lost: {am_task_lost}")
|
||||
print(f"TCTMM task lost: {tctmm_task_lost}")
|
||||
print(f"MM task lost: {mm_task_lost}")
|
||||
print(f"HK task lost: {hk_task_lost}")
|
||||
print(f"DL task lost: {dl_task_lost}")
|
||||
|
||||
|
||||
def handle_latchup_status_report(hk_data: bytes):
|
||||
# 1 byte ID, 7 times 2 bytes of counts, and 8 bytes of time and 1 byte sync status.
|
||||
if len(hk_data) < 24:
|
||||
raise ValueError("Latchup status report smaller than expected")
|
||||
current_idx = 0
|
||||
id = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
counts_of_alerts = []
|
||||
for _ in range(7):
|
||||
counts_of_alerts.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
current_idx += 2
|
||||
print(f"ID: {id}")
|
||||
print(f"Counts of alerts: {counts_of_alerts}")
|
||||
time_ms = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
current_idx += 2
|
||||
time_seconds = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
time_minutes = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
time_hour = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
time_day = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
time_month = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
# Is stored as years since 1900.
|
||||
time_year = 1900 + hk_data[current_idx]
|
||||
current_idx += 1
|
||||
is_synced = hk_data[current_idx]
|
||||
print(f"Time Sync Status: {is_synced}")
|
||||
try:
|
||||
dt = datetime(
|
||||
year=time_year,
|
||||
month=time_month,
|
||||
day=time_day,
|
||||
hour=time_hour,
|
||||
minute=time_minutes,
|
||||
second=time_seconds,
|
||||
microsecond=time_ms * 1000,
|
||||
)
|
||||
print(f"Time Now: {dt}")
|
||||
except ValueError:
|
||||
print(
|
||||
f"Time: {time_day}.{time_month}.{time_year}T"
|
||||
f"{time_hour}:{time_minutes}:{time_seconds}.{time_ms}"
|
||||
)
|
||||
|
@ -6,54 +6,61 @@ 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 import CmdTreeNode, TmtcDefinitionWrapper
|
||||
|
||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_diag_command,
|
||||
enable_periodic_hk_command_with_interval,
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_11_tc_sched import (
|
||||
from tmtccmd.pus.s11_tc_sched import (
|
||||
create_enable_tc_sched_cmd,
|
||||
create_time_tagged_cmd,
|
||||
)
|
||||
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,
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice, pack_mode_data, Mode
|
||||
from tmtccmd.pus.s20_fsfw_param import (
|
||||
create_scalar_double_parameter,
|
||||
create_load_param_cmd,
|
||||
pack_boolean_parameter_app_data,
|
||||
create_scalar_boolean_parameter,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
SWITCH_HPA_ON_PROC = ["0", "proc_hpa"]
|
||||
SWITCH_ON = ["2", "on"]
|
||||
SWITCH_OFF = ["3", "off"]
|
||||
NORMAL_SSR = ["4", "nml_ssr"]
|
||||
NORMAL_DRO = ["5", "nml_dro"]
|
||||
NORMAL_X8 = ["6", "nml_x8"]
|
||||
NORMAL_TX = ["7", "nml_tx"]
|
||||
NORMAL_MPA = ["8", "nml_mpa"]
|
||||
NORMAL_HPA = ["9", "nml_hpa"]
|
||||
SWITCH_ON = "on"
|
||||
SWITCH_OFF = "off"
|
||||
NORMAL_SSR = "nml_ssr"
|
||||
NORMAL_DRO = "nml_dro"
|
||||
NORMAL_X8 = "nml_x8"
|
||||
NORMAL_TX = "nml_tx"
|
||||
NORMAL_MPA = "nml_mpa"
|
||||
NORMAL_HPA = "nml_hpa"
|
||||
NORMAL_CUSTOM = "nml_custom"
|
||||
|
||||
ENABLE_HK = ["enable_hk"]
|
||||
DISABLE_HK = ["disable_hk"]
|
||||
REQ_OS_HK = ["hk_os"]
|
||||
ENABLE_HK = "enable_hk"
|
||||
DISABLE_HK = "disable_hk"
|
||||
REQ_OS_HK = "hk_os"
|
||||
|
||||
INJECT_SSR_TO_DRO_FAILURE = ["10", "inject_ssr_dro_fault"]
|
||||
INJECT_DRO_TO_X8_FAILURE = ["11", "inject_dro_x8_fault"]
|
||||
INJECT_X8_TO_TX_FAILURE = ["12", "inject_x8_tx_fault"]
|
||||
INJECT_TX_TO_MPA_FAILURE = ["13", "inject_tx_mpa_fault"]
|
||||
INJECT_MPA_TO_HPA_FAILURE = ["14", "inject_mpa_hpa_fault"]
|
||||
INJECT_ALL_ON_FAILURE = ["15", "inject_all_on_fault"]
|
||||
DISABLE_ORDER_CHECKING = "disable_order_checking"
|
||||
ENABLE_ORDER_CHECKING = "enable_order_checking"
|
||||
|
||||
UPDATE_I_UPPER_LIMIT = "update_i_upper_limit"
|
||||
UPDATE_V_LOWER_LIMIT = "update_v_lower_limit"
|
||||
UPDATE_V_UPPER_LIMIT = "update_v_upper_limit"
|
||||
|
||||
INJECT_SSR_TO_DRO_FAILURE = "inject_ssr_dro_fault"
|
||||
INJECT_DRO_TO_X8_FAILURE = "inject_dro_x8_fault"
|
||||
INJECT_X8_TO_TX_FAILURE = "inject_x8_tx_fault"
|
||||
INJECT_TX_TO_MPA_FAILURE = "inject_tx_mpa_fault"
|
||||
INJECT_MPA_TO_HPA_FAILURE = "inject_mpa_hpa_fault"
|
||||
INJECT_ALL_ON_FAILURE = "inject_all_on_fault"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -66,10 +73,21 @@ class Info:
|
||||
NORMAL_TX = f"{NORMAL}, TX on"
|
||||
NORMAL_MPA = f"{NORMAL}, MPA on"
|
||||
NORMAL_HPA = f"{NORMAL}, HPA on"
|
||||
NORMAL_CUSTOM = f"{NORMAL}, Custom Channel Settings"
|
||||
REQ_OS_HK = "Request One Shot HK"
|
||||
SWITCH_HPA_ON_PROC = "Switch HPA on procedure"
|
||||
ENABLE_HK = "Enable HK"
|
||||
DISABLE_HK = "Disable HK"
|
||||
UPDATE_I_UPPER_LIMIT = "Update upper current parameter"
|
||||
UPDATE_V_LOWER_LIMIT = "Update lower voltage parameter"
|
||||
UPDATE_V_UPPER_LIMIT = "Update upper voltage parameter"
|
||||
INJECT_SSR_TO_DRO_FAILURE = "Inject SSR to DRO failure"
|
||||
INJECT_DRO_TO_X8_FAILURE = "Inject DRO to X8 failure"
|
||||
INJECT_X8_TO_TX_FAILURE = "Inject X8 to TX failure"
|
||||
INJECT_TX_TO_MPA_FAILURE = "Inject TX to MPA failure"
|
||||
INJECT_MPA_TO_HPA_FAILURE = "Inject MPA to HPA failure"
|
||||
INJECT_ALL_ON_FAILURE = "Inject all on failure"
|
||||
DISABLE_ORDER_CHECKING = "Disable order checks"
|
||||
ENABLE_ORDER_CHECKING = "Enable order checks"
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -85,7 +103,41 @@ class NormalSubmodesMask(enum.IntEnum):
|
||||
HPA_ON = 5
|
||||
|
||||
|
||||
class ParamIds(enum.IntEnum):
|
||||
class SubmodeForNormalMode(enum.IntEnum):
|
||||
NONE = 0
|
||||
SSR_ON = 1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
DRO_ON = 1 << NormalSubmodesMask.DRO_ON | (
|
||||
1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
)
|
||||
X8_ON = (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
)
|
||||
TX_ON = (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
)
|
||||
MPA_ON = (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
| (1 << NormalSubmodesMask.MPA_ON)
|
||||
)
|
||||
HPA_ON = (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
| (1 << NormalSubmodesMask.MPA_ON)
|
||||
| (1 << NormalSubmodesMask.HPA_ON)
|
||||
)
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
NEG_V_LOWER_BOUND = 0
|
||||
NEG_V_UPPER_BOUND = 1
|
||||
|
||||
@ -122,11 +174,33 @@ class ParamIds(enum.IntEnum):
|
||||
INJECT_MPA_TO_HPA_FAILURE = 34
|
||||
INJECT_ALL_ON_FAILURE = 35
|
||||
|
||||
DISABLE_ORDER_CHECK_CHANNELS = 40
|
||||
|
||||
|
||||
class DevSelect(enum.IntEnum):
|
||||
SSR_NEG_V = 0
|
||||
DRO = 1
|
||||
X8 = 2
|
||||
TX = 3
|
||||
MPA = 4
|
||||
HPA = 5
|
||||
|
||||
|
||||
def create_pl_pcdu_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("pl_pcdu", "Payload PCDU", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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)
|
||||
@ -135,8 +209,12 @@ def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
||||
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.NORMAL_CUSTOM, info=Info.NORMAL_CUSTOM)
|
||||
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.UPDATE_V_LOWER_LIMIT, info=Info.UPDATE_V_LOWER_LIMIT)
|
||||
oce.add(keys=OpCode.UPDATE_V_UPPER_LIMIT, info=Info.UPDATE_V_UPPER_LIMIT)
|
||||
oce.add(keys=OpCode.UPDATE_I_UPPER_LIMIT, info=Info.UPDATE_I_UPPER_LIMIT)
|
||||
oce.add(
|
||||
keys=OpCode.INJECT_SSR_TO_DRO_FAILURE,
|
||||
info="Inject failure SSR to DRO transition",
|
||||
@ -158,15 +236,19 @@ def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
||||
info="Inject failure in MPA to HPA transition",
|
||||
)
|
||||
oce.add(keys=OpCode.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
|
||||
oce.add(keys=OpCode.DISABLE_ORDER_CHECKING, info=Info.DISABLE_ORDER_CHECKING)
|
||||
oce.add(keys=OpCode.ENABLE_ORDER_CHECKING, info=Info.ENABLE_ORDER_CHECKING)
|
||||
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
|
||||
|
||||
|
||||
def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
def pack_pl_pcdu_commands( # noqa C901: Complexity is okay here.
|
||||
q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa C901: Complexity is okay here.
|
||||
if cmd_str == 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:
|
||||
if cmd_str == 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:
|
||||
if cmd_str in OpCode.ENABLE_HK:
|
||||
interval = float(
|
||||
input("Please enter HK collection interval in floating point seconds: ")
|
||||
)
|
||||
@ -176,13 +258,13 @@ def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
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 OpCode.DISABLE_HK:
|
||||
if cmd_str == OpCode.DISABLE_HK:
|
||||
cmd = disable_periodic_hk_command(
|
||||
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 OpCode.NORMAL_SSR:
|
||||
if cmd_str == OpCode.NORMAL_SSR:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_SSR,
|
||||
@ -191,54 +273,116 @@ def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
),
|
||||
)
|
||||
if op_code in OpCode.NORMAL_DRO:
|
||||
if cmd_str == OpCode.NORMAL_DRO:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_DRO,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
|
||||
)
|
||||
if op_code in OpCode.NORMAL_X8:
|
||||
if cmd_str == OpCode.NORMAL_X8:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_X8,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
|
||||
)
|
||||
if op_code in OpCode.NORMAL_TX:
|
||||
if cmd_str == OpCode.NORMAL_TX:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_TX,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
|
||||
)
|
||||
if op_code in OpCode.NORMAL_MPA:
|
||||
if cmd_str == OpCode.NORMAL_MPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_MPA,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
|
||||
)
|
||||
if op_code in OpCode.NORMAL_HPA:
|
||||
if cmd_str == OpCode.NORMAL_HPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_HPA,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
|
||||
)
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
if cmd_str == OpCode.NORMAL_CUSTOM:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_CUSTOM,
|
||||
mode=Mode.NORMAL,
|
||||
submode=prompt_custom_normal_submode(),
|
||||
)
|
||||
|
||||
if cmd_str == 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=SetId.ADC)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.SWITCH_HPA_ON_PROC:
|
||||
hpa_on_procedure(q)
|
||||
if op_code in OpCode.INJECT_ALL_ON_FAILURE:
|
||||
if cmd_str == OpCode.DISABLE_ORDER_CHECKING:
|
||||
q.add_log_cmd(Info.DISABLE_ORDER_CHECKING)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_boolean_parameter(
|
||||
PL_PCDU_ID, 0, ParamId.DISABLE_ORDER_CHECK_CHANNELS, True
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if cmd_str == OpCode.ENABLE_ORDER_CHECKING:
|
||||
q.add_log_cmd(Info.ENABLE_ORDER_CHECKING)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_boolean_parameter(
|
||||
PL_PCDU_ID, 0, ParamId.DISABLE_ORDER_CHECK_CHANNELS, False
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if cmd_str == OpCode.UPDATE_I_UPPER_LIMIT:
|
||||
q.add_log_cmd(Info.UPDATE_I_UPPER_LIMIT)
|
||||
print("Select device to update lower current limit for: ")
|
||||
param_id = dev_select_to_upper_i_update_param_id(dev_select_prompt(True))
|
||||
new_param_value = float(
|
||||
input("Please specify new parameter value as a double: ")
|
||||
)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_double_parameter(PL_PCDU_ID, 0, param_id, new_param_value)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.UPDATE_V_LOWER_LIMIT:
|
||||
q.add_log_cmd(Info.UPDATE_V_LOWER_LIMIT)
|
||||
print("Select device to update lower voltage limit for: ")
|
||||
param_id = dev_select_to_lower_u_update_param_id(dev_select_prompt(False))
|
||||
new_param_value = float(
|
||||
input("Please specify new parameter value as a double: ")
|
||||
)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_double_parameter(PL_PCDU_ID, 0, param_id, new_param_value)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.UPDATE_V_UPPER_LIMIT:
|
||||
q.add_log_cmd(Info.UPDATE_V_UPPER_LIMIT)
|
||||
print("Select device to update upper voltage limit for: ")
|
||||
param_id = dev_select_to_upper_u_update_param_id(dev_select_prompt(False))
|
||||
new_param_value = float(
|
||||
input("Please specify new parameter value as a double: ")
|
||||
)
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_double_parameter(PL_PCDU_ID, 0, param_id, new_param_value)
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.INJECT_ALL_ON_FAILURE:
|
||||
pack_failure_injection_cmd(
|
||||
q=q,
|
||||
param_id=ParamIds.INJECT_ALL_ON_FAILURE,
|
||||
param_id=ParamId.INJECT_ALL_ON_FAILURE,
|
||||
print_str="All On",
|
||||
)
|
||||
|
||||
@ -248,7 +392,7 @@ def hpa_on_procedure(q: DefaultPusQueueHelper):
|
||||
if delay_dro_to_x8 is None:
|
||||
delay_dro_to_x8 = 900
|
||||
q.add_log_cmd(
|
||||
f"Starting procedure to switch on PL PCDU HPA with DRO to X8 "
|
||||
"Starting procedure to switch on PL PCDU HPA with DRO to X8 "
|
||||
f"delay of {delay_dro_to_x8} seconds"
|
||||
)
|
||||
pl_pcdu_on = PusTelecommand(
|
||||
@ -381,41 +525,17 @@ def request_wait_time() -> Optional[float]:
|
||||
|
||||
def submode_mask_to_submode(on_tgt: NormalSubmodesMask) -> int:
|
||||
if on_tgt == NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON:
|
||||
return 1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
return SubmodeForNormalMode.SSR_ON
|
||||
if on_tgt == NormalSubmodesMask.DRO_ON:
|
||||
return 1 << NormalSubmodesMask.DRO_ON | (
|
||||
1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
)
|
||||
return SubmodeForNormalMode.DRO_ON
|
||||
if on_tgt == NormalSubmodesMask.X8_ON:
|
||||
return (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
)
|
||||
return SubmodeForNormalMode.X8_ON
|
||||
if on_tgt == NormalSubmodesMask.TX_ON:
|
||||
return (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
)
|
||||
return SubmodeForNormalMode.TX_ON
|
||||
if on_tgt == NormalSubmodesMask.MPA_ON:
|
||||
return (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
| (1 << NormalSubmodesMask.MPA_ON)
|
||||
)
|
||||
return SubmodeForNormalMode.MPA_ON
|
||||
if on_tgt == NormalSubmodesMask.HPA_ON:
|
||||
return (
|
||||
1 << NormalSubmodesMask.DRO_ON
|
||||
| (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON)
|
||||
| (1 << NormalSubmodesMask.X8_ON)
|
||||
| (1 << NormalSubmodesMask.TX_ON)
|
||||
| (1 << NormalSubmodesMask.MPA_ON)
|
||||
| (1 << NormalSubmodesMask.HPA_ON)
|
||||
)
|
||||
return SubmodeForNormalMode.HPA_ON
|
||||
|
||||
|
||||
def pack_wait_time_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||
@ -423,21 +543,21 @@ def pack_wait_time_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||
q.add_log_cmd(f"Updating {print_str} wait time to {wait_time}")
|
||||
if wait_time is None:
|
||||
return
|
||||
param_data = pack_scalar_double_param_app_data(
|
||||
param_data = create_scalar_double_parameter(
|
||||
object_id=PL_PCDU_ID,
|
||||
domain_id=0,
|
||||
unique_id=param_id,
|
||||
parameter=wait_time,
|
||||
)
|
||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
||||
q.add_pus_tc(create_load_param_cmd(param_data))
|
||||
|
||||
|
||||
def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||
q.add_log_cmd(f"Inserting {print_str} error")
|
||||
param_data = pack_boolean_parameter_app_data(
|
||||
param_data = create_scalar_boolean_parameter(
|
||||
object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True
|
||||
)
|
||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
||||
q.add_pus_tc(create_load_param_cmd(param_data))
|
||||
|
||||
|
||||
def pack_pl_pcdu_mode_cmd(
|
||||
@ -453,24 +573,23 @@ def pack_pl_pcdu_mode_cmd(
|
||||
|
||||
|
||||
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",
|
||||
"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):
|
||||
def handle_plpcdu_hk(pw: PrintWrapper, 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 = []
|
||||
@ -496,4 +615,103 @@ def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
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)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=3
|
||||
)
|
||||
|
||||
|
||||
def dev_select_prompt(skip_ssr: bool) -> DevSelect:
|
||||
while True:
|
||||
for dev in DevSelect:
|
||||
if skip_ssr and dev == DevSelect.SSR_NEG_V:
|
||||
continue
|
||||
print(f"{dev}: {dev.name}")
|
||||
dev_select = int(input("Select device by index: "))
|
||||
try:
|
||||
return DevSelect(dev_select)
|
||||
except IndexError:
|
||||
_LOGGER.warn("Invalid paramter index, try again.")
|
||||
continue
|
||||
|
||||
|
||||
def dev_select_to_upper_i_update_param_id(dev_select: DevSelect) -> ParamId:
|
||||
param_id = None
|
||||
if dev_select == DevSelect.DRO:
|
||||
param_id = ParamId.DRO_I_UPPER_BOUND
|
||||
elif dev_select == DevSelect.X8:
|
||||
param_id = ParamId.X8_I_UPPER_BOUND
|
||||
elif dev_select == DevSelect.TX:
|
||||
param_id = ParamId.TX_I_UPPER_BOUND
|
||||
elif dev_select == DevSelect.MPA:
|
||||
param_id = ParamId.MPA_I_UPPER_BOUND
|
||||
elif dev_select == DevSelect.HPA:
|
||||
param_id = ParamId.HPA_I_UPPER_BOUND
|
||||
if param_id is None:
|
||||
raise ValueError("invalid parameter ID")
|
||||
return param_id
|
||||
|
||||
|
||||
def dev_select_to_lower_u_update_param_id(dev_select: DevSelect) -> ParamId:
|
||||
param_id = None
|
||||
if dev_select == DevSelect.SSR_NEG_V:
|
||||
param_id = ParamId.NEG_V_LOWER_BOUND
|
||||
if dev_select == DevSelect.DRO:
|
||||
param_id = ParamId.DRO_U_LOWER_BOUND
|
||||
elif dev_select == DevSelect.X8:
|
||||
param_id = ParamId.X8_U_LOWER_BOUND
|
||||
elif dev_select == DevSelect.TX:
|
||||
param_id = ParamId.TX_U_LOWER_BOUND
|
||||
elif dev_select == DevSelect.MPA:
|
||||
param_id = ParamId.MPA_U_LOWER_BOUND
|
||||
elif dev_select == DevSelect.HPA:
|
||||
param_id = ParamId.HPA_U_LOWER_BOUND
|
||||
if param_id is None:
|
||||
raise ValueError("invalid parameter ID")
|
||||
return param_id
|
||||
|
||||
|
||||
def dev_select_to_upper_u_update_param_id(dev_select: DevSelect) -> ParamId:
|
||||
param_id = None
|
||||
if dev_select == DevSelect.SSR_NEG_V:
|
||||
param_id = ParamId.NEG_V_UPPER_BOUND
|
||||
if dev_select == DevSelect.DRO:
|
||||
param_id = ParamId.DRO_U_UPPER_BOUND
|
||||
elif dev_select == DevSelect.X8:
|
||||
param_id = ParamId.X8_U_UPPER_BOUND
|
||||
elif dev_select == DevSelect.TX:
|
||||
param_id = ParamId.TX_U_UPPER_BOUND
|
||||
elif dev_select == DevSelect.MPA:
|
||||
param_id = ParamId.MPA_U_UPPER_BOUND
|
||||
elif dev_select == DevSelect.HPA:
|
||||
param_id = ParamId.HPA_U_UPPER_BOUND
|
||||
if param_id is None:
|
||||
raise ValueError("invalid parameter ID")
|
||||
return param_id
|
||||
|
||||
|
||||
def prompt_custom_normal_submode() -> int:
|
||||
print("Prompting custom submode.")
|
||||
submode = 0
|
||||
|
||||
def prompt_channel(submode: int, channel_str: str, mask: NormalSubmodesMask) -> int:
|
||||
while True:
|
||||
channel_on = input(f" {channel_str} ON? [y/n]: ")
|
||||
if channel_on in ["y", "1", "yes"]:
|
||||
submode |= 1 << mask
|
||||
elif channel_on in ["n", "0", "no"]:
|
||||
pass
|
||||
else:
|
||||
_LOGGER.warning("invalid input, try again")
|
||||
continue
|
||||
break
|
||||
return submode
|
||||
|
||||
submode = prompt_channel(
|
||||
submode, "SSR", NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
)
|
||||
submode = prompt_channel(submode, "DRO", NormalSubmodesMask.DRO_ON)
|
||||
submode = prompt_channel(submode, "X8", NormalSubmodesMask.X8_ON)
|
||||
submode = prompt_channel(submode, "TX", NormalSubmodesMask.TX_ON)
|
||||
submode = prompt_channel(submode, "MPA", NormalSubmodesMask.MPA_ON)
|
||||
submode = prompt_channel(submode, "HPA", NormalSubmodesMask.HPA_ON)
|
||||
return submode
|
@ -5,22 +5,23 @@
|
||||
@author J. Meier
|
||||
@date 01.07.2021
|
||||
"""
|
||||
import enum
|
||||
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, Mode
|
||||
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 generate_one_hk_command, make_sid
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId:
|
||||
class SetId(enum.IntEnum):
|
||||
HK = 3
|
||||
|
||||
|
||||
@ -65,27 +66,27 @@ def add_rad_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pack_rad_sensor_test_into(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
def create_rad_sensor_cmd(
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
|
||||
|
||||
if op_code in OpCode.ON:
|
||||
if cmd_str in OpCode.ON:
|
||||
rad_sensor_mode_cmd(object_id, Mode.ON, Info.ON, q)
|
||||
if op_code in OpCode.NORMAL:
|
||||
if cmd_str in OpCode.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Mode.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCode.OFF:
|
||||
if cmd_str in OpCode.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Mode.OFF, Info.OFF, q)
|
||||
if op_code in OpCode.REQ_HK_ONCE:
|
||||
if cmd_str 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=SetId.HK))
|
||||
)
|
||||
if op_code in OpCode.DEBUG_ON:
|
||||
if cmd_str in OpCode.DEBUG_ON:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_ON}")
|
||||
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 OpCode.DEBUG_OFF:
|
||||
if cmd_str in OpCode.DEBUG_OFF:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandId.DISABLE_DEBUG_OUTPUT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -99,9 +100,8 @@ def rad_sensor_mode_cmd(
|
||||
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):
|
||||
def handle_rad_sensor_data(pw: PrintWrapper, 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"
|
||||
@ -111,8 +111,10 @@ def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
)
|
||||
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)")
|
||||
pw.dlog("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)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=7
|
||||
)
|
||||
|
@ -2,32 +2,29 @@ import enum
|
||||
import json
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import CmdTreeNode
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, Subservice, pack_mode_data
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
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.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
|
||||
|
||||
USE_SCEX_CONF_FILE = True
|
||||
|
||||
|
||||
class OpCode:
|
||||
PING = ["0", "ping"]
|
||||
ION_CMD = ["1", "ion"]
|
||||
TEMP_CMD = ["2", "temp"]
|
||||
EXP_STATUS_CMD = ["3", "expstatus"]
|
||||
PING = "ping"
|
||||
ION_CMD = "ion"
|
||||
TEMP_CMD = "temp"
|
||||
EXP_STATUS_CMD = "expstatus"
|
||||
|
||||
ONE_CELLS_CMD = ["4", "onecell"]
|
||||
ALL_CELLS_CMD = ["5", "allcells"]
|
||||
FRAM = ["6", "fram"]
|
||||
ONE_CELLS_CMD = "onecell"
|
||||
ALL_CELLS_CMD = "allcells"
|
||||
FRAM = "fram"
|
||||
|
||||
SWITCH_ON = ["7", "on"]
|
||||
SWITCH_OFF = ["8", "off"]
|
||||
SWITCH_ON = "on"
|
||||
SWITCH_OFF = "off"
|
||||
NORMAL = "normal"
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
@ -53,32 +50,23 @@ class Info:
|
||||
|
||||
SWITCH_ON = "Switch Scex on"
|
||||
SWITCH_OFF = "Switch Scex off"
|
||||
NORMAL = "Switch SCEX to normal mode"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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=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
|
||||
)
|
||||
def create_scex_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
scex_node = CmdTreeNode("scex", "Solar Cell Experiment")
|
||||
for op_code, info in combined_dict.items():
|
||||
scex_node.add_child(CmdTreeNode(op_code, info))
|
||||
return scex_node
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SCEX.value)
|
||||
def pack_scex_cmds(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
def pack_scex_cmds(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
if cmd_str == OpCode.SWITCH_ON:
|
||||
q.add_log_cmd(Info.SWITCH_ON)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -87,7 +75,16 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.ON, 0),
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.SWITCH_OFF:
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd(Info.NORMAL)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.NORMAL, 0),
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.SWITCH_OFF:
|
||||
q.add_log_cmd(Info.SWITCH_OFF)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -96,20 +93,20 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
app_data=pack_mode_data(SCEX_HANDLER_ID, Mode.OFF, 0),
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.PING:
|
||||
if cmd_str == OpCode.PING:
|
||||
q.add_log_cmd(Info.PING)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.PING, app_data))
|
||||
if op_code in OpCode.ION_CMD:
|
||||
if cmd_str == OpCode.ION_CMD:
|
||||
q.add_log_cmd(Info.ION_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.ION_CMD, app_data))
|
||||
if op_code in OpCode.TEMP_CMD:
|
||||
if cmd_str == OpCode.TEMP_CMD:
|
||||
q.add_log_cmd(Info.TEMP_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.TEMP_CMD, app_data))
|
||||
|
||||
if op_code in OpCode.EXP_STATUS_CMD:
|
||||
if cmd_str == OpCode.EXP_STATUS_CMD:
|
||||
q.add_log_cmd(Info.EXP_STATUS_CMD)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(
|
||||
@ -117,7 +114,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
)
|
||||
|
||||
# one cell
|
||||
if op_code in OpCode.ONE_CELLS_CMD:
|
||||
if cmd_str == OpCode.ONE_CELLS_CMD:
|
||||
q.add_log_cmd(Info.ONE_CELLS_CMD)
|
||||
app_data = bytearray([0])
|
||||
|
||||
@ -131,8 +128,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
cell_select = int(cell_select)
|
||||
if cell_select < 1 or cell_select > 10:
|
||||
print(
|
||||
f"Invalid cell number {cell_select}, "
|
||||
f"Please enter a valid number: "
|
||||
f"Invalid cell number {cell_select}, Please enter a valid number: "
|
||||
)
|
||||
continue
|
||||
cn = cell_select - 1
|
||||
@ -148,7 +144,8 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
dac_weight1 = json_data["dac_weight1"]
|
||||
dac_weight2 = json_data["dac_weight2"]
|
||||
dac_weight3 = json_data["dac_weight3"]
|
||||
|
||||
else:
|
||||
raise ValueError("CLI support for SCEX params not implemented")
|
||||
# in app_data
|
||||
# app_data.extend(struct.pack("!H", first_dac))
|
||||
app_data.append(cell_select)
|
||||
@ -165,7 +162,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
create_action_cmd(SCEX_HANDLER_ID, ActionId.ONE_CELLS_CMD, app_data)
|
||||
)
|
||||
|
||||
if op_code in OpCode.ALL_CELLS_CMD:
|
||||
if cmd_str == OpCode.ALL_CELLS_CMD:
|
||||
q.add_log_cmd(Info.ALL_CELLS_CMD)
|
||||
app_data = bytearray([0])
|
||||
|
||||
@ -182,6 +179,8 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
dac_weight2 = json_data["dac_weight2"]
|
||||
dac_weight3 = json_data["dac_weight3"]
|
||||
|
||||
else:
|
||||
raise ValueError("CLI support for SCEX params not implemented")
|
||||
# in app_data
|
||||
# app_data.extend(struct.pack("!H", first_dac))
|
||||
append_16_bit_val(packet=app_data, val=first_dac[cn])
|
||||
@ -197,7 +196,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
|
||||
create_action_cmd(SCEX_HANDLER_ID, ActionId.ALL_CELLS_CMD, app_data)
|
||||
)
|
||||
|
||||
if op_code in OpCode.FRAM:
|
||||
if cmd_str == OpCode.FRAM:
|
||||
q.add_log_cmd(Info.FRAM)
|
||||
app_data = bytes([0])
|
||||
q.add_pus_tc(create_action_cmd(SCEX_HANDLER_ID, ActionId.FRAM, app_data))
|
||||
|
@ -1,42 +1,48 @@
|
||||
import enum
|
||||
from typing import Dict, Tuple
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import PL_SUBSYSTEM_ID
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
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_mode import Subservice as ModeSubservice
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||
|
||||
|
||||
class ModeId(enum.IntEnum):
|
||||
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 PayloadMode(enum.IntEnum):
|
||||
OFF = 0
|
||||
MPSOC_STREAM = "mode_mpsoc_stream"
|
||||
CAM_STREAM = "mode_cam_stream"
|
||||
EARTH_OBSV = "mode_eart_obsv"
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
OFF = "Off Command"
|
||||
REPORT_ALL_MODES = "Report all modes"
|
||||
MPSOC_STREAM = "MPSoC Stream Mode"
|
||||
CAM_STREAM = "Camera Stream Mode"
|
||||
EARTH_OBSV = "Earth Observation Mode"
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, str]] = {
|
||||
OpCode.OFF: (PayloadMode.OFF, Info.OFF),
|
||||
OpCode.OFF: (ModeId.OFF, Info.OFF),
|
||||
OpCode.MPSOC_STREAM: (ModeId.MPSOC_STREAM, Info.MPSOC_STREAM),
|
||||
}
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.PL_SS)
|
||||
def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
info_prefix = "ACS Subsystem"
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
def create_payload_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
info_prefix = "Payload Subsystem"
|
||||
if cmd_str == OpCode.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -45,21 +51,29 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
app_data=PL_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
mode_info_tup = HANDLER_LIST.get(op_code)
|
||||
mode_info_tup = HANDLER_LIST.get(cmd_str)
|
||||
assert mode_info_tup is not None
|
||||
if mode_info_tup is None:
|
||||
return
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=PL_SUBSYSTEM_ID,
|
||||
info=f"{info_prefix}: {mode_info_tup[1]}",
|
||||
submode=0,
|
||||
mode=mode_info_tup[0],
|
||||
submode=0,
|
||||
q=q,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_payload_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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)
|
||||
def create_payload_subsystem_node() -> CmdTreeNode:
|
||||
payload_node = CmdTreeNode("payload", "Payload Subsystem")
|
||||
subsystem_node = CmdTreeNode("subsystem", "Subsystem Commands")
|
||||
subsystem_node.add_child(CmdTreeNode(OpCode.OFF, Info.OFF))
|
||||
subsystem_node.add_child(CmdTreeNode(OpCode.MPSOC_STREAM, Info.MPSOC_STREAM))
|
||||
subsystem_node.add_child(CmdTreeNode(OpCode.EARTH_OBSV, Info.EARTH_OBSV))
|
||||
subsystem_node.add_child(CmdTreeNode(OpCode.CAM_STREAM, Info.CAM_STREAM))
|
||||
|
||||
subsystem_node.add_child(
|
||||
CmdTreeNode(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
)
|
||||
payload_node.add_child(subsystem_node)
|
||||
return payload_node
|
||||
|
@ -8,6 +8,7 @@ import struct
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
add_gomspace_nodes,
|
||||
pack_common_gomspace_cmds,
|
||||
add_gomspace_cmd_defs,
|
||||
req_hk_cmds,
|
||||
@ -16,10 +17,10 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
OBC_ENDIANNESS,
|
||||
unpack_array_in_data,
|
||||
)
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
import eive_tmtc.gomspace.gomspace_common as gs
|
||||
from eive_tmtc.config.object_ids import ACU_HANDLER_ID
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
@ -50,6 +51,15 @@ class Info:
|
||||
TEST = "ACU Test"
|
||||
|
||||
|
||||
def create_acu_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"acu", "P60 PCDU ACU device", hide_children_which_are_leaves=True
|
||||
)
|
||||
add_gomspace_nodes(node)
|
||||
node.add_child(CmdTreeNode(OpCode.TEST[0], Info.TEST))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_acu_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -63,11 +73,11 @@ def add_acu_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str):
|
||||
q.add_log_cmd("Handling ACU command")
|
||||
pack_common_power_cmds("ACU", object_id, q, op_code)
|
||||
pack_common_gomspace_cmds("ACU", object_id, q, op_code)
|
||||
acu_req_hk_cmds(q, op_code)
|
||||
pack_common_power_cmds("ACU", object_id, q, cmd_str)
|
||||
pack_common_gomspace_cmds("ACU", object_id, q, cmd_str)
|
||||
acu_req_hk_cmds(q, cmd_str)
|
||||
pack_test_cmds(object_id=object_id, q=q)
|
||||
|
||||
|
||||
|
@ -1,25 +1,22 @@
|
||||
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,
|
||||
CmdTreeNode,
|
||||
)
|
||||
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
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import BPX_HANDLER_ID
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
|
||||
class BpxSetId:
|
||||
class BpxSetId(enum.IntEnum):
|
||||
GET_HK_SET = 0
|
||||
GET_CFG_SET = 5
|
||||
|
||||
@ -27,48 +24,64 @@ class BpxSetId:
|
||||
class BpxActionId:
|
||||
REBOOT = 2
|
||||
RESET_COUNTERS = 3
|
||||
SET_CFG = 4
|
||||
CONFIG_CMD = 4
|
||||
GET_CFG = 5
|
||||
SET_CFG = 6
|
||||
MAN_HEATER_ON = 10
|
||||
MAN_HEATER_OFF = 11
|
||||
|
||||
|
||||
class BpxHeaterModeSelect(enum.IntEnum):
|
||||
OFF = 0
|
||||
AUTO = 1
|
||||
|
||||
|
||||
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"]
|
||||
HK = "hk"
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
RST_CFG = "reset_cfg"
|
||||
SET_CFG = "set_cfg"
|
||||
MAN_HEATER_ON = "man_heater_on"
|
||||
MAN_HEATER_OFF = "man_heater_off"
|
||||
RST_BOOT_CNT = "rst_boot_cnt"
|
||||
REQUEST_CFG = "cfg"
|
||||
REQUEST_CFG_HK = "cfg_hk"
|
||||
REBOOT = "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)"
|
||||
def create_bpx_batt_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("bat", "BPX battery device", hide_children_for_print=True)
|
||||
node.add_child(CmdTreeNode(BpxOpCode.ON, "ON command"))
|
||||
node.add_child(CmdTreeNode(BpxOpCode.OFF, "OFF command"))
|
||||
node.add_child(CmdTreeNode(BpxOpCode.HK, "HK command"))
|
||||
node.add_child(CmdTreeNode(BpxOpCode.RST_BOOT_CNT, "Reset boot count"))
|
||||
node.add_child(
|
||||
CmdTreeNode(BpxOpCode.RST_CFG, "Reset Config to stored default settings")
|
||||
)
|
||||
oce.add(keys=BpxOpCode.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
op_code_entry=oce,
|
||||
node.add_child(CmdTreeNode(BpxOpCode.SET_CFG, "Set BPX configuration"))
|
||||
node.add_child(CmdTreeNode(BpxOpCode.MAN_HEATER_ON, "Manual heater on"))
|
||||
node.add_child(CmdTreeNode(BpxOpCode.MAN_HEATER_OFF, "Manual heater off"))
|
||||
node.add_child(
|
||||
CmdTreeNode(BpxOpCode.REQUEST_CFG, "Request Configuration Struct (Step 1)")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
BpxOpCode.REQUEST_CFG_HK, "Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
)
|
||||
node.add_child(CmdTreeNode(BpxOpCode.REBOOT, "Reboot Command"))
|
||||
return node
|
||||
|
||||
|
||||
@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:
|
||||
def pack_bpx_commands(
|
||||
q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa C901: Complexity is okay here.
|
||||
if cmd_str == 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:
|
||||
if cmd_str == BpxOpCode.OFF:
|
||||
q.add_log_cmd("Off mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.OFF, 0)
|
||||
q.add_pus_tc(
|
||||
@ -78,7 +91,7 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCode.ON:
|
||||
if cmd_str == BpxOpCode.ON:
|
||||
q.add_log_cmd("On mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.ON, 0)
|
||||
q.add_pus_tc(
|
||||
@ -88,27 +101,71 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCode.RST_BOOT_CNT:
|
||||
if cmd_str == 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:
|
||||
if cmd_str == BpxOpCode.RST_CFG:
|
||||
q.add_log_cmd("Reset BPX configuration")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionId.CONFIG_CMD
|
||||
)
|
||||
)
|
||||
if cmd_str == BpxOpCode.SET_CFG:
|
||||
q.add_log_cmd("Setting BPX configuration")
|
||||
user_data = bytearray()
|
||||
batt_mode = BpxHeaterModeSelect(
|
||||
int(input("BPX heater mode select, 0 for OFF 1 for AUTO: "))
|
||||
)
|
||||
user_data.append(batt_mode)
|
||||
lower_limit = int(input("Lower heater limit (-2 default): "))
|
||||
user_data.append(struct.pack("!b", lower_limit)[0])
|
||||
upper_limit = int(input("Upper heater limit (3 default): "))
|
||||
user_data.append(struct.pack("!b", upper_limit)[0])
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID,
|
||||
action_id=BpxActionId.SET_CFG,
|
||||
user_data=user_data,
|
||||
)
|
||||
)
|
||||
if cmd_str == 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:
|
||||
if cmd_str == 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:
|
||||
if cmd_str == 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)
|
||||
)
|
||||
if cmd_str == BpxOpCode.MAN_HEATER_ON:
|
||||
q.add_log_cmd("BPX manual heater on with seconds burntime")
|
||||
burn_time = int(input("BPX heater burn time in seconds [1-65535]: "))
|
||||
if burn_time < 1 or burn_time > 65535:
|
||||
raise ValueError("Invalid burntime, smaller than 0 or larger than 65535")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID,
|
||||
action_id=BpxActionId.MAN_HEATER_ON,
|
||||
user_data=struct.pack("!H", burn_time),
|
||||
)
|
||||
)
|
||||
if cmd_str == BpxOpCode.MAN_HEATER_OFF:
|
||||
q.add_log_cmd("BPX manual heater off")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionId.MAN_HEATER_OFF
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
HEADER_LIST = [
|
||||
@ -125,8 +182,7 @@ HEADER_LIST = [
|
||||
]
|
||||
|
||||
|
||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
def handle_bpx_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||
if set_id == BpxSetId.GET_HK_SET:
|
||||
fmt_str = "!HHHHhhhhIB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
@ -157,7 +213,9 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
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)
|
||||
FsfwTmTcPrinter.get_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]
|
||||
@ -171,4 +229,6 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
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)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=10
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import enum
|
||||
import struct
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
pack_set_u8_param_command,
|
||||
@ -13,17 +14,16 @@ from eive_tmtc.gomspace.gomspace_common import (
|
||||
pack_reboot_command,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import OUT_ENABLE_LIST
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
from tmtccmd.config import CmdTreeNode, OpCodeEntry
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_diag_command,
|
||||
generate_one_hk_command,
|
||||
enable_periodic_hk_command_with_interval,
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ class GsInfo:
|
||||
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"
|
||||
@ -102,7 +103,7 @@ class PowerOpCodes:
|
||||
|
||||
REBOOT = ["reboot"]
|
||||
INFO_CORE = ["info"]
|
||||
REQUEST_SWITCHER_SET = ["request_switchers"]
|
||||
SWITCHER_HK = ["switcher_states"]
|
||||
ENABLE_INFO_HK = ["info_hk_on"]
|
||||
DISABLE_INFO_HK = ["info_hk_off"]
|
||||
INFO_AUX = ["info_aux"]
|
||||
@ -115,7 +116,7 @@ class PowerOpCodes:
|
||||
PRINT_LATCHUPS = ["print_latchups"]
|
||||
|
||||
|
||||
class SetId:
|
||||
class SetId(enum.IntEnum):
|
||||
CORE = 1
|
||||
AUX = 2
|
||||
CONFIG = 3
|
||||
@ -138,7 +139,7 @@ def pack_common_power_cmds(
|
||||
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetId.CORE)))
|
||||
|
||||
|
||||
def pack_common_gomspace_cmds(
|
||||
def pack_common_gomspace_cmds( # noqa C901: Complexity is okay here.
|
||||
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
@ -198,7 +199,8 @@ def pack_common_gomspace_cmds(
|
||||
if op_code in GomspaceOpCode.SAVE_TABLE_DEFAULT:
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table [0: Board Config, 1: Module Config, 2: Calibration Parameter]: "
|
||||
"Source table [0: Board Config, 1: Module Config, 2: Calibration"
|
||||
" Parameter]: "
|
||||
)
|
||||
)
|
||||
if source_table not in [0, 1, 2]:
|
||||
@ -213,8 +215,8 @@ def pack_common_gomspace_cmds(
|
||||
if op_code in GomspaceOpCode.LOAD_TABLE:
|
||||
target_table = int(
|
||||
input(
|
||||
"Target table ID [0: Board Config, 1: Module Config, 2: Calibration Parameter, "
|
||||
"4: HK TM]: "
|
||||
"Target table ID [0: Board Config, 1: Module Config, 2: Calibration"
|
||||
" Parameter, 4: HK TM]: "
|
||||
)
|
||||
)
|
||||
if target_table not in [0, 1, 2, 4]:
|
||||
@ -222,8 +224,8 @@ def pack_common_gomspace_cmds(
|
||||
if target_table != 4:
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table (file or default) [0: Board Config, 1: Module Config, "
|
||||
"2: Calibration Parameter, value + 4 for default table]: "
|
||||
"Source table (file or default) [0: Board Config, 1: Module Config,"
|
||||
" 2: Calibration Parameter, value + 4 for default table]: "
|
||||
)
|
||||
)
|
||||
if source_table not in [0, 1, 2, 4, 5, 6]:
|
||||
@ -255,7 +257,7 @@ def req_hk_cmds(
|
||||
q: DefaultPusQueueHelper,
|
||||
op_code: str,
|
||||
obj_id: bytes,
|
||||
set_id_pair: [int, int],
|
||||
set_id_pair: Tuple[int, int],
|
||||
):
|
||||
if op_code in PowerOpCodes.REQUEST_CORE_HK_ONCE:
|
||||
q.add_log_cmd(f"{prefix}: {PowerInfo.REQUEST_CORE_HK_ONCE}")
|
||||
@ -267,10 +269,6 @@ def req_hk_cmds(
|
||||
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
|
||||
|
||||
|
||||
def pack_pdu_disable_safe_off_cmd() -> PusTelecommand:
|
||||
pass
|
||||
|
||||
|
||||
def generic_on_cmd(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
|
||||
):
|
||||
@ -308,6 +306,54 @@ def add_common_power_defs(oce: OpCodeEntry):
|
||||
oce.add(keys=PowerOpCodes.DISABLE_INFO_HK, info=PowerInfo.DISABLE_INFO_HK)
|
||||
|
||||
|
||||
def add_gomspace_nodes(node: CmdTreeNode):
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.REQUEST_CORE_HK_ONCE[0], PowerInfo.REQUEST_CORE_HK_ONCE
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.REQUEST_AUX_HK_ONCE[0], PowerInfo.REQUEST_AUX_HK_ONCE)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.ENABLE_INFO_HK[0], PowerInfo.ENABLE_INFO_HK)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.DISABLE_INFO_HK[0], PowerInfo.DISABLE_INFO_HK)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.REQUEST_CORE_HK_ONCE[0],
|
||||
PowerInfo.REQUEST_CORE_HK_ONCE,
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.REQUEST_AUX_HK_ONCE[0],
|
||||
PowerInfo.REQUEST_AUX_HK_ONCE,
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.PRINT_LATCHUPS[0], PowerInfo.PRINT_LATCHUPS)
|
||||
)
|
||||
node.add_child(CmdTreeNode(GomspaceOpCode.GET_PARAM[0], GsInfo.GET_PARAMETER))
|
||||
node.add_child(CmdTreeNode(GomspaceOpCode.REBOOT[0], GsInfo.REBOOT))
|
||||
node.add_child(
|
||||
CmdTreeNode(GomspaceOpCode.SET_INTEGER_PARAM[0], GsInfo.SET_PARAMETER)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(GomspaceOpCode.REQUEST_CONFIG_TABLE[0], GsInfo.REQUEST_CONFIG_TABLE)
|
||||
)
|
||||
node.add_child(CmdTreeNode(GomspaceOpCode.SAVE_TABLE[0], GsInfo.SAVE_TABLE))
|
||||
node.add_child(
|
||||
CmdTreeNode(GomspaceOpCode.SAVE_TABLE_DEFAULT[0], GsInfo.SAVE_TABLE_DEFAULT)
|
||||
)
|
||||
node.add_child(CmdTreeNode(GomspaceOpCode.LOAD_TABLE[0], GsInfo.LOAD_TABLE))
|
||||
node.add_child(
|
||||
CmdTreeNode(GomspaceOpCode.RESET_GND_WATCHDOG[0], GsInfo.RESET_GND_WATCHDOG)
|
||||
)
|
||||
|
||||
|
||||
def add_gomspace_cmd_defs(oce: OpCodeEntry):
|
||||
oce.add(
|
||||
keys=PowerOpCodes.REQUEST_CORE_HK_ONCE,
|
||||
|
@ -5,13 +5,15 @@
|
||||
@author J. Meier
|
||||
@date 13.12.2020
|
||||
"""
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
add_gomspace_nodes,
|
||||
pack_common_gomspace_cmds,
|
||||
req_hk_cmds,
|
||||
pack_common_power_cmds,
|
||||
SetId,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
TableEntry,
|
||||
Channel,
|
||||
@ -27,20 +29,24 @@ from eive_tmtc.config.object_ids import P60_DOCK_HANDLER
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
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"]
|
||||
class CmdString:
|
||||
STACK_3V3_ON = "stack_3v3_on"
|
||||
STACK_3V3_OFF = "stack_3v3_off"
|
||||
STACK_5V_ON = "stack_5v_on"
|
||||
STACK_5V_OFF = "stack_5v_off"
|
||||
TEST = "test"
|
||||
ACU_OFF = "acu_off"
|
||||
ACU_ON = "acu_on"
|
||||
|
||||
|
||||
class P60Info:
|
||||
class CmdInfo:
|
||||
PREFIX = "P60 Dock"
|
||||
STACK_3V3_ON = f"{PREFIX}: Turn Stack 3V3 on"
|
||||
STACK_3V3_OFF = f"{PREFIX}: Turn Stack 3V3 off"
|
||||
STACK_5V_ON = f"{PREFIX}: Turn Stack 5V on"
|
||||
STACK_5V_OFF = f"{PREFIX}: Turn Stack 5V off"
|
||||
ACU_OFF = "Switch ACU off"
|
||||
ACU_ON = "Switch ACU on"
|
||||
|
||||
|
||||
class P60DockTestProcedure:
|
||||
@ -98,13 +104,15 @@ class P60DockHkTable:
|
||||
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
|
||||
|
||||
|
||||
def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
def pack_p60dock_cmds( # noqa C901: Complexity okay here.
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
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 P60OpCode.STACK_3V3_ON:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_ON)
|
||||
pack_common_power_cmds("P60 Dock", object_id, q, cmd_str)
|
||||
pack_common_gomspace_cmds("P60 Dock", object_id, q, cmd_str)
|
||||
p60_dock_req_hk_cmds(q, cmd_str)
|
||||
if cmd_str == CmdString.STACK_3V3_ON:
|
||||
q.add_log_cmd(CmdInfo.STACK_3V3_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
@ -112,8 +120,8 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCode.STACK_3V3_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_3V3_OFF)
|
||||
if cmd_str == CmdString.STACK_3V3_OFF:
|
||||
q.add_log_cmd(CmdInfo.STACK_3V3_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
@ -121,8 +129,8 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCode.STACK_5V_ON:
|
||||
q.add_log_cmd(P60Info.STACK_5V_ON)
|
||||
if cmd_str == CmdString.STACK_5V_ON:
|
||||
q.add_log_cmd(CmdInfo.STACK_5V_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
@ -130,8 +138,8 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
if op_code in P60OpCode.STACK_5V_OFF:
|
||||
q.add_log_cmd(P60Info.STACK_5V_OFF)
|
||||
if cmd_str == CmdString.STACK_5V_OFF:
|
||||
q.add_log_cmd(CmdInfo.STACK_5V_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_u8_param_command(
|
||||
objb,
|
||||
@ -237,5 +245,18 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
|
||||
q.add_pus_tc(pack_set_u16_param_command(objb, invalid_address, parameter))
|
||||
|
||||
|
||||
def create_p60_dock_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"p60_dock", "P60 PCDU dock device", hide_children_which_are_leaves=True
|
||||
)
|
||||
add_gomspace_nodes(node)
|
||||
node.add_child(CmdTreeNode(CmdString.STACK_3V3_ON, CmdInfo.STACK_3V3_ON))
|
||||
node.add_child(CmdTreeNode(CmdString.STACK_3V3_OFF, CmdInfo.STACK_3V3_OFF))
|
||||
node.add_child(CmdTreeNode(CmdString.STACK_5V_ON, CmdInfo.STACK_5V_ON))
|
||||
node.add_child(CmdTreeNode(CmdString.STACK_5V_OFF, CmdInfo.STACK_5V_OFF))
|
||||
node.add_child(CmdTreeNode(CmdString.TEST, "P60 Tests"))
|
||||
return node
|
||||
|
||||
|
||||
def p60_dock_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
req_hk_cmds("P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetId.CORE, SetId.AUX])
|
||||
|
@ -3,9 +3,18 @@
|
||||
@author J. Meier
|
||||
@date 17.12.2020
|
||||
"""
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import PDU_1_HANDLER_ID
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
pack_ping_command,
|
||||
TableIds,
|
||||
pack_get_param_command,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import PduHkTable
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
add_gomspace_nodes,
|
||||
pack_common_gomspace_cmds,
|
||||
req_hk_cmds,
|
||||
PowerOpCodes,
|
||||
@ -15,17 +24,15 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
create_generic_on_cmd,
|
||||
create_generic_off_cmd,
|
||||
pack_common_power_cmds,
|
||||
GomspaceOpCode,
|
||||
GsInfo,
|
||||
PowerInfo,
|
||||
add_common_power_defs,
|
||||
SetId,
|
||||
)
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.gomspace.gomspace_common import *
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import *
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from tmtccmd.config import CmdTreeNode, OpCodeEntry, TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Pdu1InfoBase:
|
||||
@ -67,13 +74,13 @@ class PDU1TestProcedure:
|
||||
turn_channel_3_off = False
|
||||
|
||||
|
||||
def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str):
|
||||
q.add_log_cmd("Commanding PDU1")
|
||||
objb = object_id.as_bytes
|
||||
pdu1_switch_cmds(q, op_code)
|
||||
pdu1_req_hk_cmds(q, op_code)
|
||||
pack_common_power_cmds("PDU1", object_id, q, op_code)
|
||||
pack_common_gomspace_cmds("PDU1", object_id, q, op_code)
|
||||
pdu1_switch_cmds(q, cmd_str)
|
||||
pdu1_req_hk_cmds(q, cmd_str)
|
||||
pack_common_power_cmds("PDU1", object_id, q, cmd_str)
|
||||
pack_common_gomspace_cmds("PDU1", object_id, q, cmd_str)
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
|
||||
q.add_log_cmd("PDU1: Ping Test")
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
@ -102,38 +109,40 @@ def info_off_pdu1(base: str) -> str:
|
||||
return "PDU1: " + base + " off"
|
||||
|
||||
|
||||
def pdu1_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in PowerOpCodes.TCS_ON:
|
||||
def pdu1_switch_cmds( # noqa C901: Complexity is okay here.
|
||||
q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa C901: Complexity okay here
|
||||
if cmd_str in PowerOpCodes.TCS_ON:
|
||||
tcs_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.TCS_OFF:
|
||||
elif cmd_str in PowerOpCodes.TCS_OFF:
|
||||
tcs_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.SYRLINKS_ON:
|
||||
elif cmd_str in PowerOpCodes.SYRLINKS_ON:
|
||||
syrlinks_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.SYRLINKS_OFF:
|
||||
elif cmd_str in PowerOpCodes.SYRLINKS_OFF:
|
||||
syrlinks_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.STAR_TRACKER_ON:
|
||||
elif cmd_str in PowerOpCodes.STAR_TRACKER_ON:
|
||||
startracker_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.STAR_TRACKER_OFF:
|
||||
elif cmd_str in PowerOpCodes.STAR_TRACKER_OFF:
|
||||
startracker_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.MGT_ON:
|
||||
elif cmd_str in PowerOpCodes.MGT_ON:
|
||||
mgt_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.MGT_OFF:
|
||||
elif cmd_str in PowerOpCodes.MGT_OFF:
|
||||
mgt_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.SUS_N_ON:
|
||||
elif cmd_str in PowerOpCodes.SUS_N_ON:
|
||||
sun_sensor_nominal_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.SUS_N_OFF:
|
||||
elif cmd_str in PowerOpCodes.SUS_N_OFF:
|
||||
sun_sensor_nominal_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.SCEX_ON:
|
||||
elif cmd_str in PowerOpCodes.SCEX_ON:
|
||||
solar_cell_experiment_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.SCEX_OFF:
|
||||
elif cmd_str in PowerOpCodes.SCEX_OFF:
|
||||
solar_cell_experiment_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.PLOC_ON:
|
||||
elif cmd_str in PowerOpCodes.PLOC_ON:
|
||||
ploc_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.PLOC_OFF:
|
||||
elif cmd_str in PowerOpCodes.PLOC_OFF:
|
||||
ploc_off_cmd(q)
|
||||
elif op_code in PowerOpCodes.ACS_A_ON:
|
||||
elif cmd_str in PowerOpCodes.ACS_A_ON:
|
||||
acs_board_a_on_cmd(q)
|
||||
elif op_code in PowerOpCodes.ACS_A_OFF:
|
||||
elif cmd_str in PowerOpCodes.ACS_A_OFF:
|
||||
acs_board_a_off_cmd(q)
|
||||
|
||||
|
||||
@ -156,6 +165,67 @@ def add_pdu1_common_defs(oce: OpCodeEntry):
|
||||
oce.add(keys=PowerOpCodes.SCEX_OFF, info=info_off_pdu1(Pdu1InfoBase.SCEX))
|
||||
|
||||
|
||||
def add_pdu1_subnodes(node: CmdTreeNode):
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.TCS_ON[0], info_on_pdu1(Pdu1InfoBase.TCS)))
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.TCS_OFF[0], info_off_pdu1(Pdu1InfoBase.TCS))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.STAR_TRACKER_ON[0], info_on_pdu1(Pdu1InfoBase.STR))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.STAR_TRACKER_OFF[0], info_off_pdu1(Pdu1InfoBase.STR))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SUS_N_ON[0], info_on_pdu1(Pdu1InfoBase.SUS_N))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SUS_N_OFF[0], info_off_pdu1(Pdu1InfoBase.SUS_N))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.ACS_A_ON[0], info_on_pdu1(Pdu1InfoBase.ACS_A))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.ACS_A_OFF[0], info_off_pdu1(Pdu1InfoBase.ACS_A))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SYRLINKS_ON[0], info_on_pdu1(Pdu1InfoBase.SYRLINKS))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SYRLINKS_OFF[0], info_off_pdu1(Pdu1InfoBase.SYRLINKS))
|
||||
)
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.MGT_ON[0], info_on_pdu1(Pdu1InfoBase.MGT)))
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.MGT_OFF[0], info_off_pdu1(Pdu1InfoBase.MGT))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.PLOC_ON[0], info_on_pdu1(Pdu1InfoBase.PLOC))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.PLOC_OFF[0], info_off_pdu1(Pdu1InfoBase.PLOC))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SCEX_ON[0], info_on_pdu1(Pdu1InfoBase.SCEX))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SCEX_OFF[0], info_off_pdu1(Pdu1InfoBase.SCEX))
|
||||
)
|
||||
|
||||
|
||||
def create_pdu1_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"pdu1", "P60 PCDU PDU1 device", hide_children_which_are_leaves=True
|
||||
)
|
||||
add_gomspace_nodes(node)
|
||||
add_pdu1_subnodes(node)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PRINT_SWITCH_V_I[0], "PDU1: Print Switches, Voltages, Currents"
|
||||
)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -166,7 +236,6 @@ def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
|
||||
keys=PowerOpCodes.PRINT_SWITCH_V_I,
|
||||
info="PDU1: Print Switches, Voltages, Currents",
|
||||
)
|
||||
oce.add(keys=GomspaceOpCode.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.PDU1.value,
|
||||
@ -181,6 +250,7 @@ PDU1_DICT = {
|
||||
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
|
||||
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
|
||||
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
|
||||
Pdu1ChIndex.PLOC: Pdu1InfoBase.PLOC,
|
||||
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
|
||||
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
|
||||
}
|
||||
@ -255,7 +325,7 @@ def mgt_off_cmd(q: DefaultPusQueueHelper):
|
||||
|
||||
|
||||
def create_mgt_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
|
||||
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
|
||||
|
||||
|
||||
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
|
||||
|
@ -6,8 +6,20 @@
|
||||
@author J. Meier
|
||||
@date 17.12.2020
|
||||
"""
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.object_ids import PDU_2_HANDLER_ID
|
||||
from eive_tmtc.gomspace.gomspace_common import (
|
||||
pack_reboot_command,
|
||||
pack_ping_command,
|
||||
pack_gnd_wdt_reset_command,
|
||||
pack_get_param_command,
|
||||
TableIds,
|
||||
pack_request_full_hk_table_command,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import PduHkTable, PduConfigTable
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
add_gomspace_nodes,
|
||||
pack_common_gomspace_cmds,
|
||||
req_hk_cmds,
|
||||
PowerOpCodes,
|
||||
@ -20,10 +32,11 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
SetId,
|
||||
add_common_power_defs,
|
||||
)
|
||||
from eive_tmtc.gomspace.gomspace_common import *
|
||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import *
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import CmdTreeNode, OpCodeEntry, TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Pdu2InfoBase:
|
||||
@ -76,13 +89,13 @@ class PDU2TestProcedure:
|
||||
request_hk_table = False
|
||||
|
||||
|
||||
def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
||||
def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str):
|
||||
q.add_log_cmd("Testing PDU2")
|
||||
objb = object_id.as_bytes
|
||||
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)
|
||||
pdu2_switch_cmds(q, cmd_str)
|
||||
pdu2_req_hk_cmds(q, cmd_str)
|
||||
pack_common_power_cmds("PDU2", object_id, q, cmd_str)
|
||||
pack_common_gomspace_cmds("PDU2", object_id, q, cmd_str)
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
|
||||
q.add_log_cmd("PDU2: Reboot")
|
||||
q.add_pus_tc(pack_reboot_command(object_id))
|
||||
@ -159,7 +172,86 @@ def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
def add_pdu2_subnodes(node: CmdTreeNode):
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.ACS_B_ON[0], info_on_pdu2(Pdu2InfoBase.ACS_B))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.ACS_B_OFF[0], info_off_pdu2(Pdu2InfoBase.ACS_B))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SUS_R_ON[0], info_on_pdu2(Pdu2InfoBase.SUS_R))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.SUS_R_OFF[0], info_off_pdu2(Pdu2InfoBase.SUS_R))
|
||||
)
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.RW_ON[0], info_on_pdu2(Pdu2InfoBase.RW)))
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.RW_OFF[0], info_off_pdu2(Pdu2InfoBase.RW)))
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PL_PCDU_VBAT_NOM_ON[0],
|
||||
info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PL_PCDU_VBAT_NOM_OFF[0],
|
||||
info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PL_PCDU_VBAT_RED_ON[0],
|
||||
info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PL_PCDU_VBAT_RED_OFF[0],
|
||||
info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.HEATER_ON[0], info_on_pdu2(Pdu2InfoBase.HEATER))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.HEATER_OFF[0], info_off_pdu2(Pdu2InfoBase.HEATER))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.SOLAR_ARRAY_DEPL_ON[0],
|
||||
info_on_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.SOLAR_ARRAY_DEPL_OFF[0],
|
||||
info_off_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.PL_CAM_ON[0], info_on_pdu2(Pdu2InfoBase.PL_CAM))
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.PL_CAM_OFF[0], info_off_pdu2(Pdu2InfoBase.PL_CAM))
|
||||
)
|
||||
|
||||
|
||||
def create_pdu2_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"pdu2", "P60 PCDU PDU2 device", hide_children_which_are_leaves=True
|
||||
)
|
||||
add_gomspace_nodes(node)
|
||||
add_pdu2_subnodes(node)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
PowerOpCodes.PRINT_SWITCH_V_I[0], "PDU2: Print Switches, Voltages, Currents"
|
||||
)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str): # noqa C901
|
||||
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:
|
||||
@ -284,7 +376,7 @@ def heater_off_cmd(q: DefaultPusQueueHelper):
|
||||
|
||||
|
||||
def create_heater_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
|
||||
|
||||
|
||||
def sus_red_on_cmd(q: DefaultPusQueueHelper):
|
||||
@ -372,4 +464,4 @@ def payload_camera_off_cmd(q: DefaultPusQueueHelper):
|
||||
|
||||
|
||||
def create_payload_camera_off_cmd() -> PusTelecommand:
|
||||
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
|
||||
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
|
||||
|
@ -13,50 +13,91 @@ from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
PCDU_HANDLER_ID,
|
||||
get_object_ids,
|
||||
)
|
||||
from eive_tmtc.tmtc.power.pdu1 import (
|
||||
add_pdu1_subnodes,
|
||||
pdu1_req_hk_cmds,
|
||||
pdu1_switch_cmds,
|
||||
add_pdu1_common_defs,
|
||||
add_pdu1_cmds,
|
||||
)
|
||||
from eive_tmtc.tmtc.power.pdu2 import (
|
||||
add_pdu2_subnodes,
|
||||
pdu2_req_hk_cmds,
|
||||
add_pdu2_common_defs,
|
||||
pdu2_switch_cmds,
|
||||
add_pdu2_cmds,
|
||||
)
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry
|
||||
from eive_tmtc.config.object_ids import PCDU_HANDLER_ID
|
||||
|
||||
from eive_tmtc.tmtc.power.p60dock import P60OpCode, P60Info, p60_dock_req_hk_cmds
|
||||
from eive_tmtc.tmtc.power.p60dock import CmdString, CmdInfo, 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
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_request_one_diag_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
SWITCHER_SET = 0
|
||||
|
||||
|
||||
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
pdu1_switch_cmds(q, op_code)
|
||||
pdu2_switch_cmds(q, op_code)
|
||||
if op_code in PowerOpCodes.INFO_CORE:
|
||||
class PcduSetIds(enum.IntEnum):
|
||||
SWITCHER_SET = 0
|
||||
|
||||
|
||||
class PcduSwitches(enum.IntEnum):
|
||||
PDU1_CH0_TCS_BOARD_3V3 = 0
|
||||
PDU1_CH1_SYRLINKS_12V = 1
|
||||
PDU1_CH2_STAR_TRACKER_5V = 2
|
||||
PDU1_CH3_MGT_5V = 3
|
||||
PDU1_CH4_SUS_NOMINAL_3V3 = 4
|
||||
PDU1_CH5_SOLAR_CELL_EXP_5V = 5
|
||||
PDU1_CH6_PLOC_12V = 6
|
||||
PDU1_CH7_ACS_A_SIDE_3V3 = 7
|
||||
PDU1_CH8_UNOCCUPIED = 8
|
||||
|
||||
PDU2_CH0_Q7S = 9
|
||||
PDU2_CH1_PL_PCDU_BATT_0_14V8 = 10
|
||||
PDU2_CH2_RW_5V = 11
|
||||
PDU2_CH3_TCS_BOARD_HEATER_IN_8V = 12
|
||||
PDU2_CH4_SUS_REDUNDANT_3V3 = 13
|
||||
PDU2_CH5_DEPLOYMENT_MECHANISM_8V = 14
|
||||
PDU2_CH6_PL_PCDU_BATT_1_14V8 = 15
|
||||
PDU2_CH7_ACS_BOARD_SIDE_B_3V3 = 16
|
||||
PDU2_CH8_PAYLOAD_CAMERA = 17
|
||||
|
||||
P60_DOCK_5V_STACK = 18
|
||||
P60_DOCK_3V3_STACK = 19
|
||||
|
||||
|
||||
def pack_power_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
pdu1_switch_cmds(q, cmd_str)
|
||||
pdu2_switch_cmds(q, cmd_str)
|
||||
if cmd_str 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 cmd_str 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])
|
||||
p60_dock_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
acu_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
q.add_wait_seconds(8.0)
|
||||
elif op_code in PowerOpCodes.INFO_AUX:
|
||||
elif cmd_str in PowerOpCodes.INFO_AUX:
|
||||
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
pdu2_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
p60_dock_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
acu_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
q.add_wait_seconds(8.0)
|
||||
elif op_code in PowerOpCodes.INFO_ALL:
|
||||
elif cmd_str in PowerOpCodes.INFO_ALL:
|
||||
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
pdu2_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
@ -66,49 +107,56 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
acu_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
|
||||
acu_req_hk_cmds(q, PowerOpCodes.REQUEST_AUX_HK_ONCE[0])
|
||||
q.add_wait_seconds(8.0)
|
||||
elif op_code in PowerOpCodes.RESET_ALL_GND_WDTS:
|
||||
elif cmd_str in PowerOpCodes.RESET_ALL_GND_WDTS:
|
||||
oids = get_object_ids()
|
||||
pack_reset_gnd_wdt_cmd(q, "P60 Dock", oids[P60_DOCK_HANDLER])
|
||||
pack_reset_gnd_wdt_cmd(q, "ACU", oids[ACU_HANDLER_ID])
|
||||
pack_reset_gnd_wdt_cmd(q, "PDU1", oids[PDU_1_HANDLER_ID])
|
||||
pack_reset_gnd_wdt_cmd(q, "PDU2", oids[PDU_2_HANDLER_ID])
|
||||
q.add_wait_seconds(5.0)
|
||||
elif op_code in PowerOpCodes.REQUEST_SWITCHER_SET:
|
||||
q.add_log_cmd("PCDU: Requesting Switcher Set")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
make_sid(PCDU_HANDLER_ID, SetId.SWITCHER_SET)
|
||||
)
|
||||
)
|
||||
if q.empty():
|
||||
logging.getLogger(__name__).info(
|
||||
f"Queue is empty, no stack for op code {op_code}"
|
||||
f"Queue is empty, no stack for op code {cmd_str}"
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_p60_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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)
|
||||
oce.add(keys=CmdString.STACK_3V3_ON, info=CmdInfo.STACK_3V3_ON)
|
||||
oce.add(keys=CmdString.STACK_3V3_OFF, info=CmdInfo.STACK_3V3_OFF)
|
||||
oce.add(keys=CmdString.STACK_5V_ON, info=CmdInfo.STACK_5V_ON)
|
||||
oce.add(keys=CmdString.STACK_5V_OFF, info=CmdInfo.STACK_5V_OFF)
|
||||
add_gomspace_cmd_defs(oce)
|
||||
oce.add(keys=P60OpCode.TEST, info="P60 Tests")
|
||||
oce.add(keys=CmdString.TEST, info="P60 Tests")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce
|
||||
)
|
||||
|
||||
|
||||
def create_power_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("power", "Power commands", hide_children_which_are_leaves=True)
|
||||
add_pdu1_subnodes(node)
|
||||
add_pdu2_subnodes(node)
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.SWITCHER_HK[0], PowerInfo.SWITCHER_HK))
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.INFO_ALL[0], PowerInfo.INFO_ALL))
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.INFO_CORE[0], PowerInfo.INFO_CORE))
|
||||
node.add_child(CmdTreeNode(PowerOpCodes.INFO_AUX[0], PowerInfo.INFO_AUX))
|
||||
node.add_child(
|
||||
CmdTreeNode(PowerOpCodes.RESET_ALL_GND_WDTS[0], PowerInfo.RESET_ALL_GND_WDTS)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
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)
|
||||
oce.add(keys=PowerOpCodes.REQUEST_SWITCHER_SET, info=PowerInfo.REQUEST_SWITCHER_SET)
|
||||
oce.add(keys=PowerOpCodes.RESET_ALL_GND_WDTS, info=PowerInfo.RESET_ALL_GND_WDTS)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.POWER.value,
|
||||
|
287
eive_tmtc/tmtc/power/pwr_ctrl.py
Normal file
287
eive_tmtc/tmtc/power/pwr_ctrl.py
Normal file
@ -0,0 +1,287 @@
|
||||
import datetime
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import (
|
||||
create_scalar_double_parameter,
|
||||
create_scalar_float_parameter,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_command
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
enable_periodic_hk_command_with_interval,
|
||||
generate_one_hk_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.tmtc.queue import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import PWR_CONTROLLER
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
CORE_HK_SET = 0
|
||||
ENABLE_PL_SET = 1
|
||||
|
||||
|
||||
# class ActionId(enum.IntEnum):
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
BATTERY_INTERNAL_RESISTANCE = 0
|
||||
BATTERY_MAXIMUM_CAPACITY = 1
|
||||
COULOMB_COUNTER_VOLTAGE_UPPER_THRESHOLD = 2
|
||||
MAX_ALLOWED_TIME_DIFF = 3
|
||||
PAYLOAD_OP_LIMIT_ON = 4
|
||||
PAYLOAD_OP_LIMIT_LOW = 5
|
||||
HIGHER_MODES_LIMIT = 6
|
||||
|
||||
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NML = "normal"
|
||||
SET_PARAMETER = "set_parameter"
|
||||
REQUEST_CORE_HK = "core_hk"
|
||||
ENABLE_CORE_HK = "core_enable_hk"
|
||||
DISABLE_CORE_HK = "core_disable_hk"
|
||||
REQUEST_ENABLE_PL_HK = "enable_pl_hk"
|
||||
ENABLE_ENABLE_PL_HK = "enable_pl_enable_hk"
|
||||
DISABLE_ENABLE_PL_HK = "enable_pl_disable_hk"
|
||||
|
||||
|
||||
class Info:
|
||||
OFF = "PWR Ctrl Mode to OFF"
|
||||
ON = "PWR Ctrl Mode to ON"
|
||||
NML = "PWR Ctrl Mode to NORMAL"
|
||||
SET_PARAMETER = "Set Parameter"
|
||||
REQUEST_CORE_HK = "Request Core HK once"
|
||||
ENABLE_CORE_HK = "Enable Core HK Data Generation"
|
||||
DISABLE_CORE_HK = "Disable Core HK Data Generation"
|
||||
REQUEST_ENABLE_PL_HK = "Request Enable PL HK once"
|
||||
ENABLE_ENABLE_PL_HK = "Enable Enable PL HK Data Generation"
|
||||
DISABLE_ENABLE_PL_HK = "Disable Enable PL HK Data Generation"
|
||||
|
||||
|
||||
def create_pwr_ctrl_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("pwr_ctrl", "Power Controller", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
def pack_power_ctrl_command(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"{Info.OFF}")
|
||||
q.add_pus_tc(pack_mode_command(PWR_CONTROLLER, Mode.OFF, 0))
|
||||
elif cmd_str == OpCode.ON:
|
||||
q.add_log_cmd(f"{Info.ON}")
|
||||
q.add_pus_tc(pack_mode_command(PWR_CONTROLLER, Mode.ON, 0))
|
||||
elif cmd_str == OpCode.NML:
|
||||
q.add_log_cmd(f"{Info.NML}")
|
||||
q.add_pus_tc(pack_mode_command(PWR_CONTROLLER, Mode.NORMAL, 0))
|
||||
elif cmd_str in OpCode.SET_PARAMETER:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER}")
|
||||
set_pwr_ctrl_param(q)
|
||||
elif cmd_str == OpCode.REQUEST_CORE_HK:
|
||||
q.add_log_cmd(Info.REQUEST_CORE_HK)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(PWR_CONTROLLER, SetId.CORE_HK_SET))
|
||||
)
|
||||
elif cmd_str == OpCode.ENABLE_CORE_HK:
|
||||
interval = float(input("Please specify interval in floating point seconds: "))
|
||||
q.add_log_cmd(Info.ENABLE_CORE_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(
|
||||
False, make_sid(PWR_CONTROLLER, SetId.CORE_HK_SET), interval
|
||||
)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif cmd_str == OpCode.DISABLE_CORE_HK:
|
||||
q.add_log_cmd(Info.DISABLE_CORE_HK)
|
||||
q.add_pus_tc(
|
||||
disable_periodic_hk_command(
|
||||
False, make_sid(PWR_CONTROLLER, SetId.CORE_HK_SET)
|
||||
)
|
||||
)
|
||||
elif cmd_str == OpCode.REQUEST_ENABLE_PL_HK:
|
||||
q.add_log_cmd(Info.REQUEST_ENABLE_PL_HK)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(PWR_CONTROLLER, SetId.ENABLE_PL_SET))
|
||||
)
|
||||
elif cmd_str == OpCode.ENABLE_ENABLE_PL_HK:
|
||||
interval = float(input("Please specify interval in floating point seconds: "))
|
||||
q.add_log_cmd(Info.ENABLE_ENABLE_PL_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(
|
||||
False, make_sid(PWR_CONTROLLER, SetId.ENABLE_PL_SET), interval
|
||||
)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif cmd_str == OpCode.DISABLE_ENABLE_PL_HK:
|
||||
q.add_log_cmd(Info.DISABLE_ENABLE_PL_HK)
|
||||
q.add_pus_tc(
|
||||
disable_periodic_hk_command(
|
||||
False, make_sid(PWR_CONTROLLER, SetId.ENABLE_PL_SET)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def set_pwr_ctrl_param(q: DefaultPusQueueHelper):
|
||||
for val in ParamId:
|
||||
print("{:<2}: {:<20}".format(val, val.name))
|
||||
param = int(input("Specify parameter to set \n" ""))
|
||||
match param:
|
||||
case ParamId.BATTERY_INTERNAL_RESISTANCE:
|
||||
value = float(input("Specify parameter value to set [Ohm]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.BATTERY_INTERNAL_RESISTANCE,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.BATTERY_MAXIMUM_CAPACITY:
|
||||
value = float(input("Specify parameter value to set [Ah]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.BATTERY_MAXIMUM_CAPACITY,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.COULOMB_COUNTER_VOLTAGE_UPPER_THRESHOLD:
|
||||
value = float(input("Specify parameter value to set [V]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.COULOMB_COUNTER_VOLTAGE_UPPER_THRESHOLD,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.MAX_ALLOWED_TIME_DIFF:
|
||||
value = float(input("Specify parameter value to set [s]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_double_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.MAX_ALLOWED_TIME_DIFF,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.PAYLOAD_OP_LIMIT_ON:
|
||||
value = float(input("Specify parameter value to set [1]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.PAYLOAD_OP_LIMIT_ON,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.PAYLOAD_OP_LIMIT_LOW:
|
||||
value = float(input("Specify parameter value to set [1]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.PAYLOAD_OP_LIMIT_LOW,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
case ParamId.HIGHER_MODES_LIMIT:
|
||||
value = float(input("Specify parameter value to set [1]: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_float_parameter(
|
||||
object_id=PWR_CONTROLLER,
|
||||
domain_id=0,
|
||||
unique_id=ParamId.HIGHER_MODES_LIMIT,
|
||||
parameter=value,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def handle_pwr_ctrl_hk_data(
|
||||
pw: PrintWrapper,
|
||||
set_id: int,
|
||||
hk_data: bytes,
|
||||
packet_time: datetime.datetime,
|
||||
):
|
||||
pw.ilog(_LOGGER, f"Received PWR CTRL HK with packet time {packet_time}")
|
||||
match set_id:
|
||||
case SetId.CORE_HK_SET:
|
||||
handle_core_hk_data(pw, hk_data)
|
||||
case SetId.ENABLE_PL_SET:
|
||||
handle_enable_pl_data(pw, hk_data)
|
||||
|
||||
|
||||
def handle_core_hk_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received Core HK Set")
|
||||
fmt_int16 = "!h"
|
||||
fmt_float = "!f"
|
||||
inc_len_int16 = struct.calcsize(fmt_int16)
|
||||
inc_len_float = struct.calcsize(fmt_float)
|
||||
if len(hk_data) < inc_len_int16 + 2 * inc_len_float:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
total_battery_current = struct.unpack(
|
||||
fmt_int16, hk_data[current_idx : current_idx + inc_len_int16]
|
||||
)[0]
|
||||
current_idx += inc_len_int16
|
||||
open_circuit_voltage_charge = struct.unpack(
|
||||
fmt_float, hk_data[current_idx : current_idx + inc_len_float]
|
||||
)[0]
|
||||
current_idx += inc_len_float
|
||||
coulomb_counter_charge = struct.unpack(
|
||||
fmt_float, hk_data[current_idx : current_idx + inc_len_float]
|
||||
)[0]
|
||||
current_idx += inc_len_float
|
||||
pw.dlog(f"Total Battery Current: {total_battery_current} [mA]")
|
||||
pw.dlog(f"Open Circuit Voltage Charge: {open_circuit_voltage_charge*100:8.3f} [%]")
|
||||
pw.dlog(f"Coulomb Counter Charge: {coulomb_counter_charge*100:8.3f} [%]")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||
|
||||
|
||||
def handle_enable_pl_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received Enable PL HK Set")
|
||||
fmt_uint16 = "!B"
|
||||
inc_len_uint16 = struct.calcsize(fmt_uint16)
|
||||
if len(hk_data) < inc_len_uint16:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
pl_use_allowed = struct.unpack(
|
||||
fmt_uint16, hk_data[current_idx : current_idx + inc_len_uint16]
|
||||
)[0]
|
||||
current_idx += inc_len_uint16
|
||||
pw.dlog(f"PL Use Allowed: {pl_use_allowed}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=1)
|
62
eive_tmtc/tmtc/power/subsystem.py
Normal file
62
eive_tmtc/tmtc/power/subsystem.py
Normal file
@ -0,0 +1,62 @@
|
||||
import enum
|
||||
from typing import Dict, Tuple
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import EPS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
||||
OFF = "off"
|
||||
NML = "normal"
|
||||
REPORT_ALL_MODES = "all_modes"
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
OFF = "Off Mode Command"
|
||||
NML = "Normal Mode Command"
|
||||
REPORT_ALL_MODES = "Report All Modes Recursively"
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||
OpCode.OFF: (Mode.OFF, 0, Info.OFF),
|
||||
OpCode.NML: (Mode.NORMAL, 0, Info.NML),
|
||||
}
|
||||
|
||||
|
||||
def build_eps_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
info_prefix = "EPS Subsystem"
|
||||
if cmd_str 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,
|
||||
app_data=EPS_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
mode_info_tup = HANDLER_LIST.get(cmd_str)
|
||||
if mode_info_tup is None:
|
||||
return
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=EPS_SUBSYSTEM_ID,
|
||||
info=f"{info_prefix}: {mode_info_tup[2]}",
|
||||
mode=mode_info_tup[0],
|
||||
submode=mode_info_tup[1],
|
||||
q=q,
|
||||
)
|
||||
|
||||
|
||||
def create_eps_subsystem_node() -> CmdTreeNode:
|
||||
eps_node = CmdTreeNode("eps", "EPS Subsystem")
|
||||
for cmd_str, (_, _, info) in HANDLER_LIST.items():
|
||||
eps_node.add_child(CmdTreeNode(cmd_str, info))
|
||||
eps_node.add_child(CmdTreeNode(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES))
|
||||
return eps_node
|
@ -1,5 +1,9 @@
|
||||
import dataclasses
|
||||
import struct
|
||||
import logging
|
||||
import sqlite3
|
||||
from typing import List, Tuple
|
||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||
|
||||
from eive_tmtc.tmtc.power.acu import acu_config_table_handler
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
@ -7,8 +11,9 @@ from eive_tmtc.tmtc.power.common_power import (
|
||||
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 tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.gomspace.gomspace_common import GomspaceDeviceActionId
|
||||
from eive_tmtc.config.object_ids import (
|
||||
@ -18,6 +23,8 @@ from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
P60_INDEX_LIST = [
|
||||
"ACU VCC",
|
||||
"PDU1 VCC",
|
||||
@ -74,8 +81,8 @@ class WdtInfo:
|
||||
self.pw.dlog(wdt_info)
|
||||
for idx in range(len(self.wdt_reboots_list)):
|
||||
self.pw.dlog(
|
||||
f"{WDT_LIST[idx].ljust(5)} | "
|
||||
f"{self.wdt_reboots_list[idx]:010} | {self.time_pings_left_list[idx]:010}",
|
||||
f"{WDT_LIST[idx].ljust(5)} | {self.wdt_reboots_list[idx]:010} |"
|
||||
f" {self.time_pings_left_list[idx]:010}",
|
||||
)
|
||||
|
||||
def parse(self, wdt_data: bytes, current_idx: int) -> int:
|
||||
@ -118,7 +125,7 @@ class DevicesInfoParser:
|
||||
return current_idx
|
||||
|
||||
def print(self, pw: PrintWrapper):
|
||||
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
||||
pw.dlog("Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
||||
for i in range(len(self.dev_types)):
|
||||
pw.dlog(
|
||||
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
|
||||
@ -145,18 +152,31 @@ class DevicesInfoParser:
|
||||
return "Unknown Type"
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class PduData:
|
||||
boot_count: int
|
||||
batt_mode: int
|
||||
temperature: float
|
||||
vcc: int
|
||||
vbat: int
|
||||
out_enables: List[bool]
|
||||
voltages: List[int]
|
||||
currents: List[int]
|
||||
|
||||
|
||||
def handle_pdu_data(
|
||||
printer: FsfwTmTcPrinter, pdu_idx: int, set_id: int, hk_data: bytes
|
||||
hk_data: bytes,
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
pdu_idx: int,
|
||||
set_id: int,
|
||||
):
|
||||
pw = PrintWrapper(printer=printer)
|
||||
current_idx = 0
|
||||
priv_idx = pdu_idx - 1
|
||||
if set_id == SetId.AUX or set_id == SetId.AUX:
|
||||
fmt_str = "!hhBBBIIH"
|
||||
fmt_str = "!BBBIIH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
vcc,
|
||||
vbat,
|
||||
conv_enb_0,
|
||||
conv_enb_1,
|
||||
conv_enb_2,
|
||||
@ -164,7 +184,6 @@ def handle_pdu_data(
|
||||
uptime,
|
||||
reset_cause,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV")
|
||||
pw.dlog(f"Converter Enables [{conv_enb_0},{conv_enb_1},{conv_enb_2}]")
|
||||
pw.dlog(
|
||||
f"Boot Cause {boot_cause} | Uptime {uptime} | Reset Cause {reset_cause}",
|
||||
@ -186,7 +205,7 @@ def handle_pdu_data(
|
||||
wdt = WdtInfo(pw=pw)
|
||||
current_idx = wdt.parse(wdt_data=hk_data[current_idx:], current_idx=current_idx)
|
||||
wdt.print()
|
||||
pw.dlog(f"PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
|
||||
pw.dlog("PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
|
||||
dev_parser.print(pw=pw)
|
||||
if set_id == SetId.CORE or set_id == SetId.CORE:
|
||||
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
|
||||
@ -215,20 +234,98 @@ def handle_pdu_data(
|
||||
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||
)
|
||||
pw.dlog(content_line)
|
||||
fmt_str = "!IBf"
|
||||
fmt_str = "!IBfhh"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(boot_count, batt_mode, temperature) = struct.unpack(
|
||||
(boot_count, batt_mode, temperature, vcc, vbat) = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
info = (
|
||||
f"Boot Count {boot_count} | Battery Mode {batt_mode} | "
|
||||
f"Temperature {temperature}"
|
||||
f"Temperature {temperature} | VCC {vcc} | VBAT {vbat}"
|
||||
)
|
||||
pw.dlog(info)
|
||||
try:
|
||||
handle_pdu_db_insertion(
|
||||
hk_info,
|
||||
pdu_idx,
|
||||
PduData(
|
||||
boot_count,
|
||||
batt_mode,
|
||||
temperature,
|
||||
vcc,
|
||||
vbat,
|
||||
output_enb_list,
|
||||
voltage_list,
|
||||
current_list,
|
||||
),
|
||||
)
|
||||
except sqlite3.OperationalError as e:
|
||||
_LOGGER.warning(f"SQLite error {e}")
|
||||
_LOGGER.info(info)
|
||||
|
||||
|
||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer=printer)
|
||||
def handle_pdu_db_insertion(
|
||||
hk_info: HkTmInfo,
|
||||
pdu_idx: int,
|
||||
pdu_data: PduData,
|
||||
):
|
||||
cursor = hk_info.db_con.cursor()
|
||||
if pdu_idx == 1:
|
||||
tbl_base_name = "pdu1"
|
||||
channel_list = PDU1_CHANNELS_NAMES
|
||||
else:
|
||||
tbl_base_name = "pdu2"
|
||||
channel_list = PDU2_CHANNELS_NAMES
|
||||
cursor.execute(
|
||||
f"""
|
||||
CREATE TABLE IF NOT EXISTS {tbl_base_name}(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
boot_count NUM,
|
||||
bat_mode NUM,
|
||||
temp REAL,
|
||||
vcc NUM,
|
||||
vbat NUM
|
||||
)"""
|
||||
)
|
||||
cursor.execute(
|
||||
f"INSERT INTO {tbl_base_name} VALUES(?, ?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
str(hk_info.packet_uuid),
|
||||
hk_info.packet_datetime,
|
||||
pdu_data.boot_count,
|
||||
pdu_data.batt_mode,
|
||||
pdu_data.temperature,
|
||||
pdu_data.vcc,
|
||||
pdu_data.vbat,
|
||||
),
|
||||
)
|
||||
|
||||
for idx, name in enumerate(channel_list):
|
||||
words = name.split()
|
||||
camel_case_name = "_".join(word.lower() for word in words)
|
||||
tbl_name = f"{tbl_base_name}_{camel_case_name}"
|
||||
cursor.execute(
|
||||
f"""
|
||||
CREATE TABLE IF NOT EXISTS {tbl_name}(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
out_enable NUM,
|
||||
voltage NUM,
|
||||
current NUM
|
||||
)"""
|
||||
)
|
||||
value_tuple = (
|
||||
str(hk_info.packet_uuid),
|
||||
hk_info.packet_datetime,
|
||||
pdu_data.out_enables[idx],
|
||||
pdu_data.voltages[idx],
|
||||
pdu_data.currents[idx],
|
||||
)
|
||||
cursor.execute(f"INSERT INTO {tbl_name} VALUES(?, ?, ?, ?, ?)", value_tuple)
|
||||
hk_info.db_con.commit()
|
||||
|
||||
|
||||
def handle_p60_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.CORE:
|
||||
pw.dlog("Received P60 Core HK. Voltages in mV, currents in mA")
|
||||
current_idx = 0
|
||||
@ -275,7 +372,9 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
temps = f"In C: Temp 0 {temp_0} | Temp 1 {temp_1} | "
|
||||
pw.dlog(temps)
|
||||
pw.dlog(batt_info)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=9
|
||||
)
|
||||
if set_id == SetId.AUX:
|
||||
pw.dlog("Received P60 AUX HK. Voltages in mV, currents in mA")
|
||||
current_idx = 0
|
||||
@ -331,8 +430,9 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
)
|
||||
pw.dlog(misc_info)
|
||||
batt_info = (
|
||||
f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0} | "
|
||||
f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}"
|
||||
f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0} |"
|
||||
f" Charge Current {batt_charge_current} | Discharge Current"
|
||||
f" {batt_discharge_current}"
|
||||
)
|
||||
pw.dlog(batt_info)
|
||||
pw.dlog(
|
||||
@ -340,7 +440,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
"6:TempSens(BatPack)|7:TempSens(BatPack)"
|
||||
)
|
||||
dev_parser.print(pw=pw)
|
||||
printer.print_validity_buffer(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||
)
|
||||
|
||||
@ -353,8 +453,7 @@ def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[
|
||||
return current_idx, u16_list
|
||||
|
||||
|
||||
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer=printer)
|
||||
def handle_acu_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.CORE:
|
||||
mppt_mode = hk_data[0]
|
||||
current_idx = 1
|
||||
@ -382,9 +481,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
current_idx += inc_len
|
||||
pw.dlog("Received ACU Core HK. Voltages in mV, currents in mA")
|
||||
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV | MPPT Mode {mppt_mode}")
|
||||
header_str = (
|
||||
f"Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
|
||||
)
|
||||
header_str = "Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
|
||||
pw.dlog(header_str)
|
||||
for i in range(6):
|
||||
pw.dlog(
|
||||
@ -396,7 +493,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
|
||||
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
|
||||
)
|
||||
printer.print_validity_buffer(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=12
|
||||
)
|
||||
if set_id == SetId.AUX:
|
||||
@ -421,19 +518,22 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
|
||||
|
||||
pw.dlog(
|
||||
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | DAC 2 {dac_enb_str[2]}"
|
||||
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | "
|
||||
f"DAC 2 {dac_enb_str[2]}"
|
||||
)
|
||||
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
|
||||
pw.dlog(
|
||||
f"Ground WDT: Reboot Count {wdt_cnt_gnd} | Time Left {wdt_gnd_time_left} sec"
|
||||
f"Ground WDT: Reboot Count {wdt_cnt_gnd} | Time Left"
|
||||
f" {wdt_gnd_time_left} sec"
|
||||
)
|
||||
|
||||
pw.dlog(
|
||||
f"ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|"
|
||||
f"5:DAC|6:TempSens|7:Reserved"
|
||||
"ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|5:DAC|6:TempSens|7:Reserved"
|
||||
)
|
||||
dev_parser.print(pw=pw)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=8)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=8
|
||||
)
|
||||
|
||||
|
||||
def handle_get_param_data_reply(
|
||||
@ -478,7 +578,8 @@ def pdu_config_table_handler(
|
||||
pw.dlog("[tcs, syrlinks, str, mgt, sus-n, scex, ploc, acs-a, unused]")
|
||||
elif obj_id.as_bytes == PDU_2_HANDLER_ID:
|
||||
pw.dlog(
|
||||
"[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red, acs-b, pl-cam]"
|
||||
"[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red,"
|
||||
" acs-b, pl-cam]"
|
||||
)
|
||||
out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H")
|
||||
out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H")
|
||||
@ -554,3 +655,26 @@ def parse_name_list(data: bytes, name_len: int):
|
||||
idx += len(name)
|
||||
idx += 1
|
||||
return ch_list
|
||||
|
||||
|
||||
def handle_pcdu_hk(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||
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_5v_val = hk_data[current_idx]
|
||||
current_idx += 1
|
||||
p60_stack_3v3_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_5v_val}")
|
||||
pw.dlog(f"{'P60 Dock 3V3 Stack'.ljust(25)}: {p60_stack_3v3_val}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 4)
|
||||
|
@ -1,24 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file solar_array_deployment.py
|
||||
@brief The test function in this file simply returns a command which triggers the solar array deployment.
|
||||
@brief The test function in this file simply returns a command which triggers the solar array
|
||||
deployment.
|
||||
@author J. Meier
|
||||
@date 15.02.2021
|
||||
"""
|
||||
import logging
|
||||
import struct
|
||||
|
||||
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,
|
||||
CmdTreeNode,
|
||||
)
|
||||
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.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -37,25 +35,17 @@ class ActionId:
|
||||
MANUAL_DEPLOYMENT = 5
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_sa_depl_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
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",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
def add_solar_array_deployment_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("solar_array_deployment", "Solar Array Deployment")
|
||||
node.add_child(CmdTreeNode(OpCode.MANUAL_DEPLOYMENT, Info.MANUAL_DEPLOYMENT))
|
||||
node.add_child(CmdTreeNode(OpCode.BURN_SA_0_ONLY, Info.BURN_SA_0_ONLY))
|
||||
node.add_child(CmdTreeNode(OpCode.BURN_SA_1_ONLY, Info.BURN_SA_1_ONLY))
|
||||
return node
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SA_DEPLYOMENT)
|
||||
def pack_solar_array_deployment_test_into(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
op_code = p.op_code
|
||||
def pack_solar_array_deployment_test_into(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
switch_interval_ms = 0
|
||||
if op_code == OpCode.MANUAL_DEPLOYMENT:
|
||||
if cmd_str == OpCode.MANUAL_DEPLOYMENT:
|
||||
while True:
|
||||
burn_time_secs = prompt_burn_time()
|
||||
if burn_time_secs < 0:
|
||||
@ -79,9 +69,9 @@ def pack_solar_array_deployment_test_into(p: ServiceProviderParams):
|
||||
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:
|
||||
elif cmd_str == OpCode.BURN_SA_0_ONLY:
|
||||
burn_one_channel_only(q, 0)
|
||||
elif op_code in OpCode.BURN_SA_1_ONLY:
|
||||
elif cmd_str == OpCode.BURN_SA_1_ONLY:
|
||||
burn_one_channel_only(q, 1)
|
||||
|
||||
|
||||
|
118
eive_tmtc/tmtc/system.py
Normal file
118
eive_tmtc/tmtc/system.py
Normal file
@ -0,0 +1,118 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from eive_tmtc.config.object_ids import EIVE_SYSTEM_ID
|
||||
from tmtccmd.pus.s200_fsfw_mode import (
|
||||
create_mode_command,
|
||||
create_announce_mode_recursive_command,
|
||||
)
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
|
||||
|
||||
class SystemMode:
|
||||
BOOT = 5
|
||||
SAFE = AcsMode.SAFE
|
||||
IDLE = AcsMode.IDLE
|
||||
PTG_NADIR = AcsMode.PTG_NADIR
|
||||
PTG_TARGET = AcsMode.PTG_TARGET
|
||||
PTG_TARGET_GS = AcsMode.PTG_TARGET_GS
|
||||
PTG_INERTIAL = AcsMode.PTG_INERTIAL
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
EXECUTE_I2C_REBOOT = 10
|
||||
|
||||
|
||||
class OpCode:
|
||||
BOOT_MODE = "boot"
|
||||
SAFE_MODE = "safe"
|
||||
IDLE_MODE = "idle"
|
||||
NADIR_MODE = "nadir"
|
||||
TARGET_MODE = "ptg_target"
|
||||
TARGET_GS_MODE = "ptg_target_gs"
|
||||
INERTIAL_MODE = "ptg_inertial"
|
||||
ANNOUNCE_MODES = "announce_modes"
|
||||
REBOOT_I2C = "reboot_i2c"
|
||||
|
||||
|
||||
class Info:
|
||||
BOOT_MODE = "Command System into Boot Mode"
|
||||
SAFE_MODE = "Command System into Safe Mode"
|
||||
IDLE_MODE = "Command System into Idle Pointing Mode"
|
||||
NADIR_MODE = "Command System into Nadir Pointing Mode"
|
||||
TARGET_MODE = "Command System into Target Pointing Mode"
|
||||
TARGET_GS_MODE = "Command System into Target Groundstation Pointing Mode"
|
||||
INERTIAL_MODE = "Command System into Inertial Pointing Mode"
|
||||
ANNOUNCE_MODES = "Announce mode recursively"
|
||||
REBOOT_I2C = "Reboot I2C bus"
|
||||
|
||||
|
||||
def build_system_cmds(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
prefix = "EIVE System"
|
||||
if cmd_str == OpCode.SAFE_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.SAFE_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.SAFE, 0))
|
||||
elif cmd_str == OpCode.IDLE_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.IDLE, 0))
|
||||
elif cmd_str == OpCode.NADIR_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NADIR_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_NADIR, 0))
|
||||
elif cmd_str == OpCode.TARGET_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.TARGET_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET, 0))
|
||||
elif cmd_str == OpCode.TARGET_GS_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.TARGET_GS_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET_GS, 0))
|
||||
elif cmd_str == OpCode.INERTIAL_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.INERTIAL_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_INERTIAL, 0))
|
||||
elif cmd_str == OpCode.ANNOUNCE_MODES:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
|
||||
elif cmd_str == OpCode.BOOT_MODE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.BOOT_MODE}")
|
||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.BOOT, 0))
|
||||
elif cmd_str == OpCode.REBOOT_I2C:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REBOOT_I2C}")
|
||||
q.add_pus_tc(create_action_cmd(EIVE_SYSTEM_ID, ActionId.EXECUTE_I2C_REBOOT))
|
||||
|
||||
|
||||
def create_system_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("system", "EIVE System")
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.BOOT_MODE, info=Info.BOOT_MODE)
|
||||
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
|
||||
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
|
||||
oce.add(keys=OpCode.NADIR_MODE, info=Info.NADIR_MODE)
|
||||
oce.add(keys=OpCode.TARGET_MODE, info=Info.TARGET_MODE)
|
||||
oce.add(keys=OpCode.TARGET_GS_MODE, info=Info.TARGET_GS_MODE)
|
||||
oce.add(keys=OpCode.INERTIAL_MODE, info=Info.INERTIAL_MODE)
|
||||
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
|
||||
oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SYSTEM.value,
|
||||
info="EIVE system commands",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
pass
|
@ -1 +1,2 @@
|
||||
from .tm import * # noqa
|
||||
from .tmp1075 import add_tmp_sens_cmds
|
||||
|
@ -6,8 +6,8 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
|
||||
|
||||
class InfoAssy:
|
||||
|
111
eive_tmtc/tmtc/tcs/ctrl.py
Normal file
111
eive_tmtc/tmtc/tcs/ctrl.py
Normal file
@ -0,0 +1,111 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import TCS_CONTROLLER
|
||||
from eive_tmtc.tmtc.tcs import CtrlSetId
|
||||
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_hk_command,
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
)
|
||||
|
||||
|
||||
class CmdStr:
|
||||
REQUEST_PRIMARY_TEMP_SET = "temp"
|
||||
ENABLE_TEMP_SET = "enable_temp_set"
|
||||
REQUEST_DEVICE_TEMP_SET = "temp_devs"
|
||||
REQUEST_DEVICE_SUS_SET = "temp_sus"
|
||||
REQUEST_HEATER_INFO = "heater_info"
|
||||
REQUEST_TCS_CTRL_INFO = "tcs_ctrl_info"
|
||||
|
||||
|
||||
class CmdInfo:
|
||||
ENABLE_TEMP_SET = "Enable Primary Temperature Set"
|
||||
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
||||
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
||||
REQUEST_HEATER_INFO = "Request heater information"
|
||||
REQUEST_TCS_CTRL_INFO = "Request TCS controller information"
|
||||
|
||||
|
||||
def pack_tcs_ctrl_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == CmdStr.REQUEST_PRIMARY_TEMP_SET:
|
||||
sensor_set_sid = make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS)
|
||||
q.add_log_cmd(CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
||||
if cmd_str == CmdStr.REQUEST_DEVICE_TEMP_SET:
|
||||
q.add_log_cmd(CmdInfo.REQUEST_DEVICE_TEMP_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(TCS_CONTROLLER, CtrlSetId.DEVICE_SENSORS))
|
||||
)
|
||||
if cmd_str == CmdStr.REQUEST_DEVICE_SUS_SET:
|
||||
q.add_log_cmd(CmdInfo.REQUEST_DEVICE_SUS_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
||||
)
|
||||
)
|
||||
if cmd_str == CmdStr.REQUEST_HEATER_INFO:
|
||||
q.add_log_cmd(CmdInfo.REQUEST_HEATER_INFO)
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.HEATER_INFO)
|
||||
)
|
||||
)
|
||||
if cmd_str == CmdStr.REQUEST_TCS_CTRL_INFO:
|
||||
q.add_log_cmd(CmdInfo.REQUEST_TCS_CTRL_INFO)
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.TCS_CTRL_INFO)
|
||||
)
|
||||
)
|
||||
if cmd_str == CmdStr.ENABLE_TEMP_SET:
|
||||
interval_seconds = float(input("Please specify interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
False, make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS), interval_seconds
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
pack_tcs_ass_cmds(q, cmd_str)
|
||||
|
||||
|
||||
CTN = CmdTreeNode
|
||||
|
||||
|
||||
def create_tcs_ctrl_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"tcs_ctrl", "TCS Controller", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CTN(CmdStr.ENABLE_TEMP_SET, CmdInfo.ENABLE_TEMP_SET))
|
||||
node.add_child(
|
||||
CTN(CmdStr.REQUEST_PRIMARY_TEMP_SET, CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
||||
)
|
||||
node.add_child(CTN(CmdStr.REQUEST_DEVICE_TEMP_SET, CmdInfo.REQUEST_DEVICE_TEMP_SET))
|
||||
node.add_child(CTN(CmdStr.REQUEST_DEVICE_SUS_SET, CmdInfo.REQUEST_DEVICE_SUS_SET))
|
||||
node.add_child(CTN(CmdStr.REQUEST_HEATER_INFO, CmdInfo.REQUEST_HEATER_INFO))
|
||||
node.add_child(CTN(CmdStr.REQUEST_TCS_CTRL_INFO, CmdInfo.REQUEST_TCS_CTRL_INFO))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_ctrl_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=CmdStr.ENABLE_TEMP_SET, info=CmdInfo.ENABLE_TEMP_SET)
|
||||
oce.add(keys=CmdStr.REQUEST_PRIMARY_TEMP_SET, info=CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
||||
oce.add(keys=CmdStr.REQUEST_DEVICE_TEMP_SET, info=CmdInfo.REQUEST_DEVICE_TEMP_SET)
|
||||
oce.add(keys=CmdStr.REQUEST_DEVICE_SUS_SET, info=CmdInfo.REQUEST_DEVICE_SUS_SET)
|
||||
oce.add(keys=CmdStr.REQUEST_HEATER_INFO, info=CmdInfo.REQUEST_HEATER_INFO)
|
||||
oce.add(keys=CmdStr.REQUEST_TCS_CTRL_INFO, info=CmdInfo.REQUEST_TCS_CTRL_INFO)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS_CTRL,
|
||||
info="TCS controller",
|
||||
op_code_entry=oce,
|
||||
)
|
@ -5,3 +5,23 @@ class CtrlSetId(enum.IntEnum):
|
||||
PRIMARY_SENSORS = 0
|
||||
DEVICE_SENSORS = 1
|
||||
SUS_TEMP_SENSORS = 2
|
||||
HEATER_INFO = 4
|
||||
TCS_CTRL_INFO = 5
|
||||
|
||||
|
||||
class TcsSubmode(enum.IntEnum):
|
||||
DEFAULT = 0
|
||||
NO_HEATER_CTRL = 1
|
||||
|
||||
|
||||
class Heater(enum.IntEnum):
|
||||
HEATER_0_PLOC_PROC_BRD = 0
|
||||
HEATER_1_PCDU_BRD = 1
|
||||
HEATER_2_ACS_BRD = 2
|
||||
HEATER_3_OBC_BRD = 3
|
||||
HEATER_4_CAMERA = 4
|
||||
HEATER_5_STR = 5
|
||||
HEATER_6_DRO = 6
|
||||
HEATER_7_SYRLINKS = 7
|
||||
NUMBER_OF_SWITCHES = 8
|
||||
NONE = 0xFF
|
||||
|
@ -5,38 +5,39 @@
|
||||
"""
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import CmdTreeNode, OpCodeEntry, TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util.obj_id import ObjectIdU32
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.pus.s201_fsfw_health import (
|
||||
pack_set_health_cmd_data,
|
||||
FsfwHealth,
|
||||
Subservice,
|
||||
pack_set_health_cmd_data,
|
||||
)
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util.obj_id import ObjectIdU32
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from eive_tmtc.tmtc.tcs.defs import Heater
|
||||
|
||||
class Heater(enum.IntEnum):
|
||||
HEATER_0_OBC_BRD = 0
|
||||
HEATER_1_PLOC_PROC_BRD = 1
|
||||
HEATER_2_ACS_BRD = 2
|
||||
HEATER_3_PCDU_PDU = 3
|
||||
HEATER_4_CAMERA = 4
|
||||
HEATER_5_STR = 5
|
||||
HEATER_6_DRO = 6
|
||||
HEATER_7_HPA = 7
|
||||
NUMBER_OF_SWITCHES = 8
|
||||
HEATER_LOCATION = [
|
||||
"PLOC Processing Board",
|
||||
"PCDU PDU",
|
||||
"ACS Board",
|
||||
"OBC Board",
|
||||
"Camera",
|
||||
"Startracker",
|
||||
"DRO",
|
||||
"Syrlinks",
|
||||
]
|
||||
|
||||
|
||||
class OpCode:
|
||||
HEATER_CMD = ["0", "switch-cmd"]
|
||||
HEATER_EXT_CTRL = ["1", "set-ext-ctrl"]
|
||||
HEATER_FAULTY_CMD = ["2", "set-faulty"]
|
||||
HEATER_HEALTHY_CMD = ["3", "set-healthy"]
|
||||
HEATER_CMD = "switch_cmd"
|
||||
HEATER_EXT_CTRL = "set_ext_ctrl"
|
||||
HEATER_FAULTY_CMD = "set_faulty"
|
||||
HEATER_HEALTHY_CMD = "set_healthy"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -54,6 +55,18 @@ class ActionIds(enum.IntEnum):
|
||||
SWITCH_HEATER = 0
|
||||
|
||||
|
||||
CTN = CmdTreeNode
|
||||
|
||||
|
||||
def create_heater_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("heaters", "Heater Device", hide_children_which_are_leaves=True)
|
||||
node.add_child(CTN(OpCode.HEATER_CMD, Info.HEATER_CMD))
|
||||
node.add_child(CTN(OpCode.HEATER_HEALTHY_CMD, Info.HEATER_HEALTHY_CMD))
|
||||
node.add_child(CTN(OpCode.HEATER_EXT_CTRL, Info.HEATER_EXT_CTRL))
|
||||
node.add_child(CTN(OpCode.HEATER_FAULTY_CMD, Info.HEATER_FAULTY_CMD))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_heater_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -68,8 +81,8 @@ def add_heater_cmds(defs: TmtcDefinitionWrapper):
|
||||
)
|
||||
|
||||
|
||||
def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelper):
|
||||
if op_code in OpCode.HEATER_CMD:
|
||||
def pack_heater_cmds(object_id: bytes, cmd_str: str, q: DefaultPusQueueHelper):
|
||||
if cmd_str == OpCode.HEATER_CMD:
|
||||
q.add_log_cmd("Heater Switching")
|
||||
heater_number = prompt_heater()
|
||||
while True:
|
||||
@ -89,7 +102,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
debug_string = f"Switching heater {heater_number} {act_str}"
|
||||
q.add_log_cmd(debug_string)
|
||||
q.add_pus_tc(pack_switch_heater_command(object_id, heater_number, action))
|
||||
if op_code in OpCode.HEATER_EXT_CTRL:
|
||||
if cmd_str == OpCode.HEATER_EXT_CTRL:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -99,7 +112,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
health_str="External Control",
|
||||
heater_idx=heater_number,
|
||||
)
|
||||
if op_code in OpCode.HEATER_FAULTY_CMD:
|
||||
if cmd_str == OpCode.HEATER_FAULTY_CMD:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -109,7 +122,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
health_str="Faulty",
|
||||
heater_idx=heater_number,
|
||||
)
|
||||
if op_code in OpCode.HEATER_HEALTHY_CMD:
|
||||
if cmd_str == OpCode.HEATER_HEALTHY_CMD:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -123,25 +136,25 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
|
||||
def heater_idx_to_obj(heater: int) -> ObjectIdU32:
|
||||
from eive_tmtc.config.object_ids import (
|
||||
HEATER_0_OBC_BRD,
|
||||
HEATER_1_PLOC_PROC_BRD,
|
||||
HEATER_0_PLOC_PROC_BRD,
|
||||
HEATER_1_PCDU_BRD,
|
||||
HEATER_2_ACS_BRD,
|
||||
HEATER_3_PCDU_BRD,
|
||||
HEATER_3_OBC_BRD,
|
||||
HEATER_4_CAMERA,
|
||||
HEATER_5_STR,
|
||||
HEATER_6_DRO,
|
||||
HEATER_7_HPA,
|
||||
HEATER_7_SYRLINKS,
|
||||
)
|
||||
|
||||
obj_id_array = [
|
||||
HEATER_0_OBC_BRD,
|
||||
HEATER_1_PLOC_PROC_BRD,
|
||||
HEATER_0_PLOC_PROC_BRD,
|
||||
HEATER_1_PCDU_BRD,
|
||||
HEATER_2_ACS_BRD,
|
||||
HEATER_3_PCDU_BRD,
|
||||
HEATER_3_OBC_BRD,
|
||||
HEATER_4_CAMERA,
|
||||
HEATER_5_STR,
|
||||
HEATER_6_DRO,
|
||||
HEATER_7_HPA,
|
||||
HEATER_7_SYRLINKS,
|
||||
]
|
||||
obj_dict = get_object_ids()
|
||||
obj_id_obj = obj_dict.get(obj_id_array[heater])
|
||||
@ -159,7 +172,7 @@ def prompt_heater() -> int:
|
||||
print("HEATER 4 | CAMERA")
|
||||
print("HEATER 5 | STR")
|
||||
print("HEATER 6 | DRO")
|
||||
print("HEATER 7 | HPA")
|
||||
print("HEATER 7 | Syrlinks")
|
||||
heater_number = input("Type number of heater to switch [0-7]: ")
|
||||
if not heater_number.isdigit():
|
||||
print("Heater number not a digit")
|
||||
|
@ -1,16 +1,19 @@
|
||||
import enum
|
||||
from typing import Optional
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
RTD_IDS = [
|
||||
oids.RTD_0_PLOC_HSPD,
|
||||
@ -31,39 +34,90 @@ RTD_IDS = [
|
||||
oids.RTD_15_IMTQ,
|
||||
]
|
||||
|
||||
RTD_NAMES = {
|
||||
oids.RTD_0_PLOC_HSPD: "RTD 0 PLOC Heatspreader",
|
||||
oids.RTD_1_PLOC_MISSIONBRD: "RTD 1 PLOC Missionboard",
|
||||
oids.RTD_2_4K_CAM: "RTD 2 4K Camera",
|
||||
oids.RTD_3_DAC_HSPD: "RTD 3 DAC HSPC",
|
||||
oids.RTD_4_STR: "RTD 4 Startracker",
|
||||
oids.RTD_5_RW1_MX_MY: "RTD 5 RW1 MX MY",
|
||||
oids.RTD_6_DRO: "RTD 6 DRO",
|
||||
oids.RTD_7_SCEX: "RTD 7 SCEX",
|
||||
oids.RTD_8_X8: "RTD 8 X8",
|
||||
oids.RTD_9_HPA: "RTD 9 HPA",
|
||||
oids.RTD_10_PL_TX: "RTD 10 PL TX",
|
||||
oids.RTD_11_MPA: "RTD 11 MPA",
|
||||
oids.RTD_12_ACU: "RTD 12 ACU",
|
||||
oids.RTD_13_PLPCDU_HSPD: "RTD 13 PL PCDU Heatspreader",
|
||||
oids.RTD_14_TCS_BRD: "RTD 14 TCS Board",
|
||||
oids.RTD_15_IMTQ: "RTD 15 iMTQ",
|
||||
}
|
||||
|
||||
|
||||
class CommandId:
|
||||
WRITE_CONFIG = 6
|
||||
|
||||
|
||||
class OpCode:
|
||||
ON = ["0", "on"]
|
||||
OFF = ["1", "off"]
|
||||
NORMAL = ["2", "normal"]
|
||||
WRITE_CONFIG = ["3", "Write config"]
|
||||
class RtdId(enum.IntEnum):
|
||||
RTD_0_PLOC_HSPC = 0
|
||||
RTD_1_PLOC_MISSIONBRD = 1
|
||||
RTD_2_4K_CAM = 2
|
||||
RTD_3_DAC_HSPD = 3
|
||||
RTD_4_STR = 4
|
||||
RTD_5_RW1_MX_MY = 5
|
||||
RTD_6_DRO = 6
|
||||
RTD_7_SCEX = 7
|
||||
RTD_8_X8 = 8
|
||||
RTD_9_HPA = 9
|
||||
RTD_10_PL_TX = 10
|
||||
RTD_11_MPA = 11
|
||||
RTD_12_ACU = 12
|
||||
RTD_13_PLPCDU_HSPD = 13
|
||||
RTD_14_TCS_BRD = 14
|
||||
RTD_15_IMTQ = 15
|
||||
|
||||
|
||||
class Info:
|
||||
class SetId(enum.IntEnum):
|
||||
TEMPERATURE = 1
|
||||
|
||||
|
||||
class CmdStr:
|
||||
ON = "on"
|
||||
OFF = "off"
|
||||
NORMAL = "normal"
|
||||
WRITE_CONFIG = "write_cfg"
|
||||
|
||||
|
||||
class CmdInfo:
|
||||
ON = "Switch handler on"
|
||||
OFF = "Switch handler off"
|
||||
NORMAL = "Switch handler normal"
|
||||
WRITE_CONFIG = "Write config"
|
||||
|
||||
|
||||
def create_rtd_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("rtd", "RTD commands", hide_children_which_are_leaves=True)
|
||||
node.add_child(CmdTreeNode(CmdStr.ON, CmdInfo.ON))
|
||||
node.add_child(CmdTreeNode(CmdStr.NORMAL, CmdInfo.NORMAL))
|
||||
node.add_child(CmdTreeNode(CmdStr.OFF, CmdInfo.OFF))
|
||||
node.add_child(CmdTreeNode(CmdStr.WRITE_CONFIG, CmdInfo.WRITE_CONFIG))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def specify_rtd_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.ON, info=Info.ON)
|
||||
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
|
||||
oce.add(keys=OpCode.OFF, info=Info.OFF)
|
||||
oce.add(keys=OpCode.WRITE_CONFIG, info=Info.WRITE_CONFIG)
|
||||
oce.add(keys=CmdStr.ON, info=CmdInfo.ON)
|
||||
oce.add(keys=CmdStr.NORMAL, info=CmdInfo.NORMAL)
|
||||
oce.add(keys=CmdStr.OFF, info=CmdInfo.OFF)
|
||||
oce.add(keys=CmdStr.WRITE_CONFIG, info=CmdInfo.WRITE_CONFIG)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RTD.value, info="RTD commands", op_code_entry=oce
|
||||
)
|
||||
|
||||
|
||||
def pack_rtd_commands(
|
||||
op_code: str, object_id: Optional[ObjectIdU32], q: DefaultPusQueueHelper
|
||||
cmd_str: str, object_id: Optional[ObjectIdU32], q: DefaultPusQueueHelper
|
||||
):
|
||||
if object_id is not None and object_id not in RTD_IDS:
|
||||
print("Specified object ID not a valid RTD ID")
|
||||
@ -72,14 +126,14 @@ def pack_rtd_commands(
|
||||
tgt_rtd_idx = prompt_rtd_idx()
|
||||
object_id_dict = get_object_ids()
|
||||
object_id = object_id_dict.get(RTD_IDS[tgt_rtd_idx])
|
||||
if op_code in OpCode.ON:
|
||||
if cmd_str == CmdStr.ON:
|
||||
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Mode.ON, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.NORMAL:
|
||||
if cmd_str == CmdStr.NORMAL:
|
||||
app_data = pack_mode_data(
|
||||
object_id=object_id.as_bytes, mode=Mode.NORMAL, submode=0
|
||||
)
|
||||
@ -88,7 +142,7 @@ def pack_rtd_commands(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.OFF:
|
||||
if cmd_str == CmdStr.OFF:
|
||||
app_data = pack_mode_data(
|
||||
object_id=object_id.as_bytes, mode=Mode.OFF, submode=0
|
||||
)
|
||||
@ -97,11 +151,28 @@ def pack_rtd_commands(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.WRITE_CONFIG:
|
||||
if cmd_str in CmdStr.WRITE_CONFIG:
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandId.WRITE_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def handle_rtd_hk(object_id: bytes, hk_data: bytes, pw: PrintWrapper):
|
||||
rtd_name = RTD_NAMES.get(object_id)
|
||||
if rtd_name is None:
|
||||
rtd_name = "unknown RTD device"
|
||||
pw.dlog(f"Received RTD HK for RTD {rtd_name} with object ID {object_id}")
|
||||
fmt_str = "!ffBB"
|
||||
fmt_len = struct.calcsize(fmt_str)
|
||||
(rtd_val, temp_celcius, last_err_byte, error_byte) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + fmt_len]
|
||||
)
|
||||
pw.dlog(f"Temperature Celcius: {temp_celcius}")
|
||||
pw.dlog(f"RTD Value: {rtd_val}")
|
||||
pw.dlog(f"Error Byte: {error_byte}")
|
||||
pw.dlog(f"Last Error Byte: {last_err_byte}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[fmt_len:], 4)
|
||||
|
||||
|
||||
def prompt_rtd_idx():
|
||||
while True:
|
||||
rtd_idx = input("Please specify RTD index [0-15]: ")
|
||||
|
@ -1,6 +1,5 @@
|
||||
from .defs import CtrlSetId
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import TCS_CONTROLLER, TCS_SUBSYSTEM_ID
|
||||
from eive_tmtc.config.object_ids import TCS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
|
||||
from tmtccmd.config.tmtc import (
|
||||
@ -8,67 +7,43 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, create_announce_mode_recursive_command
|
||||
|
||||
|
||||
class OpCodeSys:
|
||||
OFF = ["off"]
|
||||
NML = ["nml"]
|
||||
REQUEST_PRIMARY_TEMP_SET = ["temp"]
|
||||
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
|
||||
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
NML = "nml"
|
||||
ANNOUNCE_MODES = "announce_modes"
|
||||
|
||||
|
||||
class InfoSys:
|
||||
OFF = "Switch TCS subsystem OFF"
|
||||
NML = "Switch TCS subsystem NORMAL (nominal)"
|
||||
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
||||
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
||||
ANNOUNCE_MODES = "Announce Modes recursively"
|
||||
|
||||
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
|
||||
sensor_set_sid = make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS)
|
||||
q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(TCS_CONTROLLER, CtrlSetId.DEVICE_SENSORS))
|
||||
)
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodeSys.OFF:
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(InfoSys.OFF)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
|
||||
if op_code in OpCodeSys.NML:
|
||||
if cmd_str == OpCode.NML:
|
||||
q.add_log_cmd(InfoSys.NML)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
|
||||
pack_tcs_ass_cmds(q, op_code)
|
||||
if cmd_str == OpCode.ANNOUNCE_MODES:
|
||||
q.add_log_cmd(InfoSys.ANNOUNCE_MODES)
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(TCS_SUBSYSTEM_ID))
|
||||
pack_tcs_ass_cmds(q, cmd_str)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodeSys.OFF, info=InfoSys.OFF)
|
||||
oce.add(keys=OpCodeSys.NML, info=InfoSys.NML)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_PRIMARY_TEMP_SET, info=InfoSys.REQUEST_PRIMARY_TEMP_SET
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
|
||||
)
|
||||
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
oce.add(keys=OpCode.OFF, info=InfoSys.OFF)
|
||||
oce.add(keys=OpCode.NML, info=InfoSys.NML)
|
||||
oce.add(keys=OpCode.ANNOUNCE_MODES, info=InfoSys.ANNOUNCE_MODES)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS,
|
||||
info="TCS Board",
|
||||
name=CustomServiceList.TCS_SS,
|
||||
info="TCS subsystem",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user