Skip to content

Commit b1ab529

Browse files
authored
Merge pull request #554 from KarateBrot/fftDebug
Update FFT debug modes
2 parents 1836aec + ff7ff85 commit b1ab529

File tree

3 files changed

+48
-22
lines changed

3 files changed

+48
-22
lines changed

js/flightlog_fields_presenter.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,27 @@ function FlightLogFieldPresenter() {
657657
'debug[2]':'Dyn Idle D [roll]',
658658
'debug[3]':'Min RPM',
659659
};
660+
DEBUG_FRIENDLY_FIELD_NAMES.FFT = {
661+
'debug[all]':'Debug FFT',
662+
'debug[0]':'Gyro Pre Dyn Notch [dbg-axis]',
663+
'debug[1]':'Gyro Post Dyn Notch [dbg-axis]',
664+
'debug[2]':'Gyro Downsampled [dbg-axis]',
665+
'debug[3]':'Not used',
666+
};
667+
DEBUG_FRIENDLY_FIELD_NAMES.FFT_TIME = {
668+
'debug[all]':'Debug FFT TIME',
669+
'debug[0]':'Active calc step',
670+
'debug[1]':'Step duration',
671+
'debug[2]':'Not used',
672+
'debug[3]':'Not used',
673+
};
674+
DEBUG_FRIENDLY_FIELD_NAMES.FFT_FREQ = {
675+
'debug[all]':'Debug FFT FREQ',
676+
'debug[0]':'Notch 1 Center Freq [dbg-axis]',
677+
'debug[1]':'Notch 2 Center Freq [dbg-axis]',
678+
'debug[2]':'Notch 3 Center Freq [dbg-axis]',
679+
'debug[3]':'Gyro Pre Dyn Notch [dbg-axis]',
680+
};
660681
} else if (semver.gte(firmwareVersion, '4.2.0')) {
661682
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
662683
'debug[all]':'Feedforward [roll]',
@@ -950,11 +971,11 @@ function FlightLogFieldPresenter() {
950971
return value.toFixed(0) + "°C";
951972
case 'FFT':
952973
switch (fieldName) {
953-
case 'debug[0]': // gyro pre-notch [for selected axis]
954-
case 'debug[1]': // gyro post-notch [for selected axis]
955-
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + "deg/s";
956-
// debug 2 = sample average
957-
// debug 3 = not used
974+
case 'debug[0]': // gyro pre dyn notch [for gyro debug axis]
975+
case 'debug[1]': // gyro post dyn notch [for gyro debug axis]
976+
case 'debug[2]': // gyro pre dyn notch, downsampled for FFT [for gyro debug axis]
977+
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + " deg/s";
978+
// debug 3 = not used
958979
default:
959980
return value.toFixed(0);
960981
}
@@ -963,17 +984,18 @@ function FlightLogFieldPresenter() {
963984
case 'debug[0]':
964985
return FlightLogFieldPresenter.presentEnum(value, FFT_CALC_STEPS);
965986
case 'debug[1]':
966-
case 'debug[2]':
967-
return value.toFixed(0) + "\u03BCs";
987+
return value.toFixed(0) + " \u03BCs";
988+
// debug 2 = not used
989+
// debug 3 = not used
968990
default:
969991
return value.toFixed(0);
970992
}
971993
case 'FFT_FREQ':
972994
switch (fieldName) {
973-
case 'debug[3]': // raw gyro [for debug axis]
974-
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + "deg/s";
995+
case 'debug[3]': // gyro pre dyn notch [for gyro debug axis]
996+
return Math.round(flightLog.gyroRawToDegreesPerSecond(value)) + " deg/s";
975997
default:
976-
return value.toFixed(0) + "Hz";
998+
return value.toFixed(0) + " Hz";
977999
}
9781000
case 'RTH':
9791001
switch(fieldName) {

js/graph_config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,12 @@ GraphConfig.load = function(config) {
470470
};
471471
case 'FFT':
472472
switch (fieldName) {
473-
case 'debug[0]': // gyro scaled [for selected axis]
474-
case 'debug[1]': // pre-dyn notch gyro [for selected axis]
475-
case 'debug[2]': // pre-dyn notch gyro FFT downsampled [roll]
473+
case 'debug[0]': // pre-dyn notch gyro [for gyro debug axis]
474+
case 'debug[1]': // post-dyn notch gyro [for gyro debug axis]
475+
case 'debug[2]': // pre-dyn notch gyro downsampled for FFT [for gyro debug axis]
476476
return {
477477
offset: 0,
478-
power: 0.25,
478+
power: 1.0,
479479
inputRange: maxDegreesSecond(gyroScaleMargin), // Maximum grad/s + 20%
480480
outputRange: 1.0
481481
};
@@ -484,14 +484,14 @@ GraphConfig.load = function(config) {
484484
}
485485
case 'FFT_FREQ':
486486
switch (fieldName) {
487-
case 'debug[0]': // roll center freq
488-
case 'debug[1]': // pitch center freq
489-
return getCurveForMinMaxFields('debug[0]', 'debug[1]');
490-
case 'debug[2]': // pre-dyn notch gyro [for selected axis]
491-
case 'debug[3]': // raw gyro [for selected axis]
487+
case 'debug[0]': // notch 1 center freq [for gyro debug axis]
488+
case 'debug[1]': // notch 2 center freq [for gyro debug axis]
489+
case 'debug[2]': // notch 3 center freq [for gyro debug axis]
490+
return getCurveForMinMaxFields('debug[0]', 'debug[1]', 'debug[2]');
491+
case 'debug[3]': // pre-dyn notch gyro [for gyro debug axis]
492492
return {
493493
offset: 0,
494-
power: 0.25,
494+
power: 1.0,
495495
inputRange: maxDegreesSecond(gyroScaleMargin), // Maximum grad/s + 20%
496496
outputRange: 1.0
497497
};

js/header_dialog.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,12 @@ function HeaderDialog(dialog, onSave) {
362362
features.push(
363363
{bit: 27, group: 'other', name: 'ESC_SENSOR', description: 'Use KISS ESC 24A telemetry as sensor'},
364364
{bit: 28, group: 'other', name: 'ANTI_GRAVITY', description: 'Temporary boost I-Term on high throttle changes'},
365-
{bit: 29, group: 'other', name: 'DYNAMIC_FILTER', description: 'Dynamic gyro notch filtering'}
366-
)
365+
);
366+
if (semver.lt(sysConfig.firmwareVersion, "4.3.0")) {
367+
features.push(
368+
{bit: 29, group: 'other', name: 'DYNAMIC_FILTER', description: 'Dynamic gyro notch filtering'},
369+
);
370+
}
367371
}
368372

369373
var radioGroups = [];

0 commit comments

Comments
 (0)