Distinguishing between OV and UV alerts, inhibit added

- During overvoltage alerts, only power sources (PWM switch and DC/DC are
  switched off), undervoltage only switches load off
- Alert inhibit added to prevent switching off during PWM switch startup
This commit is contained in:
Martin Jaeger
2019-11-05 18:43:33 +01:00
parent 7874b8b4d6
commit 5e3181f5e5
5 changed files with 77 additions and 56 deletions
+4
View File
@@ -18,6 +18,8 @@
#include "config.h"
#include "pcb.h"
#include "adc_dma.h"
#include <stdio.h>
#include <time.h> // for time(NULL) function
@@ -203,6 +205,8 @@ void PwmSwitch::control()
&& time(NULL) > (off_timestamp + restart_interval)
&& enabled == true)
{
// turning the PWM switch on creates a short voltage rise, so inhibit alerts by 100 ms
adc_alert_inhibit(ADC_POS_V_BAT, 100);
pwm_signal_start(1);
printf("PWM charger start.\n");
}