diff options
| author | Selene ToyKeeper | 2020-09-14 03:15:50 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-09-14 03:15:50 -0600 |
| commit | b8fd5ee8cc6a04a2c214f80c51269a68802309d8 (patch) | |
| tree | 34d8006cf13d977b5726554d421089e8dd7aeede /spaghetti-monster/fsm-adc.c | |
| parent | reorganized code in fsm-events.* to put things in a more coherent order (diff) | |
| parent | steps.py: fixed python3 floating-point error (diff) | |
| download | anduril-b8fd5ee8cc6a04a2c214f80c51269a68802309d8.tar.gz anduril-b8fd5ee8cc6a04a2c214f80c51269a68802309d8.tar.bz2 anduril-b8fd5ee8cc6a04a2c214f80c51269a68802309d8.zip | |
merged upstream fsm branch to get fix for laggy voltage readings on FW3A
(and other build targets which don't use sleep ticks during standby)
Diffstat (limited to 'spaghetti-monster/fsm-adc.c')
| -rw-r--r-- | spaghetti-monster/fsm-adc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c index 96c4af3..4766786 100644 --- a/spaghetti-monster/fsm-adc.c +++ b/spaghetti-monster/fsm-adc.c @@ -227,6 +227,8 @@ void adc_deferred() { #endif } #endif + + if (adc_reset) adc_reset --; } @@ -245,7 +247,7 @@ static inline void ADC_voltage_handler() { uint16_t measurement; // latest ADC value - if (go_to_standby || (adc_smooth[0] < 255)) { + if (adc_reset) { // while asleep, or just after waking, don't lowpass measurement = adc_raw[0]; adc_smooth[0] = measurement; // no lowpass while asleep } @@ -318,10 +320,7 @@ static inline void ADC_temperature_handler() { static uint16_t temperature_history[NUM_TEMP_HISTORY_STEPS]; static int8_t warning_threshold = 0; - if (reset_thermal_history) { // wipe out old data - // don't keep resetting - reset_thermal_history = 0; - + if (adc_reset) { // wipe out old data // ignore average, use latest sample uint16_t foo = adc_raw[1]; adc_smooth[1] = foo; |
