@@ -209,7 +209,7 @@ function FlightLog(logData) {
209
209
} else
210
210
return false ;
211
211
} ;
212
-
212
+
213
213
function buildFieldNames ( ) {
214
214
// Make an independent copy
215
215
fieldNames = parser . frameDefs . I . name . slice ( 0 ) ;
@@ -239,7 +239,7 @@ function FlightLog(logData) {
239
239
if ( ! that . isFieldDisabled ( ) . SETPOINT ) {
240
240
fieldNames . push ( "rcCommands[0]" , "rcCommands[1]" , "rcCommands[2]" , "rcCommands[3]" ) ; // Custom calculated scaled rccommand
241
241
}
242
- if ( ! ( that . isFieldDisabled ( ) . GYRO || that . isFieldDisabled ( ) . PID ) ) {
242
+ if ( ! that . isFieldDisabled ( ) . GYRO && ! that . isFieldDisabled ( ) . PID ) {
243
243
fieldNames . push ( "axisError[0]" , "axisError[1]" , "axisError[2]" ) ; // Custom calculated error field
244
244
}
245
245
@@ -385,8 +385,8 @@ function FlightLog(logData) {
385
385
destFrame ,
386
386
destFrame_currentIndex ;
387
387
388
- // The G frames need to be processed always. They are "invalid" if not H (Home) has been detected
389
- // before, but if not processed the viewer shows cuts and gaps. This happens if the quad takes off before
388
+ // The G frames need to be processed always. They are "invalid" if not H (Home) has been detected
389
+ // before, but if not processed the viewer shows cuts and gaps. This happens if the quad takes off before
390
390
// fixing enough satellites.
391
391
if ( frameValid || ( frameType == 'G' && frame ) ) {
392
392
switch ( frameType ) {
@@ -419,7 +419,7 @@ function FlightLog(logData) {
419
419
destFrame [ slowFrameIndex + destFrame_currentIndex ] = lastSlow [ slowFrameIndex ] === undefined ? null : lastSlow [ slowFrameIndex ] ;
420
420
}
421
421
destFrame_currentIndex += slowFrameLength ;
422
-
422
+
423
423
// Also merge last seen gps-frame data
424
424
for ( let gpsFrameIndex = 0 ; gpsFrameIndex < lastGPSLength ; gpsFrameIndex ++ ) {
425
425
destFrame [ gpsFrameIndex + destFrame_currentIndex ] = lastGPS [ gpsFrameIndex ] === undefined ? null : lastGPS [ gpsFrameIndex ] ;
@@ -617,7 +617,7 @@ function FlightLog(logData) {
617
617
destFrame = destChunk . frames [ i ] ,
618
618
fieldIndex = destFrame . length - ADDITIONAL_COMPUTED_FIELD_COUNT ;
619
619
620
- if ( gyroADC ) { //don't calculate attitude if no gyro data
620
+ if ( ! that . isFieldDisabled ( ) . GYRO ) { //don't calculate attitude if no gyro data
621
621
attitude = chunkIMU . updateEstimatedAttitude (
622
622
[ srcFrame [ gyroADC [ 0 ] ] , srcFrame [ gyroADC [ 1 ] ] , srcFrame [ gyroADC [ 2 ] ] ] ,
623
623
[ srcFrame [ accSmooth [ 0 ] ] , srcFrame [ accSmooth [ 1 ] ] , srcFrame [ accSmooth [ 2 ] ] ] ,
@@ -632,7 +632,7 @@ function FlightLog(logData) {
632
632
}
633
633
634
634
// Add the Feedforward PID sum (P+I+D+F)
635
- if ( axisPID ) {
635
+ if ( ! that . isFieldDisabled ( ) . GYRO && ! that . isFieldDisabled ( ) . PID ) {
636
636
for ( var axis = 0 ; axis < 3 ; axis ++ ) {
637
637
let pidSum =
638
638
( axisPID [ axis ] [ 0 ] !== undefined ? srcFrame [ axisPID [ axis ] [ 0 ] ] : 0 ) +
@@ -647,7 +647,7 @@ function FlightLog(logData) {
647
647
}
648
648
649
649
// Assign value
650
- destFrame [ fieldIndex ++ ] = pidSum ;
650
+ destFrame [ fieldIndex ++ ] = pidSum ;
651
651
}
652
652
}
653
653
@@ -657,29 +657,31 @@ function FlightLog(logData) {
657
657
// Calculate the Scaled rcCommand (setpoint) (in deg/s, % for throttle)
658
658
var fieldIndexRcCommands = fieldIndex ;
659
659
660
- // Since version 4.0 is not more a virtual field. Copy the real field to the virtual one to maintain the name, workspaces, etc.
661
- if ( sysConfig . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( sysConfig . firmwareVersion , '4.0.0' ) ) {
662
- // Roll, pitch and yaw
663
- for ( var axis = 0 ; axis <= AXIS . YAW ; axis ++ ) {
664
- destFrame [ fieldIndex ++ ] = srcFrame [ setpoint [ axis ] ] ;
665
- }
666
- // Throttle
667
- destFrame [ fieldIndex ++ ] = srcFrame [ setpoint [ AXIS . YAW + 1 ] ] / 10 ;
660
+ if ( ! that . isFieldDisabled ( ) . SETPOINT ) {
668
661
669
- // Versions earlier to 4.0 we must calculate the expected setpoint
670
- } else {
671
- // Roll, pitch and yaw
672
- for ( var axis = 0 ; axis <= AXIS . YAW ; axis ++ ) {
662
+ // Since version 4.0 is not more a virtual field. Copy the real field to the virtual one to maintain the name, workspaces, etc.
663
+ if ( sysConfig . firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver . gte ( sysConfig . firmwareVersion , '4.0.0' ) ) {
664
+ // Roll, pitch and yaw
665
+ for ( let axis = 0 ; axis <= AXIS . YAW ; axis ++ ) {
666
+ destFrame [ fieldIndex ++ ] = srcFrame [ setpoint [ axis ] ] ;
667
+ }
668
+ // Throttle
669
+ destFrame [ fieldIndex ++ ] = srcFrame [ setpoint [ AXIS . YAW + 1 ] ] / 10 ;
670
+
671
+ // Versions earlier to 4.0 we must calculate the expected setpoint
672
+ } else {
673
+ // Roll, pitch and yaw
674
+ for ( let axis = 0 ; axis <= AXIS . YAW ; axis ++ ) {
675
+ destFrame [ fieldIndex ++ ] = rcCommand [ axis ] !== undefined ? that . rcCommandRawToDegreesPerSecond ( srcFrame [ rcCommand [ axis ] ] , axis , currentFlightMode ) : 0 ;
676
+ }
677
+ // Throttle
673
678
destFrame [ fieldIndex ++ ] =
674
- ( rcCommand [ axis ] !== undefined ? that . rcCommandRawToDegreesPerSecond ( srcFrame [ rcCommand [ axis ] ] , axis , currentFlightMode ) : 0 ) ;
675
- }
676
- // Throttle
677
- destFrame [ fieldIndex ++ ] =
678
- ( rcCommand [ AXIS . YAW + 1 ] !== undefined ? that . rcCommandRawToThrottle ( srcFrame [ rcCommand [ AXIS . YAW + 1 ] ] ) : 0 ) ;
679
+ ( rcCommand [ AXIS . YAW + 1 ] !== undefined ? that . rcCommandRawToThrottle ( srcFrame [ rcCommand [ AXIS . YAW + 1 ] ] ) : 0 ) ;
680
+ }
679
681
}
680
682
681
683
// Calculate the PID Error
682
- if ( axisPID && gyroADC ) {
684
+ if ( ! that . isFieldDisabled ( ) . GYRO && ! that . isFieldDisabled ( ) . PID ) {
683
685
for ( var axis = 0 ; axis < 3 ; axis ++ ) {
684
686
let gyroADCdegrees = ( gyroADC [ axis ] !== undefined ? that . gyroRawToDegreesPerSecond ( srcFrame [ gyroADC [ axis ] ] ) : 0 ) ;
685
687
destFrame [ fieldIndex ++ ] = destFrame [ fieldIndexRcCommands + axis ] - gyroADCdegrees ;
@@ -1085,7 +1087,7 @@ FlightLog.prototype.rcCommandRawToDegreesPerSecond = function(value, axis, curre
1085
1087
}
1086
1088
1087
1089
var rcRate = sysConfig [ "rc_rates" ] [ axis ] / 100.0 ;
1088
- if ( rcRate > 2.0 ) {
1090
+ if ( rcRate > 2.0 ) {
1089
1091
rcRate += RC_RATE_INCREMENTAL * ( rcRate - 2.0 ) ;
1090
1092
}
1091
1093
0 commit comments