Skip to content

Commit 4e0cd01

Browse files
committed
Various fixes for debug modes
1 parent afc8fb8 commit 4e0cd01

File tree

5 files changed

+48
-257
lines changed

5 files changed

+48
-257
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
66
<title>INAV - Blackbox Explorer</title>
7-
<link rel="icon" type="image/png" href="images/icon-128.png">
7+
<link rel="icon" type="image/png" href="images/bf_icon_128.png">
88
<meta name="description" content="">
99
<meta name="viewport" content="width=device-width, initial-scale=1">
1010

js/flightlog_fielddefs.js

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -149,34 +149,19 @@ var
149149
FILTER_TYPE = makeReadOnly([
150150
"PT1",
151151
"BIQUAD",
152-
"FIR",
152+
"FIR"
153153
]),
154154

155155
DEBUG_MODE = makeReadOnly([
156-
"NONE",
157-
"CYCLETIME",
158-
"BATTERY",
159-
"GYRO",
160-
"ACCELEROMETER",
161-
"MIXER",
162-
"AIRMODE",
163-
"PIDLOOP",
164-
"NOTCH",
165-
"RC_INTERPOLATION",
166-
"VELOCITY",
167-
"DTERM_FILTER",
168-
"ANGLERATE",
169-
"ESC_SENSOR",
170-
"SCHEDULER",
171-
"STACK",
172-
"DEBUG_ESC_SENSOR_RPM",
173-
"DEBUG_ESC_SENSOR_TMP",
174-
"DEBUG_ALTITUDE",
175-
"DEBUG_FFT",
176-
"DEBUG_FFT_TIME",
177-
"DEBUG_FFT_FREQ",
178-
"DEBUG_FRSKY_D_RX",
179-
"DEBUG_GYRO_RAW"
156+
"NONE",
157+
"GYRO",
158+
"NOTCH",
159+
"NAV_LANDING_DETECTOR",
160+
"FW_CLIMB_RATE_TO_ALTITUDE",
161+
"RANGEFINDER",
162+
"RANGEFINDER_QUALITY",
163+
"PITOT",
164+
"AGL"
180165
]),
181166

