mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
ghst: use memcpy instead of for loop
PR review, ghost protocol, use memcpy instead of for loop Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
committed by
Lorenz Meier
co-authored by
Beat Küng
parent
64342f568d
commit
c0f7429f8c
+1
-3
@@ -203,9 +203,7 @@ static bool ghst_parse_buffer(uint16_t *values, int8_t *rssi, uint16_t *num_valu
|
|||||||
// discard most of the data, but keep the last 3 bytes (otherwise we could miss the frame start)
|
// discard most of the data, but keep the last 3 bytes (otherwise we could miss the frame start)
|
||||||
current_frame_position = 3;
|
current_frame_position = 3;
|
||||||
|
|
||||||
for (unsigned i = 0; i < current_frame_position; ++i) {
|
memcpy(ghst_frame_ptr, ghst_frame_ptr + sizeof(ghst_frame_t) - current_frame_position, current_frame_position);
|
||||||
ghst_frame_ptr[i] = ghst_frame_ptr[sizeof(ghst_frame_t) - current_frame_position + i];
|
|
||||||
}
|
|
||||||
|
|
||||||
GHST_VERBOSE("Discarding buffer");
|
GHST_VERBOSE("Discarding buffer");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user