From f58eb0d976e9c44cc76e92a8ee92771d300d7e03 Mon Sep 17 00:00:00 2001 From: portersky <24420859+portersky@users.noreply.github.com> Date: Mon, 15 Jun 2026 00:16:50 +0200 Subject: [PATCH] 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. --- celrs/crsf.c | 2 +- celrs/crsf.h | 1 - tests/test_crsf.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/celrs/crsf.c b/celrs/crsf.c index b54adec..7dbe648 100644 --- a/celrs/crsf.c +++ b/celrs/crsf.c @@ -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 */ dst[0] = 0xC8; /* RC frame address */ dst[1] = length; - dst[2] = CEL_CRSF_TYPE_RC_CHANNELS_PACKED; + dst[2] = CEL_CRSF_TYPE_RC_CHANNELS; memcpy(dst + 3, packed, 22); uint8_t crc = cel_crsf_crc(dst + 2, 1 + 22); dst[2 + length - 1] = crc; diff --git a/celrs/crsf.h b/celrs/crsf.h index 6552279..e6708f1 100644 --- a/celrs/crsf.h +++ b/celrs/crsf.h @@ -18,7 +18,6 @@ /* CRSF frame types (ELRS) */ typedef enum { - CEL_CRSF_TYPE_RC_CHANNELS_PACKED = 0x01, CEL_CRSF_TYPE_GPS = 0x02, CEL_CRSF_TYPE_VARIO = 0x07, CEL_CRSF_TYPE_BATTERY = 0x08, diff --git a/tests/test_crsf.c b/tests/test_crsf.c index 3e7a5ae..70080c2 100644 --- a/tests/test_crsf.c +++ b/tests/test_crsf.c @@ -193,7 +193,7 @@ void test_build_rc_frame_roundtrip(void) { cel_crsf_frame frame; 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) {