LibreSolar / charge-controller-firmware

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

DAQ: Overvoltage and undervoltage alert debouncing calculation wrong if sampling frequency != 1kHz #109

Open martinjaeger opened 3 years ago

martinjaeger commented 3 years ago

The debouncing depends on the sampling frequency being 1 kHz, so one call is equivalent to 1 millisecond. This should be fixed to work properly in STM32G4 based charge controllers which currently run the ADC at much higher sampling rate.

JordanSilverman commented 3 years ago

Do you think this was the issue that caused the overvoltage protection to fail in your controller?

martinjaeger commented 3 years ago

No, don't think so, as it was only configured for battery overvoltage so far. But I realized this issue while implementing the protection for the high-side aswell.