diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 5e13a39972573a9753913c004f17eb644bb86832..aa5129b7c3d9cd058bfcab99191eda502148bda6 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -451,6 +451,14 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) stopLowBattAlarm(); } + + // control_sensors_enabled: + // relevant bits: 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control + emit attitudeControlEnabled(state.onboard_control_sensors_enabled & (1 << 11)); + emit positionYawControlEnabled(state.onboard_control_sensors_enabled & (1 << 12)); + emit positionZControlEnabled(state.onboard_control_sensors_enabled & (1 << 13)); + emit positionXYControlEnabled(state.onboard_control_sensors_enabled & (1 << 14)); + // Trigger drop rate updates as needed. Here we convert the incoming // drop_rate_comm value from 1/100 of a percent in a uint16 to a true // percentage as a float. We also cap the incoming value at 100% as defined @@ -580,6 +588,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) speedZ = pos.vz/100.0; emit globalPositionChanged(this, latitude, longitude, altitude, time); emit speedChanged(this, speedX, speedY, speedZ, time); + // Set internal state if (!positionLock) { @@ -601,6 +610,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) // only accept values in a realistic range // quint64 time = getUnixTime(pos.time_usec); quint64 time = getUnixTime(pos.time_usec); + + emit gpsLocalizationChanged(this, pos.fix_type); + // TODO: track localization state not only for gps but also for other loc. sources + int loc_type = pos.fix_type; + if (loc_type == 1) + { + loc_type = 0; + } + emit localizationChanged(this, loc_type); if (pos.fix_type > 2) { diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index acaf4f019a8e2f4499d6e012eb3a073a5f14813a..295480a69571dc47d930ab5d27693e1ffd6b94ba 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -472,25 +472,45 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b void HSIDisplay::updatePositionLock(UASInterface* uas, bool lock) { Q_UNUSED(uas); + bool changed = positionLock != lock; positionLock = lock; + if (changed) + { + update(); + } } void HSIDisplay::updateAttitudeControllerEnabled(bool enabled) { + bool changed = attControlEnabled != enabled; attControlEnabled = enabled; attControlKnown = true; + if (changed) + { + update(); + } } void HSIDisplay::updatePositionXYControllerEnabled(bool enabled) { + bool changed = xyControlEnabled != enabled; xyControlEnabled = enabled; xyControlKnown = true; + if (changed) + { + update(); + } } void HSIDisplay::updatePositionZControllerEnabled(bool enabled) { + bool changed = zControlEnabled != enabled; zControlEnabled = enabled; zControlKnown = true; + if (changed) + { + update(); + } } void HSIDisplay::updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance)