Skip to content

Commit 2769c28

Browse files
authored
Add AUTOPILOT_POSITION and OPTICALFLOW debug modes (#803)
* The DEBUG modes list is updated. The OPTICALFLOW, AUTOPILOT_POSITION debugs are added * added converters for OPTICALFLOW debug * added converters for AUTOPILOT_POSITION debug
1 parent f10ad5e commit 2769c28

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

src/flightlog_fielddefs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,14 @@ export function adjustFieldDefsList(firmwareType, firmwareVersion) {
530530
if (semver.gte(firmwareVersion, "4.6.0")) {
531531
DEBUG_MODE.splice(DEBUG_MODE.indexOf('GPS_RESCUE_THROTTLE_PID'), 1, 'AUTOPILOT_ALTITUDE');
532532
DEBUG_MODE.splice(DEBUG_MODE.indexOf("GYRO_SCALED"), 1);
533+
DEBUG_MODE.splice(DEBUG_MODE.indexOf("RANGEFINDER_QUALITY") + 1, 0, "OPTICALFLOW");
533534
DEBUG_MODE.push('TPA');
534535
DEBUG_MODE.push('S_TERM');
535536
DEBUG_MODE.push('SPA');
536537
DEBUG_MODE.push('TASK');
537538
DEBUG_MODE.push('GIMBAL');
538539
DEBUG_MODE.push('WING_SETPOINT');
540+
DEBUG_MODE.push('AUTOPILOT_POSITION');
539541
}
540542

541543
DEBUG_MODE = makeReadOnly(DEBUG_MODE);

src/flightlog_fields_presenter.js

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const FRIENDLY_FIELD_NAMES = {
3232
"axisF[0]": "PID Feedforward [roll]",
3333
"axisF[1]": "PID Feedforward [pitch]",
3434
"axisF[2]": "PID Feedforward [yaw]",
35-
35+
3636
"axisS[all]": "PID S",
3737
"axisS[0]": "PID S [roll]",
3838
"axisS[1]": "PID S [pitch]",
@@ -129,7 +129,7 @@ const FRIENDLY_FIELD_NAMES = {
129129
GPS_altitude: "GPS Altitude ASL",
130130
GPS_speed: "GPS Speed",
131131
GPS_ground_course: "GPS Heading",
132-
132+
133133
"gpsCartesianCoords[all]": "GPS Coords",
134134
"gpsCartesianCoords[0]": "GPS Coords [X]",
135135
"gpsCartesianCoords[1]": "GPS Coords [Y]",
@@ -1388,6 +1388,26 @@ FlightLogFieldPresenter.adjustDebugDefsList = function (
13881388
'debug[4]': 'Current Setpoint [yaw]',
13891389
'debug[5]': 'Adjusted Setpoint [yaw]',
13901390
};
1391+
DEBUG_FRIENDLY_FIELD_NAMES.OPTICALFLOW = {
1392+
'debug[all]': 'Optical Flow',
1393+
'debug[0]': 'Quality',
1394+
'debug[1]': 'Raw flow rates X',
1395+
'debug[2]': 'Raw flow rates Y',
1396+
'debug[3]': 'Processed flow rates X',
1397+
'debug[4]': 'Processed flow rates Y',
1398+
'debug[5]': 'Delta time',
1399+
};
1400+
DEBUG_FRIENDLY_FIELD_NAMES.AUTOPILOT_POSITION = {
1401+
'debug[all]': 'Autopilot Position',
1402+
'debug[0]': 'Distance',
1403+
'debug[1]': 'GPS Distance',
1404+
'debug[2]': 'PID Sum EF',
1405+
'debug[3]': 'Angle',
1406+
'debug[4]': 'pidP',
1407+
'debug[5]': 'pidI',
1408+
'debug[6]': 'pidD',
1409+
'debug[7]': 'pidA',
1410+
};
13911411
}
13921412
}
13931413
};
@@ -1728,7 +1748,7 @@ FlightLogFieldPresenter.decodeFieldToFriendly = function (
17281748
}
17291749
case "GPS_ground_course":
17301750
return `${(value / 10).toFixed(1)} °`;
1731-
1751+
17321752
case "gpsCartesianCoords[0]":
17331753
case "gpsCartesianCoords[1]":
17341754
case "gpsCartesianCoords[2]":
@@ -2151,6 +2171,28 @@ FlightLogFieldPresenter.decodeDebugFieldToFriendly = function (
21512171
return value.toFixed(0);
21522172
case "EZLANDING":
21532173
return `${(value / 100.0).toFixed(2)} %`;
2174+
case "OPTICALFLOW":
2175+
switch (fieldName) {
2176+
case "debug[1]":
2177+
case "debug[2]":
2178+
case "debug[3]":
2179+
case "debug[4]":
2180+
return `${(value / 1000).toFixed(1)}`;
2181+
default:
2182+
return value.toFixed(1);
2183+
}
2184+
case "AUTOPILOT_POSITION":
2185+
switch (fieldName) {
2186+
case "debug[2]":
2187+
case "debug[3]":
2188+
case "debug[4]":
2189+
case "debug[5]":
2190+
case "debug[6]":
2191+
case "debug[7]":
2192+
return `${(value / 10).toFixed(1)}`;
2193+
default:
2194+
return value.toFixed(1);
2195+
}
21542196
}
21552197
return value.toFixed(0);
21562198
}
@@ -2816,6 +2858,28 @@ FlightLogFieldPresenter.ConvertDebugFieldValue = function (
28162858
return value;
28172859
case "DSHOT_TELEMETRY_COUNTS":
28182860
return value;
2861+
case "OPTICALFLOW":
2862+
switch (fieldName) {
2863+
case "debug[1]":
2864+
case "debug[2]":
2865+
case "debug[3]":
2866+
case "debug[4]":
2867+
return toFriendly ? value / 1000 : value * 1000;
2868+
default:
2869+
return value;
2870+
}
2871+
case "AUTOPILOT_POSITION":
2872+
switch (fieldName) {
2873+
case "debug[2]":
2874+
case "debug[3]":
2875+
case "debug[4]":
2876+
case "debug[5]":
2877+
case "debug[6]":
2878+
case "debug[7]":
2879+
return toFriendly ? value / 10 : value * 10;
2880+
default:
2881+
return value;
2882+
}
28192883
}
28202884
}
28212885
return value;

0 commit comments

Comments
 (0)