Skip to content

Commit

Permalink
Update SX1278.cpp to fix errataFix typo
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kb9nate authored Jul 18, 2024
1 parent 858bf64 commit ceba2d9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/modules/SX127x/SX1278.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ceba2d9

Please sign in to comment.