Showing the changes to interface/src/SerialInterface.cpp (1 of 43 files). Show all
Unified · Split
| @@ -167,14 +167,14 @@ void SerialInterface::readData() { · 166 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | int initialSamples = totalSamples; |
| 169 | 169 | |
| 170 | − while (read(serialFd, &bufchar, 1) > 0) { | |
| 171 | − //std::cout << bufchar[0]; | |
| 170 | + while (read(serialFd, &bufchar, 1) > 0) { | |
| 171 | + //printLof("%c", bufchar[0]); | |
| 172 | 172 | serialBuffer[serialBufferPos] = bufchar[0]; |
| 173 | 173 | serialBufferPos++; |
| 174 | 174 | // Have we reached end of a line of input? |
| 175 | 175 | if ((bufchar[0] == '\n') || (serialBufferPos >= MAX_BUFFER)) { |
| 176 | 176 | std::string serialLine(serialBuffer, serialBufferPos-1); |
| 177 | − //std::cout << serialLine << "\n"; | |
| 177 | + //printLog("%s\n", serialLine.c_str()); | |
| 178 | 178 | int spot; |
| 179 | 179 | //int channel = 0; |
| 180 | 180 | std::string val; |
| @@ -182,7 +182,7 @@ void SerialInterface::readData() { · 1 unmodified line | ||
| 182 | 182 | spot = serialLine.find_first_of(" ", 0); |
| 183 | 183 | if (spot != std::string::npos) { |
| 184 | 184 | val = serialLine.substr(0,spot); |
| 185 | − //std::cout << val << "\n"; | |
| 185 | + //printLog("%s\n", val.c_str()); | |
| 186 | 186 | if (i < NUM_CHANNELS) lastMeasured[i] = atoi(val.c_str()); |
| 187 | 187 | else samplesAveraged = atoi(val.c_str()); |
| 188 | 188 | } else LED = atoi(serialLine.c_str()); |
| @@ -208,8 +208,7 @@ void SerialInterface::readData() { · 19 unmodified lines | ||
| 208 | 208 | } |
| 209 | 209 | if (totalSamples == GRAVITY_SAMPLES) { |
| 210 | 210 | gravity = glm::normalize(gravity); |
| 211 | − std::cout << "gravity: " << gravity.x << "," << | |
| 212 | − gravity.y << "," << gravity.z << "\n"; | |
| 211 | + printLof("gravity: %f,%f,%f\n", gravity.x, gravity.y, gravity.z); | |
| 213 | 212 | } |
| 214 | 213 | |
| 215 | 214 | totalSamples++; |
| @@ -222,7 +221,7 @@ void SerialInterface::readData() { · 6 unmodified lines | ||
| 222 | 221 | gettimeofday(&now, NULL); |
| 223 | 222 | |
| 224 | 223 | if (diffclock(&lastGoodRead, &now) > NO_READ_MAXIMUM_MSECS) { |
| 225 | − std::cout << "No data - Shutting down SerialInterface.\n"; | |
| 224 | + printLog("No data - Shutting down SerialInterface.\n"); | |
| 226 | 225 | resetSerial(); |
| 227 | 226 | } |
| 228 | 227 | } else { |