-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsensor.py
More file actions
68 lines (57 loc) · 3.17 KB
/
Copy pathsensor.py
File metadata and controls
68 lines (57 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
####################################################################################
# #
# sensor.py -- Contains functions for processing sensor readouts #
# #
# Author: Colton Acosta #
# Date: 1/12/2023 #
# Sun Devil Rocketry Avionics #
# #
####################################################################################
####################################################################################
# Imports #
####################################################################################
import controller as SDR_controller
####################################################################################
# Imports #
####################################################################################
max_sensor_vals = {
"pt0" : 1000,
"pt1" : 1000,
"pt2" : 1000,
"pt3" : 1000,
"pt4" : 1000,
"pt5" : 1000,
"pt6" : 1000,
"pt7" : 1000,
"tc" : 100 ,
"lc" : 500 ,
"oxfr" : 1.0,
"ffr" : 1.0
}
####################################################################################
# #
# PROCEDURE: #
# format_sensor_readout #
# #
# DESCRIPTION: #
# Formats a sensor readout into rounded readout and units #
# #
####################################################################################
def format_sensor_readout( controller, sensor, readout ):
# Readout units
units = SDR_controller.sensor_units[controller][sensor]
# Rounded readout
if ( units != None ):
readout_str = "{:.1f}".format( readout )
else:
readout_str = str( readout )
# Concatentate label, readout, and units
if ( units != None ):
output = readout_str + " " + units
else:
output = readout_str
return output
## format_sensor_readout ##
###################################################################################
# END OF FILE #
###################################################################################