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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user