Inside the timer interrupt, we may have changed the PWM outputs,
so the reading of ADC will be useless. Drop it in this case.
FIXME: possible race condition against timer IRQ.
ISR(ADC_vect) { // IRQ handler
uint16_t adcval = ADCW;
+ /*
+ * After the timer interrupt, drop the current reading.
+ * We may have changed the PWM outputs, so the value is
+ * probably useless anyway.
+ * FIXME: possible race condition - we should make an explicit
+ * notification inside the timer IRQ handler.
+ */
+ if (slow_adcs_wanted) {
+ start_next_adc();
+ return;
+ }
+
if (zero_count) {
if (zero_count > 1) {
ADCSRA |= _BV(ADSC);