From ae082e6331d75c2cbe339290fbce4e79c2aa2ede Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 Nov 2019 18:00:54 -0700 Subject: fixed ADC code; measures and behaves correctly now, and is easier to read... ... but factory reset's auto-calibrate still doesn't get the right values for some reason (manual calibration works, but not auto) --- spaghetti-monster/fsm-adc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster/fsm-adc.h') diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h index 5f4d0c8..6e39750 100644 --- a/spaghetti-monster/fsm-adc.h +++ b/spaghetti-monster/fsm-adc.h @@ -40,7 +40,9 @@ #endif volatile uint8_t irq_adc = 0; // ADC interrupt happened? -uint16_t adc_value; // last ADC measurement +volatile uint8_t irq_adc_stable = 0; // have we passed the 1st junk value yet? +uint8_t adc_channel = 0; // 0=voltage, 1=temperature +uint16_t adc_values[2]; // last ADC measurements (0=voltage, 1=temperature) uint8_t adcint_enable = 0; // is the current ADC result needed? void ADC_inner(); // do the actual ADC-related calculations -- cgit v1.2.3