Skip to content

Commit 0902401

Browse files
committed
SBUS decoding: Fix channel 18 return value
1 parent 87a6d36 commit 0902401

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/rc/sbus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,9 @@ sbus_decode(uint64_t frame_time, uint8_t *frame, uint16_t *values, uint16_t *num
606606
chancount = 18;
607607

608608
/* channel 17 (index 16) */
609-
values[16] = (frame[SBUS_FLAGS_BYTE] & (1 << 0)) * 1000 + 998;
609+
values[16] = (((frame[SBUS_FLAGS_BYTE] & (1 << 0)) > 0) ? 1 : 0) * 1000 + 998;
610610
/* channel 18 (index 17) */
611-
values[17] = (frame[SBUS_FLAGS_BYTE] & (1 << 1)) * 1000 + 998;
611+
values[17] = (((frame[SBUS_FLAGS_BYTE] & (1 << 1)) > 0) ? 1 : 0) * 1000 + 998;
612612
}
613613

614614
/* note the number of channels decoded */

0 commit comments

Comments
 (0)