diff --git a/src/main.cpp b/src/main.cpp index e0f0783d3..0f2e575c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,8 +87,6 @@ uint8_t kb_model; // The I2C address of the RTC Module (if found) uint8_t rtc_found; -bool rIf_wide_lora = false; - // Keystore Chips uint8_t keystore_found; #ifndef ARCH_PORTDUINO @@ -385,7 +383,6 @@ void setup() rIf = NULL; } else { DEBUG_MSG("SX1280 Radio init succeeded, using SX1280 radio\n"); - rIf_wide_lora = true; } } #endif diff --git a/src/main.h b/src/main.h index bd24dec76..3744c8acd 100644 --- a/src/main.h +++ b/src/main.h @@ -17,7 +17,6 @@ extern uint8_t kb_model; extern uint8_t rtc_found; extern uint8_t keystore_found; -extern bool rIf_wide_lora; extern bool eink_found; extern bool pmu_found; extern bool isCharging; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 97dd66fae..4d24b40c4 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -365,37 +365,37 @@ void RadioInterface::applyModemConfig() switch (loraConfig.modem_preset) { case Config_LoRaConfig_ModemPreset_SHORT_FAST: - bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250; + bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 7; break; case Config_LoRaConfig_ModemPreset_SHORT_SLOW: - bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250; + bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 8; break; case Config_LoRaConfig_ModemPreset_MEDIUM_FAST: - bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250; + bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 9; break; case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: - bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250; + bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 10; break; case Config_LoRaConfig_ModemPreset_LONG_FAST: - bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250; + bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 11; break; case Config_LoRaConfig_ModemPreset_LONG_SLOW: - bw = (myRegion->wideLora && rIf_wide_lora) ? 400 : 125; + bw = (myRegion->wideLora) ? 406.25 : 125; cr = 8; sf = 12; break; case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: - bw = (myRegion->wideLora && rIf_wide_lora) ? 200 : 31.25; + bw = (myRegion->wideLora) ? 203.125 : 31.25; cr = 8; sf = 12; break; @@ -411,6 +411,14 @@ void RadioInterface::applyModemConfig() bw = 31.25; if (bw == 62) // Fix for 62.5Khz bandwidth bw = 62.5; + if (bw == 200) + bw = 203.125; + if (bw == 400) + bw = 406.25; + if (bw == 800) + bw = 812.5; + if (bw == 1600) + bw = 1625.0; } power = loraConfig.tx_power; @@ -443,7 +451,7 @@ void RadioInterface::applyModemConfig() DEBUG_MSG("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power); DEBUG_MSG("Radio myRegion->freqStart / myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart); - DEBUG_MSG("Radio myRegion->numChannels: %d\n", numChannels); + DEBUG_MSG("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw); DEBUG_MSG("Radio channel_num: %d\n", channel_num); DEBUG_MSG("Radio frequency: %f\n", getFreq()); DEBUG_MSG("Slot time: %u msec\n", slotTimeMsec); diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 10d791847..d717f3b65 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -61,7 +61,7 @@ bool SX128xInterface::init() #endif if (res == RADIOLIB_ERR_NONE) - res = lora.setCRC(RADIOLIB_SX128X_LORA_CRC_ON); + res = lora.setCRC(2); if (res == RADIOLIB_ERR_NONE) startReceive(); // start receiving