Showing the changes to interface/src/SerialInterface.cpp (1 of 54 files). Show all
Unified · Split
| @@ -36,6 +36,28 @@ const int LONG_TERM_RATE_SAMPLES = 1000; · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | const bool USING_INVENSENSE_MPU9150 = 1; |
| 38 | 38 | |
| 39 | +SerialInterface::SerialInterface() : | |
| 40 | + _active(false), | |
| 41 | + _gravity(0, 0, 0), | |
| 42 | + _averageRotationRates(0, 0, 0), | |
| 43 | + _averageAcceleration(0, 0, 0), | |
| 44 | + _estimatedRotation(0, 0, 0), | |
| 45 | + _estimatedPosition(0, 0, 0), | |
| 46 | + _estimatedVelocity(0, 0, 0), | |
| 47 | + _lastAcceleration(0, 0, 0), | |
| 48 | + _lastRotationRates(0, 0, 0), | |
| 49 | + _compassMinima(-211, -132, -186), | |
| 50 | + _compassMaxima(89, 95, 98), | |
| 51 | + _angularVelocityToLinearAccel(0.003f, -0.001f, -0.006f, | |
| 52 | + -0.005f, -0.001f, -0.006f, | |
| 53 | + 0.010f, 0.004f, 0.007f), | |
| 54 | + _angularAccelToLinearAccel(0.0f, 0.0f, 0.002f, | |
| 55 | + 0.0f, 0.0f, 0.001f, | |
| 56 | + -0.002f, -0.002f, 0.0f) | |
| 57 | +{ | |
| 58 | + | |
| 59 | +} | |
| 60 | + | |
| 39 | 61 | void SerialInterface::pair() { |
| 40 | 62 | |
| 41 | 63 | #ifndef _WIN32 |
| @@ -75,10 +97,10 @@ void SerialInterface::initializePort(char* portname) { · 33 unmodified lines | ||
| 75 | 97 | #ifndef _WIN32 |
| 76 | 98 | _serialDescriptor = open(portname, O_RDWR | O_NOCTTY | O_NDELAY); |
| 77 | 99 | |
| 78 | − printLog("Opening SerialUSB %s: ", portname); | |
| 100 | + qDebug("Opening SerialUSB %s: ", portname); | |
| 79 | 101 | |
| 80 | 102 | if (_serialDescriptor == -1) { |
| 81 | − printLog("Failed.\n"); | |
| 103 | + qDebug("Failed.\n"); | |
| 82 | 104 | return; |
| 83 | 105 | } |
| 84 | 106 | |
| @@ -112,7 +134,7 @@ void SerialInterface::initializePort(char* portname) { · 27 unmodified lines | ||
| 112 | 134 | mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL | INV_XYZ_COMPASS); |
| 113 | 135 | } |
| 114 | 136 | |
| 115 | − printLog("Connected.\n"); | |
| 137 | + qDebug("Connected.\n"); | |
| 116 | 138 | resetSerial(); |
| 117 | 139 | |
| 118 | 140 | _active = true; |
| @@ -351,7 +373,7 @@ void SerialInterface::readData(float deltaTime) { · 232 unmodified lines | ||
| 351 | 373 | gettimeofday(&now, NULL); |
| 352 | 374 | |
| 353 | 375 | if (diffclock(&lastGoodRead, &now) > NO_READ_MAXIMUM_MSECS) { |
| 354 | − printLog("No data - Shutting down SerialInterface.\n"); | |
| 376 | + qDebug("No data - Shutting down SerialInterface.\n"); | |
| 355 | 377 | resetSerial(); |
| 356 | 378 | } |
| 357 | 379 | } else { |