aboutsummaryrefslogtreecommitdiff
path: root/fsm
diff options
context:
space:
mode:
authorSelene ToyKeeper2024-03-26 03:41:17 -0600
committerSelene ToyKeeper2024-03-26 03:41:17 -0600
commit35b5c42f8996167248b7e6d2e4053f6bbef1505c (patch)
tree7b852c3965c277e749285ceeaccd043730647210 /fsm
parentdammit, got alkaline detection half working and then my flashing adapter died (diff)
downloadanduril-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 '')
-rw-r--r--fsm/ramping.c2
-rw-r--r--fsm/ramping.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/fsm/ramping.c b/fsm/ramping.c
index 63ab399..743e619 100644
--- a/fsm/ramping.c
+++ b/fsm/ramping.c
@@ -58,7 +58,7 @@ inline void set_level_aux_rgb_leds(uint8_t level) {
void set_level(uint8_t level) {
#ifdef USE_RAMP_LEVEL_HARD_LIMIT
- if (level > ramp_level_hard_limit)
+ if (ramp_level_hard_limit && (level > ramp_level_hard_limit))
level = ramp_level_hard_limit;
#endif
diff --git a/fsm/ramping.h b/fsm/ramping.h
index 6fe87fe..f542bd2 100644
--- a/fsm/ramping.h
+++ b/fsm/ramping.h
@@ -11,7 +11,7 @@ uint8_t actual_level = 0;
// the level used before actual
uint8_t prev_level = 0;
#ifdef USE_RAMP_LEVEL_HARD_LIMIT
-uint8_t ramp_level_hard_limit = RAMP_SIZE;
+uint8_t ramp_level_hard_limit = 0;
#endif
void set_level(uint8_t level);
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.