Skip to content

Commit d2b9f07

Browse files
authored
Merge pull request #57 from systemetric/battery-changes
Change in how the voltage is displayed with new zenners.
2 parents c42b4de + 83f018e commit d2b9f07

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

robot/greengiant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def get_version(self):
251251

252252
def get_battery_voltage(self):
253253
# both GG and PiLow use a 1/3 divider and a 4.096v reference giving a max readable voltage of ~12.3v
254-
return read_high_low_data(self._bus, _GG_BATTERY_V_H) * _GG_BATTERY_MAX_READING / _GG_BATTERY_ADC_MAX
254+
return read_high_low_data(self._bus, _GG_BATTERY_V_H)
255255

256256
def get_fvr_reading(self):
257257
"""Return the fixed voltage reading. The number read here is sampling the 4.096v reference using the VCC rail (GG only)

robot/wrapper.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class to their respecitve classes
3434
# this boot cycle. This is to highlight weird behaviour in the arena
3535
COPY_STAT_FILE = "/tmp/usb_file_uploaded"
3636

37+
V_ZEN = (10.1)
3738

3839
def setup_logging(level):
3940
"""Display the just the message when logging events
@@ -166,14 +167,14 @@ def report_hardware_status(self):
166167
"""Print out a nice log message at the start of each robot init with
167168
the hardware status"""
168169

169-
battery_voltage = self._green_giant.get_battery_voltage()
170+
battery_voltage = ((self._green_giant.get_battery_voltage() / 65535) * 4.096) + V_ZEN
170171
battery_str = "Battery Voltage: %.2fv" % battery_voltage
171172
# GG cannot read voltages above 12.2v
172-
if battery_voltage > 12.2:
173-
battery_str = "Battery Voltage: > 12.2v"
174-
if battery_voltage < 11.5:
175-
self._warnings.append("Battery voltage below 11.5v, consider "
176-
"changing for a charged battery")
173+
#if battery_voltage > 12.2:
174+
# battery_str = "Battery Voltage: > 12.2v"
175+
# if battery_voltage < 11.5:
176+
# self._warnings.append("Battery voltage below 11.5v, consider "
177+
# "changing for a charged battery")
177178

178179
if self._gg_version < 3:
179180
self._warnings.append(

0 commit comments

Comments
 (0)