diff --git a/js/flightlog_fielddefs.js b/js/flightlog_fielddefs.js index 09d82586..013ffac3 100644 --- a/js/flightlog_fielddefs.js +++ b/js/flightlog_fielddefs.js @@ -5,7 +5,7 @@ function makeReadOnly(x) { if (Object.freeze) { return Object.freeze(x); } - + // Otherwise a no-op return x; } @@ -18,21 +18,21 @@ const DSHOT_RANGE = DSHOT_MAX_VALUE - DSHOT_MIN_VALUE; const ANALOG_MIN_VALUE = 1000; // Fields definitions for lists -var +var FlightLogEvent = makeReadOnly({ SYNC_BEEP: 0, - + AUTOTUNE_CYCLE_START: 10, AUTOTUNE_CYCLE_RESULT: 11, AUTOTUNE_TARGETS: 12, INFLIGHT_ADJUSTMENT: 13, LOGGING_RESUME: 14, DISARM: 15, - + GTUNE_CYCLE_RESULT: 20, FLIGHT_MODE: 30, TWITCH_TEST: 40, // Feature for latency testing - + CUSTOM : 250, // Virtual Event Code - Never part of Log File. CUSTOM_BLANK : 251, // Virtual Event Code - Never part of Log File. - No line shown LOG_END: 255 @@ -46,7 +46,7 @@ var }), FLIGHT_LOG_FLIGHT_MODE_NAME = [], - + FLIGHT_LOG_FLIGHT_MODE_NAME_PRE_3_3 = makeReadOnly([ 'ARM', 'ANGLE', @@ -184,7 +184,7 @@ var FAST_PROTOCOL = makeReadOnly([ "PWM", "ONESHOT125", - "ONESHOT42", + "ONESHOT42", "MULTISHOT", "BRUSHED", "DSHOT150", @@ -196,7 +196,7 @@ var MOTOR_SYNC = makeReadOnly([ "SYNCED", - "UNSYNCED" + "UNSYNCED" ]), SERIALRX_PROVIDER = makeReadOnly([ @@ -221,29 +221,29 @@ var ]), RC_SMOOTHING_TYPE = makeReadOnly([ - "INTERPOLATION", + "INTERPOLATION", "FILTER" ]), RC_SMOOTHING_INPUT_TYPE = makeReadOnly([ - "PT1", + "PT1", "BIQUAD" ]), RC_SMOOTHING_DERIVATIVE_TYPE = makeReadOnly([ - "PT1", + "PT1", "BIQUAD" ]), RC_SMOOTHING_MODE = makeReadOnly([ - "OFF", + "OFF", "ON" ]), RC_SMOOTHING_DEBUG_AXIS = makeReadOnly([ - "ROLL", - "PITCH", - "YAW", + "ROLL", + "PITCH", + "YAW", "THROTTLE" ]), @@ -251,7 +251,7 @@ var "OFF", "DEFAULT", "AUTO", - "MANUAL" + "MANUAL" ]), FILTER_TYPE = makeReadOnly([ @@ -339,6 +339,10 @@ var "TIMING_ACCURACY", "RX_EXPRESSLRS_SPI", "RX_EXPRESSLRS_PHASELOCK", + "DEBUG_RX_STATE_TIME", + "GPS_RESCUE_VELOCITY", + "GPS_RESCUE_HEADING", + "GPS_RESCUE_TRACKING", ]), SUPER_EXPO_YAW = makeReadOnly([ @@ -410,7 +414,7 @@ var "SMALL_ANGLE", "FIXED_WING" ]), - + FLIGHT_LOG_FAILSAFE_PHASE_NAME = makeReadOnly([ "IDLE", "RX_LOSS_DETECTED", @@ -431,9 +435,9 @@ var ITERM_RELAX = makeReadOnly([ "OFF", "RP", - "RPY", + "RPY", "RP_INC", - "RPY_INC", + "RPY_INC", ]), ITERM_RELAX_TYPE = makeReadOnly([ @@ -502,7 +506,7 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) { DEBUG_MODE.splice(DEBUG_MODE.indexOf('AIRMODE'), 1); DEBUG_MODE.splice(DEBUG_MODE.indexOf('VELOCITY'), 1); DEBUG_MODE.splice(DEBUG_MODE.indexOf('DTERM_FILTER'), 1); - + if(semver.gte(firmwareVersion, '3.4.0')) { DEBUG_MODE.splice(DEBUG_MODE.indexOf('GYRO'), 1, 'GYRO_FILTERED'); DEBUG_MODE.splice(DEBUG_MODE.indexOf('NOTCH'), 1, 'GYRO_SCALED'); diff --git a/js/flightlog_fields_presenter.js b/js/flightlog_fields_presenter.js index 6493035a..5e6885b4 100644 --- a/js/flightlog_fields_presenter.js +++ b/js/flightlog_fields_presenter.js @@ -106,7 +106,7 @@ function FlightLogFieldPresenter() { 'rxFlightChannelsValid': 'RX Flight Ch. Valid', 'rssi': 'RSSI', }; - + const DEBUG_FRIENDLY_FIELD_NAMES_INITIAL = { 'NONE' : { 'debug[all]':'Debug [all]', @@ -137,7 +137,7 @@ function FlightLogFieldPresenter() { 'debug[3]':'Not Used', }, 'GYRO_FILTERED' : { - 'debug[all]':'Debug Gyro Filtered', + 'debug[all]':'Debug Gyro Filtered', 'debug[0]':'Gyro Filtered [X]', 'debug[1]':'Gyro Filtered [Y]', 'debug[2]':'Gyro Filtered [Z]', @@ -172,7 +172,7 @@ function FlightLogFieldPresenter() { 'debug[3]':'Not Used', }, 'GYRO_SCALED' : { - 'debug[all]':'Debug Gyro Scaled', + 'debug[all]':'Debug Gyro Scaled', 'debug[0]':'Gyro Scaled [roll]', 'debug[1]':'Gyro Scaled [pitch]', 'debug[2]':'Gyro Scaled [yaw]', @@ -277,35 +277,35 @@ function FlightLogFieldPresenter() { 'debug[3]':'Offset Min', }, 'GYRO_RAW' : { - 'debug[all]':'Debug Gyro Raw', + 'debug[all]':'Debug Gyro Raw', 'debug[0]':'Gyro Raw [X]', 'debug[1]':'Gyro Raw [Y]', 'debug[2]':'Gyro Raw [Z]', 'debug[3]':'Not Used', }, 'DUAL_GYRO' : { - 'debug[all]':'Debug Dual Gyro', + 'debug[all]':'Debug Dual Gyro', 'debug[0]':'Gyro 1 Filtered [roll]', 'debug[1]':'Gyro 1 Filtered [pitch]', 'debug[2]':'Gyro 2 Filtered [roll]', 'debug[3]':'Gyro 2 Filtered [pitch]', }, 'DUAL_GYRO_RAW': { - 'debug[all]':'Debug Dual Gyro Raw', + 'debug[all]':'Debug Dual Gyro Raw', 'debug[0]':'Gyro 1 Raw [roll]', 'debug[1]':'Gyro 1 Raw [pitch]', 'debug[2]':'Gyro 2 Raw [roll]', 'debug[3]':'Gyro 2 Raw [pitch]', }, 'DUAL_GYRO_COMBINED': { - 'debug[all]':'Debug Dual Combined', + 'debug[all]':'Debug Dual Combined', 'debug[0]':'Not Used', 'debug[1]':'Gyro Filtered [roll]', 'debug[2]':'Gyro Filtered [pitch]', 'debug[3]':'Not Used', }, 'DUAL_GYRO_DIFF': { - 'debug[all]':'Debug Dual Gyro Diff', + 'debug[all]':'Debug Dual Gyro Diff', 'debug[0]':'Gyro Diff [roll]', 'debug[1]':'Gyro Diff [pitch]', 'debug[2]':'Gyro Diff [yaw]', @@ -398,8 +398,8 @@ function FlightLogFieldPresenter() { 'RTH' : { 'debug[all]':'RTH', 'debug[0]':'Rescue Throttle', - 'debug[1]':'Rescue Angle', - 'debug[2]':'Altitude Adjustment', + 'debug[1]':'Rescue Pitch Angle', + 'debug[2]':'Throttle adjustment', 'debug[3]':'Rescue State', }, 'ITERM_RELAX' : { @@ -452,14 +452,14 @@ function FlightLogFieldPresenter() { 'debug[3]':'Gyro Pre-Dyn [dbg-axis]', }, 'DSHOT_RPM_TELEMETRY' : { - 'debug[all]':'DShot Telemetry RPM', + 'debug[all]':'DShot Telemetry RPM', 'debug[0]':'Motor 1 - DShot', 'debug[1]':'Motor 2 - DShot', 'debug[2]':'Motor 3 - DShot', 'debug[3]':'Motor 4 - DShot', }, 'RPM_FILTER' : { - 'debug[all]':'RPM Filter', + 'debug[all]':'RPM Filter', 'debug[0]':'Motor 1 - rpmFilter', 'debug[1]':'Motor 2 - rpmFilter', 'debug[2]':'Motor 3 - rpmFilter', @@ -494,63 +494,63 @@ function FlightLogFieldPresenter() { 'debug[3]':'Gyro 2 [pitch]', }, 'DSHOT_RPM_ERRORS' : { - 'debug[all]':'DSHOT RPM Error', + 'debug[all]':'DSHOT RPM Error', 'debug[0]':'DSHOT RPM Error [1]', 'debug[1]':'DSHOT RPM Error [2]', 'debug[2]':'DSHOT RPM Error [3]', 'debug[3]':'DSHOT RPM Error [4]', }, 'CRSF_LINK_STATISTICS_UPLINK' : { - 'debug[all]':'CRSF Stats Uplink', + 'debug[all]':'CRSF Stats Uplink', 'debug[0]':'Uplink RSSI 1', 'debug[1]':'Uplink RSSI 2', 'debug[2]':'Uplink Link Quality', 'debug[3]':'RF Mode', }, 'CRSF_LINK_STATISTICS_PWR' : { - 'debug[all]':'CRSF Stats Power', + 'debug[all]':'CRSF Stats Power', 'debug[0]':'Antenna', 'debug[1]':'SNR', 'debug[2]':'TX Power', 'debug[3]':'Not Used', }, 'CRSF_LINK_STATISTICS_DOWN' : { - 'debug[all]':'CRSF Stats Downlink', + 'debug[all]':'CRSF Stats Downlink', 'debug[0]':'Downlink RSSI', 'debug[1]':'Downlink Link Quality', 'debug[2]':'Downlink SNR', 'debug[3]':'Not Used', }, 'BARO' : { - 'debug[all]':'Debug Barometer', + 'debug[all]':'Debug Barometer', 'debug[0]':'Baro State', 'debug[1]':'Baro Temperature', 'debug[2]':'Baro Pressure', 'debug[3]':'Baro Pressure Sum', }, 'GPS_RESCUE_THROTTLE_PID' : { - 'debug[all]':'GPS Rescue Throttle PID', + 'debug[all]':'GPS Rescue Throttle PID', 'debug[0]':'Throttle P', 'debug[1]':'Throttle I', 'debug[2]':'Throttle D', 'debug[3]':'Z Velocity', }, 'DYN_IDLE' : { - 'debug[all]':'Dyn Idle', + 'debug[all]':'Dyn Idle', 'debug[0]':'Motor Range Min Inc', 'debug[1]':'Target RPS Change Rate', 'debug[2]':'Error', 'debug[3]':'Min RPM', }, 'FF_LIMIT' : { - 'debug[all]':'FF Limit', + 'debug[all]':'FF Limit', 'debug[0]':'FF input [roll]', 'debug[1]':'FF input [pitch]', 'debug[2]':'FF limited [roll]', 'debug[3]':'Not Used', }, 'FF_INTERPOLATED' : { - 'debug[all]':'FF Interpolated [roll]', + 'debug[all]':'FF Interpolated [roll]', 'debug[0]':'Setpoint Delta Impl [roll]', 'debug[1]':'Boost amount [roll]', 'debug[2]':'Boost amount, clipped [roll]', @@ -626,6 +626,27 @@ function FlightLogFieldPresenter() { 'debug[2]':'Frequency Offset', 'debug[3]':'Phase Shift', }, + 'GPS_RESCUE_VELOCITY' : { + 'debug[all]':'GPS Rescue Velocity', + 'debug[0]':'Velocity P', + 'debug[1]':'Velocity D', + 'debug[2]':'Velocity to Home', + 'debug[3]':'Target Velocity', + }, + 'GPS_RESCUE_HEADING' : { + 'debug[all]':'GPS Rescue Heading', + 'debug[0]':'Rescue Yaw', + 'debug[1]':'Rescue Roll', + 'debug[2]':'Attitude', + 'debug[3]':'Angle to home', + }, + 'GPS_RESCUE_TRACKING' : { + 'debug[all]':'GPS Rescue Tracking', + 'debug[0]':'Velocity to home', + 'debug[1]':'Target velocity', + 'debug[2]':'Altitude', + 'debug[3]':'Target altitude', + }, }; let DEBUG_FRIENDLY_FIELD_NAMES = null; @@ -678,6 +699,13 @@ function FlightLogFieldPresenter() { 'debug[2]':'Notch 3 Center Freq [dbg-axis]', 'debug[3]':'Gyro Pre Dyn Notch [dbg-axis]', }; + DEBUG_FRIENDLY_FIELD_NAMES.GPS_RESCUE_THROTTLE_PID = { + 'debug[all]':'GPS Rescue Altitude', + 'debug[0]':'Throttle P', + 'debug[1]':'Throttle D', + 'debug[2]':'Altitude', + 'debug[3]':'Target Altitude', + }; } else if (semver.gte(firmwareVersion, '4.2.0')) { DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = { 'debug[all]':'Feedforward [roll]', @@ -713,13 +741,13 @@ function FlightLogFieldPresenter() { }; FlightLogFieldPresenter.presentFlags = function(flags, flagNames) { - var + var printedFlag = false, i, result = ""; - + i = 0; - + while (flags > 0) { if ((flags & 1) != 0) { if (printedFlag) { @@ -730,11 +758,11 @@ function FlightLogFieldPresenter() { result += flagNames[i]; } - + flags >>= 1; i++; } - + if (printedFlag) { return result; } else { @@ -745,22 +773,22 @@ function FlightLogFieldPresenter() { // Only list events that have changed, flag with eirer go ON or OFF. FlightLogFieldPresenter.presentChangeEvent = function presentChangeEvent(flags, lastFlags, flagNames) { var eventState = ''; - var found = false; + var found = false; for(var i = 0; i < flagNames.length; i++) { if((1< 0 to 128 case 'debug[3]': // LQ 0-100 return value.toFixed(0) + '%'; default: + // debug 0 is CRC error count 0 to int16_t + // debug 1 is unknown frame count 0 to int16_t + // debug 2 is RSSI 0 to -128 -> 0 to 128 return value.toFixed(0); } case 'SCHEDULER_DETERMINISM': @@ -1092,8 +1132,8 @@ function FlightLogFieldPresenter() { case 'debug[2]': // task delay time in us*10 case 'debug[3]': // task delay time in us*10 return (value / 10).toFixed(1) + 'us'; - // debug 1 is task ID of late task default: + // debug 1 is task ID of late task return value.toFixed(0); } case 'TIMING_ACCURACY': @@ -1109,28 +1149,58 @@ function FlightLogFieldPresenter() { switch (fieldName) { case 'debug[3]': // uplink LQ % return value.toFixed(1) + '%'; - // debug 0 = Lost connection count - // debug 1 = RSSI - // debug 2 = SNR default: + // debug 0 = Lost connection count + // debug 1 = RSSI + // debug 2 = SNR return value.toFixed(0); } case 'RX_EXPRESSLRS_PHASELOCK': switch (fieldName) { case 'debug[2]': // Frequency offset in ticks return value.toFixed(0) + 'ticks'; - // debug 0 = Phase offset us - // debug 1 = Filtered phase offset us - // debug 3 = Pphase shift in us default: + // debug 0 = Phase offset us + // debug 1 = Filtered phase offset us + // debug 3 = Pphase shift in us return value.toFixed(0) + 'us'; } + case 'GPS_RESCUE_VELOCITY': + switch (fieldName) { + case 'debug[0]': // Pitch P degrees * 100 + case 'debug[1]': // Pitch D degrees * 100 + return (value / 100).toFixed(1) + 'deg'; + case 'debug[2]': // velocity to home cm/s + case 'debug[3]': // velocity target cm/s + return (value / 100).toFixed(1) + 'm/s'; + } + case 'GPS_RESCUE_HEADING': + switch (fieldName) { + case 'debug[0]': // Rescue yaw rate deg/s * 10 up to +/- 90 + return (value / 10).toFixed(1) + 'deg/s'; + case 'debug[1]': // Rescue roll deg * 100 up to +/- 20 deg + return (value / 100).toFixed(1) + 'deg'; + case 'debug[2]': // Attitude in degrees * 10 + case 'debug[3]': // Angle to home in degrees * 10 + return (value / 10).toFixed(1) + 'deg'; + } + case 'GPS_RESCUE_TRACKING': + switch (fieldName) { + case 'debug[0]': // velocity to home cm/s + case 'debug[1]': // velocity target cm/s + return (value / 100).toFixed(1) + 'm/s'; + case 'debug[2]': // altitude cm + case 'debug[3]': // altitude target cm + return (value / 100).toFixed(1) + 'm'; + default: + return value.toFixed(0); + } } return value.toFixed(0); } return ""; }; - + FlightLogFieldPresenter.fieldNameToFriendly = function(fieldName, debugMode) { if (debugMode) { if (fieldName.includes('debug')) { @@ -1148,12 +1218,12 @@ function FlightLogFieldPresenter() { } return debugFields[fieldName]; - } + } } if (FRIENDLY_FIELD_NAMES[fieldName]) { return FRIENDLY_FIELD_NAMES[fieldName]; } - + return fieldName; }; })(); diff --git a/js/graph_config.js b/js/graph_config.js index 06d959a0..198a4600 100644 --- a/js/graph_config.js +++ b/js/graph_config.js @@ -5,13 +5,13 @@ function GraphConfig(graphConfig) { graphs = graphConfig ? graphConfig : [], listeners = [], that = this; - + function notifyListeners() { for (var i = 0; i < listeners.length; i++) { listeners[i](that); } } - + this.selectedFieldName = null; this.selectedGraphIndex = 0; this.selectedFieldIndex = 0; @@ -22,62 +22,61 @@ function GraphConfig(graphConfig) { this.getGraphs = function() { return graphs; }; - + /** * newGraphs is an array of objects like {label: "graph label", height:, fields:[{name: curve:{offset:, power:, inputRange:, outputRange:, steps:}, color:, }, ...]} */ this.setGraphs = function(newGraphs) { graphs = newGraphs; - + notifyListeners(); }; - + /** * Convert the given graph configs to make them appropriate for the given flight log. */ this.adaptGraphs = function(flightLog, graphs) { - var + var logFieldNames = flightLog.getMainFieldNames(), - + // Make copies of graphs into here so we can modify them without wrecking caller's copy newGraphs = []; - + for (var i = 0; i < graphs.length; i++) { - var + var graph = graphs[i], newGraph = $.extend( // Default values for missing properties: { height: 1, - }, + }, // The old graph - graph, + graph, // New fields to replace the old ones: { fields:[], }, ), colorIndex = 0; - + for (var j = 0; j < graph.fields.length; j++) { var field = graph.fields[j], matches; - + var adaptField = function(field, colorIndexOffset, forceNewCurve) { const defaultCurve = GraphConfig.getDefaultCurveForField(flightLog, field.name); - if (field.curve === undefined || forceNewCurve) { field.curve = defaultCurve; } else { - /* The curve may have been originally created for a craft with different endpoints, so use the + /* The curve may have been originally created for a craft with different endpoints, so use the * recommended offset and input range instead of the provided one. */ field.curve.offset = defaultCurve.offset; field.curve.inputRange = defaultCurve.inputRange; } - + if(colorIndexOffset!=null && field.color != undefined) { // auto offset the actual color (to expand [all] selections) var index; for(index=0; index < GraphConfig.PALETTE.length; index++) @@ -91,20 +90,20 @@ function GraphConfig(graphConfig) { field.color = GraphConfig.PALETTE[colorIndex % GraphConfig.PALETTE.length].color; colorIndex++; } - + if (field.smoothing === undefined) { field.smoothing = GraphConfig.getDefaultSmoothingForField(flightLog, field.name); } - + return field; }; - + if ((matches = field.name.match(/^(.+)\[all\]$/))) { - var + var nameRoot = matches[1], nameRegex = new RegExp("^" + nameRoot + "\[[0-9]+\]$"), colorIndexOffset = 0; - + for (var k = 0; k < logFieldNames.length; k++) { if (logFieldNames[k].match(nameRegex)) { // add special condition for rcCommands and debug as each of the fields requires a different scaling. @@ -120,13 +119,13 @@ function GraphConfig(graphConfig) { } } } - + newGraphs.push(newGraph); } - + this.setGraphs(newGraphs); }; - + this.addListener = function(listener) { listeners.push(listener); }; @@ -153,12 +152,12 @@ GraphConfig.load = function(config) { if (config) { for (var i = 0; i < config.length; i++) { var graph = config[i]; - + for (var j = 0; j < graph.fields.length; j++) { - var + var field = graph.fields[j], matches; - + if ((matches = field.name.match(/^gyroData(.+)$/))) { field.name = "gyroADC" + matches[1]; } @@ -167,7 +166,7 @@ GraphConfig.load = function(config) { } else { config = false; } - + return config; }; @@ -189,7 +188,7 @@ GraphConfig.load = function(config) { } } catch (e) { return 0;} }; - + GraphConfig.getDefaultCurveForField = function(flightLog, fieldName) { var @@ -203,19 +202,19 @@ GraphConfig.load = function(config) { sysConfig["rates"][1] * 10.0 * scale, sysConfig["rates"][2] * 10.0 * scale); default: - return Math.max(flightLog.rcCommandRawToDegreesPerSecond(500,0) * scale, - flightLog.rcCommandRawToDegreesPerSecond(500,1) * scale, + return Math.max(flightLog.rcCommandRawToDegreesPerSecond(500,0) * scale, + flightLog.rcCommandRawToDegreesPerSecond(500,1) * scale, flightLog.rcCommandRawToDegreesPerSecond(500,2) * scale); } } - + var getMinMaxForFields = function(/* fieldName1, fieldName2, ... */) { // helper to make a curve scale based on the combined min/max of one or more fields var stats = flightLog.getStats(), min = Number.MAX_VALUE, max = Number.MIN_VALUE; - + for(var i in arguments) { var fieldIndex = flightLog.getMainFieldIndexByName(arguments[i]), @@ -302,7 +301,7 @@ GraphConfig.load = function(config) { return { offset: 0, power: 0.25, /* Make this 1.0 to scale linearly */ - inputRange: maxDegreesSecond(gyroScaleMargin), // Maximum grad/s + 20% + inputRange: maxDegreesSecond(gyroScaleMargin), // Maximum grad/s + 20% outputRange: 1.0 }; } else if (fieldName.match(/^axis.+\[/)) { @@ -316,14 +315,14 @@ GraphConfig.load = function(config) { return { offset: -1500, power: 1.0, - inputRange: 500, + inputRange: 500, outputRange: 1.0 }; } else if (fieldName.match(/^rcCommand\[/)) { return { offset: 0, power: 0.25, - inputRange: 500 * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands + inputRange: 500 * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands outputRange: 1.0 }; } else if (fieldName == "heading[2]") { @@ -356,7 +355,7 @@ GraphConfig.load = function(config) { }; } else if (fieldName.match(/^debug.*/) && sysConfig.debug_mode!=null) { - var debugModeName = DEBUG_MODE[sysConfig.debug_mode]; + var debugModeName = DEBUG_MODE[sysConfig.debug_mode]; switch (debugModeName) { case 'CYCLETIME': switch (fieldName) { @@ -366,7 +365,7 @@ GraphConfig.load = function(config) { power: 1, inputRange: 50, outputRange: 1.0 - }; + }; default: return { offset: -1000, // zero offset @@ -375,13 +374,13 @@ GraphConfig.load = function(config) { outputRange: 1.0 }; } - case 'PIDLOOP': + case 'PIDLOOP': return { offset: -250, // zero offset power: 1.0, inputRange: 250, // 0-500uS outputRange: 1.0 - }; + }; case 'GYRO': case 'GYRO_FILTERED': case 'GYRO_SCALED': @@ -421,7 +420,7 @@ GraphConfig.load = function(config) { power: 1, inputRange: 2048, outputRange: 1.0 - }; + }; default: return { offset: -130, @@ -444,7 +443,7 @@ GraphConfig.load = function(config) { return { offset: 0, power: 0.25, - inputRange: 500 * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands + inputRange: 500 * gyroScaleMargin, // +20% to let compare in the same scale with the rccommands outputRange: 1.0 }; case 'debug[1]': // raw RC command derivative @@ -520,7 +519,7 @@ GraphConfig.load = function(config) { power: 1.0, inputRange: 100, outputRange: 1.0 - }; + }; case 'ESC_SENSOR_RPM': case 'DSHOT_RPM_TELEMETRY': case 'RPM_FILTER': @@ -694,7 +693,7 @@ GraphConfig.load = function(config) { inputRange: 50, outputRange: 1.0, }; - case 'debug[2]': // total delay in last second + case 'debug[2]': // total delay in last second return { offset: -500, power: 1.0, @@ -736,6 +735,129 @@ GraphConfig.load = function(config) { default: return getCurveForMinMaxFields(fieldName); } + case 'GPS_RESCUE_THROTTLE_PID': + switch (fieldName) { + case 'debug[0]': // Throttle P uS added + case 'debug[1]': // Throttle D uS added + return { + offset: 0, + power: 1.0, + inputRange: 300, + outputRange: 1.0, + }; + case 'debug[2]': // Altitude + case 'debug[3]': // Target Altitude + return { + offset: 0, + power: 1.0, + inputRange: 5000, + outputRange: 1.0, + }; + default: + return getCurveForMinMaxFields(fieldName); + } + case 'GPS_RESCUE_VELOCITY': + switch (fieldName) { + case 'debug[0]': // Pitch P deg * 100 + case 'debug[1]': // Pitch D deg * 100 + return { + offset: 0, + power: 1.0, + inputRange: 2000, + outputRange: 1.0, + }; + case 'debug[2]': // Velocity in cm/s + case 'debug[3]': // Velocity to home in cm/s + return { + offset: 0, + power: 1.0, + inputRange: 500, + outputRange: 1.0, + }; + default: + return getCurveForMinMaxFields(fieldName); + } + case 'GPS_RESCUE_HEADING': + switch (fieldName) { + case 'debug[0]': // Rescue yaw rate deg/s * 10 up to +/- 90 + return { + offset: 0, + power: 1.0, + inputRange: 1000, + outputRange: 1.0, + }; + case 'debug[1]': // Rescue roll deg * 10 up to +/- 20 deg + return { + offset: 0, + power: 1.0, + inputRange: 10000, + outputRange: 1.0, + }; + case 'debug[2]': // Yaw attitude * 10 + case 'debug[3]': // Angle to home * 10 + return { + offset: -1800, + power: 1.0, + inputRange: 1800, + outputRange: 1.0, + }; + default: + return getCurveForMinMaxFields(fieldName); + } + case 'RTH': + switch (fieldName) { + case 'debug[0]': // Rescue throttle 1000-2000 us + return { + offset: -1500, + power: 1.0, + inputRange: 500, + outputRange: 1.0, + }; + case 'debug[2]': // Altitude adjustment or positive of negative + return { + offset: 0, + power: 1.0, + inputRange: 500, + outputRange: 1.0, + }; + case 'debug[1]': // rescue pitch angle + return { + offset: 0, + power: 1.0, + inputRange: 5000, + outputRange: 1.0, + }; + case 'debug[3]': // Failure counters coded + return { + offset: -1000, + power: 1.0, + inputRange: 1000, + outputRange: 1.0, + }; + default: + return getCurveForMinMaxFields(fieldName); + } + case 'GPS_RESCUE_TRACKING': + switch (fieldName) { + case 'debug[0]': // velocity to home cm/s + case 'debug[1]': // target velocity cm/s + return { + offset: 0, + power: 1.0, + inputRange: 500, + outputRange: 1.0, + }; + case 'debug[2]': // altitude m + case 'debug[3]': // Target altitude m + return { + offset: 0, + power: 1.0, + inputRange: 5000, + outputRange: 1.0, + }; + default: + return getCurveForMinMaxFields(fieldName); + } } } // if not found above then @@ -750,10 +872,10 @@ GraphConfig.load = function(config) { }; } }; - + /** * Get an array of suggested graph configurations will be usable for the fields available in the given flightlog. - * + * * Supply an array of strings `graphNames` to only fetch the graph with the given names. */ GraphConfig.getExampleGraphConfigs = function(flightLog, graphNames) { @@ -762,7 +884,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]"]}); @@ -796,12 +918,12 @@ GraphConfig.load = function(config) { var srcGraph = EXAMPLE_GRAPHS[i], destGraph = { - label: srcGraph.label, + label: srcGraph.label, fields: [], height: srcGraph.height || 1 }, found; - + if (graphNames !== undefined) { found = false; for (j = 0; j < graphNames.length; j++) { @@ -810,25 +932,25 @@ GraphConfig.load = function(config) { break; } } - + if (!found) { continue; } } - + for (j = 0; j < srcGraph.fields.length; j++) { var srcFieldName = srcGraph.fields[j], destField = { name: srcFieldName }; - + destGraph.fields.push(destField); } - + result.push(destGraph); } - + return result; }; })();