Skip to content

Commit

Permalink
Fix debug modes
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Nov 23, 2022
1 parent 4b20639 commit b33f719
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
16 changes: 1 addition & 15 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ let
"GPS_RESCUE_TRACKING",
"ATTITUDE",
"VTX_MSP",
"GPS_DOP",
]),

SUPER_EXPO_YAW = makeReadOnly([
Expand Down Expand Up @@ -541,24 +542,9 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO_COMBINED'), 1);
}
if (semver.gte(firmwareVersion, '4.2.0')) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_INTERPOLATED'), 1);
}
if (semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_INTERPOLATED'), 1, 'FEEDFORWARD');
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_LIMIT'), 1, 'FEEDFORWARD_LIMIT');
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DYN_IDLE'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FFT'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FFT_TIME'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FFT_FREQ'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('GPS_RESCUE_THROTTLE_PID'), 1);
}
if (semver.gte(firmwareVersion, '4.4.0')) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('BARO'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('RTH'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('GPS_RESCUE_THROTTLE_PID'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('VTX_MSP'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('GPS_DOP'), 1);
}

DEBUG_MODE = makeReadOnly(DEBUG_MODE);
Expand Down
30 changes: 15 additions & 15 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,20 @@ function FlightLogFieldPresenter() {
'debug[2]':'Setpoint Roll',
'debug[3]':'Setpoint Pitch',
},
'VTX_MSP' : {
'debug[all]': 'VTX MSP',
'debug[0]': 'packetCounter',
'debug[1]': 'isCrsfPortConfig',
'debug[2]': 'isLowPowerDisarmed',
'debug[3]': 'mspTelemetryDescriptor',
},
'GPS_DOP' : {
'debug[all]': 'GPS Dilution of Precision',
'debug[0]': 'Number of Satellites',
'debug[1]': 'pDOP (positional - 3D)',
'debug[2]': 'hDOP (horizontal - 2D)',
'debug[3]': 'vDOP (vertical - 1D)',
},
};

let DEBUG_FRIENDLY_FIELD_NAMES = null;
Expand Down Expand Up @@ -707,20 +721,6 @@ function FlightLogFieldPresenter() {
'debug[2]':'Altitude',
'debug[3]':'Target altitude',
};
DEBUG_FRIENDLY_FIELD_NAMES.VTX_MSP = {
'debug[all]': 'VTX MSP',
'debug[0]': 'packetCounter',
'debug[1]': 'isCrsfPortConfig',
'debug[2]': 'isLowPowerDisarmed',
'debug[3]': 'mspTelemetryDescriptor',
};
DEBUG_FRIENDLY_FIELD_NAMES.GPS_DOP = {
'debug[all]': 'GPS Dilution of Precision',
'debug[0]': 'Number of Satellites',
'debug[1]': 'pDOP (positional - 3D)',
'debug[2]': 'hDOP (horizontal - 2D)',
'debug[3]': 'vDOP (vertical - 1D)',
};
} else if (semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD = {
'debug[all]':'Feedforward [roll]',
Expand Down Expand Up @@ -1327,7 +1327,7 @@ function FlightLogFieldPresenter() {
case 'debug[2]': // hDOP (horizontal - 2D)
case 'debug[3]': // vDOP (vertical - 1D)
default:
return (value / 100).toFixed(1);
return (value / 100).toFixed(2);
}
}
return value.toFixed(0);
Expand Down
30 changes: 23 additions & 7 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,23 @@ GraphConfig.load = function(config) {
};
default:
return getCurveForMinMaxFields(fieldName);
}
}
case 'GPS_DOP':
switch (fieldName) {
case 'debug[0]': // Number of Satellites (now this is in normal GPS data, maybe gpsTrust?)
case 'debug[1]': // pDOP
case 'debug[2]': // hDOP
case 'debug[3]': // vDOP
return {
offset: 0,
power: 1.0,
inputRange: 200,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}

case 'BARO':
switch (fieldName) {
case 'debug[0]': // Baro state 0-10
Expand Down Expand Up @@ -941,7 +957,7 @@ GraphConfig.load = function(config) {
i, j;

const EXAMPLE_GRAPHS = [];

if (!flightLog.isFieldDisabled().MOTORS) {
EXAMPLE_GRAPHS.push({label: "Motors",fields: ["motor[all]", "servo[5]"]});
EXAMPLE_GRAPHS.push({label: "Motors (Legacy)",fields: ["motorLegacy[all]", "servo[5]"]});
Expand Down Expand Up @@ -990,7 +1006,7 @@ GraphConfig.load = function(config) {
height: srcGraph.height || 1
},
found;

if (graphNames !== undefined) {
found = false;
for (j = 0; j < graphNames.length; j++) {
Expand All @@ -999,12 +1015,12 @@ GraphConfig.load = function(config) {
break;
}
}

if (!found) {
continue;
}
}

for (j = 0; j < srcGraph.fields.length; j++) {
var
srcFieldName = srcGraph.fields[j],
Expand All @@ -1014,10 +1030,10 @@ GraphConfig.load = function(config) {

destGraph.fields.push(destField);
}

result.push(destGraph);
}

return result;
};
})();
2 changes: 1 addition & 1 deletion js/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, stickCanvas, craftCanv
idents.vbatField = fieldIndex;
idents.numCells = flightLog.getNumCellsEstimate();
break;
case "BaroAlt":
case "baroAlt":
idents.baroField = fieldIndex;
break;
case "roll":
Expand Down

0 comments on commit b33f719

Please sign in to comment.