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 | 142 | int i; |
| 143 | 143 | int disp_x = 10; |
| 144 | 144 | const int GAP = 16; |
| 145 | − char val[10]; | |
| 146 | − for(i = 0; i < NUM_CHANNELS; i++) | |
| 147 | − { | |
| 148 | − | |
| 149 | − // Actual value | |
| 145 | + char val[40]; | |
| 146 | + if (!USING_INVENSENSE_MPU9150) { | |
| 147 | + for(i = 0; i < NUM_CHANNELS; i++) | |
| 148 | + { | |
| 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 | 173 | glLineWidth(2.0); |
| 151 | 174 | glColor4f(1, 1, 1, 1); |
| 152 | − glBegin(GL_LINES); | |
| 153 | − glVertex2f(disp_x, height*0.95); | |
| 154 | − glVertex2f(disp_x, height*(0.25 + 0.75f*getValue(i)/4096)); | |
| 155 | − glColor4f(1, 0, 0, 1); | |
| 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; | |
| 175 | + //glBegin(GL_LINES); | |
| 176 | + //glVertex2f(disp_x, height*0.95); | |
| 177 | + sprintf(val, "Yaw %d, Pitch %d, Roll %d", _lastYaw, _lastPitch, _lastRoll); | |
| 178 | + drawtext(10, 100, 0.10, 0, 1.0, 0, val, 0, 1, 0); | |
| 170 | 179 | } |
| 171 | 180 | // Display Serial latency block |
| 172 | 181 | if (LED) { |
| @@ -198,7 +207,7 @@ void SerialInterface::readData() { · 25 unmodified lines | ||
| 198 | 207 | |
| 199 | 208 | int initialSamples = totalSamples; |
| 200 | 209 | |
| 201 | − if (USING_INVENSENSE_MPU9150) { | |
| 210 | + if (USING_INVENSENSE_MPU9150) { | |
| 202 | 211 | unsigned char gyroBuffer[20]; |
| 203 | 212 | |
| 204 | 213 | // ask the invensense for raw gyro data |