Skip to content

Commit f2b67b6

Browse files
committed
Only use the low bit of the extended channels packet for arm status
1 parent bbfa686 commit f2b67b6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/lib/CrsfProtocol/crsf_protocol.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ typedef struct crsf_channels_s
198198
unsigned ch15 : 11;
199199
} PACKED crsf_channels_t;
200200

201+
/**
202+
* Bits used in the byte following crsf_channels_t in the ExpressLRS extended CHANNELS_PACKED packet
203+
*/
204+
#define CRSF_CHANNELS_STATUS_FLAG_ARM (1 << 0)
205+
201206
typedef struct deviceInformationPacket_s
202207
{
203208
uint32_t serialNo;

src/lib/tx-crsf/TXModuleEndpoint.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ void TXModuleEndpoint::RcPacketToChannelsData(const crsf_header_t *message) // d
122122
// frame len 24 -> arming mode CH5: use channel 5 value
123123
// frame len 25 -> arming mode Switch: use commanded arming status in extra byte
124124
//
125-
armCmd = message->frame_size == 24 ? CRSF_to_BIT(localChannelData[4]) : payload[readByteIndex];
125+
armCmd = message->frame_size == CRSF_FRAME_SIZE(sizeof(crsf_channels_t))
126+
? CRSF_to_BIT(localChannelData[AUX1])
127+
: (payload[readByteIndex] & CRSF_CHANNELS_STATUS_FLAG_ARM);
126128

127129
// monitoring arming state
128130
if (lastArmCmd != armCmd)

0 commit comments

Comments
 (0)