aboutsummaryrefslogtreecommitdiff
path: root/fsm/adc.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2024-08-19 13:10:04 -0600
committerSelene ToyKeeper2024-08-19 13:10:04 -0600
commit4c2bbf92194ff5f41a87baa95c5388b325a27d2d (patch)
tree2d2b51fc3ef800e55009bc5f01ef7119d4c32d6e /fsm/adc.h
parentts25-boost: reduced visible PWM, made party strobe less blurry (diff)
parentremoved "Off -> 3H" strobe/mood mode access from Extended Simple UI (diff)
downloadanduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.gz
anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.bz2
anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.zip
Merge branch 'trunk' into wurkkos-ts25-boost
# By Selene ToyKeeper (20) and others * trunk: (25 commits) removed "Off -> 3H" strobe/mood mode access from Extended Simple UI include hardware-specific readme files in the release .zip added change log for 2024-04-20 release Forgot to update model count after the last couple additions use low aux for chan-aux level 0 MODELS: added emisar-d3aa make-release.sh should use version-string.sh instead of duplicating code d3aa: fixed voltage calculation to use 0.02V units instead of 0.025V d3aa weak battery test: blink 3x instead of 2x, and omit number readout 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) weak battery detection: use different thresholds for AA and Li-Ion (also, fixed bug where a totally empty li-ion didn't get limited) d3aa: got weak battery detection actually working, and not letting the magic smoke out of updi adapters any more (probably) dammit, got alkaline detection half working and then my flashing adapter died (saving progress here so I can work on a different branch) fixed inaccurate comment (thanks to xikteny for spotting it) d3aa fine-tuning: - new ramp - production style config defaults (simple mode, Hank config) - candle tuning - fixed way-too-fast thermal regulation (might still be a bit fast, but it's a lot better) d3aa: fixed voltage measurement Allow manually running GitHub actions workflows Bugfix: Prevent switching channel modes when in tactical mode ... # Conflicts: # arch/attiny1616.c (fixed)
Diffstat (limited to '')
-rw-r--r--fsm/adc.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/fsm/adc.h b/fsm/adc.h
index 02e33f8..5dec6c5 100644
--- a/fsm/adc.h
+++ b/fsm/adc.h
@@ -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