Skip to content

Commit

Permalink
[SX126x] Use integer frequency for band selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Apr 4, 2024
1 parent a387b3b commit 263f788
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/modules/SX126x/SX1262.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ int16_t SX1262::setFrequency(float freq, bool calibrate) {

// try to match the frequency ranges
int freqBand = (int)freq;
if((freq >= 902) && (freq <= 928)) {
if((freqBand >= 902) && (freqBand <= 928)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_902_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_902_MHZ_2;
} else if((freq >= 863) && (freq <= 870)) {
} else if((freqBand >= 863) && (freqBand <= 870)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_863_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_863_MHZ_2;
} else if((freq >= 779) && (freq <= 787)) {
} else if((freqBand >= 779) && (freqBand <= 787)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_779_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_779_MHZ_2;
} else if((freq >= 470) && (freq <= 510)) {
} else if((freqBand >= 470) && (freqBand <= 510)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_470_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_470_MHZ_2;
} else if((freq >= 430) && (freq <= 440)) {
} else if((freqBand >= 430) && (freqBand <= 440)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_430_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_430_MHZ_2;
}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/SX126x/SX1268.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ int16_t SX1268::setFrequency(float freq, bool calibrate) {

// try to match the frequency ranges
int freqBand = (int)freq;
if((freq >= 779) && (freq <= 787)) {
if((freqBand >= 779) && (freqBand <= 787)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_779_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_779_MHZ_2;
} else if((freq >= 470) && (freq <= 510)) {
} else if((freqBand >= 470) && (freqBand <= 510)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_470_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_470_MHZ_2;
} else if((freq >= 430) && (freq <= 440)) {
} else if((freqBand >= 430) && (freqBand <= 440)) {
data[0] = RADIOLIB_SX126X_CAL_IMG_430_MHZ_1;
data[1] = RADIOLIB_SX126X_CAL_IMG_430_MHZ_2;
}
Expand Down

0 comments on commit 263f788

Please sign in to comment.