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
return _metaData->decimalPlaces();
} else {
qWarning() << kMissingMetadata << name();
return FactMetaData::defaultDecimalPlaces;
return FactMetaData::kDefaultDecimalPlaces;
}
}
......
......@@ -88,7 +88,7 @@ const char* FactMetaData::_qgcRebootRequiredJsonKey = "qgcRebootRequired";
FactMetaData::FactMetaData(QObject* parent)
: QObject (parent)
, _type (valueTypeInt32)
, _decimalPlaces (unknownDecimalPlaces)
, _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0)
, _defaultValueAvailable(false)
, _rawMax (_maxForType())
......@@ -112,7 +112,7 @@ FactMetaData::FactMetaData(QObject* parent)
FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
: QObject (parent)
, _type (type)
, _decimalPlaces (unknownDecimalPlaces)
, _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0)
, _defaultValueAvailable(false)
, _rawMax (_maxForType())
......@@ -142,7 +142,7 @@ FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent)
FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent)
: QObject (parent)
, _type (type)
, _decimalPlaces (unknownDecimalPlaces)
, _decimalPlaces (kUnknownDecimalPlaces)
, _rawDefaultValue (0)
, _defaultValueAvailable(false)
, _rawMax (_maxForType())
......@@ -1023,8 +1023,8 @@ double FactMetaData::cookedIncrement(void) const
int FactMetaData::decimalPlaces(void) const
{
int actualDecimalPlaces = defaultDecimalPlaces;
int incrementDecimalPlaces = unknownDecimalPlaces;
int actualDecimalPlaces = kDefaultDecimalPlaces;
int incrementDecimalPlaces = kUnknownDecimalPlaces;
// First determine decimal places from increment
double increment = _rawTranslator(this->rawIncrement()).toDouble();
......@@ -1041,20 +1041,21 @@ int FactMetaData::decimalPlaces(void) const
}
}
// Correct decimal places is the larger of the two, increment or meta data value
if (incrementDecimalPlaces != unknownDecimalPlaces && _decimalPlaces == unknownDecimalPlaces) {
actualDecimalPlaces = incrementDecimalPlaces;
} else {
// Adjust decimal places for cooked translation
int settingsDecimalPlaces = _decimalPlaces == unknownDecimalPlaces ? defaultDecimalPlaces : _decimalPlaces;
double ctest = _rawTranslator(1.0).toDouble();
settingsDecimalPlaces += -log10(ctest);
if (_decimalPlaces == kUnknownDecimalPlaces) {
if (incrementDecimalPlaces != kUnknownDecimalPlaces) {
actualDecimalPlaces = incrementDecimalPlaces;
} else {
// Adjust decimal places for cooked translation
int settingsDecimalPlaces = _decimalPlaces == kUnknownDecimalPlaces ? kDefaultDecimalPlaces : _decimalPlaces;
double ctest = _rawTranslator(1.0).toDouble();
settingsDecimalPlaces = qMin(25, settingsDecimalPlaces);
settingsDecimalPlaces = qMax(0, settingsDecimalPlaces);
settingsDecimalPlaces += -log10(ctest);
actualDecimalPlaces = qMax(settingsDecimalPlaces, incrementDecimalPlaces);
settingsDecimalPlaces = qMin(25, settingsDecimalPlaces);
settingsDecimalPlaces = qMax(0, settingsDecimalPlaces);
}
} else {
actualDecimalPlaces = _decimalPlaces;
}
return actualDecimalPlaces;
......
......@@ -166,8 +166,8 @@ public:
/// @returns false: Convertion failed
bool clampValue(const QVariant& cookedValue, QVariant& typedValue);
static const int defaultDecimalPlaces = 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 kDefaultDecimalPlaces = 3; ///< Default value for decimal places if not specified/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 size_t typeToSize(ValueType_t type);
......
......@@ -47,11 +47,13 @@
"specifiesAltitudeOnly": true
},
{
"id": 84,
"comment": "MAV_CMD_NAV_VTOL_TAKEOFF",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "VTOL"
"id": 84,
"comment": "MAV_CMD_NAV_VTOL_TAKEOFF",
"description": "Takeoff to specified altitude.",
"specifiesCoordinate": false,
"specifiesAltitudeOnly": true,
"friendlyEdit": true,
"category": "VTOL"
},
{
"id": 85,
......
......@@ -286,7 +286,7 @@
{
"id": 84,
"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.",
"specifiesCoordinate": true,
"friendlyEdit": true,
......
......@@ -351,7 +351,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
MissionCmdParamInfo* paramInfo = new MissionCmdParamInfo(this);
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->_param = i;
paramInfo->_units = paramObject.value(_unitsJsonKey).toString();
......
......@@ -242,7 +242,8 @@ Rectangle {
MissionCommandDialog {
missionItem: _root.missionItem
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 {
anchors.left: parent.left
mapControl: editorMap
buttonsOnLeft: true
terrainButtonVisible: true
visible: _toolStripBottom < y && _editingLayer === _layerMission
terrainButtonVisible: _editingLayer === _layerMission
visible: _toolStripBottom < y
terrainButtonChecked: waypointValuesDisplay.visible
onTerrainButtonClicked: waypointValuesDisplay.toggleVisible()
}
......
......@@ -12,7 +12,7 @@
"shortDescription": "Offline editing vehicle type",
"type": "uint32",
"enumStrings": "Fixed Wing,Multi-Rotor,VTOL,Rover,Sub",
"enumValues": "1,2,19,10,12",
"enumValues": "1,2,20,10,12",
"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