Skip to content

Commit 854a999

Browse files
committed
fix debug headers and scaling for 4.3
1 parent 683789f commit 854a999

File tree

3 files changed

+157
-23
lines changed

3 files changed

+157
-23
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 & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -400,21 +400,21 @@ function FlightLogFieldPresenter() {
400400
'debug[0]':'Motor Range Min Inc',
401401
'debug[1]':'Target RPS Change Rate',
402402
'debug[2]':'Error',
403-
'debug[3]':'Min RPS',
403+
'debug[3]':'Min RPM',
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 RPM',
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,13 @@ 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);
827+
default:
828+
return value.toFixed(0);
829+
}
774830
case 'AC_ERROR':
775831
return (value / 10).toFixed(1) + 'deg';
776832
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

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

0 commit comments

Comments
 (0)