From 9c0d1832464e4ee7ee8c4c63092ac4337347483b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 29 Jan 2020 05:08:14 -0700 Subject: rewrote ADC code to use a continuous lowpass system on all measurements, to eliminate noise and maybe increase precision (thermal code still needs to be rewritten though) --- spaghetti-monster/fsm-wdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spaghetti-monster/fsm-wdt.c') diff --git a/spaghetti-monster/fsm-wdt.c b/spaghetti-monster/fsm-wdt.c index 0c49a75..e9dca3a 100644 --- a/spaghetti-monster/fsm-wdt.c +++ b/spaghetti-monster/fsm-wdt.c @@ -181,9 +181,11 @@ void WDT_inner() { // start a new ADC measurement every 4 ticks adc_trigger ++; if (0 == (adc_trigger & 3)) { + // in case we're in standby mode and auto-retrigger is turned off ADC_start_measurement(); - irq_adc_stable = 0; - adcint_enable = 1; + adc_sample_count = 0; + // allow regulation logic to run + adc_deferred_enable = 1; } #endif } -- cgit v1.2.3