diff --git a/include/global_config.h b/include/global_config.h index 93074a8..53d4ee9 100644 --- a/include/global_config.h +++ b/include/global_config.h @@ -32,10 +32,14 @@ #define BUZZER_PIN 35 #endif -// REB trigger PIN -#define REB_PIN 42 -#ifdef T3_V1_6_SX1276 +// REB trigger PIN — default 42, but LILYGO uses 42 for COMPASS_SCL (I2C), +// so remap to 39 to avoid fighting the I2C peripheral. +#ifdef LILYGO +#define REB_PIN 39 +#elif defined(T3_V1_6_SX1276) #define REB_PIN 35 +#else +#define REB_PIN 42 #endif #define WATERFALL_ENABLED true diff --git a/lib/loraboards/LoRaBoards.cpp b/lib/loraboards/LoRaBoards.cpp index 5cbd27e..76395eb 100644 --- a/lib/loraboards/LoRaBoards.cpp +++ b/lib/loraboards/LoRaBoards.cpp @@ -528,34 +528,6 @@ void loopPMU() #endif } -bool beginDisplay() -{ - /** - Wire.beginTransmission(DISPLAY_ADDR); - if (Wire.endTransmission() == 0) - { - Serial.printf("Found Display model at 0x%X address\n", DISPLAY_ADDR); - u8g2 = new DISPLAY_MODEL(U8G2_R0, U8X8_PIN_NONE); - u8g2->begin(); - u8g2->clearBuffer(); - u8g2->setFont(u8g2_font_inb19_mr); - u8g2->drawStr(0, 30, "LilyGo"); - u8g2->drawHLine(2, 35, 47); - u8g2->drawHLine(3, 36, 47); - u8g2->drawVLine(45, 32, 12); - u8g2->drawVLine(46, 33, 12); - u8g2->setFont(u8g2_font_inb19_mf); - u8g2->drawStr(58, 60, "LoRa"); - u8g2->sendBuffer(); - u8g2->setFont(u8g2_font_fur11_tf); - delay(3000); - return true; - } - - Serial.printf("Warning: Failed to find Display at 0x%0X address\n", DISPLAY_ADDR); - return false;*/ -} - bool beginSDCard() { #ifdef SDCARD_CS @@ -821,11 +793,6 @@ void setupBoards(bool disable_u8g2) Serial.printf("SD card %s is ready.\n", card_type); } - if (!disable_u8g2) - { - beginDisplay(); - } - beginWiFi(); #ifdef HAS_GPS diff --git a/lib/loraboards/LoRaBoards.h b/lib/loraboards/LoRaBoards.h index 4873013..5b510e1 100644 --- a/lib/loraboards/LoRaBoards.h +++ b/lib/loraboards/LoRaBoards.h @@ -61,8 +61,6 @@ void setupBoards(bool disable_u8g2 = true); bool beginSDCard(); -bool beginDisplay(); - void disablePeripherals(); bool beginPower(); diff --git a/src/main.cpp b/src/main.cpp index 9330205..e407130 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -872,28 +872,9 @@ Config config; #ifdef USING_LR1121 void setLRFreq(float freq) { - bool skipCalibration = false; - /** - if(!(((freq >= 150.0) && (freq <= 960.0)) || - ((freq >= 1900.0) && (freq <= 2200.0)) || - ((freq >= 2400.0) && (freq <= 2500.0)))) { - return(RADIOLIB_ERR_INVALID_FREQUENCY); - }**/ - - // check if we need to recalibrate image - // int16_t state; - - if (!true && (fabsf(freq - radio.freqMHz) >= RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG_MHZ)) - { - state = radio.calibrateImageRejection(freq - 4, freq + 4); - // RADIOLIB_ASSERT(state); - } - - // set frequency - state = radio.setRfFrequency((uint32_t)(freq * 1000000.0f)); - // RADIOLIB_ASSERT(state); - radio.freqMHz = freq; - radio.highFreq = (freq > 1000.0); + // LR1120::setFrequency updates protected freqMHz/highFreq and runs image + // calibration when the hop exceeds RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG_MHZ. + state = radio.setFrequency(freq); } #endif