fix: send RC channels with correct CRSF type
cel_crsf_build_rc_frame tagged RC channel frames with 0x01, which is not a valid CRSF frame type. The TX module's CRSF parser never recognized these as channel updates, so it had no RC data to forward over RF and the receiver could never report link quality. Use CEL_CRSF_TYPE_RC_CHANNELS (0x16), the spec-correct RC Channels Packed type. Drop the bogus 0x01 enum value.
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@ size_t cel_crsf_build_rc_frame(uint8_t* dst, int16_t const channels[16]) {
|
|||||||
uint8_t length = 1 + 22 + 1; /* type + payload + crc */
|
uint8_t length = 1 + 22 + 1; /* type + payload + crc */
|
||||||
dst[0] = 0xC8; /* RC frame address */
|
dst[0] = 0xC8; /* RC frame address */
|
||||||
dst[1] = length;
|
dst[1] = length;
|
||||||
dst[2] = CEL_CRSF_TYPE_RC_CHANNELS_PACKED;
|
dst[2] = CEL_CRSF_TYPE_RC_CHANNELS;
|
||||||
memcpy(dst + 3, packed, 22);
|
memcpy(dst + 3, packed, 22);
|
||||||
uint8_t crc = cel_crsf_crc(dst + 2, 1 + 22);
|
uint8_t crc = cel_crsf_crc(dst + 2, 1 + 22);
|
||||||
dst[2 + length - 1] = crc;
|
dst[2 + length - 1] = crc;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
/* CRSF frame types (ELRS) */
|
/* CRSF frame types (ELRS) */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CEL_CRSF_TYPE_RC_CHANNELS_PACKED = 0x01,
|
|
||||||
CEL_CRSF_TYPE_GPS = 0x02,
|
CEL_CRSF_TYPE_GPS = 0x02,
|
||||||
CEL_CRSF_TYPE_VARIO = 0x07,
|
CEL_CRSF_TYPE_VARIO = 0x07,
|
||||||
CEL_CRSF_TYPE_BATTERY = 0x08,
|
CEL_CRSF_TYPE_BATTERY = 0x08,
|
||||||
|
|||||||
+1
-1
@@ -193,7 +193,7 @@ void test_build_rc_frame_roundtrip(void) {
|
|||||||
|
|
||||||
cel_crsf_frame frame;
|
cel_crsf_frame frame;
|
||||||
TEST_ASSERT_EQUAL_INT(0, cel_crsf_frame_parse(&frame, dst, len));
|
TEST_ASSERT_EQUAL_INT(0, cel_crsf_frame_parse(&frame, dst, len));
|
||||||
TEST_ASSERT_EQUAL_UINT8(CEL_CRSF_TYPE_RC_CHANNELS_PACKED, frame.type);
|
TEST_ASSERT_EQUAL_UINT8(CEL_CRSF_TYPE_RC_CHANNELS, frame.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_build_ping_frame_null_dst(void) {
|
void test_build_ping_frame_null_dst(void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user