forked from Archive/PX4-Autopilot
battery: only propagate warning state in upwards
This commit is contained in:
parent
f9b8afc006
commit
115e7246b0
|
@ -225,14 +225,14 @@ void
|
|||
Battery::determineWarning(bool connected)
|
||||
{
|
||||
if (connected) {
|
||||
// Smallest values must come first
|
||||
if (_remaining < _param_emergency_thr.get()) {
|
||||
// propagate warning state only if the state is higher, otherwise remain in current waringin state
|
||||
if (_remaining < _param_emergency_thr.get() || (_warning == battery_status_s::BATTERY_WARNING_EMERGENCY)) {
|
||||
_warning = battery_status_s::BATTERY_WARNING_EMERGENCY;
|
||||
|
||||
} else if (_remaining < _param_crit_thr.get()) {
|
||||
} else if (_remaining < _param_crit_thr.get() || (_warning == battery_status_s::BATTERY_WARNING_CRITICAL)) {
|
||||
_warning = battery_status_s::BATTERY_WARNING_CRITICAL;
|
||||
|
||||
} else if (_remaining < _param_low_thr.get()) {
|
||||
} else if (_remaining < _param_low_thr.get() || (_warning == battery_status_s::BATTERY_WARNING_LOW)) {
|
||||
_warning = battery_status_s::BATTERY_WARNING_LOW;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue