At night, we probably don't want to just hammer the batteries with 14.4V
all the time. If we switch to "solar mode", that'll give the batteries
a bit of a break from the charger.
Before when blinking LEDs I just XORed a bit-mask, that turns out to be
unwise as they blinked out of phase which was just annoying, but it is
still useful to have that "flashing" state to draw your attention to a
problem or to indicate a state.
- We use a single 8-bit register to hold things like the blink phase
(which is XORed each cycle), and whether we have checked the ADCs.
- Temperature LEDs blink when fan is in "kick-start" state.
- Battery voltage LED now has three states:
- On: battery is above minimum voltage (good)
- Off: battery is low
- Blinking: battery is critical (bad)
- In "solar" mode, mains charger LED will blink if we are in the
"waiting for low voltage timeout" sub-state.
- Re-introduce the "critically low" threshold which kick-starts the
charger immediately (like the "low" threshold does now).
- Add a charging time so we consider the charger to be "charging" for
`T_CHARGE_S` seconds, then check to see the battery has reached the
float voltage.
- Delay starting the charger until the battery has been low for
`T_LOW_S` seconds to prevent the charger flapping in and out.
- Re-work the state machines so charging and discharging uses the same
timer.
If the charger is doing a bulk charge, it'll likely be dumping high
current into the battery, resulting in a high voltage appearing at the
terminals.
We don't want to disturb this… we want to wait until the charger thinks
it's done, which it signifies by turning off. We should see the voltage
drop back and continue falling. If we're above our "high" threshold at
this point, *then* we might consider leaving it off.
We should delay our shutdown in case the charger decides to ramp down
itself. Otherwise we can get the situation where a smart charger starts
high, tripping the high threshold immediately, leading to the controller
and charger oscillating between on and off.
This will get copied over to setpoints.h, where the developer can
customise them. If they do so, and I have to change things, the
Makefile will warn them of this.
It appears the minimum PWM is more strongly dependent on battery voltage
than I had planned, it needs to be just a little higher to ensure the
fan keeps turning at low RPM.
- Adjust the calculations so that we base our initial PWM at 0 then
clamp to minimum PWM
- Implement a fan kick-start mode
- Start with fan off so kick-start mode works