|
|
|
@ -300,6 +300,7 @@ Vehicle::Vehicle(LinkInterface* link,
@@ -300,6 +300,7 @@ Vehicle::Vehicle(LinkInterface* link,
|
|
|
|
|
// Start csv logger
|
|
|
|
|
connect(&_csvLogTimer, &QTimer::timeout, this, &Vehicle::_writeCsvLine); |
|
|
|
|
_csvLogTimer.start(1000); |
|
|
|
|
_lastBatteryAnnouncement.start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Disconnected Vehicle for offline editing
|
|
|
|
@ -1126,7 +1127,7 @@ void Vehicle::_handleAttitudeQuaternion(mavlink_message_t& message)
@@ -1126,7 +1127,7 @@ void Vehicle::_handleAttitudeQuaternion(mavlink_message_t& message)
|
|
|
|
|
// if repr_offset is valid, rotate attitude and rates
|
|
|
|
|
if (repr_offset.norm() >= 0.5f) { |
|
|
|
|
quat = quat * repr_offset; |
|
|
|
|
rates = repr_offset * rates;
|
|
|
|
|
rates = repr_offset * rates; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float roll, pitch, yaw; |
|
|
|
@ -1550,12 +1551,16 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
@@ -1550,12 +1551,16 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
|
|
|
|
|
} |
|
|
|
|
_battery1FactGroup.percentRemaining()->setRawValue(sysStatus.battery_remaining); |
|
|
|
|
|
|
|
|
|
//-- Low battery warning
|
|
|
|
|
if (sysStatus.battery_remaining > 0) { |
|
|
|
|
if (sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() && |
|
|
|
|
sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) { |
|
|
|
|
int warnThreshold = _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt(); |
|
|
|
|
if (sysStatus.battery_remaining < warnThreshold && |
|
|
|
|
sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent && |
|
|
|
|
_lastBatteryAnnouncement.elapsed() > (sysStatus.battery_remaining < warnThreshold * 0.5 ? 15000 : 30000)) { |
|
|
|
|
_say(tr("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining)); |
|
|
|
|
_lastBatteryAnnouncement.start(); |
|
|
|
|
_lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining; |
|
|
|
|
} |
|
|
|
|
_lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (_onboardControlSensorsPresent != sysStatus.onboard_control_sensors_present) { |
|
|
|
@ -1656,12 +1661,13 @@ void Vehicle::_updateArmed(bool armed)
@@ -1656,12 +1661,13 @@ void Vehicle::_updateArmed(bool armed)
|
|
|
|
|
if (_armed != armed) { |
|
|
|
|
_armed = armed; |
|
|
|
|
emit armedChanged(_armed); |
|
|
|
|
|
|
|
|
|
// We are transitioning to the armed state, begin tracking trajectory points for the map
|
|
|
|
|
if (_armed) { |
|
|
|
|
_trajectoryPoints->start(); |
|
|
|
|
_flightTimerStart(); |
|
|
|
|
_clearCameraTriggerPoints(); |
|
|
|
|
// Reset battery warning
|
|
|
|
|
_lastAnnouncedLowBatteryPercent = 100; |
|
|
|
|
} else { |
|
|
|
|
_trajectoryPoints->stop(); |
|
|
|
|
_flightTimerStop(); |
|
|
|
|