Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
85e81a84
Commit
85e81a84
authored
Aug 27, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Had to give up on bitfields
parent
f12a2f74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
QGCUASFileManager.cc
src/uas/QGCUASFileManager.cc
+4
-1
QGCUASFileManager.h
src/uas/QGCUASFileManager.h
+9
-8
No files found.
src/uas/QGCUASFileManager.cc
View file @
85e81a84
...
...
@@ -80,7 +80,7 @@ QGCUASFileManager::QGCUASFileManager(QObject* parent, UASInterface* uas, uint8_t
_systemIdServer
=
_mav
->
getUASID
();
// Make sure we don't have bad structure packing
Q_ASSERT
(
sizeof
(
RequestHeader
)
==
1
2
);
Q_ASSERT
(
sizeof
(
RequestHeader
)
==
1
6
);
}
/// @brief Calculates a 32 bit CRC for the specified request.
...
...
@@ -95,6 +95,9 @@ quint32 QGCUASFileManager::crc32(Request* request, unsigned state)
// Always calculate CRC with 0 initial CRC value
quint32
crcSave
=
request
->
hdr
.
crc32
;
request
->
hdr
.
crc32
=
0
;
request
->
hdr
.
padding
[
0
]
=
0
;
request
->
hdr
.
padding
[
1
]
=
0
;
request
->
hdr
.
padding
[
2
]
=
0
;
for
(
size_t
i
=
0
;
i
<
cbData
;
i
++
)
state
=
crctab
[(
state
^
data
[
i
])
&
0xff
]
^
(
state
>>
8
);
...
...
src/uas/QGCUASFileManager.h
View file @
85e81a84
...
...
@@ -75,16 +75,17 @@ public slots:
protected:
/// @brief This is the fixed length portion of the protocol data. T
his structure is layed out such that it should not require
///
any special compiler packing to not consume extra space
.
/// @brief This is the fixed length portion of the protocol data. T
rying to pack structures across differing compilers is
///
questionable, so we pad the structure ourselves to 32 bit alignment which should get us what we want
.
struct
RequestHeader
{
uint16_t
seqNumber
;
///< sequence number for message
unsigned
int
session
:
4
;
///< Session id for read and write commands
unsigned
int
opcode
:
4
;
///< Command opcode
uint8_t
size
;
///< Size of data
uint32_t
crc32
;
///< CRC for entire Request structure, with crc32 set to 0
uint32_t
offset
;
///< Offsets for List and Read commands
uint16_t
seqNumber
;
///< sequence number for message
uint8_t
session
;
///< Session id for read and write commands
uint8_t
opcode
;
///< Command opcode
uint8_t
size
;
///< Size of data
uint8_t
padding
[
3
];
uint32_t
crc32
;
///< CRC for entire Request structure, with crc32 and padding set to 0
uint32_t
offset
;
///< Offsets for List and Read commands
};
struct
Request
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment