From 3cafb86c00a95a70e58144230f641c2c94208e7b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 29 Mar 2024 08:21:07 -0600 Subject: d3aa weak battery test: blink 3x instead of 2x, and omit number readout --- hw/hank/emisar-d3aa/hwdef.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'hw/hank/emisar-d3aa/hwdef.c') diff --git a/hw/hank/emisar-d3aa/hwdef.c b/hw/hank/emisar-d3aa/hwdef.c index 8aaa893..36c6fed 100644 --- a/hw/hank/emisar-d3aa/hwdef.c +++ b/hw/hank/emisar-d3aa/hwdef.c @@ -123,9 +123,10 @@ uint8_t quick_volt_measurement() { void detect_weak_battery() { // guess at the cell strength with a load test... - // - measure voltage while LEDs off + // - measure voltage with LEDs off // - measure again with LEDs on // - determine how much to limit power + // (ramp up until battery becomes unstable) // - blink to indicate weak battery mode, if active ramp_level_hard_limit = 0; @@ -162,17 +163,23 @@ void detect_weak_battery() { } set_level(0); - // TODO? limit NiMH to ~half power, even if it passed the sag test? - // (and if so, blink 2X for NiMH, 3X for alkaline) + // Blink again if not in full-power mode: + // - 1 blink total: Strong Li-ion cell, full power enabled + // - 2 blinks: Strong AA cell, max AA power enabled + // (not used on this driver, strong AA uses mode 1) + // - 3 blinks: Weak battery, power severely limited uint8_t extra_blinks = 0; - if (ramp_level_hard_limit) extra_blinks ++; + if (ramp_level_hard_limit) extra_blinks += 2; for (uint8_t i=0; i