* (1024UL * (mV)) \
/ (6UL * ADC_1100MV_VALUE)) >> 8))
static unsigned char batt_levels[] = {
- MV_TO_ADC8(3350),
- MV_TO_ADC8(3700),
- MV_TO_ADC8(3900),
+ MV_TO_ADC8(3000), // below this, do not enable load, and switch off
+ MV_TO_ADC8(3150), // below this, switch off after some time
+ MV_TO_ADC8(3450), // battery low
+ MV_TO_ADC8(3800), // battery ok, above that almost full
};
#define BATT_N_LEVELS (sizeof(batt_levels) / sizeof(batt_levels[0]))
}
} else {
unsigned char b_level = battery_level();
- if (b_level) {
+ if (b_level > 1) {
battery_exhausted = 0;
} else if (battery_exhausted) {
if (!--battery_exhausted)
battery_exhausted = LED_BATTEMPTY_COUNT;
}
- n_blinks = b_level + 1;
- blink_on_time = 4;
+ n_blinks = b_level ? b_level : 1;
+ blink_on_time = b_level ? 4 : 2;
blink_off_time = 0;
}