Load off for internal overtemp implemented

This commit is contained in:
Martin Jaeger
2019-10-31 12:07:21 +01:00
parent b1a7babaff
commit b98461fee4
5 changed files with 55 additions and 8 deletions
+21 -2
View File
@@ -275,7 +275,7 @@ void LoadOutput::state_machine()
}
else {
// must be battery over/under temperature then
state = LOAD_STATE_OFF_BAT_TEMP;
state = LOAD_STATE_OFF_TEMPERATURE;
}
}
}
@@ -294,7 +294,7 @@ void LoadOutput::state_machine()
}
else {
// must be battery over/under temperature then
state = LOAD_STATE_OFF_BAT_TEMP;
state = LOAD_STATE_OFF_TEMPERATURE;
}
}
break;
@@ -328,6 +328,13 @@ void LoadOutput::state_machine()
state = LOAD_STATE_DISABLED; // switch to normal mode again
}
break;
case LOAD_STATE_OFF_TEMPERATURE:
if (!(log_data.error_flags & (1U << ERR_INT_OVERTEMP)) &&
port->pos_current_limit > 0)
{
state = LOAD_STATE_DISABLED;
}
break;
}
usb_state_machine();
@@ -363,6 +370,16 @@ void LoadOutput::control()
log_data.error_flags |= (1 << ERR_LOAD_OVERCURRENT);
print_error("Load overcurrent detected\n");
overcurrent_timestamp = time(NULL);
return;
}
// internal overtemperature
if (log_data.error_flags & (1U << ERR_INT_OVERTEMP)) {
switch_set(false);
usb_set(false);
state = LOAD_STATE_OFF_TEMPERATURE;
print_error("Device overtemperature detected\n");
return;
}
// overcurrent detected because of voltage dip by 25%
@@ -374,6 +391,7 @@ void LoadOutput::control()
log_data.error_flags |= (1 << ERR_LOAD_VOLTAGE_DIP);
print_error("Load voltage dip detected\n");
overcurrent_timestamp = time(NULL);
return;
}
voltage_prev = port->voltage;
@@ -389,6 +407,7 @@ void LoadOutput::control()
state = LOAD_STATE_OFF_OVERVOLTAGE;
overcurrent_timestamp = time(NULL);
log_data.error_flags |= (1 << ERR_LOAD_OVERVOLTAGE);
return;
}
}
else {