Skip to content

Conversation

@pkendall64
Copy link
Collaborator

@pkendall64 pkendall64 commented Jul 31, 2025

Problem

When binding in 50Hz 2.4GHz and the UID[5] bit 0 is unset, the radio config command would be ignored because logic for checking the InvertedIQ flag was removed and in binding mode the invertedIQ flag is always true.

  • Fix the inverted IQ check.
  • Bonus: fix LR1121 passing wrong value to command.

This was a little more complicated than reverting #3014 because of 900MHz and LR1121 being dual band!

Fix LR1121 passing wrong value to command
Copy link
Member

@CapnBry CapnBry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus cleanup too, nice. Seems to resolve the 50Hz connection not working after binding.

I have to admit I was clearly not awake enough this morning when I was trying to understand FHSSgetInitialFreq() << 1000000000. Shift right a billion?! No, that's a comparison you dum dum.

@SunjunKim
Copy link
Contributor

SunjunKim commented Jul 31, 2025

The problem still exists... The bug procedure is demonstrated in the video here.
https://youtu.be/IRlgI3jj9aA?si=JJKR0Rolkd1G3vF2

@CapnBry
Copy link
Member

CapnBry commented Jul 31, 2025

Well hang on, I was just lucky I believe. subGHz is always true for SX1280, since the value of the initialfreq is in register values, not absolute herz, which is 12,307,660, which will ignore the IQinvert even for Team2.4

But there is another issue that when going into binding mode, it ALWAYS needs to go through all the code of SetRFLinkRate() so the binding packet is sent on the correct frequency rather than whereever it was when the FHSS was stopped to enter bind mode. It needs

diff --git a/src/src/tx_main.cpp b/src/src/tx_main.cpp
index 2b2d26ce..89afe9c7 100644
--- a/src/src/tx_main.cpp
+++ b/src/src/tx_main.cpp
@@ -387,7 +387,8 @@ void SetRFLinkRate(uint8_t index) // Set speed of RF link
   if ((ModParams == ExpressLRS_currAirRate_Modparams)
     && (RFperf == ExpressLRS_currAirRate_RFperfParams)
     && (subGHz || invertIQ == Radio.IQinverted)
-    && (OtaSwitchModeCurrent == newSwitchMode))
+    && (OtaSwitchModeCurrent == newSwitchMode)
+    && (!InBindingMode))  // binding mode must always execute code below to set frequency
     return;

   DBGLN("set rate %u", index);

bool invertIQ = InBindingMode || (UID[5] & 0x01);
OtaSwitchMode_e newSwitchMode = (OtaSwitchMode_e)config.GetSwitchMode();

bool subGHz = FHSSgetInitialFreq() < 1000000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool subGHz = FHSSconfig->freq_center < 1000000000;

#if defined(RADIO_LR1121)
if (FHSSuseDualBand && subGHz)
{
subGHz = FHSSgetInitialGeminiFreq() < 1000000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subGHz = FHSSconfigDualBand->freq_center < 1000000000;

Copy link
Contributor

@SunjunKim SunjunKim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fix subGhz being always true (due to the FREQ_HZ_TO_REG_VAL conversion)

@SunjunKim SunjunKim self-assigned this Jul 31, 2025
@CapnBry CapnBry self-requested a review July 31, 2025 18:10
@SunjunKim SunjunKim self-requested a review July 31, 2025 18:19
@SunjunKim SunjunKim removed their assignment Jul 31, 2025
@pkendall64 pkendall64 force-pushed the fix-invertedIQ-check branch from fbabb29 to d4f2013 Compare July 31, 2025 19:52
Copy link
Member

@CapnBry CapnBry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Tested again, this time multiple times and also with devices that are both running InvertIQ and not InvertIQ. Binds ("at freq = 12307660") and connects on both. Tested 50Hz and 150Hz. SX1280 only though.

Copy link
Contributor

@mha1 mha1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.4G and 900MHz bind at 50Hz and 100Hz packet rates tested ok with BackRC 900/2400 Dual Band 1W Nano TX, BFPV SuperP 2.4G and SuperP 900M.

@pkendall64 pkendall64 merged commit bdc340b into ExpressLRS:3.x.x-maintenance Aug 1, 2025
51 checks passed
@pkendall64 pkendall64 deleted the fix-invertedIQ-check branch August 2, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants