Skip to content

Commit 459edb2

Browse files
committed
fix debug headers and scaling for 4.3
1 parent f4e183c commit 459edb2

File tree

3 files changed

+157
-22
lines changed

3 files changed

+157
-22
lines changed

js/flightlog_fielddefs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
480480
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO'), 1);
481481
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO_COMBINED'), 1);
482482
}
483+
if(semver.gte(firmwareVersion, '4.3.0')) {
484+
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_INTERPOLATED'), 1, 'FEEDFORWARD');
485+
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_LIMIT'), 1, 'FEEDFORWARD_LIMIT');
486+
}
483487
DEBUG_MODE = makeReadOnly(DEBUG_MODE);
484488

485489
// Flight mode names

js/flightlog_fields_presenter.js

Lines changed: 75 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -404,17 +404,17 @@ function FlightLogFieldPresenter() {
404404
},
405405
'FF_LIMIT' : {
406406
'debug[all]':'FF Limit',
407-
'debug[0]':'FF [Roll]',
408-
'debug[1]':'FF [Pitch]',
409-
'debug[2]':'FF Final [Roll]',
407+
'debug[0]':'FF input [roll]',
408+
'debug[1]':'FF input [pitch]',
409+
'debug[2]':'FF limited [roll]',
410410
'debug[3]':'Not Used',
411411
},
412412
'FF_INTERPOLATED' : {
413-
'debug[all]':'FF Interpolated',
414-
'debug[0]':'Setpoint Delta Impl [Roll]',
415-
'debug[1]':'Boost Amount',
416-
'debug[2]':'Boost Amount Clip [Roll]',
417-
'debug[3]':'Clip',
413+
'debug[all]':'FF Interpolated [roll]',
414+
'debug[0]':'Setpoint Delta Impl [roll]',
415+
'debug[1]':'Boost amount [roll]',
416+
'debug[2]':'Boost amount, clipped [roll]',
417+
'debug[3]':'Clip amount [roll]',
418418
},
419419
'RTH' : {
420420
'debug[all]':'RTH',
@@ -431,16 +431,63 @@ function FlightLogFieldPresenter() {
431431

432432
DEBUG_FRIENDLY_FIELD_NAMES = {...DEBUG_FRIENDLY_FIELD_NAMES_INITIAL};
433433

434-
if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT && semver.gte(firmwareVersion, '4.3.0')) {
435-
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
436-
'debug[0]':'Raw FF Derivative [Roll]',
437-
'debug[1]':'Cleaned FF Derivative ',
438-
'debug[2]':'Cleaned Boost Amount [Roll]',
439-
'debug[3]':'Duplicate Marker',
440-
};
434+
if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT) {
435+
if (semver.gte(firmwareVersion, '4.3.0')) {
436+
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD = {
437+
'debug[all]':'Feedforward [roll]',
438+
'debug[0]':'Setpoint, interpolated [roll]',
439+
'debug[1]':'Delta, smoothed [roll]',
440+
'debug[2]':'Boost, smoothed [roll]',
441+
'debug[3]':'rcCommand Delta [roll]',
442+
};
443+
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD_LIMIT = {
444+
'debug[all]':'Feedforward Limit [roll]',
445+
'debug[0]':'Feedforward input [roll]',
446+
'debug[1]':'Feedforward input [pitch]',
447+
'debug[2]':'Feedforward limited [roll]',
448+
'debug[3]':'Not Used',
449+
};
450+
DEBUG_FRIENDLY_FIELD_NAMES.DYN_IDLE = {
451+
'debug[all]':'Dyn Idle',
452+
'debug[0]':'Dyn Idle P [roll]',
453+
'debug[1]':'Dyn Idle I [roll]',
454+
'debug[2]':'Dyn Idle D [roll]',
455+
'debug[3]':'Min RPS',
456+
};
457+
} else if (semver.gte(firmwareVersion, '4.2.0')) {
458+
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
459+
'debug[all]':'Feedforward [roll]',
460+
'debug[0]':'Setpoint Delta [roll]',
461+
'debug[1]':'Acceleration [roll]',
462+
'debug[2]':'Acceleration, clipped [roll]',
463+
'debug[3]':'Duplicate Counter [roll]',
464+
};
465+
DEBUG_FRIENDLY_FIELD_NAMES.FF_LIMIT = {
466+
'debug[all]':'Feedforward Limit [roll]',
467+
'debug[0]':'FF limit input [roll]',
468+
'debug[1]':'FF limit input [pitch]',
469+
'debug[2]':'FF limited [roll]',
470+
'debug[3]':'Not Used',
471+
};
472+
} else if (semver.gte(firmwareVersion, '4.1.0')) {
473+
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
474+
'debug[all]':'Feedforward [roll]',
475+
'debug[0]':'Setpoint Delta [roll]',
476+
'debug[1]':'Boost [roll]',
477+
'debug[2]':'Boost, clipped [roll]',
478+
'debug[3]':'Duplicate Counter [roll]',
479+
};
480+
DEBUG_FRIENDLY_FIELD_NAMES.FF_LIMIT = {
481+
'debug[all]':'Feedforward Limit [roll]',
482+
'debug[0]':'FF limit input [roll]',
483+
'debug[1]':'FF limit input [pitch]',
484+
'debug[2]':'FF limited [roll]',
485+
'debug[3]':'Not Used',
486+
};
487+
}
441488
}
442489
};
443-
490+
444491
FlightLogFieldPresenter.presentFlags = function(flags, flagNames) {
445492
var
446493
printedFlag = false,
@@ -486,8 +533,9 @@ function FlightLogFieldPresenter() {
486533
};
487534

488535
FlightLogFieldPresenter.presentEnum = function presentEnum(value, enumNames) {
489-
if (enumNames[value] === undefined)
536+
if (enumNames[value] === undefined) {
490537
return value;
538+
}
491539

492540
return enumNames[value];
493541
};
@@ -500,8 +548,9 @@ function FlightLogFieldPresenter() {
500548
* @param value Value of the field
501549
*/
502550
FlightLogFieldPresenter.decodeFieldToFriendly = function(flightLog, fieldName, value, currentFlightMode) {
503-
if (value === undefined)
551+
if (value === undefined) {
504552
return "";
553+
}
505554

506555
switch (fieldName) {
507556
case 'time':
@@ -771,6 +820,14 @@ function FlightLogFieldPresenter() {
771820
return value.toFixed(0) + "Hz";
772821
}
773822
break;
823+
case 'DYN_IDLE':
824+
switch (fieldName) {
825+
case 'debug[3]': // minRPS best shown as rpm, since commanded value is rpm
826+
return (value * 6) + " rpm";
827+
default:
828+
return value.toFixed(0);
829+
}
830+
break;
774831
case 'AC_ERROR':
775832
return (value / 10).toFixed(1) + 'deg';
776833
case 'AC_CORRECTION':

js/graph_config.js

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ function GraphConfig(graphConfig) {
4848
newGraph = $.extend(
4949
// Default values for missing properties:
5050
{
51-
height: 1
51+
height: 1,
5252
},
5353
// The old graph
5454
graph,
5555
// New fields to replace the old ones:
5656
{
57-
fields:[]
58-
}
57+
fields:[],
58+
},
5959
),
6060
colorIndex = 0;
6161

@@ -535,7 +535,81 @@ GraphConfig.load = function(config) {
535535
return getCurveForMinMaxFieldsZeroOffset(fieldName);
536536
}
537537
break;
538-
}
538+
case 'FF_INTERPOLATED':
539+
switch (fieldName) {
540+
case 'debug[0]': // setpoint Delta
541+
case 'debug[1]': // AccelerationModified
542+
case 'debug[2]': // Acceleration
543+
return {
544+
offset: 0,
545+
power: 1.0,
546+
inputRange: 1000,
547+
outputRange: 1.0,
548+
};
549+
case 'debug[3]': // Clip or Count
550+
return {
551+
offset: -10,
552+
power: 1.0,
553+
inputRange: 10,
554+
outputRange: 1.0,
555+
};
556+
}
557+
break;
558+
case 'FEEDFORWARD': // replaces FF_INTERPOLATED in 4.3
559+
switch (fieldName) {
560+
case 'debug[0]': // in 4.3 is interpolated setpoint
561+
return {
562+
offset: 0,
563+
power: 1.0,
564+
inputRange: maxDegreesSecond(gyroScaleMargin),
565+
outputRange: 1.0,
566+
};
567+
case 'debug[1]': // feedforward delta element
568+
case 'debug[2]': // feedforward boost element
569+
return {
570+
offset: 0,
571+
power: 1.0,
572+
inputRange: 1000,
573+
outputRange: 1.0,
574+
};
575+
case 'debug[3]': // rcCommand delta
576+
return {
577+
offset: 0,
578+
power: 1.0,
579+
inputRange: 10000,
580+
outputRange: 1.0,
581+
};
582+
}
583+
break;
584+
case 'FF_LIMIT':
585+
case 'FEEDFORWARD_LIMIT':
586+
return {
587+
offset: 0,
588+
power: 1.0,
589+
inputRange: 300,
590+
outputRange: 1.0,
591+
};
592+
case 'DYN_IDLE':
593+
switch (fieldName) {
594+
case 'debug[0]': // in 4.3 is dyn idle P
595+
case 'debug[1]': // in 4.3 is dyn idle I
596+
case 'debug[2]': // in 4.3 is dyn idle D
597+
return {
598+
offset: 0,
599+
power: 1.0,
600+
inputRange: 1000,
601+
outputRange: 1.0,
602+
};
603+
case 'debug[3]': // in 4.3 and 4.2 is minRPS
604+
return {
605+
offset: -1000,
606+
power: 1.0,
607+
inputRange: 1000,
608+
outputRange: 1.0,
609+
};
610+
}
611+
break;
612+
}
539613
}
540614
// if not found above then
541615
// Scale and center the field based on the whole-log observed ranges for that field

0 commit comments

Comments
 (0)