fix vbat monitor channel

This commit is contained in:
Brendan Haines 2020-03-04 00:26:48 -07:00
parent 5fd9bee6e1
commit c0c371ec4e

View File

@ -16,7 +16,7 @@ from bokeh.models import ColumnDataSource, Slider, TextInput, Button, Paragraph
from bokeh.plotting import figure from bokeh.plotting import figure
DEBUG = False DEBUG = False
BAT_MUX_CHAN = 15 BAT_MUX_CHAN = 9
VBAT_THRESHOLD = 11.0 VBAT_THRESHOLD = 11.0
# Configure MUX for ADC # Configure MUX for ADC
@ -220,8 +220,8 @@ def update_battery_voltage(attrname=None, old=None, new=None):
global VBAT_THRESHOLD global VBAT_THRESHOLD
global vbat_text global vbat_text
vadc = get_mux_adc(BAT_MUX_CHAN) vadc = get_mux_adc(BAT_MUX_CHAN)
# vbat = vadc * (10+1)/1 vbat = vadc * (10+1)/1
vbat = vadc * 12.21/1.68 # vbat = vadc * 12.21/1.68
vbat_text.text = f"Battery Voltage: {vbat:2.1f}V" vbat_text.text = f"Battery Voltage: {vbat:2.1f}V"
if vbat < VBAT_THRESHOLD: if vbat < VBAT_THRESHOLD:
stop_controller() stop_controller()