mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 05:53:35 +08:00
S.BUS parsing improvements
This commit is contained in:
+8
-8
@@ -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 the read failed for any reason, just give up here */
|
||||||
if (ret < 1) {
|
if (ret < 1) {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_rx_time = now;
|
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
|
* Add bytes to the current frame
|
||||||
*/
|
*/
|
||||||
partial_frame_count += ret;
|
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
|
* If we don't have a full frame, return
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user