aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-adc.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-08-23 11:43:11 -0600
committerSelene ToyKeeper2020-08-23 11:43:11 -0600
commit8323c1823f4e1dbb7b78142a082bfbf7cdae2456 (patch)
tree12e614313174b0f60c9cbab7b41dd330e8873962 /spaghetti-monster/fsm-adc.h
parentmerged Emisar D4v2.5 build targets with Noctigon KR4 build targets (diff)
downloadanduril-8323c1823f4e1dbb7b78142a082bfbf7cdae2456.tar.gz
anduril-8323c1823f4e1dbb7b78142a082bfbf7cdae2456.tar.bz2
anduril-8323c1823f4e1dbb7b78142a082bfbf7cdae2456.zip
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)
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-adc.h7
1 files changed, 6 insertions, 1 deletions
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