From a87812f436e08b14a7cede83e30306d779774872 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 25 Mar 2024 04:25:43 -0600 Subject: dammit, got alkaline detection half working and then my flashing adapter died (saving progress here so I can work on a different branch) --- fsm/ramping.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fsm/ramping.c') diff --git a/fsm/ramping.c b/fsm/ramping.c index adc8acb..63ab399 100644 --- a/fsm/ramping.c +++ b/fsm/ramping.c @@ -57,6 +57,11 @@ 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) + level = ramp_level_hard_limit; + #endif + #ifdef USE_JUMP_START // maybe "jump start" the engine, if it's prone to slow starts // (pulse the output high for a moment to wake up the power regulator) -- cgit v1.2.3 From 35b5c42f8996167248b7e6d2e4053f6bbef1505c Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 26 Mar 2024 03:41:17 -0600 Subject: 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. --- fsm/ramping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fsm/ramping.c') 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 -- cgit v1.2.3