diff --git a/src/lib/LBT/LBT.cpp b/src/lib/LBT/LBT.cpp index 760d5d536b..3b650c2ece 100644 --- a/src/lib/LBT/LBT.cpp +++ b/src/lib/LBT/LBT.cpp @@ -112,6 +112,9 @@ void ICACHE_RAM_ATTR SetClearChannelAssessmentTime(void) SX12XX_Radio_Number_t ICACHE_RAM_ATTR ChannelIsClear(SX12XX_Radio_Number_t radioNumber) { + if (radioNumber == SX12XX_Radio_NONE) + return SX12XX_Radio_NONE; + LBTSuccessCalc.inc(); // Increment count for every channel check if (!LBTEnabled) @@ -161,7 +164,7 @@ SX12XX_Radio_Number_t ICACHE_RAM_ATTR ChannelIsClear(SX12XX_Radio_Number_t radio clearChannelsMask |= SX12XX_Radio_2; } } - + // Useful to debug if and how long the rssi wait is, and rssi threshold rssiCutOff // DBGLN("wait: %d, cutoff: %d, rssi: %d %d, %s", validRSSIdelayUs - elapsed, rssiCutOff, rssiInst1, rssiInst2, clearChannelsMask ? "clear" : "in use"); diff --git a/src/src/rx_main.cpp b/src/src/rx_main.cpp index d1b123e2b1..1ace16f3be 100644 --- a/src/src/rx_main.cpp +++ b/src/src/rx_main.cpp @@ -507,27 +507,31 @@ bool ICACHE_RAM_ATTR HandleSendTelemetryResponse() OtaGeneratePacketCrc(&otaPkt); - SX12XX_Radio_Number_t transmittingRadio = geminiMode ? SX12XX_Radio_All : Radio.GetLastSuccessfulPacketRadio(); - + SX12XX_Radio_Number_t transmittingRadio; + if (config.GetForceTlmOff()) + { + transmittingRadio = SX12XX_Radio_NONE; + } + else if (geminiMode) + { + transmittingRadio = SX12XX_Radio_All; + } + else + { + transmittingRadio = Radio.GetLastSuccessfulPacketRadio(); + } #if defined(Regulatory_Domain_EU_CE_2400) transmittingRadio &= ChannelIsClear(transmittingRadio); // weed out the radio(s) if channel in use +#endif + + Radio.TXnb((uint8_t*)&otaPkt, ExpressLRS_currAirRate_Modparams->PayloadLength, transmittingRadio); if (transmittingRadio == SX12XX_Radio_NONE) { - // No packet will be sent due to LBT. + // No packet will be sent due to LBT / Telem forced off. // Defer TXdoneCallback() to prepare for TLM when the IRQ is normally triggered. - deferExecutionMicros(ExpressLRS_currAirRate_RFperfParams->TOA, []() { - Radio.TXdoneCallback(); - }); + deferExecutionMicros(ExpressLRS_currAirRate_RFperfParams->TOA, Radio.TXdoneCallback); } -#endif - - if (config.GetForceTlmOff()) - { - transmittingRadio = SX12XX_Radio_NONE; - } - - Radio.TXnb((uint8_t*)&otaPkt, ExpressLRS_currAirRate_Modparams->PayloadLength, transmittingRadio); return true; }