Commit ebf34813 authored by DonLakeFlyer's avatar DonLakeFlyer

Keep track of firmware type during flash/connect

parent 11e38d40
...@@ -136,5 +136,11 @@ ...@@ -136,5 +136,11 @@
"longDescription": "Your personal access token for Esri maps", "longDescription": "Your personal access token for Esri maps",
"type": "string", "type": "string",
"defaultValue": "" "defaultValue": ""
},
{
"name": "DefaultFirmwareType",
"shortDescription": "Default firmware type for flashing",
"type": "uint32",
"defaultValue": 12
} }
] ]
...@@ -33,6 +33,7 @@ const char* AppSettings::savePathName = "SavePat ...@@ -33,6 +33,7 @@ const char* AppSettings::savePathName = "SavePat
const char* AppSettings::autoLoadMissionsName = "AutoLoadMissions"; const char* AppSettings::autoLoadMissionsName = "AutoLoadMissions";
const char* AppSettings::mapboxTokenName = "MapboxToken"; const char* AppSettings::mapboxTokenName = "MapboxToken";
const char* AppSettings::esriTokenName = "EsriToken"; const char* AppSettings::esriTokenName = "EsriToken";
const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType";
const char* AppSettings::parameterFileExtension = "params"; const char* AppSettings::parameterFileExtension = "params";
const char* AppSettings::planFileExtension = "plan"; const char* AppSettings::planFileExtension = "plan";
...@@ -67,6 +68,7 @@ AppSettings::AppSettings(QObject* parent) ...@@ -67,6 +68,7 @@ AppSettings::AppSettings(QObject* parent)
, _autoLoadMissionsFact(NULL) , _autoLoadMissionsFact(NULL)
, _mapboxTokenFact(NULL) , _mapboxTokenFact(NULL)
, _esriTokenFact(NULL) , _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL)
{ {
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only"); qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
...@@ -343,3 +345,11 @@ MAV_TYPE AppSettings::offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleT ...@@ -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: ...@@ -37,6 +37,7 @@ public:
Q_PROPERTY(Fact* autoLoadMissions READ autoLoadMissions CONSTANT) Q_PROPERTY(Fact* autoLoadMissions READ autoLoadMissions CONSTANT)
Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT) Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT)
Q_PROPERTY(Fact* esriToken READ esriToken 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 missionSavePath READ missionSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged)
...@@ -67,6 +68,7 @@ public: ...@@ -67,6 +68,7 @@ public:
Fact* autoLoadMissions (void); Fact* autoLoadMissions (void);
Fact* mapboxToken (void); Fact* mapboxToken (void);
Fact* esriToken (void); Fact* esriToken (void);
Fact* defaultFirmwareType (void);
QString missionSavePath (void); QString missionSavePath (void);
QString parameterSavePath (void); QString parameterSavePath (void);
...@@ -95,6 +97,7 @@ public: ...@@ -95,6 +97,7 @@ public:
static const char* autoLoadMissionsName; static const char* autoLoadMissionsName;
static const char* mapboxTokenName; static const char* mapboxTokenName;
static const char* esriTokenName; static const char* esriTokenName;
static const char* defaultFirmwareTypeName;
// Application wide file extensions // Application wide file extensions
static const char* parameterFileExtension; static const char* parameterFileExtension;
...@@ -137,6 +140,7 @@ private: ...@@ -137,6 +140,7 @@ private:
SettingsFact* _autoLoadMissionsFact; SettingsFact* _autoLoadMissionsFact;
SettingsFact* _mapboxTokenFact; SettingsFact* _mapboxTokenFact;
SettingsFact* _esriTokenFact; SettingsFact* _esriTokenFact;
SettingsFact* _defaultFirmwareTypeFact;
}; };
#endif #endif
...@@ -124,6 +124,8 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle ...@@ -124,6 +124,8 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle
// Send QGC heartbeat ASAP, this allows PX4 to start accepting commands // Send QGC heartbeat ASAP, this allows PX4 to start accepting commands
_sendGCSHeartbeat(); _sendGCSHeartbeat();
qgcApp()->toolbox()->settingsManager()->appSettings()->defaultFirmwareType()->setRawValue(vehicleFirmwareType);
emit vehicleAdded(vehicle); emit vehicleAdded(vehicle);
if (_vehicles.count() > 1) { if (_vehicles.count() > 1) {
......
...@@ -40,6 +40,12 @@ QGCView { ...@@ -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 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 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 string firmwareWarningMessage
property bool controllerCompleted: false property bool controllerCompleted: false
property bool initialBoardSearch: true property bool initialBoardSearch: true
...@@ -247,14 +253,24 @@ QGCView { ...@@ -247,14 +253,24 @@ QGCView {
firmwareVersionCombo.currentIndex = 0 firmwareVersionCombo.currentIndex = 0
} }
Component.onCompleted: {
if (_defaultFirmwareIsPX4) {
px4FlightStack.checked = true
} else {
apmFlightStack.checked = true
}
}
QGCRadioButton { QGCRadioButton {
id: px4FlightStack id: px4FlightStack
checked: true
exclusiveGroup: firmwareGroup exclusiveGroup: firmwareGroup
text: qsTr("PX4 Flight Stack ") text: qsTr("PX4 Flight Stack ")
visible: !_singleFirmwareMode && !px4Flow visible: !_singleFirmwareMode && !px4Flow
onClicked: parent.firmwareVersionChanged(firmwareTypeList) onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
parent.firmwareVersionChanged(firmwareTypeList)
}
} }
QGCRadioButton { QGCRadioButton {
...@@ -263,7 +279,10 @@ QGCView { ...@@ -263,7 +279,10 @@ QGCView {
text: qsTr("ArduPilot Flight Stack") text: qsTr("ArduPilot Flight Stack")
visible: !_singleFirmwareMode && !px4Flow visible: !_singleFirmwareMode && !px4Flow
onClicked: parent.firmwareVersionChanged(firmwareTypeList) onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM
parent.firmwareVersionChanged(firmwareTypeList)
}
} }
QGCComboBox { 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