Showing the changes to interface/src/SerialInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -142,31 +142,40 @@ void SerialInterface::renderLevels(int width, int height) { · 141 unmodified lines | |||
| 142 | int i; | 142 | int i; |
| 143 | int disp_x = 10; | 143 | int disp_x = 10; |
| 144 | const int GAP = 16; | 144 | const int GAP = 16; |
| 145 | char val[10]; | 145 | char val[40]; |
| 146 | for(i = 0; i < NUM_CHANNELS; i++) | 146 | if (!USING_INVENSENSE_MPU9150) { |
| 147 | { | 147 | for(i = 0; i < NUM_CHANNELS; i++) |
| 148 | 148 | { | |
| 149 | // Actual value | 149 | |
| 150 | // Actual value | ||
| 151 | glLineWidth(2.0); | ||
| 152 | glColor4f(1, 1, 1, 1); | ||
| 153 | glBegin(GL_LINES); | ||
| 154 | glVertex2f(disp_x, height*0.95); | ||
| 155 | glVertex2f(disp_x, height*(0.25 + 0.75f*getValue(i)/4096)); | ||
| 156 | glColor4f(1, 0, 0, 1); | ||
| 157 | glVertex2f(disp_x - 3, height*(0.25 + 0.75f*getValue(i)/4096)); | ||
| 158 | glVertex2f(disp_x, height*(0.25 + 0.75f*getValue(i)/4096)); | ||
| 159 | glEnd(); | ||
| 160 | // Trailing Average value | ||
| 161 | glBegin(GL_LINES); | ||
| 162 | glColor4f(1, 1, 1, 1); | ||
| 163 | glVertex2f(disp_x, height*(0.25 + 0.75f*getTrailingValue(i)/4096)); | ||
| 164 | glVertex2f(disp_x + 4, height*(0.25 + 0.75f*getTrailingValue(i)/4096)); | ||
| 165 | glEnd(); | ||
| 166 | |||
| 167 | sprintf(val, "%d", getValue(i)); | ||
| 168 | drawtext(disp_x-GAP/2, (height*0.95)+2, 0.08, 90, 1.0, 0, val, 0, 1, 0); | ||
| 169 | |||
| 170 | disp_x += GAP; | ||
| 171 | } | ||
| 172 | } else { | ||
| 150 | glLineWidth(2.0); | 173 | glLineWidth(2.0); |
| 151 | glColor4f(1, 1, 1, 1); | 174 | glColor4f(1, 1, 1, 1); |
| 152 | glBegin(GL_LINES); | 175 | //glBegin(GL_LINES); |
| 153 | glVertex2f(disp_x, height*0.95); | 176 | //glVertex2f(disp_x, height*0.95); |
| 154 | glVertex2f(disp_x, height*(0.25 + 0.75f*getValue(i)/4096)); | 177 | sprintf(val, "Yaw %d, Pitch %d, Roll %d", _lastYaw, _lastPitch, _lastRoll); |
| 155 | glColor4f(1, 0, 0, 1); | 178 | drawtext(10, 100, 0.10, 0, 1.0, 0, val, 0, 1, 0); |
| 156 | glVertex2f(disp_x - 3, height*(0.25 + 0.75f*getValue(i)/4096)); | ||
| 157 | glVertex2f(disp_x, height*(0.25 + 0.75f*getValue(i)/4096)); | ||
| 158 | glEnd(); | ||
| 159 | // Trailing Average value | ||
| 160 | glBegin(GL_LINES); | ||
| 161 | glColor4f(1, 1, 1, 1); | ||
| 162 | glVertex2f(disp_x, height*(0.25 + 0.75f*getTrailingValue(i)/4096)); | ||
| 163 | glVertex2f(disp_x + 4, height*(0.25 + 0.75f*getTrailingValue(i)/4096)); | ||
| 164 | glEnd(); | ||
| 165 | |||
| 166 | sprintf(val, "%d", getValue(i)); | ||
| 167 | drawtext(disp_x-GAP/2, (height*0.95)+2, 0.08, 90, 1.0, 0, val, 0, 1, 0); | ||
| 168 | |||
| 169 | disp_x += GAP; | ||
| 170 | } | 179 | } |
| 171 | // Display Serial latency block | 180 | // Display Serial latency block |
| 172 | if (LED) { | 181 | if (LED) { |
| @@ -198,7 +207,7 @@ void SerialInterface::readData() { · 25 unmodified lines | |||
| 198 | 207 | ||
| 199 | int initialSamples = totalSamples; | 208 | int initialSamples = totalSamples; |
| 200 | 209 | ||
| 201 | if (USING_INVENSENSE_MPU9150) { | 210 | if (USING_INVENSENSE_MPU9150) { |
| 202 | unsigned char gyroBuffer[20]; | 211 | unsigned char gyroBuffer[20]; |
| 203 | 212 | ||
| 204 | // ask the invensense for raw gyro data | 213 | // ask the invensense for raw gyro data |