diff --git a/src/main.cpp b/src/main.cpp index 21f15b1..f57de7f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,7 +57,6 @@ bool blinking = false; unsigned long blinkStart = 0; unsigned long now_ms, last_ms = 0; //millis() timers unsigned long last_battery_sample = 0; -unsigned long const start = millis(); bool secondImuActive = false; void setConfig(DeviceConfig newConfig) diff --git a/src/mpu6050sensor.cpp b/src/mpu6050sensor.cpp index 1919dd7..6568b0a 100644 --- a/src/mpu6050sensor.cpp +++ b/src/mpu6050sensor.cpp @@ -37,6 +37,8 @@ namespace { } } +bool hasNewData = false; + void gatherCalibrationData(MPU9250 &imu); void MPU6050Sensor::motionSetup(DeviceConfig * config) { @@ -122,11 +124,15 @@ void MPU6050Sensor::motionLoop() { q[3] = rawQuat.w; quaternion.set(-q[1], q[0], q[2], q[3]); quaternion *= sensorOffset; + hasNewData = true; } } void MPU6050Sensor::sendData() { - sendQuat(&quaternion, PACKET_ROTATION); + if(hasNewData) { + sendQuat(&quaternion, PACKET_ROTATION); + hasNewData = false; + } } void MPU6050Sensor::startCalibration(int calibrationType) {