diff --git a/.gitignore b/.gitignore index b7a2eec..34691b7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,8 @@ web/node_modules makeEspArduino/ lib/** firmware/lib/** - +hardware/board_esp32_v3/** +firmware/platformio.ini .pio .vscode secrets.h diff --git a/firmware/config.h b/firmware/config.h index 02c0a30..a45de54 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -98,4 +98,26 @@ #define LORA2_CS 25 #endif +#ifdef ESP32_V3 + +#define LORA_IRQ 22 +#define LORA_CS 16 +#define LORA_IO1 26 +#define LORA_IO2 NOT_A_PIN +#define LORA_RST NOT_A_PIN +#define LORA_SCK 18 +#define LORA_MOSI 23 +#define LORA_MISO 19 +#define LORA_RXEN 17 + +//comment all LORA2 lines and -DDUAL_LORA build flag to disable second module + +#define LORA2_CS 33 +#define LORA2_IRQ 35 +#define LORA2_RST NOT_A_PIN +#define LORA2_IO1 27 +#define LORA2_IO2 NOT_A_PIN +#define LORA2_RXEN 21 +#endif + #endif diff --git a/firmware/main.ino b/firmware/main.ino index a930368..711f782 100644 --- a/firmware/main.ino +++ b/firmware/main.ino @@ -23,6 +23,9 @@ #ifdef RL_SX1276 #include #endif +#ifdef RL_SX1262 +#include +#endif #include @@ -72,6 +75,7 @@ BleUartClient ble_client; #ifdef ARDUINO_LORA Layer1Class *Layer1 = new Layer1Class(); #endif + #ifdef RL_SX1276 SX1276 lora = new Module(LORA_CS, LORA_IRQ, LORA_RST, RADIOLIB_NC); #ifdef DUAL_LORA @@ -79,6 +83,13 @@ SX1276 lora = new Module(LORA_CS, LORA_IRQ, LORA_RST, RADIOLIB_NC); #endif #endif +#ifdef RL_SX1262 +SX1262 lora = new Module(LORA_CS, LORA_IRQ, LORA_RST, RADIOLIB_NC); + #ifdef DUAL_LORA + SX1262 lora2 = new Module(LORA2_CS, LORA2_IRQ, LORA2_RST, RADIOLIB_NC); + #endif +#endif + LL2Class *LL2; #include "settings/settings.h" @@ -348,14 +359,16 @@ void setupLoRa() #ifdef LOPY4 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI); //LORA_CS); #endif - #ifdef ARDUINO_LORA + + #if defined (ARDUINO_LORA) Layer1Class *Layer1_1 = new Layer1Class(); Layer1_1->setPins(LORA_CS, LORA_RST, LORA_IRQ); Layer1_1->setLoRaFrequency(loraFrq*1E6); Layer1_1->setTxPower(txPower); Layer1_1->setSpreadingFactor(spreadingFactor); #endif - #ifdef RL_SX1276 + + #if defined ( RL_SX1276 ) || defined ( RL_SX1262 ) pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, LOW); #ifdef DUAL_LORA @@ -366,7 +379,7 @@ void setupLoRa() #ifdef DUAL_LORA digitalWrite(LORA_CS, HIGH); digitalWrite(LORA2_CS, LOW); - Layer1Class *Layer1_2 = new Layer1Class(&lora2, 0, LORA2_CS, LORA2_RST, LORA2_IRQ, 7, 433, 17); + Layer1Class *Layer1_2 = new Layer1Class(&lora2, 0, LORA2_CS, LORA2_RST, LORA2_IRQ, 7, 915, 17); digitalWrite(LORA_CS, LOW); digitalWrite(LORA2_CS, HIGH); #endif diff --git a/firmware/platformio.ini b/firmware/platformio.ini index c640c75..add108c 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -13,11 +13,12 @@ src_dir = . data_dir = ../web/static default_envs= ;ttgo-lora32-v1 - ttgo-lora32-v2 + ;ttgo-lora32-v2 ;ttgo-lora32-tbeam ;heltec-v2 ;sparkfun-lora - ;lopy4 + ; lopy4 + esp32-v3 [env] platform = https://github.com/platformio/platform-espressif32.git @@ -34,7 +35,7 @@ lib_deps = ESP Async WebServer@1.2.3 LoRa@0.7.2 https://github.com/jgromes/RadioLib#3682c6c9215891e3afb7672f1235fde1c3bd75fd - https://github.com/sudomesh/LoRaLayer2#efaa3fa73e3c8f6a7c66e335873c0bd81cc865e3 + https://github.com/code8buster/LoRaLayer2.git#esp32v3 https://github.com/paidforby/AsyncSDServer#13375c6be978cb34180378ecf4042a3a4a1f5eab ESP8266 and ESP32 OLED driver for SSD1306 displays TinyGPSPlus@1.0.2 @@ -92,3 +93,11 @@ build_flags = -DLOPY4 -I./src ; -DDUAL_LORA ; -DLL2_DEBUG +[env:esp32-v3] +board = esp32dev +board_upload.maximum_size = 4194304 +board_upload.maximum_ram_size = 532480 +build_flags = -DESP32_V3 + -DRL_SX1262 + -I./src + -DDUAL_LORA