1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2018 Daniel Estevez <[email protected] >
5
+ #
6
+ # This is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 3, or (at your option)
9
+ # any later version.
10
+ #
11
+ # This software is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this software; see the file COPYING. If not, write to
18
+ # the Free Software Foundation, Inc., 51 Franklin Street,
19
+ # Boston, MA 02110-1301, USA.
20
+ #
21
+
22
+ from construct import *
23
+ from adapters import *
24
+
25
+ Timestamp = UNIXTimestampAdapter (Int32ul )
26
+
27
+ Callsign = Struct (
28
+ 'callsign' / Bytes (5 ))
29
+
30
+ OBC = Struct (
31
+ 'obc_mode' / Int8ul ,
32
+ 'obc_reset_counter' / Int32ul ,
33
+ 'obc_uptime' / Int32ul )
34
+
35
+ Gyro = Struct (
36
+ 'gyro_norm' / Int8ul )
37
+
38
+ EPS = Struct (
39
+ 'eps_counter_boot' / Int32ul ,
40
+ 'eps_last_boot_cause' / Int8ul ,
41
+ 'eps_battery_mode' / Int8ul )
42
+
43
+ Timestamp_Struct = Struct (
44
+ 'timestamp' / Timestamp )
45
+
46
+ OBC_Temp = Struct (
47
+ 'obc_temp' / AffineAdapter (1 , 128 , Int8ul ),
48
+ 'obc_daughter_board_temp' / AffineAdapter (1 , 128 , Int8ul ))
49
+
50
+ EPS_Temp = Struct (
51
+ 'eps_battery_temp' / AffineAdapter (1 , 128 , Int8ul ),
52
+ 'eps_board_temp' / AffineAdapter (1 , 128 , Int8ul ))
53
+
54
+ Ants = Struct (
55
+ 'ants_temp' / AffineAdapter (1 , 128 , Int8ul ))
56
+
57
+ TRXVU_Temp = Struct (
58
+ 'trxvu_temp' / AffineAdapter (1 , 128 , Int8ul ))
59
+
60
+ ADCS = Struct (
61
+ 'adcs_temp' / AffineAdapter (1 , 128 , Int8ul ))
62
+
63
+ OBC_Voltages = Struct (
64
+ 'obc_3v3_voltage' / LinearAdapter (10.0 , Int8ul ),
65
+ 'obc_5v0_voltage' / LinearAdapter (10.0 , Int8ul ))
66
+
67
+ TRXVU_Voltage = Struct (
68
+ 'trxvu_voltage' / LinearAdapter (10.0 , Int8ul ))
69
+
70
+ EPS_Batt_Voltage = Struct (
71
+ 'eps_batt_voltage' / LinearAdapter (10.0 , Int8ul ))
72
+
73
+ OBC_Current = Struct (
74
+ 'obc_5.0_current' / LinearAdapter (1000.0 , Int16ul ))
75
+
76
+ EPS_Currents = Struct (
77
+ 'eps_total_pv_current' / LinearAdapter (1000.0 , Int16ul ),
78
+ 'eps_total_system_current' / LinearAdapter (1000.0 , Int16ul ))
79
+
80
+ Beacon0 = Struct (
81
+ 'callsign' / Callsign ,
82
+ 'obc' / OBC ,
83
+ 'gyro' / Gyro ,
84
+ 'eps' / EPS ,
85
+ 'timestamp' / Timestamp_Struct ,
86
+ 'obc_temp' / OBC_Temp ,
87
+ 'eps_temp' / EPS_Temp ,
88
+ 'ants' / Ants ,
89
+ 'trxvu_temp' / TRXVU_Temp ,
90
+ 'adcs' / ADCS ,
91
+ 'obc_voltages' / OBC_Voltages ,
92
+ 'trxvu_voltage' / TRXVU_Voltage ,
93
+ 'eps_batt_voltage' / EPS_Batt_Voltage ,
94
+ 'obc_current' / OBC_Current ,
95
+ 'eps_currents' / EPS_Currents )
96
+
97
+ Beacon = Select (Beacon0 )
0 commit comments