mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 18:49:08 +08:00
S.BUS parsing improvements
This commit is contained in:
parent
bff0f225b1
commit
7b73e8f9ee
@ -214,23 +214,23 @@ sbus_input(int sbus_fd, uint16_t *values, uint16_t *num_values, bool *sbus_fails
|
||||
|
||||
/* if the read failed for any reason, just give up here */
|
||||
if (ret < 1) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
last_rx_time = now;
|
||||
|
||||
/* if the first byte of the frame is not the start symbol, give up instantly */
|
||||
if (frame[0] != SBUS_START_SYMBOL) {
|
||||
sbus_frame_drops++;
|
||||
partial_frame_count = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add bytes to the current frame
|
||||
*/
|
||||
partial_frame_count += ret;
|
||||
|
||||
/* if the first byte of the frame is not the start symbol, give up instantly */
|
||||
if (partial_frame_count > 0 && (frame[0] != SBUS_START_SYMBOL)) {
|
||||
sbus_frame_drops++;
|
||||
partial_frame_count = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we don't have a full frame, return
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user