Commit Graph

9 Commits

Author SHA1 Message Date
Thomas Kolb 1e093978f3 config: avoid switching between sleep and active state too often
Unfortunately, the offset voltage of the opamp for charge current
measurement breaks measurement at low currents with a small shunt, so at
dusk, when currents become low, it may happen that 0 current is measured
while the battery is still being charged. This would falsely trigger the
transition to sleep state. To improve this situation, we simply keep the
charger active for a longer time.
2022-09-24 16:39:46 +02:00
Thomas Kolb 6920c548e9 Tune high-voltage charge time and reset voltage 2021-09-19 14:07:26 +02:00
Thomas Kolb 0339b521dd charge_control: add extra state to fix initial charging
Before this change, initial charging ended exactly HOLD_TIME after the
CHARGE_INITIAL state was entered. This was usually not sufficient to
reach the INITIAL_FULL voltage. Now a new state is entered once the
INITIAL_FULL voltage is reached.
2021-07-10 16:29:48 +02:00
Thomas Kolb 49bd9247e0 Average the measurements
The measurement module now provides averaged measurements. These are
used in some places where accuracy is more important than latency (for
example for the temperature limit, where noise triggered the limit too
early).
2021-06-18 23:37:16 +02:00
Thomas Kolb 7ca6104e80 charge_control: refactoring, bug fixes
- Moved shared state transition checks to separate function
- Improved behaviour when the battery is full
2021-06-18 20:25:53 +02:00
Thomas Kolb d9bc181973 Fixed a typo 2021-06-13 14:55:43 +02:00
Thomas Kolb df3211333e Properly shut down peripherals before entering deep sleep
This is most important for the LEDs and the RS485 interface. If any LED
is on when deep sleep is entered, it will stay on the whole sleep time,
drawing about 10 mA on the 3,3V rail.

The RS485 transceiver must be switched to RX mode, as it consumes about
30 mA from the 5V rail in TX mode.
2021-06-12 16:02:21 +02:00
Thomas Kolb 98d0c08ec3 First try to implement deep sleep
It sleeps, but never wakes up again. Also it consumes a lot of current
which suspended?!
2021-06-12 16:02:21 +02:00
Thomas Kolb 6b070bbf86 Started implementing real charge control
Everything untested so far…
2021-06-07 22:45:17 +02:00