Refactor naming
This commit is contained in:
@@ -68,22 +68,14 @@
|
|||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/CustomSX1268Wrapper.h>
|
#include <helpers/CustomSX1268Wrapper.h>
|
||||||
static XiaoC3Board board;
|
static XiaoC3Board board;
|
||||||
#elif defined(SEEED_XIAO_S3)
|
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/ESP32Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
static ESP32Board board;
|
static ESP32Board board;
|
||||||
#elif defined(LILYGO_T3)
|
#elif defined(LILYGO_TLORA)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/LilyGoTLoraBoard.h>
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
#include <helpers/CustomSX1276Wrapper.h>
|
||||||
static ESP32Board board;
|
static LilyGoTLoraBoard board;
|
||||||
#elif defined(LILYGO_T3S3)
|
|
||||||
#include <helpers/LilyGoT3S3Board.h>
|
|
||||||
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
|
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
|
||||||
#else
|
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
|
||||||
#endif
|
|
||||||
static LilyGoT3S3Board board;
|
|
||||||
#elif defined(RAK_4631)
|
#elif defined(RAK_4631)
|
||||||
#include <helpers/nrf52/RAK4631Board.h>
|
#include <helpers/nrf52/RAK4631Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
@@ -1120,7 +1112,7 @@ public:
|
|||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
||||||
SPIClass spi;
|
SPIClass spi;
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
@@ -1141,24 +1133,19 @@ void setup() {
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
board.begin();
|
board.begin();
|
||||||
|
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||||
|
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||||
|
#else
|
||||||
|
float tcxo = 1.6f;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
|
|
||||||
#else // SX126X module
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
Serial.println(status);
|
Serial.println(status);
|
||||||
@@ -1167,14 +1154,12 @@ void setup() {
|
|||||||
|
|
||||||
radio.setCRC(0);
|
radio.setCRC(0);
|
||||||
|
|
||||||
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
|
#ifdef SX126X_CURRENT_LIMIT
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fast_rng.begin(radio.random(0x7FFFFFFF));
|
fast_rng.begin(radio.random(0x7FFFFFFF));
|
||||||
|
|||||||
@@ -72,22 +72,14 @@
|
|||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/CustomSX1268Wrapper.h>
|
#include <helpers/CustomSX1268Wrapper.h>
|
||||||
static XiaoC3Board board;
|
static XiaoC3Board board;
|
||||||
#elif defined(SEEED_XIAO_S3)
|
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/ESP32Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
static ESP32Board board;
|
static ESP32Board board;
|
||||||
#elif defined(LILYGO_T3)
|
#elif defined(LILYGO_TLORA)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/LilyGoTLoraBoard.h>
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
#include <helpers/CustomSX1276Wrapper.h>
|
||||||
static ESP32Board board;
|
static LilyGoTLoraBoard board;
|
||||||
#elif defined(LILYGO_T3S3)
|
|
||||||
#include <helpers/LilyGoT3S3Board.h>
|
|
||||||
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
|
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
|
||||||
#else
|
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
|
||||||
#endif
|
|
||||||
static LilyGoT3S3Board board;
|
|
||||||
#elif defined(RAK_4631)
|
#elif defined(RAK_4631)
|
||||||
#include <helpers/nrf52/RAK4631Board.h>
|
#include <helpers/nrf52/RAK4631Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
@@ -616,7 +608,7 @@ public:
|
|||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
||||||
SPIClass spi;
|
SPIClass spi;
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
@@ -653,24 +645,18 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
|
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||||
|
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||||
|
#else
|
||||||
|
float tcxo = 1.6f;
|
||||||
|
#endif
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
|
|
||||||
#else // SX126X module
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
delay(5000);
|
delay(5000);
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
@@ -680,14 +666,12 @@ void setup() {
|
|||||||
|
|
||||||
radio.setCRC(0);
|
radio.setCRC(0);
|
||||||
|
|
||||||
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
|
#ifdef SX126X_CURRENT_LIMIT
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fast_rng.begin(radio.random(0x7FFFFFFF));
|
fast_rng.begin(radio.random(0x7FFFFFFF));
|
||||||
|
|||||||
@@ -76,22 +76,14 @@
|
|||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/CustomSX1268Wrapper.h>
|
#include <helpers/CustomSX1268Wrapper.h>
|
||||||
static XiaoC3Board board;
|
static XiaoC3Board board;
|
||||||
#elif defined(SEEED_XIAO_S3)
|
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/ESP32Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
static ESP32Board board;
|
static ESP32Board board;
|
||||||
#elif defined(LILYGO_T3)
|
#elif defined(LILYGO_TLORA)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/LilyGoTLoraBoard.h>
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
#include <helpers/CustomSX1276Wrapper.h>
|
||||||
static ESP32Board board;
|
static LilyGoTLoraBoard board;
|
||||||
#elif defined(LILYGO_T3S3)
|
|
||||||
#include <helpers/LilyGoT3S3Board.h>
|
|
||||||
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
|
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
|
||||||
#else
|
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
|
||||||
#endif
|
|
||||||
static LilyGoT3S3Board board;
|
|
||||||
#elif defined(RAK_4631)
|
#elif defined(RAK_4631)
|
||||||
#include <helpers/nrf52/RAK4631Board.h>
|
#include <helpers/nrf52/RAK4631Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
@@ -671,7 +663,7 @@ public:
|
|||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
||||||
SPIClass spi;
|
SPIClass spi;
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
@@ -708,24 +700,19 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
|
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||||
|
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||||
|
#else
|
||||||
|
float tcxo = 1.6f;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
|
|
||||||
#else // SX126X module
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
delay(5000);
|
delay(5000);
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
@@ -735,14 +722,12 @@ void setup() {
|
|||||||
|
|
||||||
radio.setCRC(0);
|
radio.setCRC(0);
|
||||||
|
|
||||||
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
|
#ifdef SX126X_CURRENT_LIMIT
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fast_rng.begin(radio.random(0x7FFFFFFF));
|
fast_rng.begin(radio.random(0x7FFFFFFF));
|
||||||
|
|||||||
@@ -62,22 +62,14 @@
|
|||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/CustomSX1268Wrapper.h>
|
#include <helpers/CustomSX1268Wrapper.h>
|
||||||
static XiaoC3Board board;
|
static XiaoC3Board board;
|
||||||
#elif defined(SEEED_XIAO_S3)
|
#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/ESP32Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
static ESP32Board board;
|
static ESP32Board board;
|
||||||
#elif defined(LILYGO_T3)
|
#elif defined(LILYGO_TLORA)
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/LilyGoTLoraBoard.h>
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
#include <helpers/CustomSX1276Wrapper.h>
|
||||||
static ESP32Board board;
|
static LilyGoTLoraBoard board;
|
||||||
#elif defined(LILYGO_T3S3)
|
|
||||||
#include <helpers/LilyGoT3S3Board.h>
|
|
||||||
#if defined(P_LORA_DIO_0) // If P_LORA_DIO_0 is defined, we're using SX1276
|
|
||||||
#include <helpers/CustomSX1276Wrapper.h>
|
|
||||||
#else
|
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
|
||||||
#endif
|
|
||||||
static LilyGoT3S3Board board;
|
|
||||||
#elif defined(RAK_4631)
|
#elif defined(RAK_4631)
|
||||||
#include <helpers/nrf52/RAK4631Board.h>
|
#include <helpers/nrf52/RAK4631Board.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
@@ -553,7 +545,7 @@ public:
|
|||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
#elif defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
#elif defined(LILYGO_TLORA) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
||||||
SPIClass spi;
|
SPIClass spi;
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
@@ -574,24 +566,19 @@ void setup() {
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
board.begin();
|
board.begin();
|
||||||
|
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||||
|
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||||
|
#else
|
||||||
|
float tcxo = 1.6f;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#elif defined(P_LORA_SCLK)
|
#elif defined(P_LORA_SCLK)
|
||||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LILYGO_T3) || defined(HELTEC_LORA_V2) // ESP32 with SX1276
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX127X_SYNC_WORD, LORA_TX_POWER);
|
|
||||||
#else // SX126X module
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
Serial.println(status);
|
Serial.println(status);
|
||||||
@@ -600,14 +587,12 @@ void setup() {
|
|||||||
|
|
||||||
radio.setCRC(0);
|
radio.setCRC(0);
|
||||||
|
|
||||||
#if !defined(LILYGO_T3) && !defined(HELTEC_LORA_V2) // SX126X specific settings
|
#ifdef SX126X_CURRENT_LIMIT
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fast_rng.begin(radio.random(0x7FFFFFFF));
|
fast_rng.begin(radio.random(0x7FFFFFFF));
|
||||||
|
|||||||
@@ -320,16 +320,16 @@ lib_deps =
|
|||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
; =============
|
; =============
|
||||||
[LilyGo_T3_sx1276]
|
[LilyGo_TLora_V2_1_1_6]
|
||||||
extends = esp32_base
|
extends = esp32_base
|
||||||
board = ttgo-lora32-v1 ; TTGO/LilyGo T3 V1 ESP32 with SX1276
|
board = ttgo-lora32-v1 ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276
|
||||||
build_unflags = -Os
|
build_unflags = -Os
|
||||||
build_type = release ; Set build type to release
|
build_type = release ; Set build type to release
|
||||||
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_base.build_flags}
|
${esp32_base.build_flags}
|
||||||
-Os -ffunction-sections -fdata-sections ; Optimize for size
|
-Os -ffunction-sections -fdata-sections ; Optimize for size
|
||||||
-D LILYGO_T3
|
-D LILYGO_TLORA ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276
|
||||||
-D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin
|
-D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin
|
||||||
-D P_LORA_DIO_1=33 ; SX1276 DIO1 interrupt pin
|
-D P_LORA_DIO_1=33 ; SX1276 DIO1 interrupt pin
|
||||||
-D P_LORA_NSS=18 ; Chip select - SS pin
|
-D P_LORA_NSS=18 ; Chip select - SS pin
|
||||||
@@ -367,13 +367,13 @@ build_flags = ${esp32_base.build_flags}
|
|||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
|
|
||||||
|
|
||||||
; === LilyGo T3 with SX1276 environments ===
|
; === LILYGO T-LoRa V2.1-1.6 with SX1276 environments ===
|
||||||
[env:LilyGo_T3_sx1276_Repeater]
|
[env:LilyGo_TLora_V2_1_1_6_Repeater]
|
||||||
extends = LilyGo_T3_sx1276
|
extends = LilyGo_TLora_V2_1_1_6
|
||||||
build_src_filter = ${LilyGo_T3_sx1276.build_src_filter} +<../examples/simple_repeater/main.cpp>
|
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_repeater/main.cpp>
|
||||||
build_flags =
|
build_flags =
|
||||||
${LilyGo_T3_sx1276.build_flags}
|
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||||
-D ADVERT_NAME="\"T3-1276 Repeater\""
|
-D ADVERT_NAME="\"TLora-V2.1-1.6 Repeater\""
|
||||||
-D ADVERT_LAT=-37.0
|
-D ADVERT_LAT=-37.0
|
||||||
-D ADVERT_LON=145.0
|
-D ADVERT_LON=145.0
|
||||||
-D ADMIN_PASSWORD="\"password\""
|
-D ADMIN_PASSWORD="\"password\""
|
||||||
@@ -381,38 +381,38 @@ build_flags =
|
|||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
; -D CORE_DEBUG_LEVEL=3
|
; -D CORE_DEBUG_LEVEL=3
|
||||||
|
|
||||||
[env:LilyGo_T3_sx1276_terminal_chat]
|
[env:LilyGo_TLora_V2_1_1_6_terminal_chat]
|
||||||
extends = LilyGo_T3_sx1276
|
extends = LilyGo_TLora_V2_1_1_6
|
||||||
build_flags =
|
build_flags =
|
||||||
${LilyGo_T3_sx1276.build_flags}
|
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=1
|
-D MAX_GROUP_CHANNELS=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${LilyGo_T3_sx1276.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
|
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${LilyGo_T3_sx1276.lib_deps}
|
${LilyGo_TLora_V2_1_1_6.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:LilyGo_T3_sx1276_companion_radio_usb]
|
[env:LilyGo_TLora_V2_1_1_6_companion_radio_usb]
|
||||||
extends = LilyGo_T3_sx1276
|
extends = LilyGo_TLora_V2_1_1_6
|
||||||
build_flags =
|
build_flags =
|
||||||
${LilyGo_T3_sx1276.build_flags}
|
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=1
|
-D MAX_GROUP_CHANNELS=1
|
||||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||||
build_src_filter = ${LilyGo_T3_sx1276.build_src_filter} +<../examples/companion_radio/main.cpp>
|
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/companion_radio/main.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${LilyGo_T3_sx1276.lib_deps}
|
${LilyGo_TLora_V2_1_1_6.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:LilyGo_T3_sx1276_companion_radio_ble]
|
[env:LilyGo_TLora_V2_1_1_6_companion_radio_ble]
|
||||||
extends = LilyGo_T3_sx1276
|
extends = LilyGo_TLora_V2_1_1_6
|
||||||
build_flags =
|
build_flags =
|
||||||
${LilyGo_T3_sx1276.build_flags}
|
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=1
|
-D MAX_GROUP_CHANNELS=1
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
@@ -421,17 +421,17 @@ build_flags =
|
|||||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${LilyGo_T3_sx1276.build_src_filter} +<helpers/esp32/*.cpp> +<../examples/companion_radio/main.cpp>
|
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<helpers/esp32/*.cpp> +<../examples/companion_radio/main.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${LilyGo_T3_sx1276.lib_deps}
|
${LilyGo_TLora_V2_1_1_6.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:LilyGo_T3_sx1276_room_server]
|
[env:LilyGo_TLora_V2_1_1_6_room_server]
|
||||||
extends = LilyGo_T3_sx1276
|
extends = LilyGo_TLora_V2_1_1_6
|
||||||
build_src_filter = ${LilyGo_T3_sx1276.build_src_filter} +<../examples/simple_room_server/main.cpp>
|
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_room_server/main.cpp>
|
||||||
build_flags =
|
build_flags =
|
||||||
${LilyGo_T3_sx1276.build_flags}
|
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||||
-D ADVERT_NAME="\"T3-1276 Room\""
|
-D ADVERT_NAME="\"TLora-V2.1-1.6 Room\""
|
||||||
-D ADVERT_LAT=-37.0
|
-D ADVERT_LAT=-37.0
|
||||||
-D ADVERT_LON=145.0
|
-D ADVERT_LON=145.0
|
||||||
-D ADMIN_PASSWORD="\"password\""
|
-D ADMIN_PASSWORD="\"password\""
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include "ESP32Board.h"
|
|
||||||
#include <driver/rtc_io.h>
|
|
||||||
|
|
||||||
// LoRa radio module pins for LilyGo T3S3
|
|
||||||
// These need to be defined here for the SX1276 version
|
|
||||||
#if defined(RADIO_CLASS) && defined(CustomSX1276)
|
|
||||||
// SX1276 pin definitions specific to LilyGo T3S3
|
|
||||||
#define P_LORA_DIO_0 34 // DIO0 interrupt pin (SX1276 uses DIO0)
|
|
||||||
#define P_LORA_DIO_1 33 // DIO1 interrupt pin
|
|
||||||
#define P_LORA_NSS 7 // Chip select
|
|
||||||
#define P_LORA_RESET 8 // Reset pin
|
|
||||||
#define P_LORA_SCLK 5 // SPI clock
|
|
||||||
#define P_LORA_MISO 3 // SPI MISO
|
|
||||||
#define P_LORA_MOSI 6 // SPI MOSI
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Base class for LilyGo T-series boards
|
|
||||||
class LilyGoTBoard : public ESP32Board {
|
|
||||||
public:
|
|
||||||
void begin() {
|
|
||||||
ESP32Board::begin();
|
|
||||||
|
|
||||||
esp_reset_reason_t reason = esp_reset_reason();
|
|
||||||
if (reason == ESP_RST_DEEPSLEEP) {
|
|
||||||
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
|
||||||
if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep)
|
|
||||||
startup_reason = BD_STARTUP_RX_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS);
|
|
||||||
rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1) {
|
|
||||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
|
||||||
|
|
||||||
// Make sure the DIO1 and NSS GPIOs are hold on required levels during deep sleep
|
|
||||||
rtc_gpio_set_direction((gpio_num_t)P_LORA_DIO_1, RTC_GPIO_MODE_INPUT_ONLY);
|
|
||||||
rtc_gpio_pulldown_en((gpio_num_t)P_LORA_DIO_1);
|
|
||||||
|
|
||||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
|
||||||
|
|
||||||
if (pin_wake_btn < 0) {
|
|
||||||
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet
|
|
||||||
} else {
|
|
||||||
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet OR wake btn
|
|
||||||
}
|
|
||||||
|
|
||||||
if (secs > 0) {
|
|
||||||
esp_sleep_enable_timer_wakeup(secs * 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally set ESP32 into sleep
|
|
||||||
esp_deep_sleep_start(); // CPU halts here and never returns!
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t getBattMilliVolts() override {
|
|
||||||
analogReadResolution(12);
|
|
||||||
|
|
||||||
uint32_t raw = 0;
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
raw += analogReadMilliVolts(PIN_VBAT_READ);
|
|
||||||
}
|
|
||||||
raw = raw / 8;
|
|
||||||
|
|
||||||
return (2 * raw);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Standard ESP32 version (for T3 board)
|
|
||||||
class LilyGoT3Board : public LilyGoTBoard {
|
|
||||||
public:
|
|
||||||
const char* getManufacturerName() const override {
|
|
||||||
return "LilyGo T3";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// For S3 variant
|
|
||||||
class LilyGoT3S3Board : public LilyGoTBoard {
|
|
||||||
public:
|
|
||||||
const char* getManufacturerName() const override {
|
|
||||||
return "LilyGo T3S3";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
24
src/helpers/LilyGoTLoraBoard.h
Normal file
24
src/helpers/LilyGoTLoraBoard.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "ESP32Board.h"
|
||||||
|
|
||||||
|
// LILYGO T-LoRa V2.1-1.6 board with SX1276
|
||||||
|
class LilyGoTLoraBoard : public ESP32Board {
|
||||||
|
public:
|
||||||
|
const char* getManufacturerName() const override {
|
||||||
|
return "LILYGO T-LoRa V2.1-1.6";
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t getBattMilliVolts() override {
|
||||||
|
analogReadResolution(12);
|
||||||
|
|
||||||
|
uint32_t raw = 0;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
raw += analogReadMilliVolts(PIN_VBAT_READ);
|
||||||
|
}
|
||||||
|
raw = raw / 8;
|
||||||
|
|
||||||
|
return (2 * raw);
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user