182167
SUPER_EXPO_YAW = makeReadOnly([

js/flightlog_fields_presenter.js

Lines changed: 19 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -82,176 +82,27 @@ function FlightLogFieldPresenter() {
8282
};
8383

8484
var DEBUG_FRIENDLY_FIELD_NAMES = {
85-
'NONE' : {
85+
0 : { //Debug none
8686
'debug[all]':'debug[all]',
8787
'debug[0]':'debug[0]',
8888
'debug[1]':'debug[1]',
8989
'debug[2]':'debug[2]',
90-
'debug[3]':'debug[3]',
90+
'debug[3]':'debug[3]'
9191
},
92-
'CYCLETIME' : {
93-
'debug[all]':'Debug Cycle Time',
94-
'debug[0]':'Cycle Time',
95-
'debug[1]':'CPU Load',
96-
'debug[2]':'Motor Update',
97-
'debug[3]':'Motor Deviation',
98-
},
99-
'BATTERY' : {
100-
'debug[all]':'Debug Battery',
101-
'debug[0]':'vbat_ADC',
102-
'debug[1]':'vbat',
103-
'debug[2]':'Not Used',
104-
'debug[3]':'Not Used',
105-
},
106-
'GYRO' : {
92+
1 : { //Debug gyro
10793
'debug[all]':'Debug Gyro',
10894
'debug[0]':'gyro_raw[X]',
10995
'debug[1]':'gyro_raw[Y]',
11096
'debug[2]':'gyro_raw[Z]',
111-
'debug[3]':'Not Used',
112-
},
113-
'ACCELEROMETER' : {
114-
'debug[all]':'Debug Acc',
115-
'debug[0]':'acc_raw[X]',
116-
'debug[1]':'acc_raw[Y]',
117-
'debug[2]':'acc_raw[Z]',
118-
'debug[3]':'Not Used',
119-
},
120-
'MIXER' : {
121-
'debug[all]':'Debug Mixer',
122-
'debug[0]':'rollPitchYawMix[0]',
123-
'debug[1]':'rollPitchYawMix[1]',
124-
'debug[2]':'rollPitchYawMix[2]',
125-
'debug[3]':'rollPitchYawMix[3]',
126-
},
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-
},
134-
'PIDLOOP' : {
135-
'debug[all]':'Debug PID',
136-
'debug[0]':'Wait Time',
137-
'debug[1]':'Sub Update Time',
138-
'debug[2]':'PID Update Time',
139-
'debug[3]':'Motor Update Time',
97+
'debug[3]':'Not Used'
14098
},
141-
'NOTCH' : {
99+
2 : { //Debug Notch
142100
'debug[all]':'Debug Notch',
143101
'debug[0]':'gyro_preNotch[roll]',
144102
'debug[1]':'gyro_preNotch[pitch]',
145103
'debug[2]':'gyro_preNotch[yaw]',
146-
'debug[3]':'Not Used',
147-
},
148-
'RC_INTERPOLATION' : {
149-
'debug[all]':'Debug RC',
150-
'debug[0]':'rcCommand_raw[roll]',
151-
'debug[1]':'rcCommand_raw[pitch]',
152-
'debug[2]':'rcCommand_raw[yaw]',
153-
'debug[3]':'rxRefreshRate',
154-
},
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-
},
162-
'DTERM_FILTER' : {
163-
'debug[all]':'Debug Filter',
164-
'debug[0]':'dterm_filter[roll]',
165-
'debug[1]':'dterm_filter[pitch]',
166-
'debug[2]':'Not Used',
167-
'debug[3]':'Not Used',
168-
},
169-
'ANGLERATE' : {
170-
'debug[all]':'Debug Anglerate',
171-
'debug[0]':'Anglerate[roll]',
172-
'debug[1]':'Anglerate[pitch]',
173-
'debug[2]':'Anglerate[yaw]',
174-
'debug[3]':'Not Used',
175-
},
176-
'ESC_SENSOR' : {
177-
'debug[all]':'ESC Sensor',
178-
'debug[0]':'Motor Index',
179-
'debug[1]':'Timeouts',
180-
'debug[2]':'Temperature',
181-
'debug[3]':'RPM',
182-
},
183-
'SCHEDULER' : {
184-
'debug[all]':'Scheduler',
185-
'debug[0]':'Not Used',
186-
'debug[1]':'Not Used',
187-
'debug[2]':'Schedule Time',
188-
'debug[3]':'Function Exec Time',
189-
},
190-
'STACK' : {
191-
'debug[all]':'Stack',
192-
'debug[0]':'Stack High Mem',
193-
'debug[1]':'Stack Low Mem',
194-
'debug[2]':'Stack Current',
195-
'debug[3]':'Stack p',
196-
},
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' : {
220-
'debug[all]':'Debug FFT',
221-
'debug[0]':'gyro_raw[roll]',
222-
'debug[1]':'gyro_dyn_notch[roll]',
223-
'debug[2]':'gyro_bpf[roll]',
224-
'debug[3]':'fft_center_index[roll]',
225-
},
226-
'DEBUG_FFT_TIME' : {
227-
'debug[all]':'Debug FFT TIME',
228-
'debug[0]':'Active calc step',
229-
'debug[1]':'Step duration',
230-
'debug[2]':'Additional steps',
231-
'debug[3]':'Not used',
232-
},
233-
'DEBUG_FFT_FREQ' : {
234-
'debug[all]':'Debug FFT FREQ',
235-
'debug[0]':'center_freq[roll]',
236-
'debug[1]':'center_freq[pitch]',
237-
'debug[2]':'center_freq[yaw]',
238-
'debug[3]':'Not used',
239-
},
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' : {
249-
'debug[all]':'Debug Gyro Raw',
250-
'debug[0]':'gyro_raw[X]',
251-
'debug[1]':'gyro_raw[Y]',
252-
'debug[2]':'gyro_raw[Z]',
253-
'debug[3]':'Not Used',
254-
},
104+
'debug[3]':'Not Used'
105+
}
255106
};
256107

257108
function presentFlags(flags, flagNames) {
@@ -290,13 +141,13 @@ function FlightLogFieldPresenter() {
290141
var found = false;
291142
for(var i=0; i<=31; i++) {
292143
if((1<<i) & (flags ^ lastFlags)) { // State Changed
293-
eventState += '|' + flagNames[i] + ' ' + (((1<<i) & flags)?'ON':'OFF')
144+
eventState += '|' + flagNames[i] + ' ' + (((1<<i) & flags)?'ON':'OFF');
294145
found = true;
295146
}
296147
}
297148
if(!found) {eventState += ' | ACRO';} // Catch the state when all flags are off, which is ACRO of course
298149
return eventState;
299-
}
150+
};
300151

