fw: Fix battery voltage calculation
This commit is contained in:
parent
0e5e87af7c
commit
b4cfb40bb7
@ -33,16 +33,15 @@ uint8_t batmon_proc()
|
||||
|
||||
if (ADCSRA & (1 << ADIF)) {
|
||||
sum += ADCH;
|
||||
if (!(cnt++)) {
|
||||
if (!(++cnt)) {
|
||||
vbat = sum >> 8;
|
||||
sum = 0;
|
||||
}
|
||||
vbat = ADCH;
|
||||
ADCSRA &= ~(1 << ADIF);
|
||||
ADCSRA |= (1 << ADSC); // TODO: I want this to work off TIMER0
|
||||
if (vbat < BAT_THRES_POWER_OFF)
|
||||
return 1;
|
||||
}
|
||||
ADCSRA &= ~(1 << ADIF);
|
||||
ADCSRA |= (1 << ADSC); // TODO: I want this to work off TIMER0
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user