From 7c12405fb89d9f3f5b7254cf96625f87bd987d75 Mon Sep 17 00:00:00 2001 From: Hans Christian Olaussen <41271048+klutvott123@users.noreply.github.com> Date: Sat, 6 Nov 2021 20:04:40 +0100 Subject: [PATCH] Fix crsf msp over telemetry --- src/main/telemetry/crsf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/telemetry/crsf.c b/src/main/telemetry/crsf.c index 3d5ad4b61..ffd1c0d06 100644 --- a/src/main/telemetry/crsf.c +++ b/src/main/telemetry/crsf.c @@ -140,7 +140,11 @@ bool bufferCrsfMspFrame(uint8_t *frameStart, int frameLength) bool handleCrsfMspFrameBuffer(uint8_t payloadSize, mspResponseFnPtr responseFn) { - bool requestHandled = false; + static bool replyPending = false; + if (replyPending) { + replyPending = sendMspReply(payloadSize, responseFn); + return replyPending; + } if (!mspRxBuffer.len) { return false; } @@ -148,17 +152,17 @@ bool handleCrsfMspFrameBuffer(uint8_t payloadSize, mspResponseFnPtr responseFn) while (true) { const int mspFrameLength = mspRxBuffer.bytes[pos]; if (handleMspFrame(&mspRxBuffer.bytes[CRSF_MSP_LENGTH_OFFSET + pos], mspFrameLength, NULL)) { - requestHandled |= sendMspReply(payloadSize, responseFn); + replyPending |= sendMspReply(payloadSize, responseFn); } pos += CRSF_MSP_LENGTH_OFFSET + mspFrameLength; ATOMIC_BLOCK(NVIC_PRIO_SERIALUART1) { if (pos >= mspRxBuffer.len) { mspRxBuffer.len = 0; - return requestHandled; + return replyPending; } } } - return requestHandled; + return replyPending; } #endif -- 2.11.4.GIT