From ceba2d9b3bc7ee8311dfaf987cf3270a5c559e9a Mon Sep 17 00:00:00 2001 From: Nate Welch Date: Thu, 18 Jul 2024 08:45:29 -0500 Subject: [PATCH] Update SX1278.cpp to fix errataFix typo The binary representations that were being written to register 0x31 were not setting the correct bit. In particular for the 500kHz bandwidth setting. Changed from 0b1000000 to 0b10000000 --- src/modules/SX127x/SX1278.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index 78251d245..2d44b99e8 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -639,49 +639,49 @@ void SX1278::errataFix(bool rx) { uint8_t fixedRegs[3] = { 0x00, 0x00, 0x00 }; float rxFreq = frequency; if(fabs(SX127x::bandwidth - 7.8) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x48; fixedRegs[2] = 0x00; rxFreq += 0.00781; } else if(fabs(SX127x::bandwidth - 10.4) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x44; fixedRegs[2] = 0x00; rxFreq += 0.01042; } else if(fabs(SX127x::bandwidth - 15.6) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x44; fixedRegs[2] = 0x00; rxFreq += 0.01562; } else if(fabs(SX127x::bandwidth - 20.8) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x44; fixedRegs[2] = 0x00; rxFreq += 0.02083; } else if(fabs(SX127x::bandwidth - 31.25) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x44; fixedRegs[2] = 0x00; rxFreq += 0.03125; } else if(fabs(SX127x::bandwidth - 41.7) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x44; fixedRegs[2] = 0x00; rxFreq += 0.04167; } else if(fabs(SX127x::bandwidth - 62.5) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x40; fixedRegs[2] = 0x00; } else if(fabs(SX127x::bandwidth - 125.0) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x40; fixedRegs[2] = 0x00; } else if(fabs(SX127x::bandwidth - 250.0) <= 0.001) { - fixedRegs[0] = 0b0000000; + fixedRegs[0] = 0b00000000; fixedRegs[1] = 0x40; fixedRegs[2] = 0x00; } else if(fabs(SX127x::bandwidth - 500.0) <= 0.001) { - fixedRegs[0] = 0b1000000; + fixedRegs[0] = 0b10000000; fixedRegs[1] = mod->SPIreadRegister(0x2F); fixedRegs[2] = mod->SPIreadRegister(0x30); } else {