Skip to content

Commit

Permalink
Merge pull request #593 from ctzsnooze/update-debugs-to-44
Browse files Browse the repository at this point in the history
Update  GPS Rescue Altitude, Heading and Tracking, and Altitude, Baro and RTH debugs
  • Loading branch information
haslinghuis authored Aug 31, 2022
2 parents 0c22a81 + 428c363 commit b532dab
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 4 deletions.
94 changes: 90 additions & 4 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,27 @@ function FlightLogFieldPresenter() {
'debug[2]':'Frequency Offset',
'debug[3]':'Phase Shift',
},
'GPS_RESCUE_VELOCITY' : {
'debug[all]':'GPS Rescue Velocity',
'debug[0]':'Velocity P',
'debug[1]':'Velocity D',
'debug[2]':'Velocity to Home',
'debug[3]':'Target Velocity',
},
'GPS_RESCUE_HEADING' : {
'debug[all]':'GPS Rescue Heading',
'debug[0]':'Rescue Yaw',
'debug[1]':'Rescue Roll',
'debug[2]':'Attitude',
'debug[3]':'Angle to home',
},
'GPS_RESCUE_TRACKING' : {
'debug[all]':'GPS Rescue Tracking',
'debug[0]':'Velocity to home',
'debug[1]':'Target velocity',
'debug[2]':'Altitude',
'debug[3]':'Target altitude',
},
};

