Skip to content

Commit

Permalink
Merge pull request mavlink#5790 from DonLakeFlyer/BatteryAnnounce
Browse files Browse the repository at this point in the history
Fix battery announce for battery change
  • Loading branch information
DonLakeFlyer authored Oct 28, 2017
2 parents 50a1686 + 5cd2619 commit 1ae6821
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -914,11 +914,12 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
}
_batteryFactGroup.percentRemaining()->setRawValue(sysStatus.battery_remaining);

if (sysStatus.battery_remaining > 0 &&
sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() &&
sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) {
if (sysStatus.battery_remaining > 0) {
if (sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() &&
sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) {
_say(QString("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining));
}
_lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining;
_say(QString("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining));
}

_onboardControlSensorsPresent = sysStatus.onboard_control_sensors_present;
Expand Down

0 comments on commit 1ae6821

Please sign in to comment.