Skip to content

Fixed debug value display and made it resilient to new debug modes. #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,30 @@ var
"ESC_SENSOR",
"SCHEDULER",
"STACK",
"DEBUG_ESC_SENSOR_RPM",
"DEBUG_ESC_SENSOR_TMP",
"DEBUG_ALTITUDE",
"DEBUG_FFT",
"DEBUG_FFT_TIME",
"DEBUG_FFT_FREQ",
"DEBUG_FRSKY_D_RX",
"DEBUG_GYRO_RAW"
"ESC_SENSOR_RPM",
"ESC_SENSOR_TMP",
"ALTITUDE",
"FFT",
"FFT_TIME",
"FFT_FREQ",
"FRSKY_D_RX",
"GYRO_RAW",
"DUAL_GYRO",
"DUAL_GYRO_RAW",
"DUAL_GYRO_COMBINE",
"DUAL_GYRO_DIFF",
"MAX7456_SIGNAL",
"MAX7456_SPICLOCK",
"SBUS",
"FPORT",
"RANGEFINDER",
"RANGEFINDER_QUALITY",
"LIDAR_TF",
"CORE_TEMP",
"RUNAWAY_TAKEOFF",
"SDIO",
"CURRENT_SENSOR",
"USB"
]),

SUPER_EXPO_YAW = makeReadOnly([
Expand Down Expand Up @@ -273,4 +289,4 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
} else {
DEBUG_MODE = DEBUG_MODE_COMPLETE;
}
}
}
70 changes: 19 additions & 51 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,6 @@ function FlightLogFieldPresenter() {
'debug[2]':'rollPitchYawMix[2]',
'debug[3]':'rollPitchYawMix[3]',
},
'AIRMODE' : {
'debug[all]':'debug[all]',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',
},
'PIDLOOP' : {
'debug[all]':'Debug PID',
'debug[0]':'Wait Time',
Expand All @@ -152,13 +145,6 @@ function FlightLogFieldPresenter() {
'debug[2]':'rcCommand_raw[yaw]',
'debug[3]':'rxRefreshRate',
},
'VELOCITY' : {
'debug[all]':'debug[all]',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',
},
'DTERM_FILTER' : {
'debug[all]':'Debug Filter',
'debug[0]':'dterm_filter[roll]',
Expand Down Expand Up @@ -194,58 +180,28 @@ function FlightLogFieldPresenter() {
'debug[2]':'Stack Current',
'debug[3]':'Stack p',
},
'DEBUG_ESC_SENSOR_RPM' : {
'debug[all]':'Debug ESC Sensor RPM',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',

},
'DEBUG_ESC_SENSOR_TMP' : {
'debug[all]':'Debug ESC Sensor TMP',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',
},
'DEBUG_ALTITUDE' : {
'debug[all]':'Debug Altitude',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',
},
'DEBUG_FFT' : {
'FFT' : {
'debug[all]':'Debug FFT',
'debug[0]':'gyro_raw[roll]',
'debug[1]':'gyro_dyn_notch[roll]',
'debug[2]':'gyro_bpf[roll]',
'debug[3]':'fft_center_index[roll]',
},
'DEBUG_FFT_TIME' : {
'FFT_TIME' : {
'debug[all]':'Debug FFT TIME',
'debug[0]':'Active calc step',
'debug[1]':'Step duration',
'debug[2]':'Additional steps',
'debug[3]':'Not used',
},
'DEBUG_FFT_FREQ' : {
'FFT_FREQ' : {
'debug[all]':'Debug FFT FREQ',
'debug[0]':'center_freq[roll]',
'debug[1]':'center_freq[pitch]',
'debug[2]':'center_freq[yaw]',
'debug[3]':'Not used',
},
'DEBUG_FRSKY_D_RX' : {
'debug[all]':'Debug FRSKY_D_RX',
'debug[0]':'debug[0]',
'debug[1]':'debug[1]',
'debug[2]':'debug[2]',
'debug[3]':'debug[3]',

},
'DEBUG_GYRO_RAW' : {
'GYRO_RAW' : {
'debug[all]':'Debug Gyro Raw',
'debug[0]':'gyro_raw[X]',
'debug[1]':'gyro_raw[Y]',
Expand Down Expand Up @@ -489,16 +445,28 @@ function FlightLogFieldPresenter() {
case 'DEBUG_FFT_FREQ':
return value.toFixed(0) + "Hz";
default:
return "";
return value.toFixed(0);
}
}
return "";
};

FlightLogFieldPresenter.fieldNameToFriendly = function(fieldName, debugMode) {
if(debugMode) {
if (debugMode) {
if(fieldName.includes('debug')) {
var debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugMode < DEBUG_MODE.length ? DEBUG_MODE[debugMode] : DEBUG_MODE[0]];
var debugModeName = DEBUG_MODE[debugMode];
var debugFields;
if (debugModeName) {
debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugModeName];
}

if (!debugFields) {
if (fieldName === 'debug[all]') {
return 'Debug (' + (debugModeName || debugMode) + ')';
}
debugFields = DEBUG_FRIENDLY_FIELD_NAMES[DEBUG_MODE[0]];
}

return debugFields[fieldName];
}
}
Expand Down