diff options
| author | Selene ToyKeeper | 2020-02-05 23:34:44 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-02-05 23:34:44 -0700 |
| commit | 14ad6787546b3a2c55c129c8bd95eb6b98f14531 (patch) | |
| tree | 14ccb220c71b00e3463a0337de8f83da72e7898b /spaghetti-monster/fsm-adc.h | |
| parent | still doesn't work, but at least it's a bit less broken than before... (diff) | |
| download | anduril-14ad6787546b3a2c55c129c8bd95eb6b98f14531.tar.gz anduril-14ad6787546b3a2c55c129c8bd95eb6b98f14531.tar.bz2 anduril-14ad6787546b3a2c55c129c8bd95eb6b98f14531.zip | |
brute force method for reducing ADC noise -- average a ridiculous number of samples
(because, for some reason, even though 64 samples is plenty in a test program,
it ends up being extremely erratic when used inside Anduril... and I'm not sure why)
also, use 15-bit ADC values instead of 16 bits, in the temperature logic
(to help protect against integer overflows)
... but this code still doesn't work well. It regulates down *very* fast, and then
gradually rises until the next extra-fast drop-down. :(
... also, tempcheck mode sometimes changes by 4-5 C between readouts, which is worrisome.
... and factory reset is still broken.
Diffstat (limited to '')
| -rw-r--r-- | spaghetti-monster/fsm-adc.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h index 6283b2c..7acb505 100644 --- a/spaghetti-monster/fsm-adc.h +++ b/spaghetti-monster/fsm-adc.h @@ -40,7 +40,7 @@ #endif volatile uint8_t irq_adc = 0; // ADC interrupt happened? -uint8_t adc_sample_count = 0; // skip the first sample; it's junk +uint16_t adc_sample_count = 0; // skip the first sample; it's junk uint8_t adc_channel = 0; // 0=voltage, 1=temperature uint16_t adc_raw[2]; // last ADC measurements (0=voltage, 1=temperature) uint16_t adc_smooth[2]; // lowpassed ADC measurements (0=voltage, 1=temperature) |
