From 37b0e6f028be8a25dcc5fe2e33e3f4bbb4c21422 Mon Sep 17 00:00:00 2001 From: Wessel Nieboer Date: Thu, 9 Jul 2026 15:56:25 +0200 Subject: [PATCH] bump radiolib to 7.7.1 --- library.json | 2 +- src/helpers/radiolib/SX126xReset.h | 28 +++++----------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/library.json b/library.json index 8504793c2..2ff3aaec9 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "dependencies": { "SPI": "*", "Wire": "*", - "jgromes/RadioLib": "^7.6.0", + "jgromes/RadioLib": "^7.7.1", "rweather/Crypto": "^0.4.0", "adafruit/RTClib": "^2.1.3", "melopero/Melopero RV3028": "^1.1.0", diff --git a/src/helpers/radiolib/SX126xReset.h b/src/helpers/radiolib/SX126xReset.h index 39ddb73ee..3c36afdb3 100644 --- a/src/helpers/radiolib/SX126xReset.h +++ b/src/helpers/radiolib/SX126xReset.h @@ -3,32 +3,14 @@ #include // Full receiver reset for all SX126x-family chips (SX1262, SX1268, LLCC68, STM32WLx). -// Warm sleep powers down analog, Calibrate(0x7F) refreshes ADC/PLL/image calibration, -// then re-applies RX settings that calibration may reset. +// RadioLib 7.7.0+ provides resetAGC(): warm sleep powers down analog, Calibrate(0x7F) +// refreshes ADC/PLL/image calibration, image is re-calibrated for the operating +// frequency, and DIO2 RF switch / RX boosted gain are re-applied automatically. inline void sx126xResetAGC(SX126x* radio) { - radio->sleep(true); - radio->standby(RADIOLIB_SX126X_STANDBY_RC, true); + radio->resetAGC(); - uint8_t calData = RADIOLIB_SX126X_CALIBRATE_ALL; - radio->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE, &calData, 1, true, false); - radio->mod->hal->delay(5); - uint32_t start = millis(); - while (radio->mod->hal->digitalRead(radio->mod->getGpio())) { - if (millis() - start > 50) break; - radio->mod->hal->yield(); - } - - // Calibrate(0x7F) defaults image calibration to 902-928MHz band. - // Re-calibrate for the actual operating frequency. - radio->calibrateImage(radio->freqMHz); - -#ifdef SX126X_DIO2_AS_RF_SWITCH - radio->setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); -#endif -#ifdef SX126X_RX_BOOSTED_GAIN - radio->setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); -#endif #ifdef SX126X_REGISTER_PATCH + // for improved RX with Heltec v4 — calibration may reset this uint8_t r_data = 0; radio->readRegister(0x8B5, &r_data, 1); r_data |= 0x01;