+volatile uint16_t batt_on, batt_off;
+
+ISR(ADC_vect)
+{
+ uint16_t adcw = ADCW;
+
+ if (adc_drop) {
+ adc_drop--;
+ ADCSRA |= _BV(ADSC);
+ return;
+ }
+
+ if (adc_type == 0) {
+ if (batt_off) {
+ batt_off += adcw - (batt_off >> 5);
+ } else {
+ batt_off = adcw << 5;
+ }
+ } else {
+ if (batt_on) {
+ batt_on += adcw - (batt_on >> 5);
+ } else {
+ batt_on = adcw << 5;
+ }
+ }
+}
+