Skip to content
Snippets Groups Projects
Commit 84a8cdc1 authored by Philemon Prevot's avatar Philemon Prevot
Browse files

Add debug lines

parent 946c424f
No related branches found
No related tags found
1 merge request!3Add packet timestamp file logging to QHBv3 parser and correct wrong mag data bytes reading
......@@ -15,3 +15,6 @@ find_library(LIBUSB_LIBRARY
PATH_SUFFIXES "lib" "lib32" "lib64")
add_subdirectory(src)
message(STATUS "LIBUSB_INCLUDE_DIR: ${LIBUSB_INCLUDE_DIR}")
message(STATUS "LIBUSB_LIBRARY: ${LIBUSB_LIBRARY}")
\ No newline at end of file
......@@ -158,21 +158,27 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
case StateReception::Waiting:
if (c == 0xFE)
rcvState = StateReception::FunctionMSB;
std::cout << "Batch start : ";
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::FunctionMSB:
msgDecodedFunction = static_cast<int16_t>(c << 8);
rcvState = StateReception::FunctionLSB;
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::FunctionLSB:
msgDecodedFunction += static_cast<int16_t>(c << 0);
rcvState = StateReception::PayloadLengthMSB;
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::PayloadLengthMSB:
msgDecodedPayloadLength = static_cast<uint16_t>(c << 8);
rcvState = StateReception::PayloadLengthLSB;
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::PayloadLengthLSB:
msgDecodedPayloadLength += static_cast<uint16_t>(c << 0);
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
std::cout << "PayloadLength : " << msgDecodedPayloadLength << "\n";
if (msgDecodedPayloadLength > 0) {
if (msgDecodedPayloadLength < 1024) {
......@@ -194,13 +200,16 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
case StateReception::SoftwareMajorRev:
softwareMajorRev = static_cast<u_int8_t>(c);
rcvState = StateReception::SoftwareMinorRev;
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::SoftwareMinorRev:
softwareMinorRev = static_cast<u_int8_t>(c);
rcvState = StateReception::TimestampB;
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
break;
case StateReception::TimestampB:
last_timestamp += static_cast<uint64_t>(c << 8 * (8 - timestampByteReceived));
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
timestampByteReceived += 1;
if (timestampByteReceived == 8)
{
......@@ -209,6 +218,7 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
}
break;
case StateReception::Payload:
std::cout << std::hex << std::setfill('0') << std::setw(2) << c << " ";
if (msgDecodedPayloadIndex > msgDecodedPayloadLength)
{
//Erreur
......@@ -475,7 +485,7 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength,
void IMUFileWriter::write(uint8_t *sample, size_t size, uint8_t *imu_data) {
if(this->qhb_version == 3) {
for(int i=1; i<size-1; i++)
for(int i=0; i<size-1; i++)
{
DecodeMessage(imu_data[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment