Commit Graph

18 Commits

Author SHA1 Message Date
Thomas Kolb 19735ee550 overload: exponential backoff for retry
Whenever overload is detected, the time that must pass before the load is
turned on again is doubled. If the load was on for 5 minutes, the retry time is
reset to the configured value.
2023-06-18 16:43:41 +02:00
Thomas Kolb bd08440584 charge_control: delay overload trigger by a configurable time 2023-06-18 16:18:13 +02:00
Thomas Kolb 2cedcb712a Implement heater control
This change controls a GPIO on the expansion connector depending on the
surrounding temperature. If external temperature is too low for
charging, the GPIO is set high, else it is set low.

In combination with the new LNSC-2420-Addon board this allows to switch
on a high-power heater connected directly to the solar panels whenever
the temperature is too low to charge the battery. Once the temperature
becomes high enough again, the heater is switched off and the battery is
charged instead.
2023-04-22 20:02:16 +02:00
Thomas Kolb 5c6497fb82 charge_control: block charging if external temperature is too low 2022-10-15 21:44:27 +02:00
Thomas Kolb 481cf6f9f4 Use the new flash config module 2022-09-25 17:24:21 +02:00
Thomas Kolb 6ff8918e62 Fixed incorrect state transition due to 0-current glitch 2021-09-19 14:06:24 +02:00
Thomas Kolb 716c158716 Discharging: use averaged values for thresholds 2021-07-10 16:38:47 +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 79fe1113de charge_control: implement voltage transition 2021-07-01 21:10:13 +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 62b63efba3 charge_control: first state transition wins 2021-06-12 17:07:16 +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 d2a95c4353 charge_control: removed unused code 2021-06-11 23:52:50 +02:00
Thomas Kolb ed6ac04686 Refactoring: move FSMs to separate functions 2021-06-11 22:51:02 +02:00
Thomas Kolb 1ad35dae2b Print (dis)charge FSM state changes 2021-06-11 22:35:07 +02:00
Thomas Kolb 6b070bbf86 Started implementing real charge control
Everything untested so far…
2021-06-07 22:45:17 +02:00