Skip to content

Commit

Permalink
Merge branch 'Mitchlol-adjustable_delay_times'
Browse files Browse the repository at this point in the history
  • Loading branch information
tockn committed Mar 18, 2019
2 parents 32cfc21 + bbba6ba commit 6d7922f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/MPU6050_tockn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ void MPU6050::setGyroOffsets(float x, float y, float z){
gyroZoffset = z;
}

void MPU6050::calcGyroOffsets(bool console){
float x = 0, y = 0, z = 0;
int16_t rx, ry, rz;
void MPU6050::calcGyroOffsets(bool console, uint16_t delayBefore, uint16_t delayAfter){
float x = 0, y = 0, z = 0;
int16_t rx, ry, rz;

delay(1000);
if(console){
delay(delayBefore);
if(console){
Serial.println();
Serial.println("========================================");
Serial.println("Calculating gyro offsets");
Expand Down Expand Up @@ -89,8 +89,8 @@ void MPU6050::calcGyroOffsets(bool console){
Serial.print("Z : ");Serial.println(gyroZoffset);
Serial.println("Program will start after 3 seconds");
Serial.print("========================================");
delay(3000);
}
delay(delayAfter);
}
}

void MPU6050::update(){
Expand Down Expand Up @@ -137,4 +137,3 @@ void MPU6050::update(){
preInterval = millis();

}

2 changes: 1 addition & 1 deletion src/MPU6050_tockn.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MPU6050{
float getGyroY(){ return gyroY; };
float getGyroZ(){ return gyroZ; };

void calcGyroOffsets(bool console = false);
void calcGyroOffsets(bool console = false, uint16_t delayBefore = 1000, uint16_t delayAfter = 3000);

float getGyroXoffset(){ return gyroXoffset; };
float getGyroYoffset(){ return gyroYoffset; };
Expand Down

0 comments on commit 6d7922f

Please sign in to comment.