diff options
| author | Selene ToyKeeper | 2024-03-29 08:21:24 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-03-29 08:21:24 -0600 |
| commit | 849bc5951b27f3f6296d28e8f62f2077e811e2ad (patch) | |
| tree | 96939f9b03267c410bb211427f5ca346dc75df04 /fsm/adc.h | |
| parent | d3aa weak battery test: blink 3x instead of 2x, and omit number readout (diff) | |
| parent | use smooth steps in lockout mode, if enabled (diff) | |
| download | anduril-849bc5951b27f3f6296d28e8f62f2077e811e2ad.tar.gz anduril-849bc5951b27f3f6296d28e8f62f2077e811e2ad.tar.bz2 anduril-849bc5951b27f3f6296d28e8f62f2077e811e2ad.zip | |
Merge branch 'trunk' into emisar-d3aa
FIXME: The d3aa's voltage calculator needs to be fixed after this merge.
* trunk:
use smooth steps in lockout mode, if enabled
fixed Tactical Mode's strobes when Momentary Mode not enabled
increased voltage precision from 0.025V to 0.02V (so 0 to 255 now goes from 0.00V to 5.10V)
fixed inaccurate comment (thanks to xikteny for spotting it)
Allow manually running GitHub actions workflows
Bugfix: Prevent switching channel modes when in tactical mode
Bugfix: Tactical mode has a dependency on momentary mode
Diffstat (limited to 'fsm/adc.h')
| -rw-r--r-- | fsm/adc.h | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4,6 +4,10 @@ #pragma once +// voltage is 0.00V to 5.10V in 0.02V steps, from 0 to 255 +// so one deci-Volt is 5 steps +#define dV 5 + #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) @@ -15,13 +19,13 @@ volatile uint8_t adc_reset = 2; #ifndef VOLTAGE_WARNING_SECONDS #define VOLTAGE_WARNING_SECONDS 5 #endif -// low-battery threshold in volts * 10 +// low-battery threshold in volts * 50 #ifndef VOLTAGE_LOW -#define VOLTAGE_LOW (4*29) +#define VOLTAGE_LOW (29*dV) #endif // battery is low but not critical #ifndef VOLTAGE_RED -#define VOLTAGE_RED (4*33) +#define VOLTAGE_RED (33*dV) #endif // MCU sees voltage 0.X volts lower than actual, add X/2 to readings #ifndef VOLTAGE_FUDGE_FACTOR |
