diff options
| author | Selene ToyKeeper | 2020-03-05 17:51:27 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-03-05 17:51:27 -0700 |
| commit | 4d1c7a34fd00a4dd19e591ea0602f0f47f10d9f0 (patch) | |
| tree | 8a22c1983165f5edf9fe72733690680712a792c2 /spaghetti-monster/fsm-adc.c | |
| parent | merged from fsm, mostly to get thermal regulation updates (diff) | |
| download | anduril-4d1c7a34fd00a4dd19e591ea0602f0f47f10d9f0.tar.gz anduril-4d1c7a34fd00a4dd19e591ea0602f0f47f10d9f0.tar.bz2 anduril-4d1c7a34fd00a4dd19e591ea0602f0f47f10d9f0.zip | |
initial support for Noctigon KR4
(not complete, but far enough that it installs and runs)
New hardware support features:
- allow using PCINT other than 0 (PCINT1, PCINT2, etc)
- option to ignore voltage ADC while the button is pressed
(because my prototype shorts the voltage divider to 0 while the button is down)
Diffstat (limited to 'spaghetti-monster/fsm-adc.c')
| -rw-r--r-- | spaghetti-monster/fsm-adc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c index 2a3c5c6..2d8d01f 100644 --- a/spaghetti-monster/fsm-adc.c +++ b/spaghetti-monster/fsm-adc.c @@ -206,6 +206,12 @@ static inline void ADC_voltage_handler() { #define LVP_TIMER_START (VOLTAGE_WARNING_SECONDS*ADC_CYCLES_PER_SECOND) // N seconds between LVP warnings #define LVP_LOWPASS_STRENGTH ADC_CYCLES_PER_SECOND // lowpass for one second + #ifdef NO_LVP_WHILE_BUTTON_PRESSED + // don't run if button is currently being held + // (because the button causes a reading of zero volts) + if (button_last_state) return; + #endif + uint16_t measurement = adc_values[0]; // latest 10-bit ADC reading #ifdef USE_VOLTAGE_LOWPASS |
