From 8323c1823f4e1dbb7b78142a082bfbf7cdae2456 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 23 Aug 2020 11:43:11 -0600 Subject: attempt to fix laggy voltage readings right after waking, on FW3A (with no sleep ticks, the voltage value never gets reset to the raw value, and instead only goes through the lowpass filter) (this fix is not yet tested... will test before uploading) (also carries a risk of messing up thermal values after being asleep, so that needs to be tested too) --- spaghetti-monster/fsm-adc.h | 7 ++++++- 1 file changed, 6 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 241dee4..36d4c9c 100644 --- a/spaghetti-monster/fsm-adc.h +++ b/spaghetti-monster/fsm-adc.h @@ -21,6 +21,12 @@ #define FSM_ADC_H +#if defined(USE_LVP) || defined(USE_THERMAL_REGULATION) +// use raw value instead of lowpassed value for the next N measurements +// (2 = 1 for voltage + 1 for temperature) +volatile uint8_t adc_reset = 2; +#endif + #ifdef USE_LVP // default 5 seconds between low-voltage warning events #ifndef VOLTAGE_WARNING_SECONDS @@ -85,7 +91,6 @@ void battcheck(); volatile int16_t temperature; uint8_t therm_ceil = DEFAULT_THERM_CEIL; int8_t therm_cal_offset = 0; -volatile uint8_t reset_thermal_history = 1; static inline void ADC_temperature_handler(); #endif // ifdef USE_THERMAL_REGULATION -- cgit v1.2.3