let DEBUG_FRIENDLY_FIELD_NAMES = null;
Expand All @@ -635,7 +656,22 @@ function FlightLogFieldPresenter() {
DEBUG_FRIENDLY_FIELD_NAMES = {...DEBUG_FRIENDLY_FIELD_NAMES_INITIAL};

if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT) {
if (semver.gte(firmwareVersion, '4.3.0')) {
if (semver.gte(firmwareVersion, '4.4.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.RTH = {
'debug[all]':'RTH Rescue codes',
'debug[0]':'Pitch angle, deg',
'debug[1]':'Rescue Phase',
'debug[2]':'Failure code',
'debug[3]':'Failure timers',
};
DEBUG_FRIENDLY_FIELD_NAMES.GPS_RESCUE_THROTTLE_PID = {
'debug[all]':'GPS Rescue throttle PIDs',
'debug[0]':'Throttle P',
'debug[1]':'Throttle D',
'debug[2]':'Altitude',
'debug[3]':'Target altitude',
};
} else if (semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD = {
'debug[all]':'Feedforward [roll]',
'debug[0]':'Setpoint, un-smoothed [roll]',
Expand Down Expand Up @@ -678,6 +714,13 @@ function FlightLogFieldPresenter() {
'debug[2]':'Notch 3 Center Freq [dbg-axis]',
'debug[3]':'Gyro Pre Dyn Notch [dbg-axis]',
};
DEBUG_FRIENDLY_FIELD_NAMES.GPS_RESCUE_THROTTLE_PID = {
'debug[all]':'GPS Rescue Altitude',
'debug[0]':'Throttle P',
'debug[1]':'Throttle D',
'debug[2]':'Altitude',
'debug[3]':'Target Altitude',
};
} else if (semver.gte(firmwareVersion, '4.2.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
'debug[all]':'Feedforward [roll]',
Expand Down Expand Up @@ -1002,7 +1045,7 @@ function FlightLogFieldPresenter() {
}
case 'RTH':
switch(fieldName) {
case 'debug[1]':
case 'debug[0]': // pitch angle +/-4000 means +/- 40 deg
return (value / 100).toFixed(1) + 'deg';
default:
return value.toFixed(0);
Expand Down Expand Up @@ -1058,8 +1101,6 @@ function FlightLogFieldPresenter() {
default:
return value.toFixed(0) + "Hz";
}
case 'GPS_RESCUE_THROTTLE_PID':
return value.toFixed(0);
case 'DYN_IDLE':
switch (fieldName) {
case 'debug[3]': // minRPS
Expand Down Expand Up @@ -1128,6 +1169,51 @@ function FlightLogFieldPresenter() {
default:
return value.toFixed(0) + 'us';
}
case 'GPS_RESCUE_THROTTLE_PID':
switch (fieldName) {
case 'debug[0]': // Throttle P added uS
case 'debug[1]': // Throttle D added * uS
return value.toFixed(0) + 'uS';
case 'debug[2]': // current altitude in m
case 'debug[3]': // TARGET altitude in m
return (value / 100).toFixed(1) + 'm';
default:
return value.toFixed(0);
}
case 'GPS_RESCUE_VELOCITY':
switch (fieldName) {
case 'debug[0]': // Pitch P degrees * 100
case 'debug[1]': // Pitch D degrees * 100
return (value / 100).toFixed(1) + 'deg';
case 'debug[2]': // velocity to home cm/s
case 'debug[3]': // velocity target cm/s
return (value / 100).toFixed(1) + 'm/s';
default:
return value.toFixed(0);
}
case 'GPS_RESCUE_HEADING':
switch (fieldName) {
case 'debug[0]': // Rescue yaw rate deg/s * 10 up to +/- 90
return (value / 10).toFixed(1) + 'deg/s';
case 'debug[1]': // Rescue roll deg * 100 up to +/- 20 deg
return (value / 100).toFixed(1) + 'deg';
case 'debug[2]': // Attitude in degrees * 10
case 'debug[3]': // Angle to home in degrees * 10
return (value / 10).toFixed(1) + 'deg';
default:
return value.toFixed(0);
}
case 'GPS_RESCUE_TRACKING':
switch (fieldName) {
case 'debug[0]': // velocity to home cm/s
case 'debug[1]': // velocity target cm/s
return (value / 100).toFixed(1) + 'm/s';
case 'debug[2]': // altitude cm
case 'debug[3]': // altitude target cm
return (value / 100).toFixed(1) + 'm';
default:
return value.toFixed(0);
}
}
return value.toFixed(0);
}
Expand Down
171 changes: 171 additions & 0 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,171 @@ GraphConfig.load = function(config) {
default:
return getCurveForMinMaxFields(fieldName);
}
case 'GPS_RESCUE_THROTTLE_PID':
switch (fieldName) {
case 'debug[0]': // Throttle P uS added
case 'debug[1]': // Throttle D uS added
return {
offset: 0,
power: 1.0,
inputRange: 200,
outputRange: 1.0,
};
case 'debug[2]': // Altitude
case 'debug[3]': // Target Altitude
return {
offset: 0,
power: 1.0,
inputRange: 5000,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'GPS_RESCUE_VELOCITY':
switch (fieldName) {
case 'debug[0]': // Pitch P deg * 100
case 'debug[1]': // Pitch D deg * 100
return {
offset: 0,
power: 1.0,
inputRange: 2000,
outputRange: 1.0,
};
case 'debug[2]': // Velocity in cm/s
case 'debug[3]': // Velocity to home in cm/s
return {
offset: 0,
power: 1.0,
inputRange: 500,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'GPS_RESCUE_HEADING':
switch (fieldName) {
case 'debug[0]': // Rescue yaw rate deg/s * 10 up to +/- 90
return {
offset: 0,
power: 1.0,
inputRange: 1000,
outputRange: 1.0,
};
case 'debug[1]': // Rescue roll deg * 100 up to +/- 20 deg
return {
offset: 0,
power: 1.0,
inputRange: 10000,
outputRange: 1.0,
};
case 'debug[2]': // Yaw attitude * 10
case 'debug[3]': // Angle to home * 10
return {
offset: -1800,
power: 1.0,
inputRange: 1800,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'RTH':
switch (fieldName) {
case 'debug[0]': // Pitch angle, deg * 100
return {
offset: 0,
power: 1.0,
inputRange: 4000,
outputRange: 1.0,
};
case 'debug[1]': // Rescue Phase
case 'debug[2]': // Failure code
return {
offset: -10,
power: 1.0,
inputRange: 10,
outputRange: 1.0,
};
case 'debug[3]': // Failure counters coded
return {
offset: -2000,
power: 1.0,
inputRange: 2000,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'GPS_RESCUE_TRACKING':
switch (fieldName) {
case 'debug[0]': // velocity to home cm/s
case 'debug[1]': // target velocity cm/s
return {
offset: 0,
power: 1.0,
inputRange: 500,
outputRange: 1.0,
};
case 'debug[2]': // altitude m
case 'debug[3]': // Target altitude m
return {
offset: 0,
power: 1.0,
inputRange: 5000,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'ALTITUDE':
switch (fieldName) {
case 'debug[0]': // GPS Trust
return {
offset: 0,
power: 1.0,
inputRange: 200,
outputRange: 1.0,
};
case 'debug[1]': // Baro Alt
case 'debug[2]': // GPS Alt
return {
offset: 0,
power: 1.0,
inputRange: 5000,
outputRange: 1.0,
};
case 'debug[3]': // Vario
return {
offset: 0,
power: 1.0,
inputRange: 500,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
case 'BARO':
switch (fieldName) {
case 'debug[0]': // Baro state 0-10
return {
offset: 0,
power: 1.0,
inputRange: 20,
outputRange: 1.0,
};
case 'debug[1]': // Baro Temp
case 'debug[2]': // Baro Raw
case 'debug[3]': // Baro smoothed
return {
offset: 0,
power: 1.0,
inputRange: 2000,
outputRange: 1.0,
};
default:
return getCurveForMinMaxFields(fieldName);
}
}
}
// if not found above then
Expand Down Expand Up @@ -789,6 +954,12 @@ GraphConfig.load = function(config) {
if (!flightLog.isFieldDisabled().ACC) {
EXAMPLE_GRAPHS.push({label: "Accelerometers",fields: ["accSmooth[all]"]});
}
if (!flightLog.isFieldDisabled().HEADING) {
EXAMPLE_GRAPHS.push({label: "Heading",fields: ["heading[all]"]});
}
if (!flightLog.isFieldDisabled().MAGNETOMETER) {
EXAMPLE_GRAPHS.push({label: "Compass",fields: ["magADC[all]"]});
}
if (!flightLog.isFieldDisabled().DEBUG) {
EXAMPLE_GRAPHS.push({label: "Debug",fields: ["debug[all]"]});
}
Expand Down

0 comments on commit b532dab

Please sign in to comment.