Skip to content
Snippets Groups Projects
Commit 0839392a authored by Philémon Prévot's avatar Philémon Prévot
Browse files

Create timestamp_dev branch

parent 3db22011
Branches
No related tags found
No related merge requests found
......@@ -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++)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment