@@ -12,6 +12,7 @@ import semver from 'semver';
12
12
import { showErrorDialog } from "../utils/showErrorDialog" ;
13
13
import { checkChromeRuntimeError } from "../utils/common" ;
14
14
import $ from 'jquery' ;
15
+ import DEBUG from "../debug" ;
15
16
16
17
let sdcardTimer ;
17
18
@@ -240,112 +241,21 @@ onboard_logging.initialize = function (callback) {
240
241
}
241
242
242
243
function populateDebugModes ( debugModeSelect ) {
243
- let debugModes = [ ] ;
244
-
245
244
if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_42 ) ) {
246
245
$ ( '.blackboxDebugMode' ) . show ( ) ;
247
246
248
- debugModes = [
249
- { text : "NONE" } ,
250
- { text : "CYCLETIME" } ,
251
- { text : "BATTERY" } ,
252
- { text : "GYRO_FILTERED" } ,
253
- { text : "ACCELEROMETER" } ,
254
- { text : "PIDLOOP" } ,
255
- { text : "GYRO_SCALED" } ,
256
- { text : "RC_INTERPOLATION" } ,
257
- { text : "ANGLERATE" } ,
258
- { text : "ESC_SENSOR" } ,
259
- { text : "SCHEDULER" } ,
260
- { text : "STACK" } ,
261
- { text : "ESC_SENSOR_RPM" } ,
262
- { text : "ESC_SENSOR_TMP" } ,
263
- { text : "ALTITUDE" } ,
264
- { text : "FFT" } ,
265
- { text : "FFT_TIME" } ,
266
- { text : "FFT_FREQ" } ,
267
- { text : "RX_FRSKY_SPI" } ,
268
- { text : "RX_SFHSS_SPI" } ,
269
- { text : "GYRO_RAW" } ,
270
- { text : "DUAL_GYRO_RAW" } ,
271
- { text : "DUAL_GYRO_DIFF" } ,
272
- { text : "MAX7456_SIGNAL" } ,
273
- { text : "MAX7456_SPICLOCK" } ,
274
- { text : "SBUS" } ,
275
- { text : "FPORT" } ,
276
- { text : "RANGEFINDER" } ,
277
- { text : "RANGEFINDER_QUALITY" } ,
278
- { text : "LIDAR_TF" } ,
279
- { text : "ADC_INTERNAL" } ,
280
- { text : "RUNAWAY_TAKEOFF" } ,
281
- { text : "SDIO" } ,
282
- { text : "CURRENT_SENSOR" } ,
283
- { text : "USB" } ,
284
- { text : "SMARTAUDIO" } ,
285
- { text : "RTH" } ,
286
- { text : "ITERM_RELAX" } ,
287
- { text : "ACRO_TRAINER" } ,
288
- { text : "RC_SMOOTHING" } ,
289
- { text : "RX_SIGNAL_LOSS" } ,
290
- { text : "RC_SMOOTHING_RATE" } ,
291
- { text : "ANTI_GRAVITY" } ,
292
- { text : "DYN_LPF" } ,
293
- { text : "RX_SPEKTRUM_SPI" } ,
294
- { text : "DSHOT_RPM_TELEMETRY" } ,
295
- { text : "RPM_FILTER" } ,
296
- { text : "D_MIN" } ,
297
- { text : "AC_CORRECTION" } ,
298
- { text : "AC_ERROR" } ,
299
- { text : "DUAL_GYRO_SCALED" } ,
300
- { text : "DSHOT_RPM_ERRORS" } ,
301
- { text : "CRSF_LINK_STATISTICS_UPLINK" } ,
302
- { text : "CRSF_LINK_STATISTICS_PWR" } ,
303
- { text : "CRSF_LINK_STATISTICS_DOWN" } ,
304
- { text : "BARO" } ,
305
- { text : "GPS_RESCUE_THROTTLE_PID" } ,
306
- { text : "DYN_IDLE" } ,
307
- { text : "FEEDFORWARD_LIMIT" } ,
308
- { text : "FEEDFORWARD" } ,
309
- { text : "BLACKBOX_OUTPUT" } ,
310
- { text : "GYRO_SAMPLE" } ,
311
- { text : "RX_TIMING" } ,
312
- { text : "D_LPF" } ,
313
- { text : "VTX_TRAMP" } ,
314
- { text : "GHST" } ,
315
- { text : "GHST_MSP" } ,
316
- { text : "SCHEDULER_DETERMINISM" } ,
317
- { text : "TIMING_ACCURACY" } ,
318
- { text : "RX_EXPRESSLRS_SPI" } ,
319
- { text : "RX_EXPRESSLRS_PHASELOCK" } ,
320
- { text : "RX_STATE_TIME" } ,
321
- { text : "GPS_RESCUE_VELOCITY" } ,
322
- { text : "GPS_RESCUE_HEADING" } ,
323
- { text : "GPS_RESCUE_TRACKING" } ,
324
- { text : "GPS_CONNECTION" } ,
325
- { text : "ATTITUDE" } ,
326
- { text : "VTX_MSP" } ,
327
- { text : "GPS_DOP" } ,
328
- { text : "FAILSAFE" } ,
329
- { text : "GYRO_CALIBRATION" } ,
330
- { text : "ANGLE_MODE" } ,
331
- { text : "ANGLE_TARGET" } ,
332
- { text : "CURRENT_ANGLE" } ,
333
- { text : "DSHOT_TELEMETRY_COUNTS" } ,
334
- { text : "RPM_LIMIT" } ,
335
- ] ;
336
-
337
247
for ( let i = 0 ; i < FC . PID_ADVANCED_CONFIG . debugModeCount ; i ++ ) {
338
- if ( i < debugModes . length ) {
339
- debugModeSelect . append ( new Option ( debugModes [ i ] . text , i ) ) ;
248
+ if ( i < DEBUG . modes . length ) {
249
+ debugModeSelect . append ( new Option ( DEBUG . modes [ i ] . text , i ) ) ;
340
250
} else {
341
251
debugModeSelect . append ( new Option ( i18n . getMessage ( 'onboardLoggingDebugModeUnknown' ) , i ) ) ;
342
252
}
343
253
}
344
254
345
255
debugModeSelect
346
- . val ( FC . PID_ADVANCED_CONFIG . debugMode )
347
- . select2 ( )
348
- . sortSelect ( "NONE" ) ;
256
+ . val ( FC . PID_ADVANCED_CONFIG . debugMode )
257
+ . select2 ( )
258
+ . sortSelect ( "NONE" ) ;
349
259
} else {
350
260
$ ( '.blackboxDebugMode' ) . hide ( ) ;
351
261
}
@@ -355,28 +265,11 @@ onboard_logging.initialize = function (callback) {
355
265
if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_45 ) ) {
356
266
$ ( '.blackboxDebugFields' ) . show ( ) ;
357
267
358
- const debugFields = [
359
- { text : "PID" } ,
360
- { text : "RC Commands" } ,
361
- { text : "Setpoint" } ,
362
- { text : "Battery" } ,
363
- { text : "Magnetometer" } ,
364
- { text : "Altitude" } ,
365
- { text : "RSSI" } ,
366
- { text : "Gyro" } ,
367
- { text : "Accelerometer" } ,
368
- { text : "Debug Log" } ,
369
- { text : "Motor" } ,
370
- { text : "GPS" } ,
371
- { text : "RPM" } ,
372
- { text : "Unfiltered Gyro" } ,
373
- ] ;
374
-
375
268
let fieldsMask = FC . BLACKBOX . blackboxDisabledMask ;
376
269
377
- for ( let i = 0 ; i < debugFields . length ; i ++ ) {
270
+ for ( let i = 0 ; i < DEBUG . enableFields . length ; i ++ ) {
378
271
const enabled = ( fieldsMask & ( 1 << i ) ) === 0 ;
379
- debugFieldsSelect . append ( new Option ( debugFields [ i ] . text , i , false , enabled ) ) ;
272
+ debugFieldsSelect . append ( new Option ( DEBUG . enableFields [ i ] . text , i , false , enabled ) ) ;
380
273
}
381
274
382
275
debugFieldsSelect . sortSelect ( ) . multipleSelect ( ) ;
0 commit comments