Skip to content

Commit c894723

Browse files
authored
Develop (#19)
* fix #18 - accelerator error correction
1 parent f98ea2d commit c894723

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

GY521.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: GY521.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.2.3
4+
// VERSION: 0.3.0
55
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
66
// URL: https://github.com/RobTillaart/GY521
77
//
@@ -17,7 +17,7 @@
1717
// 0.2.2 2021-01-24 add interface part to readme.md
1818
// add GY521_registers.h
1919
// 0.2.3 2021-01-26 align version numbers (oops)
20-
//
20+
// 0.3.0 2021-04-07 fix #18 acceleration error correction (kudo's to Merkxic)
2121

2222

2323
#include "GY521.h"
@@ -107,16 +107,16 @@ int16_t GY521::read()
107107
_ay *= _raw2g;
108108
_az *= _raw2g;
109109

110+
// Error correct raw acceleration (in g) measurements // #18 kudos to Merkxic
111+
_ax += axe;
112+
_ay += aye;
113+
_az += aze;
114+
110115
// prepare for Pitch Roll Yaw
111116
_aax = atan(_ay / hypot(_ax, _az)) * RAD2DEGREES;
112117
_aay = atan(-1.0 * _ax / hypot(_ay, _az)) * RAD2DEGREES;
113118
_aaz = atan(_az / hypot(_ax, _ay)) * RAD2DEGREES;
114119

115-
// Error correct the angles
116-
_aax += axe;
117-
_aay += aye;
118-
_aaz += aze;
119-
120120
// Convert to Celsius
121121
_temperature = _temperature * 0.00294117647 + 36.53; // == /340.0 + 36.53;
122122

GY521.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: GY521.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.2.3
5+
// VERSION: 0.3.0
66
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
77
// URL: https://github.com/RobTillaart/GY521
88
//
@@ -15,7 +15,7 @@
1515
#include "Wire.h"
1616

1717

18-
#define GY521_LIB_VERSION (F("0.2.3"))
18+
#define GY521_LIB_VERSION (F("0.3.0"))
1919

2020

2121
#ifndef GY521_THROTTLE_TIME

GY521_registers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: GY521_registers.h
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.2.3
4+
// VERSION: 0.3.0
55
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
66
// URL: https://github.com/RobTillaart/GY521
77
//

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/GY521.git"
1717
},
18-
"version":"0.2.3",
18+
"version":"0.3.0",
1919
"frameworks": "arduino",
2020
"platforms": "*"
2121
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=GY521
2-
version=0.2.3
2+
version=0.3.0
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino library for GY521 angle measurement

0 commit comments

Comments
 (0)