Fine-tuning of battery/load UV/OV alerts

- Alerts now set to +-20% of actual measured voltage
- Hysteresis for load overvoltage reconnect setpoint made configurable
- Added check for PWM switch MOSFET driver undervoltage
This commit is contained in:
Martin Jaeger
2019-11-11 11:38:34 +01:00
parent f254c77ab6
commit 47954166be
5 changed files with 21 additions and 21 deletions
+6 -2
View File
@@ -83,8 +83,11 @@ extern "C" void TIM3_IRQHandler(void)
{
TIM3->SR &= ~TIM_SR_UIF; // clear update interrupt flag
// turning the PWM switch on creates a short voltage rise, so inhibit alerts by 10 ms
adc_upper_alert_inhibit(ADC_POS_V_BAT, 10);
if ((int)TIM3->CCR4 < _pwm_resolution) {
// turning the PWM switch on creates a short voltage rise, so inhibit alerts by 10 ms
// at each rising edge if switch is not continuously on
adc_upper_alert_inhibit(ADC_POS_V_BAT, 10);
}
}
void pwm_signal_set_duty_cycle(float duty)
@@ -180,6 +183,7 @@ void PwmSwitch::control()
if (_pwm_active) {
if (port_int->pos_current_limit == 0 || terminal->neg_current_limit == 0
|| terminal->current > 0 // discharging battery into solar panel --> stop
|| port_int->voltage < 9.0 // not enough voltage for MOSFET drivers anymore
|| enabled == false)
{
pwm_signal_stop();