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.
- Drop the minimum voltage down a touch so we're not flapping the mains
charger in unnecessarily.
- Halve the boost time so that the sun has a better chance of keeping
the battery up.
Raise battery minimum voltage threshold to account for inaccuracy in the
ADC readings (which can be as much as 500mV). Lower the solar threshold
so that it doesn't flap when clouds pass over.
- Thermal setpoint: the SOIC version of the microcontroller reads a
little higher than the DIP version, so make it a little more
forgiving.
- Delta voltage can be a more forgiving too.
By incrementing the battery voltage on compare, we ensure we are seeing
a steadily increasing voltage. If we're not seeing that, then we flag
the warning.
If the charge isn't rising, we should wait before acting on it in case
it is temporary in nature.
It was hoped that the charger delay should be enough, but it seems it
still can flap. We reset the warning if we see an improvement, or let
the timer expire if we don't.
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.