Skip to content

Commit 0f820fb

Browse files
authored
Merge pull request #144 from mikeller/fix_debug_mode
Fixed debug value display and made it resilient to new debug modes.
2 parents 797324c + 885bd7c commit 0f820fb

File tree

2 files changed

+44
-60
lines changed

2 files changed

+44
-60
lines changed

js/flightlog_fielddefs.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,30 @@ var
175175
"ESC_SENSOR",
176176
"SCHEDULER",
177177
"STACK",
178-
"DEBUG_ESC_SENSOR_RPM",
179-
"DEBUG_ESC_SENSOR_TMP",
180-
"DEBUG_ALTITUDE",
181-
"DEBUG_FFT",
182-
"DEBUG_FFT_TIME",
183-
"DEBUG_FFT_FREQ",
184-
"DEBUG_FRSKY_D_RX",
185-
"DEBUG_GYRO_RAW"
178+
"ESC_SENSOR_RPM",
179+
"ESC_SENSOR_TMP",
180+
"ALTITUDE",
181+
"FFT",
182+
"FFT_TIME",
183+
"FFT_FREQ",
184+
"FRSKY_D_RX",
185+
"GYRO_RAW",
186+
"DUAL_GYRO",
187+
"DUAL_GYRO_RAW",
188+
"DUAL_GYRO_COMBINE",
189+
"DUAL_GYRO_DIFF",
190+
"MAX7456_SIGNAL",
191+
"MAX7456_SPICLOCK",
192+
"SBUS",
193+
"FPORT",
194+
"RANGEFINDER",
195+
"RANGEFINDER_QUALITY",
196+
"LIDAR_TF",
197+
"CORE_TEMP",
198+
"RUNAWAY_TAKEOFF",
199+
"SDIO",
200+
"CURRENT_SENSOR",
201+
"USB"
186202
]),
187203

188204
SUPER_EXPO_YAW = makeReadOnly([
@@ -273,4 +289,4 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
273289
} else {
274290
DEBUG_MODE = DEBUG_MODE_COMPLETE;
275291
}
276-
}
292+
}

js/flightlog_fields_presenter.js

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,6 @@ function FlightLogFieldPresenter() {
124124
'debug[2]':'rollPitchYawMix[2]',
125125
'debug[3]':'rollPitchYawMix[3]',
126126
},
127-
'AIRMODE' : {
128-
'debug[all]':'debug[all]',
129-
'debug[0]':'debug[0]',
130-
'debug[1]':'debug[1]',
131-
'debug[2]':'debug[2]',
132-
'debug[3]':'debug[3]',
133-
},
134127
'PIDLOOP' : {
135128
'debug[all]':'Debug PID',
136129
'debug[0]':'Wait Time',
@@ -152,13 +145,6 @@ function FlightLogFieldPresenter() {
152145
'debug[2]':'rcCommand_raw[yaw]',
153146
'debug[3]':'rxRefreshRate',
154147
},
155-
'VELOCITY' : {
156-
'debug[all]':'debug[all]',
157-
'debug[0]':'debug[0]',
158-
'debug[1]':'debug[1]',
159-
'debug[2]':'debug[2]',
160-
'debug[3]':'debug[3]',
161-
},
162148
'DTERM_FILTER' : {
163149
'debug[all]':'Debug Filter',
164150
'debug[0]':'dterm_filter[roll]',
@@ -194,58 +180,28 @@ function FlightLogFieldPresenter() {
194180
'debug[2]':'Stack Current',
195181
'debug[3]':'Stack p',
196182
},
197-
'DEBUG_ESC_SENSOR_RPM' : {
198-
'debug[all]':'Debug ESC Sensor RPM',
199-
'debug[0]':'debug[0]',
200-
'debug[1]':'debug[1]',
201-
'debug[2]':'debug[2]',
202-
'debug[3]':'debug[3]',
203-
204-
},
205-
'DEBUG_ESC_SENSOR_TMP' : {
206-
'debug[all]':'Debug ESC Sensor TMP',
207-
'debug[0]':'debug[0]',
208-
'debug[1]':'debug[1]',
209-
'debug[2]':'debug[2]',
210-
'debug[3]':'debug[3]',
211-
},
212-
'DEBUG_ALTITUDE' : {
213-
'debug[all]':'Debug Altitude',
214-
'debug[0]':'debug[0]',
215-
'debug[1]':'debug[1]',
216-
'debug[2]':'debug[2]',
217-
'debug[3]':'debug[3]',
218-
},
219-
'DEBUG_FFT' : {
183+
'FFT' : {
220184
'debug[all]':'Debug FFT',
221185
'debug[0]':'gyro_raw[roll]',
222186
'debug[1]':'gyro_dyn_notch[roll]',
223187
'debug[2]':'gyro_bpf[roll]',
224188
'debug[3]':'fft_center_index[roll]',
225189
},
226-
'DEBUG_FFT_TIME' : {
190+
'FFT_TIME' : {
227191
'debug[all]':'Debug FFT TIME',
228192
'debug[0]':'Active calc step',
229193
'debug[1]':'Step duration',
230194
'debug[2]':'Additional steps',
231195
'debug[3]':'Not used',
232196
},
233-
'DEBUG_FFT_FREQ' : {
197+
'FFT_FREQ' : {
234198
'debug[all]':'Debug FFT FREQ',
235199
'debug[0]':'center_freq[roll]',
236200
'debug[1]':'center_freq[pitch]',
237201
'debug[2]':'center_freq[yaw]',
238202
'debug[3]':'Not used',
239203
},
240-
'DEBUG_FRSKY_D_RX' : {
241-
'debug[all]':'Debug FRSKY_D_RX',
242-
'debug[0]':'debug[0]',
243-
'debug[1]':'debug[1]',
244-
'debug[2]':'debug[2]',
245-
'debug[3]':'debug[3]',
246-
247-
},
248-
'DEBUG_GYRO_RAW' : {
204+
'GYRO_RAW' : {
249205
'debug[all]':'Debug Gyro Raw',
250206
'debug[0]':'gyro_raw[X]',
251207
'debug[1]':'gyro_raw[Y]',
@@ -489,16 +445,28 @@ function FlightLogFieldPresenter() {
489445
case 'DEBUG_FFT_FREQ':
490446
return value.toFixed(0) + "Hz";
491447
default:
492-
return "";
448+
return value.toFixed(0);
493449
}
494450
}
495451
return "";
496452
};
497453

498454
FlightLogFieldPresenter.fieldNameToFriendly = function(fieldName, debugMode) {
499-
if(debugMode) {
455+
if (debugMode) {
500456
if(fieldName.includes('debug')) {
501-
var debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugMode < DEBUG_MODE.length ? DEBUG_MODE[debugMode] : DEBUG_MODE[0]];
457+
var debugModeName = DEBUG_MODE[debugMode];
458+
var debugFields;
459+
if (debugModeName) {
460+
debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugModeName];
461+
}
462+
463+
if (!debugFields) {
464+
if (fieldName === 'debug[all]') {
465+
return 'Debug (' + (debugModeName || debugMode) + ')';
466+
}
467+
debugFields = DEBUG_FRIENDLY_FIELD_NAMES[DEBUG_MODE[0]];
468+
}
469+
502470
return debugFields[fieldName];
503471
}
504472
}

0 commit comments

Comments
 (0)