301152
function presentEnum(value, enumNames) {
302153
if (enumNames[value] === undefined)
@@ -429,63 +280,9 @@ function FlightLogFieldPresenter() {
429280
if(flightLog) {
430281
var debugModeName = DEBUG_MODE[flightLog.getSysConfig().debug_mode]; // convert to recognisable name
431282
switch (debugModeName) {
432-
case 'NONE':
433-
case 'AIRMODE':
434-
case 'VELOCITY':
435-
return "";
436-
case 'CYCLETIME':
437-
switch (fieldName) {
438-
case 'debug[1]':
439-
return value.toFixed(0) + "%";
440-
default:
441-
return value.toFixed(0) + "\u03BCS";
442-
}
443-
case 'PIDLOOP':
444-
return value.toFixed(0) + "\u03BCS";
445-
case 'BATTERY':
446-
switch (fieldName) {
447-
case 'debug[0]':
448-
return value.toFixed(0);
449-
default:
450-
return (value/10).toFixed(1) + "V"
451-
}
452283
case 'GYRO':
453284
case 'NOTCH':
454285
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + "deg/s";
455-
case 'ACCELEROMETER':
456-
return flightLog.accRawToGs(value).toFixed(2) + "g";
457-
case 'MIXER':
458-
return Math.round(flightLog.rcCommandRawToThrottle(value)) + " %";
459-
case 'RC_INTERPOLATION':
460-
switch (fieldName) {
461-
case 'debug[3]':
462-
return (value / 1000).toFixed(0) + 'mS';
463-
default:
464-
return value.toFixed(0);
465-
}
466-
case 'DFILTER':
467-
return "";
468-
case 'ANGLERATE':
469-
return value.toFixed(0) + "deg/s";
470-
case 'ESC_SENSOR':
471-
switch (fieldName) {
472-
case 'debug[2]':
473-
return value.toFixed(0) + "°C";
474-
case 'debug[3]':
475-
return value.toFixed(0) + "rpm";
476-
default:
477-
return value.toFixed(0) + "\u03BCS";
478-
}
479-
case 'SCHEDULER':
480-
return value.toFixed(0) + "\u03BCS";
481-
case 'STACK':
482-
return value.toFixed(0);
483-
case 'DEBUG_FFT':
484-
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + "deg/s";
485-
case 'DEBUG_FFT_TIME':
486-
return value.toFixed(0) + "\u03BCS";
487-
case 'DEBUG_FFT_FREQ':
488-
return value.toFixed(0) + "Hz";
489286
default:
490287
return "";
491288
}
@@ -494,12 +291,17 @@ function FlightLogFieldPresenter() {
494291
};
495292

496293
FlightLogFieldPresenter.fieldNameToFriendly = function(fieldName, debugMode) {
497-
if(debugMode) {
498-
if(fieldName.includes('debug')) {
499-
var debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugMode < DEBUG_MODE.length ? DEBUG_MODE[debugMode] : DEBUG_MODE[0]];
500-
return debugFields[fieldName];
501-
}
294+
295+
if (debugMode && fieldName.includes('debug')) {
296+
var debugFields = DEBUG_FRIENDLY_FIELD_NAMES[debugMode];
297+
298+
if (debugFields !== undefined) {
299+
return debugFields[fieldName];
300+
} else {
301+
return DEBUG_FRIENDLY_FIELD_NAMES[0][fieldName];
302+
}
502303
}
304+
503305
if (FRIENDLY_FIELD_NAMES[fieldName]) {
504306
return FRIENDLY_FIELD_NAMES[fieldName];
505307
}

manifest.json

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
{
2-
"name": "INAV - Blackbox Explorer",
3-
"description": "Interactive flight log viewer for INAV",
4-
"version": "3.0.0",
5-
"manifest_version": 2,
6-
"app": {
7-
"background": {
8-
"scripts": ["background.js"]
2+
"name": "INAV - Blackbox Explorer",
3+
"description": "Interactive flight log viewer for INAV",
4+
"version": "3.0.0",
5+
"manifest_version": 2,
6+
"default_locale": "en",
7+
"app": {
8+
"background": {
9+
"scripts": ["background.js"]
10+
}
11+
},
12+
"permissions": [
13+
{
14+
"fileSystem": ["write"]
15+
},
16+
"storage"
17+
],
18+
"icons": {
19+
"128": "images/bf_icon_128.png"
920
}
10-
},
11-
"permissions": [
12-
{"fileSystem": ["write"]},
13-
"storage"
14-
],
15-
"icons": { "128": "images/icon-128.png" }
1621
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"default_locale": "en",
88
"scripts": {
99
"start": "node node_modules/nw/bin/nw .",
10-
"debug": "node node_modules/gulp/bin/gulp.js debug",
1110
"_postinstall": "node ./node_modules/platform-dependent-modules/cli.js",
1211
"postinstall": "npm run _postinstall",
1312
"gulp": "gulp"

0 commit comments

Comments
 (0)