|
@@ -100,9 +100,11 @@ class PicoMatrix:
|
100
|
100
|
# TODO supports only 2 points
|
101
|
101
|
cal_pts = [
|
102
|
102
|
# adc, bat
|
103
|
|
- (13.65, 15.46),
|
104
|
|
- (13.60, 15.34),
|
105
|
|
- # TODO better values
|
|
103
|
+ #(13.65, 15.46),
|
|
104
|
+ #(13.60, 15.34),
|
|
105
|
+ (13.625, 15.4), # avg of above
|
|
106
|
+
|
|
107
|
+ (14.30, 16.13),
|
106
|
108
|
]
|
107
|
109
|
|
108
|
110
|
# https://www.ti.com/europe/downloads/f2810_12_calibration_10.pdf
|
|
@@ -110,6 +112,10 @@ class PicoMatrix:
|
110
|
112
|
offset = cal_pts[1][1] - cal_pts[1][0] * gain
|
111
|
113
|
v_bat = v_bat_uncal * gain + offset
|
112
|
114
|
|
|
115
|
+ # Use this to gather calibration data
|
|
116
|
+ #v_bat = v_bat_uncal
|
|
117
|
+ #print(v_bat)
|
|
118
|
+
|
113
|
119
|
# TODO auto-detect cell count
|
114
|
120
|
n_lipo = const(4) # 4S
|
115
|
121
|
v_cell = v_bat / n_lipo
|