ADC alerts and emergency stop functions added

Check for overvoltage/undervoltage conditions after each ADC reading cycle and
trigger alert (stopping DC/DC, PWM switch and load output) if limits exceeded.
This commit is contained in:
Martin Jaeger
2019-11-04 18:12:00 +01:00
parent 7412b11002
commit 7874b8b4d6
11 changed files with 198 additions and 3 deletions
+8
View File
@@ -137,6 +137,7 @@ int Dcdc::check_start_conditions()
hvs->voltage > hs_voltage_max || // also critical for buck mode because of ringing
lvs->voltage > ls_voltage_max ||
lvs->voltage < ls_voltage_min ||
dev_stat.has_error(ERR_BAT_UNDERVOLTAGE | ERR_BAT_OVERVOLTAGE) ||
time(NULL) < (off_timestamp + restart_interval))
{
return 0; // no energy transfer allowed
@@ -269,6 +270,13 @@ void Dcdc::test()
}
}
void Dcdc::emergency_stop()
{
half_bridge_stop();
state = DCDC_STATE_OFF;
off_timestamp = time(NULL);
}
void Dcdc::self_destruction()
{
print_error("Charge controller self-destruction called!\n");