From 75b42528acbc6b5f680a70be94d673088d62c8fa Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Fri, 27 Jan 2023 13:04:40 +0100 Subject: [PATCH] update github actions (#38) - update GitHub actions - update license 2023 - edit changelog.md - update readme.md - minor edits --- CHANGELOG.md | 33 +++++------ GY521.cpp | 2 +- GY521.h | 10 ++-- GY521_registers.h | 4 +- README.md | 58 ++++++++++++------- examples/GY521_angle/GY521_angle.ino | 16 ++--- .../GY521_readCalibration_2.ino | 12 ++-- examples/GY521_test_1/GY521_test_1.ino | 8 +-- examples/GY521_test_2/GY521_test_2.ino | 4 +- library.json | 2 +- library.properties | 2 +- test/unit_test_001.cpp | 3 +- 12 files changed, 81 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 033ae91..3dea7e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.3.8] - 2022-10-07 +## [0.3.9] - 2023-01-27 +- update GitHub actions +- update license 2023 +- edit changelog.md +- update readme.md +- minor edits + + +## [0.3.8] - 2022-10-07 - added CHANGELOG.md - fix #36 - limit values of pitch() roll() yaw() to 0..360 range. - rename three constants, move to .h. @@ -16,83 +24,68 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - updated documentation a bit. ## [0.3.7] - 2022-07-26 - - add partial reads readAccel(), readGyro() and readTemperature() - rename + add GY521_LIB_VERSION to examples. ## [0.3.6] - 2021-12-18 - - update library.json, license, minor edits ## [0.3.5] - 2021-10-20 - - update build-CI, badges - fix #28 add wakeup to begin(). ## [0.3.4] - 2021-07-12 - - fix #24 improve precision ## [0.3.3] - 2021-07-05 - - fix #22 improve maths ## [0.3.2] - 2021-07-05 - - fix #20 support multiWire ## [0.3.1] - 2021-06-13 - - added more unit test - some initialization ## [0.3.0] - 2021-04-07 - - fix #18 acceleration error correction (kudo's to Merkxic) -## [0.2.3] - 2021-01-26 +---- +## [0.2.3] - 2021-01-26 - align version numbers (oops) ## [0.2.2] - 2021-01-24 - - add interface part to readme.md - add GY521_registers.h ## [0.2.1] - 2020-12-24 - - add Arduino-CI build - add unit tests ## [0.2.0] - 2020-11-03 - - improve error handling -## [0.1.5] - 2020-09-29 +---- +## [0.1.5] - 2020-09-29 - fix #6 fix maths for Teensy ## [0.1.4] - 2020-09-29 - - fix #5 missing ; ## [0.1.3] - 2020-08-07 - - fix ESP support - add pitch roll yaw demo ## [0.1.2] - 2020-08-06 - - fix setAccelSensitivity - add getters ## [0.1.1] - 2020-07-09 - - refactor - initial release ## [0.1.0] - 2017-11-20 - - initial version - diff --git a/GY521.cpp b/GY521.cpp index 6d37c04..989deaf 100644 --- a/GY521.cpp +++ b/GY521.cpp @@ -1,7 +1,7 @@ // // FILE: GY521.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.3.8 +// VERSION: 0.3.9 // PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor // URL: https://github.com/RobTillaart/GY521 diff --git a/GY521.h b/GY521.h index 6dcf03d..6306228 100644 --- a/GY521.h +++ b/GY521.h @@ -2,7 +2,7 @@ // // FILE: GY521.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.8 +// VERSION: 0.3.9 // PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor // URL: https://github.com/RobTillaart/GY521 // @@ -12,12 +12,12 @@ #include "Wire.h" -#define GY521_LIB_VERSION (F("0.3.8")) +#define GY521_LIB_VERSION (F("0.3.9")) // THROTTLE TIMING #ifndef GY521_THROTTLE_TIME -#define GY521_THROTTLE_TIME 10 // milliseconds +#define GY521_THROTTLE_TIME 10 // milliseconds #endif @@ -38,7 +38,7 @@ class GY521 { public: - GY521(uint8_t address = 0x69, TwoWire *wire = &Wire); // 0x68 or 0x69 + GY521(uint8_t address = 0x69, TwoWire *wire = &Wire); // 0x68 or 0x69 #if defined (ESP8266) || defined(ESP32) @@ -140,4 +140,4 @@ class GY521 }; -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/GY521_registers.h b/GY521_registers.h index 81dc4e1..ae6a550 100644 --- a/GY521_registers.h +++ b/GY521_registers.h @@ -7,7 +7,7 @@ // -// keep names in sync with BIG MPU6050 lib +// keep names in sync with BIG MPU6050 lib #define GY521_XG_OFFS_TC 0x00 @@ -141,5 +141,5 @@ #define GY521_WHO_AM_I 0x75 -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/README.md b/README.md index 3986ee0..8358577 100644 --- a/README.md +++ b/README.md @@ -21,27 +21,29 @@ It needs to be tested a lot more. #### Examples -- calibration example to determine the offsets needed -- example to read values. -- test sketch to test get / set values. -- example to get pitch roll yaw. -- performance sketch. +- **GY521_angle** read angleX, angleY, angleZ. +- **GY521_performance** measure performance. +- **GY521_pitch_roll_yaw** to get pitch roll yaw. +- **GY521_readCalibration_1** read calibration values / errors for a flat sensor. +- **GY521_readCalibration_2** generate calibration code snippet. +- **GY521_test_1** test working of the sensor. +- **GY521_test_2** test set/get functions. ## Breakout board From left to right -| pin | pinName | description | -|:----:|:--------|:----------------| -| 0 | VCC | +5V | -| 1 | GND | ground | -| 2 | SCL | I2C clock | -| 3 | SDA | I2C data | -| 4 | XDA | auxiliary data | see datasheet -| 5 | XCL | auxiliary clock | see datasheet -| 6 | AD0 | address | -| 7 | INT | interrupt | +| pin | pinName | description | notes | +|:-----:|:---------:|:------------------|:-------:| +| 0 | VCC | +5V | +| 1 | GND | ground | +| 2 | SCL | I2C clock | +| 3 | SDA | I2C data | +| 4 | XDA | auxiliary data | see datasheet +| 5 | XCL | auxiliary clock | see datasheet +| 6 | AD0 | address | +| 7 | INT | interrupt | #### Address @@ -60,6 +62,9 @@ AD0 connected to VCC => 0x69 ## Interface +```cpp +#include "GY521.h" +``` ### Constructor @@ -80,7 +85,7 @@ AD0 connected to VCC => 0x69 - **uint16_t getThrottleTime()** returns throttle time set. -### READ +### Read #### Set before read @@ -104,7 +109,7 @@ returns status = GY521_OK on success. Since version 0.3.8 the **read()** and **readGyro()** function is updated to keep the range of **getPitch()**, **getRoll()** and **getYaw()** in the range 0..360 degrees. (Issue #36). -Problem is that with continuous roatation in a same direction internal variables will overflow and new +Problem is that with continuous rotation in a same direction internal variables will overflow and new movements (angles) will get lost as insignificant digits. @@ -147,13 +152,22 @@ See examples, use with care ## Future -**Should** -- test test and test ...(ESP too) +#### Must + - improve documentation -- look for maths optimizations (atan, hypot, performance) +#### Should + +- test test and test ...(ESP too) + +#### Could -**Could** -- calibrate function in the lib ? (think not as lib might grow?) - calibrate sketch could print code snippet to include... +#### Wont + +- look for maths optimizations (atan, hypot, performance) + - ==> hypot optimized. + - other ideas affect accuracy, so unless new ideas arise. +- calibrate function in the lib + - not as lib will grow too large. diff --git a/examples/GY521_angle/GY521_angle.ino b/examples/GY521_angle/GY521_angle.ino index cc49978..34b1daf 100644 --- a/examples/GY521_angle/GY521_angle.ino +++ b/examples/GY521_angle/GY521_angle.ino @@ -1,7 +1,7 @@ // // FILE: GY521_angle.ino // AUTHOR: Rob Tillaart -// PURPOSE: demo pitch roll yaw +// PURPOSE: read angleX, angleY, angleZ // DATE: 2022-06-06 @@ -29,13 +29,13 @@ void setup() Serial.println("\tCould not connect to GY521"); delay(1000); } - sensor.setAccelSensitivity(2); // 8g - sensor.setGyroSensitivity(1); // 500 degrees/s + sensor.setAccelSensitivity(2); // 8g + sensor.setGyroSensitivity(1); // 500 degrees/s sensor.setThrottle(); Serial.println("start..."); - // set calibration values from calibration sketch. + // set calibration values from calibration sketch. sensor.axe = 0.574; sensor.aye = -0.002; sensor.aze = -1.043; @@ -54,11 +54,11 @@ void loop() if (counter % 10 == 0) { - // Serial.println("\nCNT\tX\tY\tZ"); + // Serial.println("\nCNT\tX\tY\tZ"); } - //Serial.print(counter); - //Serial.print('\t'); + // Serial.print(counter); + // Serial.print('\t'); Serial.print(x, 1); Serial.print('\t'); Serial.print(y, 1); @@ -70,5 +70,5 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/examples/GY521_readCalibration_2/GY521_readCalibration_2.ino b/examples/GY521_readCalibration_2/GY521_readCalibration_2.ino index 54ec2de..ab6362e 100644 --- a/examples/GY521_readCalibration_2/GY521_readCalibration_2.ino +++ b/examples/GY521_readCalibration_2/GY521_readCalibration_2.ino @@ -30,12 +30,12 @@ void setup() { Serial.println("Could not connect to GY521"); } - // adjust when needed. - sensor.setAccelSensitivity(0); // 2g - sensor.setGyroSensitivity(0); // 250 degrees/s + // adjust when needed. + sensor.setAccelSensitivity(0); // 2g + sensor.setGyroSensitivity(0); // 250 degrees/s sensor.setThrottle(false); - // set all calibration errors to zero + // set all calibration errors to zero sensor.axe = 0; sensor.aye = 0; sensor.aze = 0; @@ -113,7 +113,7 @@ void loop() Serial.print(t * 0.01, 2); Serial.println(); } - // adjust calibration errors so table should get all zero's. + // adjust calibration errors so table should get all zero's. sensor.axe += ax * 0.01; sensor.aye += ay * 0.01; sensor.aze += az * 0.01; @@ -126,4 +126,4 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/examples/GY521_test_1/GY521_test_1.ino b/examples/GY521_test_1/GY521_test_1.ino index afc7954..7bfd68e 100644 --- a/examples/GY521_test_1/GY521_test_1.ino +++ b/examples/GY521_test_1/GY521_test_1.ino @@ -29,13 +29,13 @@ void setup() Serial.println("\tCould not connect to GY521"); delay(1000); } - sensor.setAccelSensitivity(0); // 2g - sensor.setGyroSensitivity(0); // 250 degrees/s + sensor.setAccelSensitivity(0); // 2g + sensor.setGyroSensitivity(0); // 250 degrees/s sensor.setThrottle(); Serial.println("start..."); - // set calibration values from calibration sketch. + // set calibration values from calibration sketch. sensor.axe = 0; sensor.aye = 0; sensor.aze = 0; @@ -84,5 +84,5 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/examples/GY521_test_2/GY521_test_2.ino b/examples/GY521_test_2/GY521_test_2.ino index c616ae6..52ceca9 100644 --- a/examples/GY521_test_2/GY521_test_2.ino +++ b/examples/GY521_test_2/GY521_test_2.ino @@ -66,7 +66,7 @@ void setup() Serial.println("\tThrot err:\tfalse"); } - for (uint16_t n = 0; n < 1000; n++) // 0 - 1 second. + for (uint16_t n = 0; n < 1000; n++) // 0 - 1 second. { sensor.setThrottleTime(n); if (sensor.getThrottleTime() != n) @@ -85,5 +85,5 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/library.json b/library.json index 6bf8dd6..a894b4e 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/GY521.git" }, - "version": "0.3.8", + "version": "0.3.9", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/library.properties b/library.properties index 9d73c1b..bc82993 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=GY521 -version=0.3.8 +version=0.3.9 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for GY521 angle measurement diff --git a/test/unit_test_001.cpp b/test/unit_test_001.cpp index 371a4a4..3a80402 100644 --- a/test/unit_test_001.cpp +++ b/test/unit_test_001.cpp @@ -155,4 +155,5 @@ unittest(test_initial_calibration_errors) unittest_main() -// -------- +// -- END OF FILE -- +