diff --git a/src/filewriter.cpp b/src/filewriter.cpp index cf1912346c3cfa1bfa442c31de2b54e280342bf1..561b777e496c30b97e4b681c74c82407081bd161 100644 --- a/src/filewriter.cpp +++ b/src/filewriter.cpp @@ -166,7 +166,6 @@ void IMUFileWriter::DecodeMessage(unsigned char c) { break; case StateReception::PayloadLengthMSB: msgDecodedPayloadLength = static_cast<uint16_t>(c << 8); - std::cerr << "Message function : " << std::hex << static_cast<uint16_t>(msgDecodedFunction) << std::endl; rcvState = StateReception::PayloadLengthLSB; break; case StateReception::PayloadLengthLSB: @@ -211,9 +210,6 @@ void IMUFileWriter::DecodeMessage(unsigned char c) { rcvState = StateReception::Waiting; break; } - if(rcvState != StateReception::Waiting) { - std::cerr << "State : " << static_cast<int>(rcvState) << std::endl; - } } void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength, const unsigned char* msgPayload) { @@ -298,7 +294,7 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength, lastAccelTimeStamp = 0; if (timeStamp > lastAccelTimeStamp) { lastAccelTimeStamp = timeStamp; - outfile << "ACCEL, " << timeStamp / 1000.0; + outfile << "ACCEL, " << timeStamp; outfile << ", " << BUILD_INT16(msgPayload[17 + i * lengthPerSample],msgPayload[17 + i * lengthPerSample+1]) * ( rangeScale / dataMaxValue ); outfile << ", " << BUILD_INT16(msgPayload[17 + dataSize + i * lengthPerSample],msgPayload[17 +dataSize + i * lengthPerSample+1]) * ( rangeScale / dataMaxValue ); outfile << ", " << BUILD_INT16(msgPayload[17 + 2*dataSize + i * lengthPerSample],msgPayload[17 +2*dataSize + i * lengthPerSample+1]) * ( rangeScale / dataMaxValue ); @@ -361,7 +357,7 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength, outfile << std::endl; } else { - + //printf("TS Pressure Error\n"); } break; case IMUFileWriter::SensorType::Light: @@ -416,14 +412,14 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength, if (lastGPSDate.year != gpsDatas.dateOfFix.year || lastGPSDate.month != gpsDatas.dateOfFix.month ||lastGPSDate.day != gpsDatas.dateOfFix.day || lastGPSDate.hour!=gpsDatas.dateOfFix.hour || lastGPSDate.minute!=gpsDatas.dateOfFix.minute || lastGPSDate.second!=gpsDatas.dateOfFix.second) { lastGPSDate = gpsDatas.dateOfFix; - outfile << "GPS, " << gpsDatas.dateOfFix.year; - outfile << "/" << gpsDatas.dateOfFix.month; - outfile << "/" << gpsDatas.dateOfFix.day; - outfile << " " << gpsDatas.dateOfFix.hour; - outfile << ":" << gpsDatas.dateOfFix.minute; - outfile << ":" << gpsDatas.dateOfFix.second; + outfile << "GPS, " << static_cast<int>(gpsDatas.dateOfFix.year); + outfile << "/" << static_cast<int>(gpsDatas.dateOfFix.month); + outfile << "/" << static_cast<int>(gpsDatas.dateOfFix.day); + outfile << " " << static_cast<int>(gpsDatas.dateOfFix.hour); + outfile << ":" << static_cast<int>(gpsDatas.dateOfFix.minute); + outfile << ":" << static_cast<int>(gpsDatas.dateOfFix.second); outfile << " fix:" << gpsDatas.fix; - outfile << ", fixQual:" << gpsDatas.fixQuality; + outfile << ", fixQual:" << static_cast<int>(gpsDatas.fixQuality); outfile << ", Lat:" << gpsDatas.latitude; outfile << " " << gpsDatas.latitudeDirection; outfile << ", Lon:" << gpsDatas.longitude; @@ -431,7 +427,7 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength, outfile << ", speed:" << gpsDatas.speed; outfile << ", ang:" << gpsDatas.angle; outfile << ", alt:" << gpsDatas.altitude; - outfile << ", sat:" << gpsDatas.satellites; + outfile << ", sat:" << static_cast<int>(gpsDatas.satellites); outfile << std::endl; } } @@ -457,12 +453,10 @@ void IMUFileWriter::write(uint8_t *sample, size_t size, uint8_t *imu_data) { uint8_t *imu_data_cur(imu_data); uint8_t softwareMajorRev=imu_data[0]; - uint8_t softwareMinorRev=imu_data[6]; - std::cerr << "sMR" << static_cast<int>(imu_data[0]) << std::endl; - std::cerr << "Size : " << size << std::endl; + uint8_t softwareMinorRev=imu_data[1]; - if(softwareMajorRev > 2) { - for(int i=1; i<size-enteteSize; i++) + if(softwareMajorRev >= 2) { + for(int i=1; i<size-1; i++) { DecodeMessage(imu_data[i]); } diff --git a/src/filewriter.h b/src/filewriter.h index a702af1710067e06b73fadd10d83298ecc55cbb0..06554b90e1d06793e5be9911732fb939e7f89848 100644 --- a/src/filewriter.h +++ b/src/filewriter.h @@ -190,7 +190,7 @@ private: unsigned int lastGyroTimeStamp; unsigned int lastMagTimeStamp; unsigned int lastLightTimeStamp; - unsigned int lastPressureTimeStamp; + unsigned int lastPressureTimeStamp = 0; unsigned int lastTemperatureTimeStamp; unsigned int lastTimeStamp; DateTime lastGPSDate; diff --git a/src/recorder.cpp b/src/recorder.cpp index 9ee40804dc697f740b2cf0439049ddda7124a2e9..5e149c1d232670b4ac4c418b3281ef55c9dbfe4b 100644 --- a/src/recorder.cpp +++ b/src/recorder.cpp @@ -178,7 +178,6 @@ void JasonRecorder::get_samples(std::vector<std::uint8_t> &samples, std::vector< size_t start = this->additional_data_size + 6; imu_data.resize(0); imu_data.reserve(this->additional_data_size); - std::cerr << "softMajorRev : " << std::dec << &buffer[4] << std::endl; imu_data.insert(imu_data.begin(), &buffer[6], &buffer[start]); size_t num_samples = (received - start); num_samples = (num_samples / (num_channels * this->depth)) * num_channels * this->depth;