Skip to content

Commit

Permalink
add flight modes and new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tblaha committed Aug 17, 2024
1 parent 3e3b4f2 commit 5ec4874
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
10 changes: 10 additions & 0 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ let
'GPSRESCUE',
'VELOCITY',
'POSITION',
'CATAPULT',
'LEARNER',
'LEGACYPID',
'NNCTL',
'ANTIGRAVITY',
'HEADADJ',
'CAMSTAB',
Expand All @@ -128,6 +132,7 @@ let
'CAMERA3',
'FLIPOVERAFTERCRASH',
'PREARM',
'THROWTOARM',
'BEEPGPSCOUNT',
'VTXPITMODE',
'USER1',
Expand Down Expand Up @@ -574,6 +579,11 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
if (firmwareType !== FIRMWARE_TYPE_INDIFLIGHT) {
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('VELOCITY'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('POSITION'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('CATAPULT'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('LEARNER'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('LEGACYPID'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('NNCTL'), 1);
FLIGHT_LOG_FLIGHT_MODE_NAME.splice(FLIGHT_LOG_FLIGHT_MODE_NAME.indexOf('THROWTOARM'), 1);
}
FLIGHT_LOG_FLIGHT_MODE_NAME = makeReadOnly(FLIGHT_LOG_FLIGHT_MODE_NAME);

Expand Down
43 changes: 37 additions & 6 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,12 @@ function FlightLogFieldPresenter() {
case 'gyroUnfilt[0]':
case 'gyroUnfilt[1]':
case 'gyroUnfilt[2]':
case 'gyroSp[0]':
case 'gyroSp[1]':
case 'gyroSp[2]':
case 'gyroADCafterRpm[0]':
case 'gyroADCafterRpm[1]':
case 'gyroADCafterRpm[2]':
return flightLog.gyroRawToDegreesPerSecond(value / highResolutionScale).toFixed(highResolutionAddPrecision) + " °/s";

case 'gyroADCs[0]':
Expand Down Expand Up @@ -1346,7 +1352,10 @@ function FlightLogFieldPresenter() {
case 'accSmooth[0]':
case 'accSmooth[1]':
case 'accSmooth[2]':
return flightLog.accRawToGs(value).toFixed(2 + highResolutionAddPrecision) + " g";
case 'accADCafterRpm[0]':
case 'accADCafterRpm[1]':
case 'accADCafterRpm[2]':
return flightLog.accRawToGs(value * 9.80665).toFixed(2 + highResolutionAddPrecision) + " m/s/s";

case 'vbatLatest':
if ((flightLog.getSysConfig().firmwareType === FIRMWARE_TYPE_BETAFLIGHT || flightLog.getSysConfig().firmwareType === FIRMWARE_TYPE_INDIFLIGHT) && semver.gte(flightLog.getSysConfig().firmwareVersion, '4.0.0')) {
Expand Down Expand Up @@ -1470,11 +1479,6 @@ function FlightLogFieldPresenter() {
case 'spfSp[2]':
return `${(value/100).toFixed(2)} N/kg`;

case 'gyroSp[0]':
case 'gyroSp[1]':
case 'gyroSp[2]':
return `${(value).toFixed(0)} °/s`;

case 'omega[0]':
case 'omega[1]':
case 'omega[2]':
Expand Down Expand Up @@ -1504,6 +1508,9 @@ function FlightLogFieldPresenter() {
case 'posSp[0]':
case 'posSp[1]':
case 'posSp[2]':
case 'ekf_pos[0]':
case 'ekf_pos[1]':
case 'ekf_pos[2]':
return `${(value/1000).toFixed(3)} m`;

case 'vel[0]':
Expand All @@ -1515,13 +1522,37 @@ function FlightLogFieldPresenter() {
case 'velSp[0]':
case 'velSp[1]':
case 'velSp[2]':
case 'ekf_vel[0]':
case 'ekf_vel[1]':
case 'ekf_vel[2]':
return `${(value/100).toFixed(2)} m/s`;

case 'accSp[0]':
case 'accSp[1]':
case 'accSp[2]':
return `${(value/100).toFixed(2)} m/s/s`;

case 'ekf_att[0]':
case 'ekf_att[1]':
case 'ekf_att[2]':
case 'extAtt[0]':
case 'extAtt[1]':
case 'extAtt[2]':
return `${(value/1000 * 180 / 3.1415).toFixed(2)} °`;

case 'extTime':
return `${(value/1000).toFixed(3)} ms`;

case 'ekf_acc_b[0]':
case 'ekf_acc_b[1]':
case 'ekf_acc_b[2]':
return `${(value/1000).toFixed(3)} m/s/s`;

case 'ekf_gyro_b[0]':
case 'ekf_gyro_b[1]':
case 'ekf_gyro_b[2]':
return `${(value).toFixed(3)} °/s`;

default:
return `${(value)} raw units`;
}
Expand Down

0 comments on commit 5ec4874

Please sign in to comment.