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:
+10
-1
@@ -260,7 +260,9 @@ void LoadOutput::state_machine()
|
||||
switch (state) {
|
||||
case LOAD_STATE_DISABLED:
|
||||
if (enable == true) {
|
||||
if (port->pos_current_limit > 0) {
|
||||
if (port->pos_current_limit > 0 &&
|
||||
!dev_stat.has_error(ERR_BAT_UNDERVOLTAGE | ERR_BAT_OVERVOLTAGE))
|
||||
{
|
||||
switch_set(true);
|
||||
state = LOAD_STATE_ON;
|
||||
}
|
||||
@@ -407,3 +409,10 @@ void LoadOutput::control()
|
||||
debounce_counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadOutput::emergency_stop(uint16_t next_state)
|
||||
{
|
||||
switch_set(false);
|
||||
leds_flicker(LED_LOAD);
|
||||
state = next_state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user