Unverified Commit b0a3f600 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8104 from DonLakeFlyer/RandomFixes

Random fixes
parents 6a1344a4 1e0f27a4
...@@ -519,7 +519,7 @@ int Fact::decimalPlaces(void) const ...@@ -519,7 +519,7 @@ int Fact::decimalPlaces(void) const
return _metaData->decimalPlaces(); return _metaData->decimalPlaces();
} else { } else {
qWarning() << kMissingMetadata << name(); qWarning() << kMissingMetadata << name();
return FactMetaData::defaultDecimalPlaces; return FactMetaData::kDefaultDecimalPlaces;
} }
} }
......
...@@ -88,7 +88,7 @@ const char* FactMetaData::_qgcRebootRequiredJsonKey = "qgcRebootRequired"; ...@@ -88,7 +88,7 @@ const char* FactMetaData::_qgcRebootRequiredJsonKey = "qgcRebootRequired";
FactMetaData::FactMetaData(QObject* parent) FactMetaData::FactMetaData(QObject* parent)
: QObject (parent) : QObject (parent)
, _type (valueTypeInt32) , _type (valueTypeInt32)
, _decimalPlaces (unknownDecimalPlaces) , _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0) , _rawDefaultValue (0)
, _defaultValueAvailable(false) , _defaultValueAvailable(false)
, _rawMax (_maxForType()) , _rawMax (_maxForType())
...@@ -112,7 +112,7 @@ FactMetaData::FactMetaData(QObject* parent) ...@@ -112,7 +112,7 @@ FactMetaData::FactMetaData(QObject* parent)
FactMetaData::FactMetaData(ValueType_t type, QObject* parent) FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
: QObject (parent) : QObject (parent)
, _type (type) , _type (type)
, _decimalPlaces (unknownDecimalPlaces) , _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0) , _rawDefaultValue (0)
, _defaultValueAvailable(false) , _defaultValueAvailable(false)
, _rawMax (_maxForType()) , _rawMax (_maxForType())
...@@ -142,7 +142,7 @@ FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent) ...@@ -142,7 +142,7 @@ FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent)
FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent) FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent)
: QObject (parent) : QObject (parent)
, _type (type) , _type (type)
, _decimalPlaces (unknownDecimalPlaces) , _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0) , _rawDefaultValue (0)
, _defaultValueAvailable(false) , _defaultValueAvailable(false)
, _rawMax (_maxForType()) , _rawMax (_maxForType())
...@@ -1023,8 +1023,8 @@ double FactMetaData::cookedIncrement(void) const ...@@ -1023,8 +1023,8 @@ double FactMetaData::cookedIncrement(void) const
int FactMetaData::decimalPlaces(void) const int FactMetaData::decimalPlaces(void) const
{ {
int actualDecimalPlaces = defaultDecimalPlaces; int actualDecimalPlaces = kDefaultDecimalPlaces;
int incrementDecimalPlaces = unknownDecimalPlaces; int incrementDecimalPlaces = kUnknownDecimalPlaces;
// First determine decimal places from increment // First determine decimal places from increment
double increment = _rawTranslator(this->rawIncrement()).toDouble(); double increment = _rawTranslator(this->rawIncrement()).toDouble();
...@@ -1041,20 +1041,21 @@ int FactMetaData::decimalPlaces(void) const ...@@ -1041,20 +1041,21 @@ int FactMetaData::decimalPlaces(void) const
} }
} }
// Correct decimal places is the larger of the two, increment or meta data value if (_decimalPlaces == kUnknownDecimalPlaces) {
if (incrementDecimalPlaces != unknownDecimalPlaces && _decimalPlaces == unknownDecimalPlaces) { if (incrementDecimalPlaces != kUnknownDecimalPlaces) {
actualDecimalPlaces = incrementDecimalPlaces; actualDecimalPlaces = incrementDecimalPlaces;
} else { } else {
// Adjust decimal places for cooked translation // Adjust decimal places for cooked translation
int settingsDecimalPlaces = _decimalPlaces == unknownDecimalPlaces ? defaultDecimalPlaces : _decimalPlaces; int settingsDecimalPlaces = _decimalPlaces == kUnknownDecimalPlaces ? kDefaultDecimalPlaces : _decimalPlaces;
double ctest = _rawTranslator(1.0).toDouble(); double ctest = _rawTranslator(1.0).toDouble();
settingsDecimalPlaces += -log10(ctest);
settingsDecimalPlaces = qMin(25, settingsDecimalPlaces); settingsDecimalPlaces += -log10(ctest);
settingsDecimalPlaces = qMax(0, settingsDecimalPlaces);
actualDecimalPlaces = qMax(settingsDecimalPlaces, incrementDecimalPlaces); settingsDecimalPlaces = qMin(25, settingsDecimalPlaces);
settingsDecimalPlaces = qMax(0, settingsDecimalPlaces);
}
} else {
actualDecimalPlaces = _decimalPlaces;
} }
return actualDecimalPlaces; return actualDecimalPlaces;
......
...@@ -166,8 +166,8 @@ public: ...@@ -166,8 +166,8 @@ public:
/// @returns false: Convertion failed /// @returns false: Convertion failed
bool clampValue(const QVariant& cookedValue, QVariant& typedValue); bool clampValue(const QVariant& cookedValue, QVariant& typedValue);
static const int defaultDecimalPlaces = 3; ///< Default value for decimal places if not specified/known static const int kDefaultDecimalPlaces = 3; ///< Default value for decimal places if not specified/known
static const int unknownDecimalPlaces = -1; ///< Number of decimal places to specify is not known static const int kUnknownDecimalPlaces = -1; ///< Number of decimal places to specify is not known
static ValueType_t stringToType(const QString& typeString, bool& unknownType); static ValueType_t stringToType(const QString& typeString, bool& unknownType);
static size_t typeToSize(ValueType_t type); static size_t typeToSize(ValueType_t type);
......
...@@ -47,11 +47,13 @@ ...@@ -47,11 +47,13 @@
"specifiesAltitudeOnly": true "specifiesAltitudeOnly": true
}, },
{ {
"id": 84, "id": 84,
"comment": "MAV_CMD_NAV_VTOL_TAKEOFF", "comment": "MAV_CMD_NAV_VTOL_TAKEOFF",
"specifiesCoordinate": true, "description": "Takeoff to specified altitude.",
"friendlyEdit": true, "specifiesCoordinate": false,
"category": "VTOL" "specifiesAltitudeOnly": true,
"friendlyEdit": true,
"category": "VTOL"
}, },
{ {
"id": 85, "id": 85,
......
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
{ {
"id": 84, "id": 84,
"rawName": "MAV_CMD_NAV_VTOL_TAKEOFF", "rawName": "MAV_CMD_NAV_VTOL_TAKEOFF",
"friendlyName": "VTOL takeoff and transition", "friendlyName": "VTOL takeoff",
"description": "Takeoff in VTOL mode, transition to forward flight and fly to the specified location.", "description": "Takeoff in VTOL mode, transition to forward flight and fly to the specified location.",
"specifiesCoordinate": true, "specifiesCoordinate": true,
"friendlyEdit": true, "friendlyEdit": true,
......
...@@ -351,7 +351,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ ...@@ -351,7 +351,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
MissionCmdParamInfo* paramInfo = new MissionCmdParamInfo(this); MissionCmdParamInfo* paramInfo = new MissionCmdParamInfo(this);
paramInfo->_label = paramObject.value(_labelJsonKey).toString(); paramInfo->_label = paramObject.value(_labelJsonKey).toString();
paramInfo->_decimalPlaces = paramObject.value(_decimalPlacesJsonKey).toInt(FactMetaData::unknownDecimalPlaces); paramInfo->_decimalPlaces = paramObject.value(_decimalPlacesJsonKey).toInt(FactMetaData::kUnknownDecimalPlaces);
paramInfo->_enumStrings = paramObject.value(_enumStringsJsonKey).toString().split(",", QString::SkipEmptyParts); paramInfo->_enumStrings = paramObject.value(_enumStringsJsonKey).toString().split(",", QString::SkipEmptyParts);
paramInfo->_param = i; paramInfo->_param = i;
paramInfo->_units = paramObject.value(_unitsJsonKey).toString(); paramInfo->_units = paramObject.value(_unitsJsonKey).toString();
......
...@@ -242,7 +242,8 @@ Rectangle { ...@@ -242,7 +242,8 @@ Rectangle {
MissionCommandDialog { MissionCommandDialog {
missionItem: _root.missionItem missionItem: _root.missionItem
map: _root.map map: _root.map
flyThroughCommandsAllowed: _missionController.flyThroughCommandsAllowed // FIXME: Disabling fly through commands doesn't work since you may need to change from an RTL to something else
flyThroughCommandsAllowed: true //_missionController.flyThroughCommandsAllowed
} }
} }
......
...@@ -941,10 +941,9 @@ Item { ...@@ -941,10 +941,9 @@ Item {
anchors.left: parent.left anchors.left: parent.left
mapControl: editorMap mapControl: editorMap
buttonsOnLeft: true buttonsOnLeft: true
terrainButtonVisible: true terrainButtonVisible: _editingLayer === _layerMission
visible: _toolStripBottom < y && _editingLayer === _layerMission visible: _toolStripBottom < y
terrainButtonChecked: waypointValuesDisplay.visible terrainButtonChecked: waypointValuesDisplay.visible
onTerrainButtonClicked: waypointValuesDisplay.toggleVisible() onTerrainButtonClicked: waypointValuesDisplay.toggleVisible()
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"shortDescription": "Offline editing vehicle type", "shortDescription": "Offline editing vehicle type",
"type": "uint32", "type": "uint32",
"enumStrings": "Fixed Wing,Multi-Rotor,VTOL,Rover,Sub", "enumStrings": "Fixed Wing,Multi-Rotor,VTOL,Rover,Sub",
"enumValues": "1,2,19,10,12", "enumValues": "1,2,20,10,12",
"defaultValue": 2 "defaultValue": 2
}, },
{ {
......
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