diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index fa158c22b..0e94bff93 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -3,7 +3,8 @@ #include "error.h" #include "mesh/NodeDB.h" -// Particular boards might define a different max power based on what their hardware can do +// Particular boards might define a different max power based on what their hardware can do, default to max power output if not +// specified (may be dangerous if using external PA and SX126x power config forgotten) #ifndef SX126X_MAX_POWER #define SX126X_MAX_POWER 22 #endif @@ -26,20 +27,23 @@ template bool SX126xInterface::init() pinMode(SX126X_POWER_EN, OUTPUT); #endif -#ifndef SX126X_E22 - float tcxoVoltage = 0; // None - we use an XTAL +// FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE +#if !defined(SX126X_DIO3_TCXO_VOLTAGE) + float tcxoVoltage = + 0; // "TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip." per + // https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.h#L471C26-L471C104 + // (DIO3 is free to be used as an IRQ) + LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage\n"); #else - // Use DIO3 to power tcxo per https://github.com/jgromes/RadioLib/issues/12#issuecomment-520695575 - float tcxoVoltage = 1.8; + float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; + LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V\n", SX126X_DIO3_TCXO_VOLTAGE); + // (DIO3 is not free to be used as an IRQ) #endif + // FIXME: May want to set depending on a definition, currently all SX126x variant files use the DC-DC regulator option bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC? RadioLibInterface::init(); - - if (power == 0) - power = SX126X_MAX_POWER; - - if (power > SX126X_MAX_POWER) // This chip has lower power limits than some + if (power > SX126X_MAX_POWER) // Clamp power to maximum defined level power = SX126X_MAX_POWER; limitPower(); @@ -54,49 +58,50 @@ template bool SX126xInterface::init() LOG_INFO("Bandwidth set to %f\n", bw); LOG_INFO("Power output set to %d\n", power); - // current limit was removed from module' ctor - // override default value (60 mA) + // Overriding current limit + // (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using + // value in SX126xInterface.h (currently 140 mA) It may or may not be neccessary, depending on how RadioLib functions, from + // SX1261/2 datasheet: OCP after setting DeviceSel with SetPaConfig(): SX1261 - 60 mA, SX1262 - 140 mA For the SX1268 the IC + // defaults to 140mA no matter the set power level, but RadioLib set it lower, this would need further checking Default values + // are: SX1262, SX1268: 0x38 (140 mA), SX1261: 0x18 (60 mA) + // FIXME: Not ideal to increase SX1261 current limit above 60mA as it can only transmit max 15dBm, should probably only do it + // if using SX1262 or SX1268 res = lora.setCurrentLimit(currentLimit); LOG_DEBUG("Current limit set to %f\n", currentLimit); LOG_DEBUG("Current limit set result %d\n", res); -#if defined(SX126X_E22) - // E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines - // SX126X_TX for an E22 Module - if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("SX126X_E22 mode enabled. Setting DIO2 as RF Switch\n"); - res = lora.setDio2AsRfSwitch(true); - } +#ifdef SX126X_DIO2_AS_RF_SWITCH + LOG_DEBUG("Setting DIO2 as RF switch\n"); + bool dio2AsRfSwitch = true; +#else + LOG_DEBUG("Setting DIO2 as not RF switch\n"); + bool dio2AsRfSwitch = false; #endif + if (res == RADIOLIB_ERR_NONE) { + res = lora.setDio2AsRfSwitch(dio2AsRfSwitch); + } -#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC) - // If SX126X_TXEN is connected to the MCU, we are manually controlling RX and TX. - // But lora.begin (called above) sets Dio2 as RF switch control, which is not true here, so set it back to false. - if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("SX126X_TXEN pin defined. Setting RF Switch: RXEN=%i, TXEN=%i\n", SX126X_RXEN, SX126X_TXEN); - res = lora.setDio2AsRfSwitch(false); - lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN); - } -#elif defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC && defined(E22_TXEN_CONNECTED_TO_DIO2)) - // Otherwise, if SX126X_RXEN is connected to the MCU, and E22_TXEN_CONNECTED_TO_DIO2 is defined, we are letting the - // E22 control RX and TX via DIO2. In this configuration, the E22's TXEN and DIO2 pins are connected to each other, - // but not to the MCU. - // However, we must still connect the E22's RXEN pin to the MCU, define SX126X_RXEN accordingly, and then call - // setRfSwitchPins, otherwise RX sensitivity (observed via RSSI) is greatly diminished. - LOG_DEBUG("SX126X_RXEN and E22_TXEN_CONNECTED_TO_DIO2 are defined; value of res: %d", res); - if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("SX126X_TXEN is RADIOLIB_NC, but SX126X_RXEN and E22_TXEN_CONNECTED_TO_DIO2 are both defined; calling " - "lora.setRfSwitchPins."); - lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN); - } + // If a pin isn't defined, we set it to RADIOLIB_NC, it is safe to always do external RF switching with RADIOLIB_NC as it has + // no effect +#ifndef SX126X_RXEN +#define SX126X_RXEN RADIOLIB_NC + LOG_DEBUG("SX126X_RXEN not defined, defaulting to RADIOLIB_NC\n"); #endif +#ifndef SX126X_TXEN +#define SX126X_TXEN RADIOLIB_NC + LOG_DEBUG("SX126X_TXEN not defined, defaulting to RADIOLIB_NC\n"); +#endif + if (res == RADIOLIB_ERR_NONE) { + LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching\n", SX126X_RXEN, SX126X_TXEN); + lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN); + } if (config.lora.sx126x_rx_boosted_gain) { uint16_t result = lora.setRxBoostedGainMode(true); - LOG_INFO("Set Rx Boosted Gain mode; result: %d\n", result); + LOG_INFO("Set RX gain to boosted mode; result: %d\n", result); } else { uint16_t result = lora.setRxBoostedGainMode(false); - LOG_INFO("Set Rx Power Saving Gain mode; result: %d\n", result); + LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d\n", result); } #if 0 @@ -265,7 +270,7 @@ template bool SX126xInterface::isChannelActive() /** Could we send right now (i.e. either not actively receiving or transmitting)? */ template bool SX126xInterface::isActivelyReceiving() { - // The IRQ status will be cleared when we start our read operation. Check if we've started a header, but haven't yet + // The IRQ status will be cleared when we start our read operation. Check if we've started a header, but haven't yet // received and handled the interrupt for reading the packet/handling errors. uint16_t irq = lora.getIrqStatus(); @@ -296,7 +301,7 @@ template bool SX126xInterface::sleep() { // Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet // \todo Display actual typename of the adapter, not just `SX126x` - LOG_DEBUG("sx126x entering sleep mode (FIXME, don't keep config)\n"); + LOG_DEBUG("SX126x entering sleep mode (FIXME, don't keep config)\n"); setStandby(); // Stop any pending operations // turn off TCXO if it was powered @@ -312,4 +317,4 @@ template bool SX126xInterface::sleep() #endif return true; -} \ No newline at end of file +} diff --git a/variants/Dongle_nRF52840-pca10059-v1/variant.h b/variants/Dongle_nRF52840-pca10059-v1/variant.h index d165d6bdc..81e2ad995 100644 --- a/variants/Dongle_nRF52840-pca10059-v1/variant.h +++ b/variants/Dongle_nRF52840-pca10059-v1/variant.h @@ -47,12 +47,12 @@ extern "C" { #define PIN_LED2 (0 + 6) // Built in Green P0.06 // Green Built in LED1 -//#define PIN_LED1 (0 + 6) // LED1 P1.15 +// #define PIN_LED1 (0 + 6) // LED1 P1.15 // RGB NeoPixel LED2 -//#define PIN_LED1 (0 + 8) Red -//#define PIN_LED1 (32 + 9) Green -//#define PIN_LED1 (0 + 12) Blue +// #define PIN_LED1 (0 + 8) Red +// #define PIN_LED1 (32 + 9) Green +// #define PIN_LED1 (0 + 12) Blue #define LED_BUILTIN PIN_LED1 #define LED_CONN PIN_LED2 @@ -113,7 +113,7 @@ static const uint8_t SCK = PIN_SPI_SCK; * eink display pins */ -//#define PIN_EINK_EN (-1) +// #define PIN_EINK_EN (-1) #define PIN_EINK_EN (0 + 6) // Turn on the Green built in LED #define PIN_EINK_CS (32) // EPD_CS #define PIN_EINK_BUSY (20) // EPD_BUSY @@ -140,7 +140,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_RESET (32 + 15) // LORA_RESET P1.15 #define SX126X_TXEN (32 + 13) // TXEN P1.13 NiceRF 868 dont use #define SX126X_RXEN (32 + 10) // RXEN P1.10 NiceRF 868 dont use -#define SX126X_E22 + +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define PIN_GPS_EN (-1) #define PIN_GPS_PPS (-1) // Pulse per second input from the GPS diff --git a/variants/MakePython_nRF52840_eink/variant.h b/variants/MakePython_nRF52840_eink/variant.h index 8cf1f7dd9..2ff9c76fd 100644 --- a/variants/MakePython_nRF52840_eink/variant.h +++ b/variants/MakePython_nRF52840_eink/variant.h @@ -73,7 +73,7 @@ static const uint8_t AREF = PIN_AREF; */ #define SPI_INTERFACES_COUNT 2 // here -//#define SPI_INTERFACES_COUNT 1 +// #define SPI_INTERFACES_COUNT 1 #define PIN_SPI_MISO (0 + 31) // MISO P0.31 #define PIN_SPI_MOSI (0 + 30) // MOSI P0.30 @@ -94,7 +94,7 @@ static const uint8_t SCK = PIN_SPI_SCK; * eink display pins */ -//#define PIN_EINK_EN (-1) +// #define PIN_EINK_EN (-1) #define PIN_EINK_CS (0 + 3) // EPD_CS #define PIN_EINK_BUSY (32 + 11) // EPD_BUSY #define PIN_EINK_DC (32 + 13) // EPD_D/C @@ -118,8 +118,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX128X_CS (0 + 23) #define SX128X_DIO1 (0 + 4) #define SX128X_BUSY (0 + 7) -//#define SX128X_TXEN (32 + 9) -//#define SX128X_RXEN (0 + 12) +// #define SX128X_TXEN (32 + 9) +// #define SX128X_RXEN (0 + 12) #define SX128X_RESET LORA_RESET #define PIN_GPS_EN (-1) diff --git a/variants/MakePython_nRF52840_oled/variant.h b/variants/MakePython_nRF52840_oled/variant.h index 2f4323dd8..e7375a610 100644 --- a/variants/MakePython_nRF52840_oled/variant.h +++ b/variants/MakePython_nRF52840_oled/variant.h @@ -96,8 +96,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX128X_CS (0 + 23) #define SX128X_DIO1 (0 + 4) #define SX128X_BUSY (0 + 7) -//#define SX128X_TXEN (32 + 9) -//#define SX128X_RXEN (0 + 12) +// #define SX128X_TXEN (32 + 9) +// #define SX128X_RXEN (0 + 12) #define SX128X_RESET LORA_RESET #define PIN_GPS_EN (-1) diff --git a/variants/ai-c3/variant.h b/variants/ai-c3/variant.h index 352d189f1..254f5fd36 100644 --- a/variants/ai-c3/variant.h +++ b/variants/ai-c3/variant.h @@ -23,7 +23,9 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY 10 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // use DIO2 as RF switch + +#define SX126X_DIO2_AS_RF_SWITCH // use DIO2 as RF switch +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define HAS_GPS 0 #undef GPS_RX_PIN diff --git a/variants/bpi_picow_esp32_s3/pins_arduino.h b/variants/bpi_picow_esp32_s3/pins_arduino.h index ee0e34ebf..af03bf28a 100644 --- a/variants/bpi_picow_esp32_s3/pins_arduino.h +++ b/variants/bpi_picow_esp32_s3/pins_arduino.h @@ -27,11 +27,11 @@ static const uint8_t SCK = 21; static const uint8_t MOSI = 38; static const uint8_t SS = 17; -//#define SPI_MOSI (11) -//#define SPI_SCK (14) -//#define SPI_MISO (2) -//#define SPI_CS (13) +// #define SPI_MOSI (11) +// #define SPI_SCK (14) +// #define SPI_MISO (2) +// #define SPI_CS (13) -//#define SDCARD_CS SPI_CS +// #define SDCARD_CS SPI_CS -#endif /* Pins_Arduino_h */ \ No newline at end of file +#endif /* Pins_Arduino_h */ diff --git a/variants/bpi_picow_esp32_s3/variant.h b/variants/bpi_picow_esp32_s3/variant.h index 78eae1dad..8114b9ea3 100644 --- a/variants/bpi_picow_esp32_s3/variant.h +++ b/variants/bpi_picow_esp32_s3/variant.h @@ -2,10 +2,10 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -//#define HAS_SCREEN 0 +// #define HAS_SCREEN 0 -//#define HAS_SDCARD -//#define SDCARD_USE_SPI1 +// #define HAS_SDCARD +// #define SDCARD_USE_SPI1 #define USE_SSD1306 #define I2C_SDA 12 @@ -14,13 +14,13 @@ #define LED_PIN 46 #define LED_STATE_ON 0 // State when LED is litted -//#define BUTTON_PIN 15 // Pico OLED 1.3 User key 0 - removed User key 1 (17) +// #define BUTTON_PIN 15 // Pico OLED 1.3 User key 0 - removed User key 1 (17) #define BUTTON_PIN 40 -//#define BUTTON_PIN 0 // This is the BOOT button pad at the moment -//#define BUTTON_NEED_PULLUP +// #define BUTTON_PIN 0 // This is the BOOT button pad at the moment +// #define BUTTON_NEED_PULLUP -//#define USE_RF95 // RFM95/SX127x +// #define USE_RF95 // RFM95/SX127x #undef RF95_SCK #undef RF95_MISO @@ -43,10 +43,11 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_BUSY #define SX126X_RESET LORA_RESET -#define SX126X_E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif -//#define USE_SX1280 +// #define USE_SX1280 #ifdef USE_SX1280 #define RF95_MISO 1 #define RF95_SCK 3 @@ -61,13 +62,13 @@ #define SX128X_RESET LORA_RESET #endif -//#define USE_EINK +// #define USE_EINK /* * eink display pins */ -//#define PIN_EINK_CS -//#define PIN_EINK_BUSY -//#define PIN_EINK_DC -//#define PIN_EINK_RES (-1) -//#define PIN_EINK_SCLK 3 -//#define PIN_EINK_MOSI 4 \ No newline at end of file +// #define PIN_EINK_CS +// #define PIN_EINK_BUSY +// #define PIN_EINK_DC +// #define PIN_EINK_RES (-1) +// #define PIN_EINK_SCLK 3 +// #define PIN_EINK_MOSI 4 diff --git a/variants/diy/dr-dev/variant.h b/variants/diy/dr-dev/variant.h index b9c82a9c8..08d57eec9 100644 --- a/variants/diy/dr-dev/variant.h +++ b/variants/diy/dr-dev/variant.h @@ -31,10 +31,13 @@ // PINS FOR THE 900M22S -#define LORA_DIO1 26 // IRQ for SX1262/SX1268 -#define LORA_DIO2 22 // BUSY for SX1262/SX1268 -#define LORA_TXEN NOT_A_PIN // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level -#define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level +#define LORA_DIO1 26 // IRQ for SX1262/SX1268 +#define LORA_DIO2 22 // BUSY for SX1262/SX1268 +// NOT_A_PIN is treated as RADIOLIB_NC due to how they are defined, best to use RADIOLIB_NC directly +#define LORA_TXEN RADIOLIB_NC // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level +// E22_TXEN_CONNECTED_TO_DIO2 wasn't defined, so RXEN wasn't controlled. Commented it out to maintain behavior, but shouldn't be. +// Need to comment out defining SX126X_RXEN as LORA_RXEN too +// #define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level #undef RF95_NSS #define RF95_NSS 16 #define SX126X_BUSY 22 @@ -53,7 +56,7 @@ */ // RX/TX for RFM95/SX127x -#define RF95_RXEN LORA_RXEN +// #define RF95_RXEN LORA_RXEN #define RF95_TXEN LORA_TXEN // #define RF95_TCXO @@ -61,12 +64,13 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_RESET LORA_RESET -#define SX126X_RXEN LORA_RXEN +// #define SX126X_RXEN LORA_RXEN #define SX126X_TXEN LORA_TXEN // supported modules list -//#define USE_RF95 // RFM95/SX127x +// #define USE_RF95 // RFM95/SX127x #define USE_SX1262 -//#define USE_SX1268 -//#define USE_LLCC68 -#define SX126X_E22 \ No newline at end of file +// #define USE_SX1268 +// #define USE_LLCC68 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/diy/hydra/variant.h b/variants/diy/hydra/variant.h index 65bf839fd..98c1c2ae1 100644 --- a/variants/diy/hydra/variant.h +++ b/variants/diy/hydra/variant.h @@ -37,8 +37,9 @@ #define SX126X_RESET LORA_RESET #define SX126X_RXEN 14 #define SX126X_TXEN RADIOLIB_NC -#define E22_TXEN_CONNECTED_TO_DIO2 1 +#define SX126X_DIO2_AS_RF_SWITCH // Set lora.tx_power to 13 for Hydra or other E22 900M30S target due to PA #define SX126X_MAX_POWER 13 -#define SX126X_E22 + +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/diy/v1/variant.h b/variants/diy/v1/variant.h index a1083f9bb..48906515b 100644 --- a/variants/diy/v1/variant.h +++ b/variants/diy/v1/variant.h @@ -52,5 +52,5 @@ #ifdef EBYTE_E22 // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // (which is the default for the sx1262interface code) -#define SX126X_E22 -#endif \ No newline at end of file +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif diff --git a/variants/diy/v1_1/variant.h b/variants/diy/v1_1/variant.h index a550b9d1c..fd5276ced 100644 --- a/variants/diy/v1_1/variant.h +++ b/variants/diy/v1_1/variant.h @@ -53,5 +53,5 @@ #ifdef EBYTE_E22 // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // (which is the default for the sx1262interface code) -#define SX126X_E22 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif diff --git a/variants/feather_diy/variant.h b/variants/feather_diy/variant.h index 85614d9b5..5e889b04e 100644 --- a/variants/feather_diy/variant.h +++ b/variants/feather_diy/variant.h @@ -105,7 +105,7 @@ extern "C" { #ifdef EBYTE_E22 // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // (which is the default for the sx1262interface code) -#define SX126X_E22 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif #ifdef __cplusplus diff --git a/variants/heltec_esp32c3/variant.h b/variants/heltec_esp32c3/variant.h index 29ed88080..7d113720d 100644 --- a/variants/heltec_esp32c3/variant.h +++ b/variants/heltec_esp32c3/variant.h @@ -33,4 +33,5 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_BUSY #define SX126X_RESET LORA_RESET -#define SX126X_E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/heltec_v3/variant.h b/variants/heltec_v3/variant.h index 3e2227e15..4ce47996b 100644 --- a/variants/heltec_v3/variant.h +++ b/variants/heltec_v3/variant.h @@ -33,4 +33,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 \ No newline at end of file + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/heltec_wireless_paper/variant.h b/variants/heltec_wireless_paper/variant.h index eb67ea816..b73596f50 100644 --- a/variants/heltec_wireless_paper/variant.h +++ b/variants/heltec_wireless_paper/variant.h @@ -40,4 +40,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 \ No newline at end of file + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/heltec_wireless_tracker/variant.h b/variants/heltec_wireless_tracker/variant.h index f3915e350..cfb752d03 100644 --- a/variants/heltec_wireless_tracker/variant.h +++ b/variants/heltec_wireless_tracker/variant.h @@ -59,4 +59,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 \ No newline at end of file + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/heltec_wsl_v3/variant.h b/variants/heltec_wsl_v3/variant.h index 40671e4fb..240a482f7 100644 --- a/variants/heltec_wsl_v3/variant.h +++ b/variants/heltec_wsl_v3/variant.h @@ -32,4 +32,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/lora_isp4520/variant.h b/variants/lora_isp4520/variant.h index ce0c48297..30b8fc169 100644 --- a/variants/lora_isp4520/variant.h +++ b/variants/lora_isp4520/variant.h @@ -28,7 +28,7 @@ #define USE_LFXO -//#define USE_SEGGER +// #define USE_SEGGER // Number of pins defined in PinDescription array #define PINS_COUNT (16) @@ -88,6 +88,7 @@ #define BATTERY_PIN 3 #define ADC_MULTIPLIER 1.436 -#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Not really an E22 but this board clones using DIO3 for tcxo control #endif diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index 3ee0406ae..b310223d7 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -134,7 +134,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_TXEN (31) #define SX126X_POWER_EN \ (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino -#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +// Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define ST7735_RESET (11) // Output #define ST7735_CS (12) diff --git a/variants/lora_relay_v2/variant.h b/variants/lora_relay_v2/variant.h index 16286210f..172da17f7 100644 --- a/variants/lora_relay_v2/variant.h +++ b/variants/lora_relay_v2/variant.h @@ -154,7 +154,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_TXEN (31) #define SX126X_POWER_EN \ (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino -#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +// Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // ST7565 SPI #define ST7735_RESET (11) // Output diff --git a/variants/m5stack-stamp-c3/variant.h b/variants/m5stack-stamp-c3/variant.h index b1a192af5..87adbc226 100644 --- a/variants/m5stack-stamp-c3/variant.h +++ b/variants/m5stack-stamp-c3/variant.h @@ -4,7 +4,7 @@ #define BUTTON_PIN 3 // M5Stack STAMP C3 built in button #define BUTTON_NEED_PULLUP -//#define HAS_SCREEN 0 +// #define HAS_SCREEN 0 #define HAS_GPS 0 #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -28,45 +28,46 @@ // WaveShare Core1262-868M OK // https://www.waveshare.com/wiki/Core1262-868M -//#define USE_SX1262 -//#define RF95_SCK 4 -//#define RF95_MISO 5 -//#define RF95_MOSI 6 -//#define RF95_NSS 7 -//#define LORA_DIO0 RADIOLIB_NC -//#define LORA_RESET 8 -//#define LORA_DIO1 10 -//#define LORA_DIO2 RADIOLIB_NC -//#define LORA_BUSY 18 -//#define SX126X_CS RF95_NSS -//#define SX126X_DIO1 LORA_DIO1 -//#define SX126X_BUSY LORA_BUSY -//#define SX126X_RESET LORA_RESET -//#define SX126X_E22 +// #define USE_SX1262 +// #define RF95_SCK 4 +// #define RF95_MISO 5 +// #define RF95_MOSI 6 +// #define RF95_NSS 7 +// #define LORA_DIO0 RADIOLIB_NC +// #define LORA_RESET 8 +// #define LORA_DIO1 10 +// #define LORA_DIO2 RADIOLIB_NC +// #define LORA_BUSY 18 +// #define SX126X_CS RF95_NSS +// #define SX126X_DIO1 LORA_DIO1 +// #define SX126X_BUSY LORA_BUSY +// #define SX126X_RESET LORA_RESET +// #define SX126X_DIO2_AS_RF_SWITCH +// #define SX126X_DIO3_TCXO_VOLTAGE 1.8 // SX128X 2.4 Ghz LoRa module Not OK - RadioLib issue ? still to confirm -//#define USE_SX1280 -//#define RF95_SCK 4 -//#define RF95_MISO 5 -//#define RF95_MOSI 6 -//#define RF95_NSS 7 -//#define LORA_DIO0 -1 -//#define LORA_DIO1 10 -//#define LORA_DIO2 21 -//#define LORA_RESET 8 -//#define LORA_BUSY 1 -//#define SX128X_CS RF95_NSS -//#define SX128X_DIO1 LORA_DIO1 -//#define SX128X_BUSY LORA_BUSY -//#define SX128X_RESET LORA_RESET -//#define SX128X_MAX_POWER 10 +// #define USE_SX1280 +// #define RF95_SCK 4 +// #define RF95_MISO 5 +// #define RF95_MOSI 6 +// #define RF95_NSS 7 +// #define LORA_DIO0 -1 +// #define LORA_DIO1 10 +// #define LORA_DIO2 21 +// #define LORA_RESET 8 +// #define LORA_BUSY 1 +// #define SX128X_CS RF95_NSS +// #define SX128X_DIO1 LORA_DIO1 +// #define SX128X_BUSY LORA_BUSY +// #define SX128X_RESET LORA_RESET +// #define SX128X_MAX_POWER 10 // Not yet tested -//#define USE_EINK -//#define PIN_EINK_EN -1 // N/C -//#define PIN_EINK_CS 9 // EPD_CS -//#define PIN_EINK_BUSY 18 // EPD_BUSY -//#define PIN_EINK_DC 19 // EPD_D/C -//#define PIN_EINK_RES -1 // Connected but not needed -//#define PIN_EINK_SCLK 4 // EPD_SCLK -//#define PIN_EINK_MOSI 6 // EPD_MOSI \ No newline at end of file +// #define USE_EINK +// #define PIN_EINK_EN -1 // N/C +// #define PIN_EINK_CS 9 // EPD_CS +// #define PIN_EINK_BUSY 18 // EPD_BUSY +// #define PIN_EINK_DC 19 // EPD_D/C +// #define PIN_EINK_RES -1 // Connected but not needed +// #define PIN_EINK_SCLK 4 // EPD_SCLK +// #define PIN_EINK_MOSI 6 // EPD_MOSI diff --git a/variants/m5stack_core/variant.h b/variants/m5stack_core/variant.h index 22fa323d7..c671d77fa 100644 --- a/variants/m5stack_core/variant.h +++ b/variants/m5stack_core/variant.h @@ -4,7 +4,7 @@ #define I2C_SCL 22 // #define BUTTON_PIN 39 // 38, 37 -//#define BUTTON_PIN 0 +// #define BUTTON_PIN 0 #define BUTTON_NEED_PULLUP // #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Plugin. diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index 5ec1a81a3..90ce41334 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -3,8 +3,8 @@ #define I2C_SCL 22 // 7-07-2023 Or enable Secondary I2C Bus -//#define I2C_SDA1 32 -//#define I2C_SCL1 33 +// #define I2C_SDA1 32 +// #define I2C_SCL1 33 #define HAS_GPS 1 #undef GPS_RX_PIN @@ -39,7 +39,7 @@ #undef RF95_MOSI #undef RF95_NSS #define USE_RF95 -//#define USE_SX1280 +// #define USE_SX1280 #ifdef USE_RF95 #define RF95_SCK 18 diff --git a/variants/monteops_hw1/variant.h b/variants/monteops_hw1/variant.h index 866ddf471..f7df0688b 100644 --- a/variants/monteops_hw1/variant.h +++ b/variants/monteops_hw1/variant.h @@ -64,7 +64,7 @@ extern "C" { * Buttons */ -//#define PIN_BUTTON1 9 // Pin for button on E-ink button module or IO expansion +// #define PIN_BUTTON1 9 // Pin for button on E-ink button module or IO expansion #define BUTTON_NEED_PULLUP #define PIN_BUTTON2 12 #define PIN_BUTTON3 24 @@ -191,7 +191,9 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG // #define SX126X_TXEN (39) // #define SX126X_RXEN (37) #define SX126X_POWER_EN (37) -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 + +#define SX126X_DIO2_AS_RF_SWITCH // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define PIN_GPS_RESET (34) // Must be P1.02 // #define PIN_GPS_EN @@ -220,7 +222,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define ADC_MULTIPLIER VBAT_DIVIDER_COMP // REAL_VBAT_MV_PER_LSB #define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) -//#define HAS_RTC 1 +// #define HAS_RTC 1 #define HAS_ETHERNET 1 @@ -237,4 +239,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/variants/my_esp32s3_diy_eink/pins_arduino.h b/variants/my_esp32s3_diy_eink/pins_arduino.h index 1f276899c..39e316624 100644 --- a/variants/my_esp32s3_diy_eink/pins_arduino.h +++ b/variants/my_esp32s3_diy_eink/pins_arduino.h @@ -24,11 +24,11 @@ static const uint8_t SCK = 5; static const uint8_t MOSI = 6; static const uint8_t SS = 7; -//#define SPI_MOSI (11) -//#define SPI_SCK (14) -//#define SPI_MISO (2) -//#define SPI_CS (13) +// #define SPI_MOSI (11) +// #define SPI_SCK (14) +// #define SPI_MISO (2) +// #define SPI_CS (13) -//#define SDCARD_CS SPI_CS +// #define SDCARD_CS SPI_CS #endif /* Pins_Arduino_h */ diff --git a/variants/my_esp32s3_diy_eink/variant.h b/variants/my_esp32s3_diy_eink/variant.h index 288daf9ff..7e4fe2756 100644 --- a/variants/my_esp32s3_diy_eink/variant.h +++ b/variants/my_esp32s3_diy_eink/variant.h @@ -2,22 +2,22 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -//#define HAS_SCREEN 0 -//#define HAS_SDCARD -//#define SDCARD_USE_SPI1 +// #define HAS_SCREEN 0 +// #define HAS_SDCARD +// #define SDCARD_USE_SPI1 -//#define USE_SSD1306 +// #define USE_SSD1306 #define I2C_SDA 18 // 1 // I2C pins for this board #define I2C_SCL 17 // 2 -//#define LED_PIN 38 // This is a RGB LED not a standard LED +// #define LED_PIN 38 // This is a RGB LED not a standard LED #define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_NEED_PULLUP -//#define USE_RF95 // RFM95/SX127x -//#define USE_SX1262 +// #define USE_RF95 // RFM95/SX127x +// #define USE_SX1262 #define USE_SX1280 #define RF95_MISO 3 diff --git a/variants/my_esp32s3_diy_oled/pins_arduino.h b/variants/my_esp32s3_diy_oled/pins_arduino.h index 1f276899c..39e316624 100644 --- a/variants/my_esp32s3_diy_oled/pins_arduino.h +++ b/variants/my_esp32s3_diy_oled/pins_arduino.h @@ -24,11 +24,11 @@ static const uint8_t SCK = 5; static const uint8_t MOSI = 6; static const uint8_t SS = 7; -//#define SPI_MOSI (11) -//#define SPI_SCK (14) -//#define SPI_MISO (2) -//#define SPI_CS (13) +// #define SPI_MOSI (11) +// #define SPI_SCK (14) +// #define SPI_MISO (2) +// #define SPI_CS (13) -//#define SDCARD_CS SPI_CS +// #define SDCARD_CS SPI_CS #endif /* Pins_Arduino_h */ diff --git a/variants/my_esp32s3_diy_oled/variant.h b/variants/my_esp32s3_diy_oled/variant.h index 9eda00791..bb9657c5b 100644 --- a/variants/my_esp32s3_diy_oled/variant.h +++ b/variants/my_esp32s3_diy_oled/variant.h @@ -2,22 +2,22 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -//#define HAS_SCREEN 0 -//#define HAS_SDCARD -//#define SDCARD_USE_SPI1 +// #define HAS_SCREEN 0 +// #define HAS_SDCARD +// #define SDCARD_USE_SPI1 #define USE_SSD1306 #define I2C_SDA 18 // 1 // I2C pins for this board #define I2C_SCL 17 // 2 -//#define LED_PIN 38 // This is a RGB LED not a standard LED +// #define LED_PIN 38 // This is a RGB LED not a standard LED #define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_NEED_PULLUP -//#define USE_RF95 // RFM95/SX127x -//#define USE_SX1262 +// #define USE_RF95 // RFM95/SX127x +// #define USE_SX1262 #define USE_SX1280 #define RF95_MISO 3 @@ -44,13 +44,13 @@ #define SX128X_RESET LORA_RESET #endif -//#define USE_EINK +// #define USE_EINK /* * eink display pins */ -//#define PIN_EINK_CS 13 -//#define PIN_EINK_BUSY 2 -//#define PIN_EINK_DC 1 -//#define PIN_EINK_RES (-1) -//#define PIN_EINK_SCLK 5 -//#define PIN_EINK_MOSI 6 +// #define PIN_EINK_CS 13 +// #define PIN_EINK_BUSY 2 +// #define PIN_EINK_DC 1 +// #define PIN_EINK_RES (-1) +// #define PIN_EINK_SCLK 5 +// #define PIN_EINK_MOSI 6 diff --git a/variants/nano-g1-explorer/variant.h b/variants/nano-g1-explorer/variant.h index 1cc3b4103..71dd49f05 100644 --- a/variants/nano-g1-explorer/variant.h +++ b/variants/nano-g1-explorer/variant.h @@ -27,7 +27,9 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 +// Not really an E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // code) #endif @@ -37,4 +39,4 @@ #define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. #define ADC_MULTIPLIER 2 -#define USE_SH1107_128_64 \ No newline at end of file +#define USE_SH1107_128_64 diff --git a/variants/nano-g1/variant.h b/variants/nano-g1/variant.h index 53adffa01..5ceb96f0c 100644 --- a/variants/nano-g1/variant.h +++ b/variants/nano-g1/variant.h @@ -27,7 +27,9 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 +// Not really an E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // code) #endif diff --git a/variants/nano-g2-ultra/variant.h b/variants/nano-g2-ultra/variant.h index 9474b6cce..d69235fd4 100644 --- a/variants/nano-g2-ultra/variant.h +++ b/variants/nano-g2-ultra/variant.h @@ -118,7 +118,9 @@ External serial flash W25Q16JV_IQ // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main CPU? #define SX126X_BUSY (32 + 11) #define SX126X_RESET (32 + 15) -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...) @@ -193,4 +195,4 @@ External serial flash W25Q16JV_IQ * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/variants/pca10056-rc-clock/variant.h b/variants/pca10056-rc-clock/variant.h index 20aed8cb6..032e1de2b 100644 --- a/variants/pca10056-rc-clock/variant.h +++ b/variants/pca10056-rc-clock/variant.h @@ -146,6 +146,7 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_BUSY (32 + 4) // P1.04 #define SX126X_RESET (0 + 3) // P0.03 #define SX126X_ANT_SW (32 + 10) // P1.10 +#define SX126X_DIO2_AS_RF_SWITCH // To debug via the segger JLINK console rather than the CDC-ACM serial device // #define USE_SEGGER diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index e6269a38b..81dfd3885 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -20,5 +20,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH // HOPE RFM90 does not have a TCXO therefore not SX126X_E22 #endif diff --git a/variants/ppr/variant.h b/variants/ppr/variant.h index 4b37970a4..4c6cc015c 100644 --- a/variants/ppr/variant.h +++ b/variants/ppr/variant.h @@ -89,8 +89,8 @@ static const uint8_t A7 = PIN_A7; // Other pins #define PIN_AREF (0xff) -//#define PIN_NFC1 (9) -//#define PIN_NFC2 (10) +// #define PIN_NFC1 (9) +// #define PIN_NFC2 (10) static const uint8_t AREF = PIN_AREF; @@ -103,8 +103,8 @@ static const uint8_t AREF = PIN_AREF; #define PIN_SERIAL1_TX (9) // Connected to Jlink CDC -//#define PIN_SERIAL2_RX (8) -//#define PIN_SERIAL2_TX (6) +// #define PIN_SERIAL2_RX (8) +// #define PIN_SERIAL2_TX (6) /* * SPI Interfaces @@ -138,7 +138,8 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define SX126X_ANT_SW (32 + 10) #define SX126X_RXEN (22) #define SX126X_TXEN (24) -#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +// Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // ERC12864-10 LCD #define ERC12864_CS (32 + 4) diff --git a/variants/ppr1/variant.h b/variants/ppr1/variant.h index 635614da0..ba3a25c2a 100644 --- a/variants/ppr1/variant.h +++ b/variants/ppr1/variant.h @@ -89,8 +89,8 @@ static const uint8_t A7 = PIN_A7; // Other pins #define PIN_AREF (0xff) -//#define PIN_NFC1 (9) -//#define PIN_NFC2 (10) +// #define PIN_NFC1 (9) +// #define PIN_NFC2 (10) static const uint8_t AREF = PIN_AREF; @@ -158,7 +158,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_RESET (0 + 17) #define SX126X_TXEN (0 + 24) #define SX126X_RXEN (0 + 22) -#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control +// Not really an E22 but this board clones using DIO3 for tcxo control +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // FIXME, to prevent burning out parts I've set the power level super low, because I don't have // an antenna wired up diff --git a/variants/rak11200/variant.h b/variants/rak11200/variant.h index 7f2c24082..b6d9c4229 100644 --- a/variants/rak11200/variant.h +++ b/variants/rak11200/variant.h @@ -81,4 +81,6 @@ static const uint8_t SCK = 33; #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_POWER_EN WB_IO3 -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/rak11310/variant.h b/variants/rak11310/variant.h index f103447fb..c2ab3628d 100644 --- a/variants/rak11310/variant.h +++ b/variants/rak11310/variant.h @@ -48,5 +48,7 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_POWER_EN 25 -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 -#endif \ No newline at end of file +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index c4061037d..7b5f6b14d 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -209,7 +209,9 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG // #define SX126X_TXEN (39) // #define SX126X_RXEN (37) #define SX126X_POWER_EN (37) -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // enables 3.3V periphery like GPS or IO Module #define PIN_3V3_EN (34) @@ -275,4 +277,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/variants/rak4631_epaper/variant.h b/variants/rak4631_epaper/variant.h index ad3e4b87f..0253ec14d 100644 --- a/variants/rak4631_epaper/variant.h +++ b/variants/rak4631_epaper/variant.h @@ -186,7 +186,9 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define SX126X_TXEN (39) // #define SX126X_RXEN (37) #define SX126X_POWER_EN (37) -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // enables 3.3V periphery like GPS or IO Module #define PIN_3V3_EN (34) @@ -239,4 +241,4 @@ static const uint8_t SCK = PIN_SPI_SCK; * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/variants/rak4631_epaper_onrxtx/variant.h b/variants/rak4631_epaper_onrxtx/variant.h index e4d7c7d45..6fc6da373 100644 --- a/variants/rak4631_epaper_onrxtx/variant.h +++ b/variants/rak4631_epaper_onrxtx/variant.h @@ -43,7 +43,7 @@ extern "C" { #define PIN_BUTTON1 9 // Pin for button on E-ink button module or IO expansion #define BUTTON_NEED_PULLUP -//#define PIN_BUTTON2 12 +// #define PIN_BUTTON2 12 /* * Analog pins @@ -69,8 +69,8 @@ static const uint8_t A7 = PIN_A7; // Other pins #define PIN_AREF (2) -//#define PIN_NFC1 (9) -//#define PIN_NFC2 (10) +// #define PIN_NFC1 (9) +// #define PIN_NFC2 (10) static const uint8_t AREF = PIN_AREF; @@ -111,7 +111,7 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_EINK_CS (0 + 16) // TX1 #define PIN_EINK_BUSY (0 + 15) // RX1 #define PIN_EINK_DC (0 + 17) // IO1 -//#define PIN_EINK_RES (-1) //first try without RESET then connect it to AIN (AIN0 5 ) +// #define PIN_EINK_RES (-1) //first try without RESET then connect it to AIN (AIN0 5 ) #define PIN_EINK_RES (0 + 5) // 2.13 BN Display needs RESET #define PIN_EINK_SCLK (0 + 14) // SCL #define PIN_EINK_MOSI (0 + 13) // SDA @@ -155,7 +155,9 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define SX126X_TXEN (39) // #define SX126X_RXEN (37) #define SX126X_POWER_EN (37) -#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // enables 3.3V periphery like GPS or IO Module #define PIN_3V3_EN (34) @@ -171,36 +173,36 @@ static const uint8_t SCK = PIN_SPI_SCK; // Therefore must be 1 to keep peripherals powered // Power is on the controllable 3V3_S rail // #define PIN_GPS_RESET (34) -//#define PIN_GPS_EN PIN_3V3_EN -//#define PIN_GPS_PPS (17) // Pulse per second input from the GPS +// #define PIN_GPS_EN PIN_3V3_EN +// #define PIN_GPS_PPS (17) // Pulse per second input from the GPS -//#define GPS_RX_PIN PIN_SERIAL1_RX -//#define GPS_TX_PIN PIN_SERIAL1_TX +// #define GPS_RX_PIN PIN_SERIAL1_RX +// #define GPS_TX_PIN PIN_SERIAL1_TX // RAK12002 RTC Module #define RV3028_RTC (uint8_t)0b1010010 // Battery // The battery sense is hooked to pin A0 (5) -//#define BATTERY_PIN PIN_A0 +// #define BATTERY_PIN PIN_A0 // and has 12 bit resolution -//#define BATTERY_SENSE_RESOLUTION_BITS 12 -//#define BATTERY_SENSE_RESOLUTION 4096.0 +// #define BATTERY_SENSE_RESOLUTION_BITS 12 +// #define BATTERY_SENSE_RESOLUTION 4096.0 // Definition of milliVolt per LSB => 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096 -//#define VBAT_MV_PER_LSB (0.73242188F) +// #define VBAT_MV_PER_LSB (0.73242188F) // Voltage divider value => 1.5M + 1M voltage divider on VBAT = (1.5M / (1M + 1.5M)) -//#define VBAT_DIVIDER (0.4F) +// #define VBAT_DIVIDER (0.4F) // Compensation factor for the VBAT divider -//#define VBAT_DIVIDER_COMP (1.73) +// #define VBAT_DIVIDER_COMP (1.73) // Fixed calculation of milliVolt from compensation value -//#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) -//#undef AREF_VOLTAGE -//#define AREF_VOLTAGE 3.0 -//#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 -//#define ADC_MULTIPLIER VBAT_DIVIDER_COMP // REAL_VBAT_MV_PER_LSB -//#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) +// #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) +// #undef AREF_VOLTAGE +// #define AREF_VOLTAGE 3.0 +// #define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +// #define ADC_MULTIPLIER VBAT_DIVIDER_COMP // REAL_VBAT_MV_PER_LSB +// #define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) -//#define HAS_RTC 1 +// #define HAS_RTC 1 #ifdef __cplusplus } @@ -210,4 +212,4 @@ static const uint8_t SCK = PIN_SPI_SCK; * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/variants/rpipico/variant.h b/variants/rpipico/variant.h index 52e748ee8..5c92dec59 100644 --- a/variants/rpipico/variant.h +++ b/variants/rpipico/variant.h @@ -53,5 +53,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 -#endif \ No newline at end of file +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif diff --git a/variants/rpipicow/variant.h b/variants/rpipicow/variant.h index a9111db6b..6de2f7bd4 100644 --- a/variants/rpipicow/variant.h +++ b/variants/rpipicow/variant.h @@ -51,5 +51,6 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 -#endif \ No newline at end of file +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif diff --git a/variants/station-g1/variant.h b/variants/station-g1/variant.h index a1d549d42..79a49fc96 100644 --- a/variants/station-g1/variant.h +++ b/variants/station-g1/variant.h @@ -27,9 +27,7 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -// #define SX126X_E22 // Not really an E22 -// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface -// code) +#define SX126X_DIO2_AS_RF_SWITCH // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch #define SX126X_MAX_POWER \ 16 // Ensure the PA does not exceed the saturation output power. More // Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1 @@ -49,4 +47,4 @@ // Station may not have GPS installed, but it has a labeled GPS pinout #define GPS_RX_PIN 34 -#define GPS_TX_PIN 12 \ No newline at end of file +#define GPS_TX_PIN 12 diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index b732b90cb..b1673d338 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -84,6 +84,8 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Not really an E22 but TTGO seems to be trying to clone that +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface -// code) \ No newline at end of file +// code) diff --git a/variants/t-echo/variant.h b/variants/t-echo/variant.h index f955285ae..6bd5091dd 100644 --- a/variants/t-echo/variant.h +++ b/variants/t-echo/variant.h @@ -133,7 +133,9 @@ External serial flash WP25R1635FZUIL0 // CPU? #define SX126X_BUSY (0 + 17) #define SX126X_RESET (0 + 25) -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Not really an E22 but TTGO seems to be trying to clone that +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // code) diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index dc363603b..c87845afa 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -63,6 +63,8 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that - // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for - // the sx1262interface code) \ No newline at end of file +// Not really an E22 but TTGO seems to be trying to clone that +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for +// the sx1262interface code) diff --git a/variants/tbeam-s3-core/variant.h b/variants/tbeam-s3-core/variant.h index 532b5b85c..5e9894cc6 100644 --- a/variants/tbeam-s3-core/variant.h +++ b/variants/tbeam-s3-core/variant.h @@ -7,9 +7,9 @@ #define I2C_SCL 18 // For QMC6310 sensors and screens #define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3 -//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented -// anywhere. -// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module. +// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented +// anywhere. +// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module. #define LED_INVERTED 1 @@ -29,7 +29,9 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Not really an E22 but TTGO seems to be trying to clone that +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // code) #endif @@ -64,4 +66,4 @@ // has 32768 Hz crystal #define HAS_32768HZ -#define USE_SH1106 \ No newline at end of file +#define USE_SH1106 diff --git a/variants/tbeam/variant.h b/variants/tbeam/variant.h index 62a864636..84a3477d4 100644 --- a/variants/tbeam/variant.h +++ b/variants/tbeam/variant.h @@ -28,7 +28,9 @@ #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Not really an E22 but TTGO seems to be trying to clone that +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // code) #endif @@ -39,4 +41,4 @@ #define HAS_AXP192 #define GPS_UBLOX #define GPS_RX_PIN 34 -#define GPS_TX_PIN 12 \ No newline at end of file +#define GPS_TX_PIN 12 diff --git a/variants/tlora_t3s3_v1/variant.h b/variants/tlora_t3s3_v1/variant.h index 3d500633f..6e1d1d0eb 100644 --- a/variants/tlora_t3s3_v1/variant.h +++ b/variants/tlora_t3s3_v1/variant.h @@ -44,7 +44,8 @@ #define SX126X_DIO1 33 #define SX126X_BUSY 34 #define SX126X_RESET LORA_RESET -#define SX126X_E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif // per SX128x_Receive_Interrupt/utilities.h @@ -58,4 +59,4 @@ #define SX128X_RXEN 21 #define SX128X_TXEN 10 #define SX128X_MAX_POWER 3 -#endif \ No newline at end of file +#endif diff --git a/variants/xiao_ble/variant.h b/variants/xiao_ble/variant.h index ae7d37458..e2b8eb613 100644 --- a/variants/xiao_ble/variant.h +++ b/variants/xiao_ble/variant.h @@ -5,7 +5,7 @@ #define VARIANT_MCK (64000000ul) #define USE_LFXO // Board uses 32khz crystal for LF -//#define USE_LFRC // Board uses RC for LF +// #define USE_LFRC // Board uses RC for LF /*---------------------------------------------------------------------------- * Headers @@ -125,7 +125,6 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_TXEN RADIOLIB_NC #define SX126X_RXEN D7 -#define E22_TXEN_CONNECTED_TO_DIO2 // ------------------------------ OR ------------------------------ @@ -141,7 +140,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #ifdef EBYTE_E22 // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // (which is the default for the sx1262interface code) -#define SX126X_E22 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif /* @@ -198,4 +198,4 @@ static const uint8_t SCL = PIN_WIRE_SCL; * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif