Skip to content

Commit 9728f19

Browse files
committed
Handle renamed gyro scale header entry.
1 parent a4f2f63 commit 9728f19

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ <h2> 2.5.8 - Minor Bug Fixes and UI layout</h2>
5252
<li>UI Overhall; improved handling for smaller screens.</li>
5353
<li>Changelog added to Welcome screen</li>
5454
<li>Add DShot to header dialog</li>
55+
<li>Update to gyro scale for BF 3.1.0; logged data is now scaled in the flight controller.</li>
5556
</ul>
5657

5758
<h2> 2.5.7 - Minor Bug Fixes and Feature Improvements</h2>

js/flightlog_parser.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -536,16 +536,22 @@ var FlightLogParser = function(logData) {
536536
that.sysConfig.currentMeterScale = currentMeterParams[1];
537537
break;
538538
case "gyro.scale":
539-
that.sysConfig.gyroScale = hexToFloat(fieldValue);
540-
541-
/* Baseflight uses a gyroScale that'll give radians per microsecond as output, whereas Cleanflight produces degrees
542-
* per second and leaves the conversion to radians per us to the IMU. Let's just convert Cleanflight's scale to
543-
* match Baseflight so we can use Baseflight's IMU for both: */
544-
if (that.sysConfig.firmwareType == FIRMWARE_TYPE_INAV ||
545-
that.sysConfig.firmwareType == FIRMWARE_TYPE_CLEANFLIGHT ||
546-
that.sysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT) {
547-
that.sysConfig.gyroScale = that.sysConfig.gyroScale * (Math.PI / 180.0) * 0.000001;
548-
}
539+
case "gyro_scale":
540+
541+
if(semver.gte(that.sysConfig.firmwareVersion, '3.1.0') && that.sysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT) {
542+
that.sysConfig.gyroScale = 1.0; // logged gyro data is now scaled in the flight controller for betaflight
543+
} else {
544+
that.sysConfig.gyroScale = hexToFloat(fieldValue);
545+
}
546+
547+
/* Baseflight uses a gyroScale that'll give radians per microsecond as output, whereas Cleanflight produces degrees
548+
* per second and leaves the conversion to radians per us to the IMU. Let's just convert Cleanflight's scale to
549+
* match Baseflight so we can use Baseflight's IMU for both: */
550+
if (that.sysConfig.firmwareType == FIRMWARE_TYPE_INAV ||
551+
that.sysConfig.firmwareType == FIRMWARE_TYPE_CLEANFLIGHT ||
552+
that.sysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT) {
553+
that.sysConfig.gyroScale = that.sysConfig.gyroScale * (Math.PI / 180.0) * 0.000001;
554+
}
549555
break;
550556
case "Firmware revision":
551557

0 commit comments

Comments
 (0)