mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-26 00:20:35 +08:00
Battery estimator: Warn on dangerously low levels.
We need to differentiate between a level where the user should act and where we are about to fall out of the sky (emergency). This helps performing more suitable failsafe actions.
This commit is contained in:
@@ -51,6 +51,7 @@ Battery::Battery() :
|
||||
_param_r_internal(this, "R_INTERNAL"),
|
||||
_param_low_thr(this, "LOW_THR"),
|
||||
_param_crit_thr(this, "CRIT_THR"),
|
||||
_param_emergency_thr(this, "EMERGEN_THR"),
|
||||
_voltage_filtered_v(-1.0f),
|
||||
_discharged_mah(0.0f),
|
||||
_remaining_voltage(1.0f),
|
||||
@@ -219,7 +220,10 @@ void
|
||||
Battery::determineWarning()
|
||||
{
|
||||
// Smallest values must come first
|
||||
if (_remaining < _param_crit_thr.get()) {
|
||||
if (_remaining < _param_emergency_thr.get()) {
|
||||
_warning = battery_status_s::BATTERY_WARNING_EMERGENCY;
|
||||
|
||||
} else if (_remaining < _param_crit_thr.get()) {
|
||||
_warning = battery_status_s::BATTERY_WARNING_CRITICAL;
|
||||
|
||||
} else if (_remaining < _param_low_thr.get()) {
|
||||
|
||||
Reference in New Issue
Block a user