1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-1473 Fix EOF handling for R7008SB

This commit is contained in:
Karl Knutsson 2014-09-04 18:15:36 +02:00
parent e9799e6c2e
commit ec0d44e1b0
2 changed files with 2 additions and 3 deletions

View File

@ -250,7 +250,7 @@ static void PIOS_SBus_UpdateState(struct pios_sbus_state *state, uint8_t b)
state->received_data[state->byte_count - 1] = b;
state->byte_count++;
} else {
if (b == SBUS_EOF_BYTE || (b % SBUS_R7008SB_EOF_COUNTER_MASK) == SBUS_R7008SB_EOF_BYTE) {
if (b == SBUS_EOF_BYTE || (b & SBUS_R7008SB_EOF_COUNTER_MASK) == 0) {
/* full frame received */
uint8_t flags = state->received_data[SBUS_FRAME_LENGTH - 3];
if (flags & SBUS_FLAG_FL) {

View File

@ -66,8 +66,7 @@
#define SBUS_FLAG_FL 0x04
#define SBUS_FLAG_FS 0x08
#define SBUS_R7008SB_EOF_COUNTER_MASK 0xCF
#define SBUS_R7008SB_EOF_BYTE 0x04
#define SBUS_R7008SB_EOF_COUNTER_MASK 0xCB
/*
* S.Bus protocol provides 16 proportional and 2 discrete channels.