History

Tweaking level indicators for new Invensense

Philip Rosedale committed 13 years ago

Commit e85e4441 parent 2076dcc1 file · +33 −24Browse files

Showing the changes to interface/src/SerialInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/SerialInterface.cpp+33−24
@@ -142,31 +142,40 @@ void SerialInterface::renderLevels(int width, int height) { · 141 unmodified lines
142142 int i;
143143 int disp_x = 10;
144144 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 {
150173 glLineWidth(2.0);
151174 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);
170179 }
171180 // Display Serial latency block
172181 if (LED) {
@@ -198,7 +207,7 @@ void SerialInterface::readData() { · 25 unmodified lines
198207
199208 int initialSamples = totalSamples;
200209
201− if (USING_INVENSENSE_MPU9150) {
210+ if (USING_INVENSENSE_MPU9150) {
202211 unsigned char gyroBuffer[20];
203212
204213 // ask the invensense for raw gyro data