Showing the changes to interface/src/SerialInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -170,12 +170,37 @@ void SerialInterface::renderLevels(int width, int height) { · 169 unmodified lines | ||
| 170 | 170 | disp_x += GAP; |
| 171 | 171 | } |
| 172 | 172 | } else { |
| 173 | + const int LEVEL_CORNER_X = 10; | |
| 174 | + const int LEVEL_CORNER_Y = 200; | |
| 175 | + | |
| 176 | + // Draw the text values | |
| 177 | + sprintf(val, "Yaw %d", _lastYaw); | |
| 178 | + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y, 0.10, 0, 1.0, 1, val, 0, 1, 0); | |
| 179 | + sprintf(val, "Pitch %d", _lastPitch); | |
| 180 | + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 15, 0.10, 0, 1.0, 1, val, 0, 1, 0); | |
| 181 | + sprintf(val, "Roll %d", _lastRoll); | |
| 182 | + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 30, 0.10, 0, 1.0, 1, val, 0, 1, 0); | |
| 183 | + | |
| 184 | + // Draw the levels as horizontal lines | |
| 185 | + const int LEVEL_CENTER = 150; | |
| 173 | 186 | glLineWidth(2.0); |
| 174 | 187 | glColor4f(1, 1, 1, 1); |
| 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); | |
| 188 | + glBegin(GL_LINES); | |
| 189 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y - 3); | |
| 190 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastYaw, LEVEL_CORNER_Y - 3); | |
| 191 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 12); | |
| 192 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastPitch, LEVEL_CORNER_Y + 12); | |
| 193 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 27); | |
| 194 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastRoll, LEVEL_CORNER_Y + 27); | |
| 195 | + glEnd(); | |
| 196 | + // Draw green vertical centerline | |
| 197 | + glColor4f(0, 1, 0, 0.5); | |
| 198 | + glBegin(GL_LINES); | |
| 199 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y - 6); | |
| 200 | + glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 30); | |
| 201 | + glEnd(); | |
| 202 | + | |
| 203 | + | |
| 179 | 204 | } |
| 180 | 205 | // Display Serial latency block |
| 181 | 206 | if (LED) { |