LibreSolar / charge-controller-firmware

Firmware for Libre Solar MPPT/PWM charge controllers
https://libre.solar/charge-controller-firmware/
Apache License 2.0
144 stars 71 forks source link

Improve error handling #104

Open martinjaeger opened 4 years ago

martinjaeger commented 4 years ago

Currently, error information is often printed to the debug console immediately after the error is identified.

Some error conditions like undervoltage may persist for a longer period of time, resulting in lots of prints to the console. Also, errors often occur / are detected in an ISR context, where printing something is not ideal.

Possible improvement: Only set an error flag and offload error reporting to a different (lower priority) thread, possibly even the main thread. The error reporting checks if a flag has changed compared to previous check and prints the information about a new (or resolved) error only once.