diff options
| author | Selene ToyKeeper | 2024-03-26 03:41:17 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-03-26 03:41:17 -0600 |
| commit | 35b5c42f8996167248b7e6d2e4053f6bbef1505c (patch) | |
| tree | 7b852c3965c277e749285ceeaccd043730647210 /hw/hank/emisar-d3aa/hwdef.h | |
| parent | dammit, got alkaline detection half working and then my flashing adapter died (diff) | |
| download | anduril-35b5c42f8996167248b7e6d2e4053f6bbef1505c.tar.gz anduril-35b5c42f8996167248b7e6d2e4053f6bbef1505c.tar.bz2 anduril-35b5c42f8996167248b7e6d2e4053f6bbef1505c.zip | |
d3aa: got weak battery detection actually working,
and not letting the magic smoke out of updi adapters any more (probably)
The alkaline detection might be a little too lenient though; it
could potentially fail to activate limits when the cell is completely
full or stronger than an average alkaline. One of my test cells
measured at 72 / 75, so if it was just a little stronger it'd pass...
but most alkalines I tried were in the 40 to 60 range and failed easily.
OTOH, if I make it easier to fail, it's likely to trip on normal li-ion
cells, and I don't want that.
So as a future enhancement idea, maybe it should have a smaller sag
threshold for AA and a larger threshold for li-ion. That would reduce
false negatives for AA, while still preventing false positives for li-ion.
Diffstat (limited to 'hw/hank/emisar-d3aa/hwdef.h')
| -rw-r--r-- | hw/hank/emisar-d3aa/hwdef.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/hank/emisar-d3aa/hwdef.h b/hw/hank/emisar-d3aa/hwdef.h index 1e677b6..7cd2849 100644 --- a/hw/hank/emisar-d3aa/hwdef.h +++ b/hw/hank/emisar-d3aa/hwdef.h @@ -116,12 +116,11 @@ enum CHANNEL_MODES { // Alkaline AA can't handle the power this light wants, // so try to detect it and limit the maximum power +// (also helps protect firmware flashing adapters from overload) #define USE_RAMP_LEVEL_HARD_LIMIT #define USE_WEAK_BATTERY_PROTECTION -#define WEAK_BATTERY_HIGHEST_LIMIT RAMP_SIZE -#define WEAK_BATTERY_MEDIUM_LIMIT (RAMP_SIZE*2/3) -#define WEAK_BATTERY_LOWEST_LIMIT (RAMP_SIZE*1/3) -#define WEAK_BATTERY_CHECK_LEVEL (RAMP_SIZE*2/3) +#define WEAK_BATTERY_TEST_MAX_LEVEL 75 // about 300 mA +#define WEAK_BATTERY_SAG_THRESHOLD (5*4) // 0.5 V // average drop across diode on this hardware #ifndef VOLTAGE_FUDGE_FACTOR |
