Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 3c0b9ea

Browse files
committed
Support Betaflight's gyro_scale field
1 parent aa48d98 commit 3c0b9ea

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static void parseHeaderLine(flightLog_t *log, mmapStream_t *stream)
454454

455455
log->sysConfig.currentMeterOffset = currentMeterParams[0];
456456
log->sysConfig.currentMeterScale = currentMeterParams[1];
457-
} else if (strcmp(fieldName, "gyro.scale") == 0) {
457+
} else if (strcmp(fieldName, "gyro.scale") == 0 || strcmp(fieldName, "gyro_scale") == 0) {
458458
floatConvert.u = strtoul(fieldValue, 0, 16);
459459

460460
log->sysConfig.gyroScale = floatConvert.f;
@@ -463,7 +463,7 @@ static void parseHeaderLine(flightLog_t *log, mmapStream_t *stream)
463463
* per second and leaves the conversion to radians per us to the IMU. Let's just convert Cleanflight's scale to
464464
* match Baseflight so we can use Baseflight's IMU for both: */
465465

466-
if (log->sysConfig.firmwareType == FIRMWARE_TYPE_CLEANFLIGHT) {
466+
if (log->sysConfig.firmwareType != FIRMWARE_TYPE_BASEFLIGHT) {
467467
log->sysConfig.gyroScale = (float) (log->sysConfig.gyroScale * (M_PI / 180.0) * 0.000001);
468468
}
469469
} else if (strcmp(fieldName, "acc_1G") == 0) {

src/parser.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
typedef enum FirmwareType {
2121
FIRMWARE_TYPE_UNKNOWN = 0,
2222
FIRMWARE_TYPE_BASEFLIGHT,
23-
FIRMWARE_TYPE_CLEANFLIGHT
23+
FIRMWARE_TYPE_CLEANFLIGHT,
24+
FIRMWARE_TYPE_BETAFLIGHT
2425
} FirmwareType;
2526

2627
typedef struct flightLogFrameStatistics_t {

0 commit comments

Comments
 (0)