Skip to content

Commit

Permalink
Add missing debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Dec 1, 2023
1 parent 5ce6146 commit 5f16b86
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 10 deletions.
96 changes: 96 additions & 0 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,90 @@ function FlightLogFieldPresenter() {
DEBUG_FRIENDLY_FIELD_NAMES = {...DEBUG_FRIENDLY_FIELD_NAMES_INITIAL};

if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT) {

if (semver.gte(firmwareVersion, '4.6.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.GYRO_CALIBRATION = {
'debug[all]': 'Gyro Calibration',
'debug[0]': 'Gyro Calibration X',
'debug[1]': 'Gyro Calibration Y',
'debug[2]': 'Gyro Calibration Z',
'debug[3]': 'Calibration Cycles remaining',
};
DEBUG_FRIENDLY_FIELD_NAMES.ANGLE_MODE = {
'debug[all]': 'Angle Mode',
'debug[0]': 'Angle Target',
'debug[1]': 'Angle Error',
'debug[2]': 'Angle Feedforward',
'debug[3]': 'Angle Current',
};
DEBUG_FRIENDLY_FIELD_NAMES.ANGLE_TARGET = {
'debug[all]': 'Angle Target',
'debug[0]': 'Angle Target',
'debug[1]': 'Sin Angle',
'debug[2]': 'Current PID Setpoint',
'debug[3]': 'Angle Current',
};
DEBUG_FRIENDLY_FIELD_NAMES.CURRENT_ANGLE = {
'debug[all]': 'Current Angle',
'debug[0]': 'Current Angle X',
'debug[1]': 'Current Angle Y',
'debug[2]': 'Current Angle Z',
};
DEBUG_FRIENDLY_FIELD_NAMES.DSHOT_TELEMETRY_COUNTS = {
'debug[all]': 'DShot Telemetry Counts',
'debug[0]': 'DShot Telemetry Debug[0] + 1',
'debug[1]': 'DShot Telemetry Debug[1] + 1',
'debug[2]': 'DShot Telemetry Debug[2] + 1',
'debug[3]': 'Preamble Skip',
};
DEBUG_FRIENDLY_FIELD_NAMES.RPM_LIMIT = {
'debug[all]': 'RPM Limit',
'debug[0]': 'Average RPM',
'debug[1]': 'Average RPM (unsmoothed)',
'debug[2]': 'RPM Limit throttle scale',
'debug[3]': 'Throttle',
'debug[4]': 'Error',
'debug[5]': 'Proportional',
'debug[6]': 'Integral',
'debug[7]': 'Derivative',
};
DEBUG_FRIENDLY_FIELD_NAMES.RC_STATS = {
'debug[all]': 'RC Stats',
'debug[0]': 'Average Throttle',
};
DEBUG_FRIENDLY_FIELD_NAMES.MAG_CALIB = {
'debug[all]': 'Mag Calibration',
'debug[0]': 'Mag X',
'debug[1]': 'Mag Y',
'debug[2]': 'Mag Z',
'debug[3]': 'Norm / Length of magADC',
'debug[4]': 'Estimated Mag Bias X',
'debug[5]': 'Estimated Mag Bias Y',
'debug[6]': 'Estimated Mag Bias Z',
'debug[7]': 'Mag Bias Estimator',
};
DEBUG_FRIENDLY_FIELD_NAMES.MAG_TASK_RATE = {
'debug[all]': 'Mag Task Rate',
'debug[0]': 'Task Rate (Hz)',
'debug[1]': 'Actual Data Rate (Hz)',
'debug[2]': 'Data Interval (Us)',
'debug[3]': 'Execute Time (Us)',
'debug[4]': 'Bus Busy',
'debug[5]': 'Read State',
'debug[6]': 'Task Time (Us)',
};
}

if (semver.gte(firmwareVersion, '4.5.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FAILSAFE = {
'debug[all]': 'Failsafe',
'debug[0]': 'Failsafe Phase switch',
'debug[1]': 'Failsafe State',
'debug[2]': 'Receiving data from Rx',
'debug[3]': 'Failsafe Phase',
};
}

if (semver.gte(firmwareVersion, '4.4.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.BARO = {
'debug[all]':'Debug Barometer',
Expand Down Expand Up @@ -1752,6 +1836,18 @@ function FlightLogFieldPresenter() {
default:
return (value / 100).toFixed(2);
}
case 'FAILSAFE':
return value.toFixed(0);
case 'GYRO_CALIBRATION':
return value.toFixed(0);
case 'ANGLE_MODE':
return value.toFixed(0);
case 'ANGLE_TARGET':
return value.toFixed(0);
case 'CURRENT_ANGLE':
return value.toFixed(0);
case 'DSHOT_TELEMETRY_COUNTS':
return value.toFixed(0);
}
return value.toFixed(0);
}
Expand Down
64 changes: 54 additions & 10 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,27 @@ GraphConfig.load = function(config) {
default:
return getCurveForMinMaxFields(fieldName);
}
case 'BARO':
switch (fieldName) {
case 'debug[0]': // Baro state 0-10
return {
offset: 0,
power: 1.0,
inputRange: 20,
outputRange: 1.0,
};
case 'debug[1]': // Baro Temp
case 'debug[2]': // Baro Raw
case 'debug[3]': // Baro smoothed
return {
offset: 0,
power: 1.0,
inputRange: 2000,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'GPS_DOP':
switch (fieldName) {
case 'debug[0]': // Number of Satellites (now this is in normal GPS data, maybe gpsTrust?)
Expand All @@ -946,29 +967,52 @@ GraphConfig.load = function(config) {
default:
return getCurveForMinMaxFields(fieldName);
}

case 'BARO':
case 'FAILSAFE':
switch (fieldName) {
case 'debug[0]': // Baro state 0-10
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: 20,
inputRange: 200,
outputRange: 1.0,
};
case 'debug[1]': // Baro Temp
case 'debug[2]': // Baro Raw
case 'debug[3]': // Baro smoothed
default:
return getCurveForMinMaxFields(fieldName);
}
case 'ANGLE_MODE':
switch (fieldName) {
case 'debug[0]':
case 'debug[1]':
case 'debug[2]':
case 'debug[3]':
return {
offset: 0,
power: 1.0,
inputRange: 2000,
inputRange: 200,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
}
}
case 'DSHOT_TELEMETRY_COUNTS':
switch (fieldName) {
case 'debug[0]':
case 'debug[1]':
case 'debug[2]':
case 'debug[3]':
return {
offset: 0,
power: 1.0,
inputRange: 200,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
}
}
// if not found above then
// Scale and center the field based on the whole-log observed ranges for that field
Expand Down

0 comments on commit 5f16b86

Please sign in to comment.