diff --git a/src/FactSystem/Fact.cc b/src/FactSystem/Fact.cc index 116992a2cf8cec730e6889cda67c022eac220551..645904a153b42e2dc0c9aa746e72c1894ed01bb1 100644 --- a/src/FactSystem/Fact.cc +++ b/src/FactSystem/Fact.cc @@ -482,3 +482,13 @@ QString Fact::validate(const QString& cookedValue, bool convertOnly) return QString("Internal error: Meta data pointer missing"); } } + +bool Fact::rebootRequired(void) const +{ + if (_metaData) { + return _metaData->rebootRequired(); + } else { + qWarning() << "Meta data pointer missing"; + return false; + } +} diff --git a/src/FactSystem/Fact.h b/src/FactSystem/Fact.h index 0c68756ee71a00881eba0a53aa1c39dada3cdc28..8e3eaa5190f9af1384d1218e40ddc4aaf765f02b 100644 --- a/src/FactSystem/Fact.h +++ b/src/FactSystem/Fact.h @@ -66,6 +66,7 @@ public: Q_PROPERTY(QString minString READ cookedMinString CONSTANT) Q_PROPERTY(bool minIsDefaultForType READ minIsDefaultForType CONSTANT) Q_PROPERTY(QString name READ name CONSTANT) + Q_PROPERTY(bool rebootRequired READ rebootRequired CONSTANT) Q_PROPERTY(QString shortDescription READ shortDescription CONSTANT) Q_PROPERTY(FactMetaData::ValueType_t type READ type CONSTANT) Q_PROPERTY(QString units READ cookedUnits CONSTANT) @@ -109,6 +110,7 @@ public: QString rawValueString (void) const; QString cookedValueString (void) const; bool valueEqualsDefault (void) const; + bool rebootRequired (void) const; void setRawValue (const QVariant& value); void setCookedValue (const QVariant& value); diff --git a/src/FactSystem/FactMetaData.cc b/src/FactSystem/FactMetaData.cc index 26160336e8e2fc007bd80c4bbf083f61cebe9b00..18ab974b1bc5ed45df3eac93f18ab04397806947 100644 --- a/src/FactSystem/FactMetaData.cc +++ b/src/FactSystem/FactMetaData.cc @@ -51,6 +51,7 @@ FactMetaData::FactMetaData(QObject* parent) , _minIsDefaultForType(true) , _rawTranslator(_defaultTranslator) , _cookedTranslator(_defaultTranslator) + , _rebootRequired(false) { } @@ -68,6 +69,7 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent) , _minIsDefaultForType(true) , _rawTranslator(_defaultTranslator) , _cookedTranslator(_defaultTranslator) + , _rebootRequired(false) { } @@ -100,6 +102,7 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other) _cookedUnits = other._cookedUnits; _rawTranslator = other._rawTranslator; _cookedTranslator = other._cookedTranslator; + _rebootRequired = other._rebootRequired; return *this; } diff --git a/src/FactSystem/FactMetaData.h b/src/FactSystem/FactMetaData.h index 8791814ac7f70b2dc3ba8d431074e68611e95739..dafb5b75d701da33258f8cea8090e3af9f7a4f27 100644 --- a/src/FactSystem/FactMetaData.h +++ b/src/FactSystem/FactMetaData.h @@ -81,6 +81,7 @@ public: ValueType_t type (void) const { return _type; } QString rawUnits (void) const { return _rawUnits; } QString cookedUnits (void) const { return _cookedUnits; } + bool rebootRequired (void) const { return _rebootRequired; } Translator rawTranslator (void) const { return _rawTranslator; } Translator cookedTranslator (void) const { return _cookedTranslator; } @@ -102,6 +103,7 @@ public: void setName (const QString& name) { _name = name; } void setShortDescription(const QString& shortDescription) { _shortDescription = shortDescription; } void setRawUnits (const QString& rawUnits); + void setRebootRequired (bool rebootRequired) { _rebootRequired = rebootRequired; } void setTranslators(Translator rawTranslator, Translator cookedTranslator); @@ -150,6 +152,7 @@ private: QString _cookedUnits; Translator _rawTranslator; Translator _cookedTranslator; + bool _rebootRequired; struct BuiltInTranslation_s { const char* rawUnits; diff --git a/src/FactSystem/ParameterLoader.cc b/src/FactSystem/ParameterLoader.cc index 2b95b3e56b65a563c712d3d4b109e55d326c257b..7d4ea5e43395219bd8e76ee64d4dd01e6b92d2da 100644 --- a/src/FactSystem/ParameterLoader.cc +++ b/src/FactSystem/ParameterLoader.cc @@ -295,6 +295,10 @@ void ParameterLoader::_valueUpdated(const QVariant& value) _writeParameterRaw(componentId, fact->name(), value); qCDebug(ParameterLoaderLog) << "Set parameter (componentId:" << componentId << "name:" << name << value << ")"; + + if (fact->rebootRequired() && !qgcApp()->runningUnitTests()) { + qgcApp()->showMessage(QStringLiteral("Change of parameter %1 requires a Vehicle reboot to take effect").arg(name)); + } } void ParameterLoader::refreshAllParameters(uint8_t componentID) diff --git a/src/FirmwarePlugin/APM/APMParameterMetaData.cc b/src/FirmwarePlugin/APM/APMParameterMetaData.cc index 6397f11041c817afbd5b19a18c7bc3efdc84afa2..be7fc932cd3900a1ebb5f71f675ab719c928b45d 100644 --- a/src/FirmwarePlugin/APM/APMParameterMetaData.cc +++ b/src/FirmwarePlugin/APM/APMParameterMetaData.cc @@ -342,6 +342,7 @@ bool APMParameterMetaData::parseParameterAttributes(QXmlStreamReader& xml, APMFa // skip empty elements. Somehow I am getting lot of these. Dont know what to do with them. } else if (elementName == "field") { QString attributeName = xml.attributes().value("name").toString(); + if ( attributeName == "Range") { QString range = xml.readElementText().trimmed(); QStringList rangeList = range.split(' '); @@ -402,6 +403,11 @@ bool APMParameterMetaData::parseParameterAttributes(QXmlStreamReader& xml, APMFa if (parseError) { rawMetaData->bitmask.clear(); } + } else if (attributeName == "RebootRequired") { + QString strValue = xml.readElementText().trimmed(); + if (strValue.compare("true", Qt::CaseInsensitive) == 0) { + rawMetaData->rebootRequired = true; + } } } else if (elementName == "values") { // doing nothing individual value will follow anyway. May be used for sanity checking. @@ -447,6 +453,7 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType) metaData->setName(rawMetaData->name); metaData->setGroup(rawMetaData->group); + metaData->setRebootRequired(rawMetaData->rebootRequired); if (!rawMetaData->shortDescription.isEmpty()) { metaData->setShortDescription(rawMetaData->shortDescription); diff --git a/src/FirmwarePlugin/APM/APMParameterMetaData.h b/src/FirmwarePlugin/APM/APMParameterMetaData.h index e346d8dfb249132f476e17729d89ec240c7edab9..66a4749bc3b8f59f20be2295a1c8e13468823fb8 100644 --- a/src/FirmwarePlugin/APM/APMParameterMetaData.h +++ b/src/FirmwarePlugin/APM/APMParameterMetaData.h @@ -37,14 +37,19 @@ class APMFactMetaDataRaw { public: - QString name; - QString group; - QString shortDescription; - QString longDescription; - QString min; - QString max; - QString incrementSize; - QString units; + APMFactMetaDataRaw(void) + : rebootRequired(false) + { } + + QString name; + QString group; + QString shortDescription; + QString longDescription; + QString min; + QString max; + QString incrementSize; + QString units; + bool rebootRequired; QList > values; QList > bitmask; }; diff --git a/src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc b/src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc index d8357f34a10e9a8dab8d1c9145ea36082a913109..052c78e10938673dd72c49f28ef03fb182ac37ab 100644 --- a/src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc +++ b/src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc @@ -312,6 +312,14 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void) qCWarning(PX4ParameterMetaDataLog) << "Invalid decimals value, name:" << metaData->name() << " type:" << metaData->type() << " decimals:" << text << " error: invalid number"; } + } else if (elementName == "reboot_required") { + Q_ASSERT(metaData); + QString text = xml.readElementText(); + qCDebug(PX4ParameterMetaDataLog) << "RebootRequired:" << text; + if (text.compare("true", Qt::CaseInsensitive) == 0) { + metaData->setRebootRequired(true); + } + } else { qDebug() << "Unknown element in XML: " << elementName; } diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index a5957e55db32ad08552529c6995d3c6129ca3dbb..695dfe3944648a8df2af3f0ce46813317080dfeb 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -50,7 +50,6 @@ Item { property var _activeVehicle: multiVehicleManager.activeVehicle - readonly property var _defaultVehicleCoordinate: mainWindow.tabletPosition readonly property real _defaultRoll: 0 readonly property real _defaultPitch: 0 readonly property real _defaultHeading: 0 @@ -71,8 +70,6 @@ Item { property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading - property var _vehicleCoordinate: _activeVehicle ? (_activeVehicle.coordinateValid ? _activeVehicle.coordinate : _defaultVehicleCoordinate) : _defaultVehicleCoordinate - property real _altitudeWGS84: _activeVehicle ? _activeVehicle.altitudeWGS84 : _defaultAltitudeWGS84 property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed @@ -120,7 +117,6 @@ Item { _flightMap.zoomLevel = _savedZoomLevel else _savedZoomLevel = _flightMap.zoomLevel - _flightMap.updateMapPosition(true /* force */) } else { _flightVideo = item } diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 85db4d30166ddbb9ec83bd00dc9c58b47937e603..8940b3e708dd12d2dbbfb30f59d22d502255c66f 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -39,18 +39,15 @@ FlightMap { id: flightMap anchors.fill: parent mapName: _mapName - latitude: mainWindow.tabletPosition.latitude - longitude: mainWindow.tabletPosition.longitude - property var rootVehicleCoordinate: _vehicleCoordinate - property bool _followVehicle: true + property bool _followVehicle: true + property bool _activeVehicleCoordinateValid: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinateValid : false + property var activeVehicleCoordinate: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinate : QtPositioning.coordinate() - onRootVehicleCoordinateChanged: updateMapPosition(false /* force */) - - function updateMapPosition(force) { - if (_followVehicle || force) { - flightMap.latitude = root._vehicleCoordinate.latitude - flightMap.longitude = root._vehicleCoordinate.longitude + onActiveVehicleCoordinateChanged: { + if (_followVehicle && activeVehicleCoordinate.isValid) { + _initialMapPositionSet = true + flightMap.center = activeVehicleCoordinate } } diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index cf1474a47d5da3a1eca2b1c617d05e91500c47bd..add34e25ba22939319f9ef6cc501ccb3394fc39c 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -43,22 +43,16 @@ import QGroundControl.Mavlink 1.0 Map { id: _map - property real latitude: 64.154549 //-- If you find yourself here on startup, something went wrong :) - property real longitude: -22.023540 - property real heading: 0 property bool interactive: true property string mapName: 'defaultMap' property string mapType: QGroundControl.flightMapSettings.mapTypeForMapName(mapName) // property alias mapWidgets: controlWidgets property bool isSatelliteMap: mapType == "Satellite Map" || mapType == "Hybrid Map" - property real lon: (longitude >= -180 && longitude <= 180) ? longitude : 0 - property real lat: (latitude >= -90 && latitude <= 90) ? latitude : 0 - readonly property real maxZoomLevel: 20 zoomLevel: 18 - center: QtPositioning.coordinate(lat, lon) + center: QGroundControl.defaultMapPosition gesture.flickDeceleration: 3000 gesture.enabled: interactive gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture @@ -69,6 +63,18 @@ Map { Component.onCompleted: onMapTypeChanged + property bool _initialMapPositionSet: false + Connections { + target: mainWindow + + onGcsPositionChanged: { + if (!_initialMapPositionSet) { + _initialMapPositionSet = true + flightMap.center = mainWindow.gcsPosition + } + } + } + onMapTypeChanged: { QGroundControl.flightMapSettings.setMapTypeForMapName(mapName, mapType) var fullMapName = QGroundControl.flightMapSettings.mapProvider + " " + mapType @@ -80,7 +86,18 @@ Map { } } -/********************************************* + MapQuickItem { + anchorPoint.x: sourceItem.width / 2 + anchorPoint.y: sourceItem.height / 2 + visible: mainWindow.gcsPosition.isValid + coordinate: mainWindow.gcsPosition + + sourceItem: MissionItemIndexLabel { + label: "Q" + } + } + + /********************************************* /// Map control widgets Column { id: controlWidgets diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index 9dcfb1339b149eb8dc912bb9a1a4dc2baf5582ed..41cd0fbad0707c622d2fa19461f4454b02da492f 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -62,13 +62,8 @@ QGCView { property var _missionItems: controller.missionItems property var _currentMissionItem - - property bool gpsLock: _activeVehicle ? _activeVehicle.coordinateValid : false - property bool _firstGpsLock: true - - //property var _homePositionManager: QGroundControl.homePositionManager - //property string _homePositionName: _homePositionManager.homePositions.get(0).name - //property var offlineHomePosition: _homePositionManager.homePositions.get(0).coordinate + property bool _firstVehiclePosition: true + property var activeVehiclePosition: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate() property var liveHomePosition: controller.liveHomePosition property var liveHomePositionAvailable: controller.liveHomePositionAvailable @@ -76,17 +71,23 @@ QGCView { property bool _syncInProgress: _activeVehicle ? _activeVehicle.missionManager.inProgress : false - onGpsLockChanged: updateMapToVehiclePosition() + Component.onCompleted: updateMapToVehiclePosition() + onActiveVehiclePositionChanged: updateMapToVehiclePosition() - Component.onCompleted: { - updateMapToVehiclePosition() + Connections { + target: multiVehicleManager + + onActiveVehicleChanged: { + // When the active vehicle changes we need to allow the first vehicle position to move the map again + _firstVehiclePosition = true + updateMapToVehiclePosition() + } } function updateMapToVehiclePosition() { - if (gpsLock && _firstGpsLock) { - _firstGpsLock = false - editorMap.latitude = _activeVehicle.latitude - editorMap.longitude = _activeVehicle.longitude + if (_activeVehicle && _activeVehicle.coordinateValid && _firstVehiclePosition) { + _firstVehiclePosition = false + editorMap.center = _activeVehicle.coordinate } } @@ -178,8 +179,6 @@ QGCView { id: editorMap anchors.fill: parent mapName: "MissionEditor" - latitude: mainWindow.tabletPosition.latitude - longitude: mainWindow.tabletPosition.longitude readonly property real animationDuration: 500 @@ -190,20 +189,6 @@ QGCView { } } - Behavior on latitude { - NumberAnimation { - duration: editorMap.animationDuration - easing.type: Easing.InOutQuad - } - } - - Behavior on longitude { - NumberAnimation { - duration: editorMap.animationDuration - easing.type: Easing.InOutQuad - } - } - MouseArea { anchors.fill: parent diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 9852ad77fa8cd90ee68459ae6be5dd8c08bf5f18..af75b7a315901a0c07c4c463dc3aee037f3b9d75 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -122,6 +122,8 @@ const char* QGCApplication::_settingsVersionKey = "SettingsVersion"; const char* QGCApplication::_promptFlightDataSave = "PromptFLightDataSave"; const char* QGCApplication::_promptFlightDataSaveNotArmed = "PromptFLightDataSaveNotArmed"; const char* QGCApplication::_styleKey = "StyleIsDark"; +const char* QGCApplication::_defaultMapPositionLatKey = "DefaultMapPositionLat"; +const char* QGCApplication::_defaultMapPositionLonKey = "DefaultMapPositionLon"; const char* QGCApplication::_darkStyleFile = ":/res/styles/style-dark.css"; const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css"; @@ -177,6 +179,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) #endif , _toolbox(NULL) , _bluetoothAvailable(false) + , _defaultMapPosition(37.803784, -122.462276) { Q_ASSERT(_app == NULL); _app = this; @@ -319,6 +322,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); } + _defaultMapPosition.setLatitude(settings.value(_defaultMapPositionLatKey, 37.803784).toDouble()); + _defaultMapPosition.setLongitude(settings.value(_defaultMapPositionLonKey, -122.462276).toDouble()); + // Initialize Bluetooth #ifdef QGC_ENABLE_BLUETOOTH QBluetoothLocalDevice localDevice; @@ -713,3 +719,12 @@ void QGCApplication::_showSetupVehicleComponent(VehicleComponent* vehicleCompone QMetaObject::invokeMethod(_rootQmlObject(), "showSetupVehicleComponent", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varComponent)); } + +void QGCApplication::setDefaultMapPosition(QGeoCoordinate& defaultMapPosition) +{ + QSettings settings; + + settings.setValue(_defaultMapPositionLatKey, defaultMapPosition.latitude()); + settings.setValue(_defaultMapPositionLonKey, defaultMapPosition.longitude()); + _defaultMapPosition = defaultMapPosition; +} diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 24bfd25d742c515461c97b71df2f33a019f3ac6e..7e0ce1bda97e68afef7a346cea5befdc25eafece 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -121,6 +121,9 @@ public: /// Do we have Bluetooth Support? bool isBluetoothAvailable() { return _bluetoothAvailable; } + QGeoCoordinate defaultMapPosition(void) { return _defaultMapPosition; } + void setDefaultMapPosition(QGeoCoordinate& defaultMapPosition); + public slots: /// You can connect to this slot to show an information message box from a different thread. void informationMessageBoxOnMainThread(const QString& title, const QString& msg); @@ -184,12 +187,6 @@ private: QQmlApplicationEngine* _qmlAppEngine; #endif - static const char* _settingsVersionKey; ///< Settings key which hold settings version - static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted - static const char* _promptFlightDataSave; ///< Settings key for promptFlightDataSave - static const char* _promptFlightDataSaveNotArmed; ///< Settings key for promptFlightDataSaveNotArmed - static const char* _styleKey; ///< Settings key for UI style - bool _runningUnitTests; ///< true: running unit tests, false: normal app static const char* _darkStyleFile; @@ -210,6 +207,16 @@ private: bool _bluetoothAvailable; + QGeoCoordinate _defaultMapPosition; ///< Map position when all other sources fail + + static const char* _settingsVersionKey; ///< Settings key which hold settings version + static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted + static const char* _promptFlightDataSave; ///< Settings key for promptFlightDataSave + static const char* _promptFlightDataSaveNotArmed; ///< Settings key for promptFlightDataSaveNotArmed + static const char* _styleKey; ///< Settings key for UI style + static const char* _defaultMapPositionLatKey; ///< Settings key for default map location + static const char* _defaultMapPositionLonKey; ///< Settings key for default map location + /// Unit Test have access to creating and destroying singletons friend class UnitTest; }; diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index ca0348a9d76299c54c70a882708d8bc2088e9475..b73ec2220f3414def698229f1e1a5e61f8542c61 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -42,7 +42,6 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app) , _virtualTabletJoystick(false) , _offlineEditingFirmwareTypeFact(QString(), "OfflineEditingFirmwareType", FactMetaData::valueTypeUint32, (uint32_t)MAV_AUTOPILOT_ARDUPILOTMEGA) , _offlineEditingFirmwareTypeMetaData(FactMetaData::valueTypeUint32) - { QSettings settings; _virtualTabletJoystick = settings.value(_virtualTabletJoystickKey, false). toBool(); diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index ff4403052e5ac349742ef5933409022bd4d2d5f0..95e3d01448511553b7e5187668be4205ffeb1648 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -76,6 +76,8 @@ public: Q_PROPERTY(Fact* offlineEditingFirmwareType READ offlineEditingFirmwareType CONSTANT) + Q_PROPERTY(QGeoCoordinate defaultMapPosition READ defaultMapPosition CONSTANT) + Q_INVOKABLE void saveGlobalSetting (const QString& key, const QString& value); Q_INVOKABLE QString loadGlobalSetting (const QString& key, const QString& defaultValue); Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value); @@ -113,6 +115,8 @@ public: bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); } int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); } + QGeoCoordinate defaultMapPosition() { return qgcApp()->defaultMapPosition(); } + Fact* offlineEditingFirmwareType () { return &_offlineEditingFirmwareTypeFact; } //-- TODO: Make this into an actual preference. @@ -144,7 +148,6 @@ signals: void mavlinkSystemIDChanged (int id); private: - FlightMapSettings* _flightMapSettings; HomePositionManager* _homePositionManager; LinkManager* _linkManager; diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 076217e3b6adc7f56ceb5384bc22371f08365e66..06cc6d828886d92cc08b5b48b76d7e2c6d0979e1 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -281,6 +281,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message) if (emitHomePositionChanged) { qCDebug(VehicleLog) << "New home position" << newHomePosition; + qgcApp()->setDefaultMapPosition(_homePosition); emit homePositionChanged(_homePosition); } if (emitHomePositionAvailableChanged) { diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index 3144830cb0b206e96e660b82a304125c50c08271..72e922e661e9b17625d8deec3fbad9e57e815409 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -33,9 +33,9 @@ import QGroundControl.FlightDisplay 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.MultiVehicleManager 1.0 -/// Inner common QML for MainWindow +/// Inner common QML for mainWindow Item { - id: mainWindow + id: mainWindow signal reallyClose @@ -50,10 +50,7 @@ Item { property real tbButtonWidth: tbCellHeight * 1.35 property real availableHeight: height - tbHeight property real menuButtonWidth: (tbButtonWidth * 2) + (tbSpacing * 4) + 1 - - property var defaultPosition: QtPositioning.coordinate(37.803784, -122.462276) - property var tabletPosition: defaultPosition - + property var gcsPosition: QtPositioning.coordinate() // Starts as invalid coordinate property var currentPopUp: null property real currentCenterX: 0 property var activeVehicle: multiVehicleManager.activeVehicle @@ -179,20 +176,20 @@ Item { PositionSource { id: positionSource updateInterval: 1000 - active: false + active: true + onPositionChanged: { if(positionSource.valid) { if(positionSource.position.coordinate.latitude) { if(Math.abs(positionSource.position.coordinate.latitude) > 0.001) { if(positionSource.position.coordinate.longitude) { if(Math.abs(positionSource.position.coordinate.longitude) > 0.001) { - tabletPosition = positionSource.position.coordinate + gcsPosition = positionSource.position.coordinate } } } } } - positionSource.stop() } } @@ -299,9 +296,6 @@ Item { anchors.fill: parent availableHeight: mainWindow.availableHeight visible: true - Component.onCompleted: { - positionSource.start() - } } Loader {