From 0839392a114d184d9aaa976c40827a1efa377352 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Phil=C3=A9mon=20Pr=C3=A9vot?= <philemon.prevot@gmail.com>
Date: Wed, 11 Dec 2024 13:27:16 +0100
Subject: [PATCH] Create timestamp_dev branch

---
 src/filewriter.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/filewriter.cpp b/src/filewriter.cpp
index 01009d0..8fba290 100644
--- a/src/filewriter.cpp
+++ b/src/filewriter.cpp
@@ -153,22 +153,27 @@ float IMUFileWriter::GetFloatSafe(const unsigned char *p, int index) {
 void IMUFileWriter::DecodeMessage(unsigned char c) {
     switch (rcvState) {
         case StateReception::Waiting:
+            std::cout << "Waiting : " << c; 
             if (c == 0xFE)
                 rcvState = StateReception::FunctionMSB;
             break;
         case StateReception::FunctionMSB:
+            std::cout << "CMD_MSB : " << c;
             msgDecodedFunction = static_cast<int16_t>(c << 8);
             rcvState = StateReception::FunctionLSB;
             break;
         case StateReception::FunctionLSB:
+            std::cout << "CMD_LSB : " << c;
             msgDecodedFunction += static_cast<int16_t>(c << 0);
             rcvState = StateReception::PayloadLengthMSB;
             break;
         case StateReception::PayloadLengthMSB:
+            std::cout << "PLD_MSB : " << c;
             msgDecodedPayloadLength = static_cast<uint16_t>(c << 8);
             rcvState = StateReception::PayloadLengthLSB;
             break;
         case StateReception::PayloadLengthLSB:
+            std::cout << "PLD_LSB : " << c;
             msgDecodedPayloadLength += static_cast<uint16_t>(c << 0);
             if (msgDecodedPayloadLength > 0) {
                 if (msgDecodedPayloadLength < 1024) {
@@ -185,6 +190,7 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
                 rcvState = StateReception::Decode;
             break;
         case StateReception::Payload:
+            std::cout << "PLD : " << c;
             if (msgDecodedPayloadIndex > msgDecodedPayloadLength)
             {
                 //Erreur
@@ -200,6 +206,7 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
             break;
         case StateReception::Decode:
         {
+            std::cout << "DCD : " << c;
             //Lance l'event de fin de decodage
             ProcessDecodedMessage(msgDecodedFunction, msgDecodedPayloadLength, msgDecodedPayload);
             msgDecoded++;
@@ -448,8 +455,6 @@ void IMUFileWriter::ProcessDecodedMessage(int msgFunction, int msgPayloadLength,
 }
 
 void IMUFileWriter::write(uint8_t *sample, size_t size, uint8_t *imu_data) {
-    uint8_t *imu_data_cur(imu_data);
-
     if(this->qhb_version == 3) {
         for(int i=1; i<size-1; i++)
         {
-- 
GitLab