Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
HighBlueParsers
Commits
9601e043
Commit
9601e043
authored
7 months ago
by
Philémon Prévot
Browse files
Options
Downloads
Patches
Plain Diff
Get rid of checksum (there are none on Device Mode samples)
parent
fc8b92c3
No related branches found
No related tags found
1 merge request
!2
HighBlueParser dev branch merged to empty main branch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/filewriter.cpp
+10
-45
10 additions, 45 deletions
src/filewriter.cpp
src/filewriter.h
+1
-1
1 addition, 1 deletion
src/filewriter.h
with
11 additions
and
46 deletions
src/filewriter.cpp
+
10
−
45
View file @
9601e043
...
...
@@ -150,21 +150,6 @@ float IMUFileWriter::GetFloatSafe(const unsigned char *p, int index) {
return
result
;
}
unsigned
char
IMUFileWriter
::
CalculateChecksum
(
int
msgFunction
,
int
msgPayloadLength
,
const
unsigned
char
msgPayload
[])
{
unsigned
char
checksum
=
0
;
checksum
^=
static_cast
<
unsigned
char
>
(
0xFE
);
checksum
^=
static_cast
<
unsigned
char
>
(
msgFunction
>>
8
);
checksum
^=
static_cast
<
unsigned
char
>
(
msgFunction
>>
0
);
checksum
^=
static_cast
<
unsigned
char
>
(
msgPayloadLength
>>
8
);
checksum
^=
static_cast
<
unsigned
char
>
(
msgPayloadLength
>>
0
);
for
(
int
i
=
0
;
i
<
msgPayloadLength
;
i
++
)
{
checksum
^=
msgPayload
[
i
];
}
return
checksum
;
}
void
IMUFileWriter
::
DecodeMessage
(
unsigned
char
c
)
{
switch
(
rcvState
)
{
case
StateReception
::
Waiting
:
...
...
@@ -198,7 +183,7 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
rcvState
=
StateReception
::
Waiting
;
}
}
else
rcvState
=
StateReception
::
CheckSum
;
rcvState
=
StateReception
::
Decode
;
break
;
case
StateReception
::
Payload
:
if
(
msgDecodedPayloadIndex
>
msgDecodedPayloadLength
)
...
...
@@ -210,21 +195,15 @@ void IMUFileWriter::DecodeMessage(unsigned char c) {
msgDecodedPayload
[
msgDecodedPayloadIndex
++
]
=
c
;
if
(
msgDecodedPayloadIndex
>=
msgDecodedPayloadLength
)
{
rcvState
=
StateReception
::
CheckSum
;
rcvState
=
StateReception
::
Decode
;
msgDecodedPayloadIndex
=
0
;
}
break
;
case
StateReception
::
CheckSum
:
case
StateReception
::
Decode
:
{
unsigned
char
calculatedChecksum
=
CalculateChecksum
(
msgDecodedFunction
,
msgDecodedPayloadLength
,
msgDecodedPayload
);
unsigned
char
receivedChecksum
=
c
;
if
(
calculatedChecksum
==
receivedChecksum
)
{
//Lance l'event de fin de decodage
ProcessDecodedMessage
(
msgDecodedFunction
,
msgDecodedPayloadLength
,
msgDecodedPayload
);
msgDecoded
++
;
}
else
{
std
::
cerr
<<
"Checksum error"
<<
std
::
endl
;
}
//Lance l'event de fin de decodage
ProcessDecodedMessage
(
msgDecodedFunction
,
msgDecodedPayloadLength
,
msgDecodedPayload
);
msgDecoded
++
;
rcvState
=
StateReception
::
Waiting
;
}
break
;
...
...
@@ -477,27 +456,13 @@ 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
);
uint8_t
softwareMajorRev
=
sample
[
5
];
uint8_t
softwareMajorRev
=
sample
[
0
];
uint8_t
softwareMinorRev
=
sample
[
6
];
std
::
cerr
<<
"sMR"
<<
static_cast
<
int
>
(
sample
[
1
0
])
<<
std
::
endl
;
std
::
cerr
<<
"sMR"
<<
static_cast
<
int
>
(
sample
[
0
])
<<
std
::
endl
;
std
::
cerr
<<
"Size : "
<<
size
<<
std
::
endl
;
uint64_t
timeStamp100MHzCurrentPacket
=
0
;
if
(
true
)
{
//On recupere l'instant de fin du paquet courant
timeStamp100MHzCurrentPacket
=
BUILD_UINT64
(
sample
[
14
],
sample
[
13
],
sample
[
12
],
sample
[
11
],
sample
[
10
],
sample
[
9
],
sample
[
8
],
sample
[
7
]);
timeStamp100MHzCurrentPacket
*=
10
;
//To put the ts in ns
uint8_t
enteteSize
=
16
;
outfile
<<
"PACKET TIMESTAMP: "
<<
static_cast
<
int
>
(
timeStamp100MHzCurrentPacket
)
<<
std
::
endl
;
for
(
int
i
=
enteteSize
;
i
<
size
-
enteteSize
;
i
++
)
if
(
softwareMajorRev
>
2
)
{
for
(
int
i
=
1
;
i
<
size
-
enteteSize
;
i
++
)
{
DecodeMessage
(
sample
[
i
]);
}
...
...
This diff is collapsed.
Click to expand it.
src/filewriter.h
+
1
−
1
View file @
9601e043
...
...
@@ -203,7 +203,7 @@ private:
PayloadLengthMSB
,
PayloadLengthLSB
,
Payload
,
CheckSum
Decode
};
StateReception
rcvState
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment