From 8024ad8cfd1a60779daeeeb62753e9362b1aec37 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Wed, 3 Aug 2022 15:19:06 +0200 Subject: [PATCH] offsets --- library.properties | 2 +- src/MPU6050_jusax23.cpp | 22 ++++++++++++++++++++-- src/MPU6050_jusax23.h | 20 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/library.properties b/library.properties index a3fc9a9..7db2ad5 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=mpu6050 version=1.0.0 -author=tockn +author=jusax23 (tockn) maintainer=jusax23 sentence=Arduino library for easy communicating with the MPU6050. paragraph=It acces get accel, gyro, and angle data. diff --git a/src/MPU6050_jusax23.cpp b/src/MPU6050_jusax23.cpp index 3f6c7ad..292b2ec 100644 --- a/src/MPU6050_jusax23.cpp +++ b/src/MPU6050_jusax23.cpp @@ -81,6 +81,10 @@ void MPU6050::calcGyroOffsets(bool console, uint16_t delayBefore, uint16_t delay gyroYoffset = y / 3000; gyroZoffset = z / 3000; + gyroXoffsetGlide = gyroXoffset; + gyroYoffsetGlide = gyroYoffset; + gyroZoffsetGlide = gyroZoffset; + if(console){ Serial.println(); Serial.println("Done!"); @@ -113,8 +117,18 @@ void MPU6050::update(){ accY = ((float)rawAccY) / 16384.0; accZ = ((float)rawAccZ) / 16384.0; - /*accX -= 0.04f; - accZ -= 0.3f;*/ + if(accX>maxAccX) maxAccX = accX; + if(accXmaxAccY) maxAccY = accY; + if(accYmaxAccZ) maxAccZ = accZ; + if(accZ