@@ -166,7 +166,6 @@ bool doStartTimer = false;
166166
167167// /////////////////////////////////////////////
168168
169- static bool didFHSS = false ;
170169static bool alreadyTLMresp = false ;
171170
172171// ////////////////////////////////////////////////////////////
@@ -364,21 +363,18 @@ void SetRFLinkRate(uint8_t index, bool bindMode) // Set speed of RF link
364363 telemBurstValid = false ;
365364}
366365
367- bool ICACHE_RAM_ATTR HandleFHSS ()
366+ static void ICACHE_RAM_ATTR HandleFHSS ()
368367{
369- // Always look at what is coming next, as this will ideally be called immediately following packet reception
370- // -OR- on TOCK if there was no packet received (but before the nonce is advanced)
371- const uint8_t upcomingNonce = OtaNonce + 1 ;
372- uint8_t modresultFHSS = upcomingNonce % ExpressLRS_currAirRate_Modparams->FHSShopInterval ;
368+ uint8_t modresultFHSS = OtaNonce % ExpressLRS_currAirRate_Modparams->FHSShopInterval ;
373369
374370 if ((ExpressLRS_currAirRate_Modparams->FHSShopInterval == 0 ) || InBindingMode || (modresultFHSS != 0 ) || (connectionState == disconnected))
375371 {
376- return false ;
372+ return ;
377373 }
378374
379375 if (geminiMode)
380376 {
381- if (((upcomingNonce / ExpressLRS_currAirRate_Modparams->FHSShopInterval ) % 2 == 0 ) || FHSSuseDualBand) // When in DualBand do not switch between radios. The OTA modulation paramters and HighFreq/LowFreq Tx amps are set during Config.
377+ if (((OtaNonce / ExpressLRS_currAirRate_Modparams->FHSShopInterval ) % 2 == 0 ) || FHSSuseDualBand) // When in DualBand do not switch between radios. The OTA modulation paramters and HighFreq/LowFreq Tx amps are set during Config.
382378 {
383379 Radio.SetFrequencyReg (FHSSgetNextFreq (), SX12XX_Radio_1);
384380 Radio.SetFrequencyReg (FHSSgetGeminiFreq (), SX12XX_Radio_2);
@@ -398,7 +394,7 @@ bool ICACHE_RAM_ATTR HandleFHSS()
398394
399395#if defined(RADIO_SX127X)
400396 // SX127x radio has to reset receive mode after hopping
401- uint8_t modresultTLM = upcomingNonce % ExpressLRS_currTlmDenom;
397+ uint8_t modresultTLM = OtaNonce % ExpressLRS_currTlmDenom;
402398 if (modresultTLM != 0 || ExpressLRS_currTlmDenom == 1 ) // if we are about to send a tlm response don't bother going back to rx
403399 {
404400 Radio.RXnb ();
@@ -407,7 +403,6 @@ bool ICACHE_RAM_ATTR HandleFHSS()
407403#if defined(Regulatory_Domain_EU_CE_2400)
408404 SetClearChannelAssessmentTime ();
409405#endif
410- return true ;
411406}
412407
413408void ICACHE_RAM_ATTR LinkStatsToOta (OTA_LinkStats_s * const ls)
@@ -842,13 +837,8 @@ void ICACHE_RAM_ATTR HWtimerCallbackTock()
842837 // For any serial drivers that need to send on a regular cadence (i.e. CRSF to betaflight)
843838 sendImmediateRC ();
844839
845- if (!didFHSS)
846- {
847- HandleFHSS ();
848- }
849- didFHSS = false ;
850-
851840 OtaNonce++;
841+ HandleFHSS ();
852842 updateDiversity ();
853843 tlmSent = HandleSendTelemetryResponse ();
854844 updatePhaseLock ();
@@ -1266,8 +1256,6 @@ bool ICACHE_RAM_ATTR RXdoneISR(SX12xxDriverCommon::rx_status const status)
12661256
12671257 if (ProcessRFPacket (status))
12681258 {
1269- didFHSS = HandleFHSS ();
1270-
12711259 if (doStartTimer)
12721260 {
12731261 doStartTimer = false ;
0 commit comments