fixed bugs

eulerConversion
Martin 2022-03-04 16:14:59 +01:00
parent db434f18b7
commit 81410a9b68
1 changed files with 10 additions and 4 deletions

View File

@ -58,7 +58,7 @@ uint8_t devStatus; // return status after each device operation (0 = succes
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount; // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer
uint32_t time = 0;
unsigned long timeOn = 0;
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
@ -85,6 +85,7 @@ OSCMessage gmsg("/gyro/");
OSCMessage emsg("/error/");
OSCMessage kmsg("/keys/");
OSCMessage quaternionMessage("/quaternion/");
OSCMessage quaternionDiffMessage("/quaternionDiff/");
void setup() {
Wire.begin();
@ -250,12 +251,17 @@ void loop() {
#endif
// Send (accel) and time elapsed over serial
int prevTime = time;
time = millis();
int prevTime = timeOn;
timeOn = millis();
int elapsedTime = timeOn - prevTime;
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
AcX = aaReal.x;
msg.add(AcX);
msg.add(AcY);
msg.add(AcZ);
msg.add(time - prevTime);
msg.add(elapsedTime);
SLIPSerial.beginPacket();