Closed hogthrob closed 4 years ago
Good observation. I even saw that a charge controller didn't continue charging even though the battery was not full, but thought it was because the device had a hardware fault (which it actually had).
I am working on the load output and issue #91 at the moment, so this error may have been solved already, but I'll double-check.
Originally, I wanted to push the changes to a separate branch load_out_rework
and do some further testing before merging it to master, but for some reason git push origin load_out_rework
also updated the master, where I added the commits locally already... as I don't want to force-push to master, I'll keep them in now.
What's missing is mainly the USB port testing with the new more generic LoadOutput
class (inheriting from PowerPort
). I'll try to do that and check aswell if above error is resolved.
With the update, the ERR_BAT_UNDERVOLTAGE
is not used for load driving anymore. Instead, each load has its own voltage limit (allowing to set different thresholds for USB output and the actual load terminal). The flag is still existing in the charger, but currently not used anymore.
Just committed recent changes from develop branch which should have finally fixed this issue. Double-checked again today.
The switch to Zephyr RTOS is now almost finished, just some final testing missing until I'll create a new firmware release.
What is the problem:
If the battery was discharged until the load disconnects, charging will never commence after it stopped e.g. due to missing sunlight.
Problem Analysis: If the load gets disconnected, we finally set the ERR_BAT_UNDERVOLTAGE in Charger::discharge_control() here: https://github.com/LibreSolar/charge-controller-firmware/blob/2154a1cb72612ce70c181a5432678fa22c61ed70/src/bat_charger.cpp#L303
Only place we clear the flag is this: https://github.com/LibreSolar/charge-controller-firmware/blob/8539fa35572731f1cb6a8a48f7904743a2f6c33c/src/bat_charger.cpp#L336-L349
Since we will now never pass the start condition check (which tests for ERR_BAT_UNDERVOLTAGE) here: https://github.com/LibreSolar/charge-controller-firmware/blob/2154a1cb72612ce70c181a5432678fa22c61ed70/src/dcdc.cpp#L132 we will never clear the flag ERR_BAT_UNDERVOLTAGE unless the battery voltage increases above the bat_conf->voltage_load_reconnect. However, how should the battery voltage magically increase above the limit without being charged?
The underlying question is: What is the exact meaning of ERR_BAT_UNDERVOLTAGE?
I tend to interpretation 2.