Commit ca419659 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5220 from DonLakeFlyer/FirmwareUpgradeRemember

Keep track of firmware type during flash/connect
parents d91ca8e1 ebf34813
......@@ -136,5 +136,11 @@
"longDescription": "Your personal access token for Esri maps",
"type": "string",
"defaultValue": ""
},
{
"name": "DefaultFirmwareType",
"shortDescription": "Default firmware type for flashing",
"type": "uint32",
"defaultValue": 12
}
]
......@@ -33,6 +33,7 @@ const char* AppSettings::savePathName = "SavePat
const char* AppSettings::autoLoadMissionsName = "AutoLoadMissions";
const char* AppSettings::mapboxTokenName = "MapboxToken";
const char* AppSettings::esriTokenName = "EsriToken";
const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType";
const char* AppSettings::parameterFileExtension = "params";
const char* AppSettings::planFileExtension = "plan";
......@@ -67,6 +68,7 @@ AppSettings::AppSettings(QObject* parent)
, _autoLoadMissionsFact(NULL)
, _mapboxTokenFact(NULL)
, _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
......@@ -343,3 +345,11 @@ MAV_TYPE AppSettings::offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleT
}
}
Fact* AppSettings::defaultFirmwareType(void)
{
if (!_defaultFirmwareTypeFact) {
_defaultFirmwareTypeFact = _createSettingsFact(defaultFirmwareTypeName);
}
return _defaultFirmwareTypeFact;
}
......@@ -37,6 +37,7 @@ public:
Q_PROPERTY(Fact* autoLoadMissions READ autoLoadMissions CONSTANT)
Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT)
Q_PROPERTY(Fact* esriToken READ esriToken CONSTANT)
Q_PROPERTY(Fact* defaultFirmwareType READ defaultFirmwareType CONSTANT)
Q_PROPERTY(QString missionSavePath READ missionSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged)
......@@ -67,6 +68,7 @@ public:
Fact* autoLoadMissions (void);
Fact* mapboxToken (void);
Fact* esriToken (void);
Fact* defaultFirmwareType (void);
QString missionSavePath (void);
QString parameterSavePath (void);
......@@ -95,6 +97,7 @@ public:
static const char* autoLoadMissionsName;
static const char* mapboxTokenName;
static const char* esriTokenName;
static const char* defaultFirmwareTypeName;
// Application wide file extensions
static const char* parameterFileExtension;
......@@ -137,6 +140,7 @@ private:
SettingsFact* _autoLoadMissionsFact;
SettingsFact* _mapboxTokenFact;
SettingsFact* _esriTokenFact;
SettingsFact* _defaultFirmwareTypeFact;
};
#endif
......@@ -124,6 +124,8 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle
// Send QGC heartbeat ASAP, this allows PX4 to start accepting commands
_sendGCSHeartbeat();
qgcApp()->toolbox()->settingsManager()->appSettings()->defaultFirmwareType()->setRawValue(vehicleFirmwareType);
emit vehicleAdded(vehicle);
if (_vehicles.count() > 1) {
......
......@@ -40,6 +40,12 @@ QGCView {
readonly property string qgcUnplugText1: qsTr("All %1 connections to vehicles must be ").arg(QGroundControl.appName) + highlightPrefix + " disconnected " + highlightSuffix + "prior to firmware upgrade."
readonly property string qgcUnplugText2: highlightPrefix + "<big>Please unplug your Pixhawk and/or Radio from USB.</big>" + highlightSuffix
readonly property int _defaultFimwareTypePX4: 12
readonly property int _defaultFimwareTypeAPM: 3
property var _defaultFirmwareFact: QGroundControl.settingsManager.appSettings.defaultFirmwareType
property bool _defaultFirmwareIsPX4: _defaultFirmwareFact.rawValue == _defaultFimwareTypePX4
property string firmwareWarningMessage
property bool controllerCompleted: false
property bool initialBoardSearch: true
......@@ -247,14 +253,24 @@ QGCView {
firmwareVersionCombo.currentIndex = 0
}
Component.onCompleted: {
if (_defaultFirmwareIsPX4) {
px4FlightStack.checked = true
} else {
apmFlightStack.checked = true
}
}
QGCRadioButton {
id: px4FlightStack
checked: true
exclusiveGroup: firmwareGroup
text: qsTr("PX4 Flight Stack ")
visible: !_singleFirmwareMode && !px4Flow
onClicked: parent.firmwareVersionChanged(firmwareTypeList)
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
parent.firmwareVersionChanged(firmwareTypeList)
}
}
QGCRadioButton {
......@@ -263,7 +279,10 @@ QGCView {
text: qsTr("ArduPilot Flight Stack")
visible: !_singleFirmwareMode && !px4Flow
onClicked: parent.firmwareVersionChanged(firmwareTypeList)
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM
parent.firmwareVersionChanged(firmwareTypeList)
}
}
QGCComboBox {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment