From c8fac1b56aa80c2d32d12f0d10b77dc6f3ecf831 Mon Sep 17 00:00:00 2001 From: code8buster Date: Sat, 7 Aug 2021 17:23:51 -0400 Subject: [PATCH 1/6] Initial changes to specify pins for dual SX1276 modules and board def for platformio --- firmware/config.h | 20 ++++++++++++++++++++ firmware/platformio.ini | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/firmware/config.h b/firmware/config.h index 02c0a30..f22a42f 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -98,4 +98,24 @@ #define LORA2_CS 25 #endif +#ifdef ESP32_V3 +#define LORA_IRQ 36 +#define LORA_CS 27 +#define LORA_IO1 11 +#define LORA_IO2 NOT_A_PIN +#define LORA_RST 15 +#define LORA_SCK 30 +#define LORA_MOSI 37 +#define LORA_MISO 31 +#define LORA_RXEN 28 + +#define DUAL_LORA + +#define LORA2_CS 9 +#define LORA2_IRQ 7 +#define LORA2_RST 15 +#define LORA2_IO1 12 +#define LORA2_IO2 NOT_A_PIN +#define LORA2_RXEN 33 + #endif diff --git a/firmware/platformio.ini b/firmware/platformio.ini index c640c75..057b038 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -17,7 +17,8 @@ default_envs= ;ttgo-lora32-tbeam ;heltec-v2 ;sparkfun-lora - ;lopy4 + ; lopy4 + ; esp32-v3 [env] platform = https://github.com/platformio/platform-espressif32.git @@ -92,3 +93,9 @@ build_flags = -DLOPY4 -I./src ; -DDUAL_LORA ; -DLL2_DEBUG +[env:esp32-v3] +board = esp32-v3 +build_flags = -DESP32_V3 + -DRL_SX1276 + -I./src + -DDUAL_LORA From 2af0a382b761f653cb2b507eb3018bca7ea5fdbb Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 8 Aug 2021 01:11:57 -0400 Subject: [PATCH 2/6] Removed redundant defines, changed platformio.ini to use esp32dev target w/ correct ram size for esp32-wroom-32u --- firmware/config.h | 3 ++- firmware/platformio.ini | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/firmware/config.h b/firmware/config.h index f22a42f..1717f9e 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -109,7 +109,7 @@ #define LORA_MISO 31 #define LORA_RXEN 28 -#define DUAL_LORA +//comment all LORA2 lines and -DDUAL_LORA build flag to disable second module #define LORA2_CS 9 #define LORA2_IRQ 7 @@ -117,5 +117,6 @@ #define LORA2_IO1 12 #define LORA2_IO2 NOT_A_PIN #define LORA2_RXEN 33 +#endif #endif diff --git a/firmware/platformio.ini b/firmware/platformio.ini index 057b038..efc4ded 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -13,7 +13,7 @@ src_dir = . data_dir = ../web/static default_envs= ;ttgo-lora32-v1 - ttgo-lora32-v2 + ttgo-lora32-v2 ;ttgo-lora32-tbeam ;heltec-v2 ;sparkfun-lora @@ -94,8 +94,9 @@ build_flags = -DLOPY4 ; -DDUAL_LORA ; -DLL2_DEBUG [env:esp32-v3] -board = esp32-v3 +board = esp32dev +board_upload.maximum_ram_size = 532480 build_flags = -DESP32_V3 - -DRL_SX1276 + -DRL_SX1276 -I./src -DDUAL_LORA From 880687f1a3934ceb4f2c8dfad5fd3750d708154a Mon Sep 17 00:00:00 2001 From: code8buster Date: Wed, 17 Nov 2021 15:03:05 -0500 Subject: [PATCH 3/6] Redefined pins for v3, added two-module instantiation in main --- .gitignore | 3 ++- firmware/config.h | 27 ++++++++++++++------------- firmware/main.ino | 14 ++++++++++++-- firmware/platformio.ini | 9 +++++---- 4 files changed, 33 insertions(+), 20 deletions(-) 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 1717f9e..a45de54 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -99,24 +99,25 @@ #endif #ifdef ESP32_V3 -#define LORA_IRQ 36 -#define LORA_CS 27 -#define LORA_IO1 11 + +#define LORA_IRQ 22 +#define LORA_CS 16 +#define LORA_IO1 26 #define LORA_IO2 NOT_A_PIN -#define LORA_RST 15 -#define LORA_SCK 30 -#define LORA_MOSI 37 -#define LORA_MISO 31 -#define LORA_RXEN 28 +#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 9 -#define LORA2_IRQ 7 -#define LORA2_RST 15 -#define LORA2_IO1 12 +#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 33 +#define LORA2_RXEN 21 #endif #endif diff --git a/firmware/main.ino b/firmware/main.ino index a930368..dba91c2 100644 --- a/firmware/main.ino +++ b/firmware/main.ino @@ -23,6 +23,9 @@ #ifdef RL_SX1276 #include #endif +#ifdef RL_SX1262 +#include +#endif #include @@ -79,6 +82,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" @@ -355,7 +365,7 @@ void setupLoRa() Layer1_1->setTxPower(txPower); Layer1_1->setSpreadingFactor(spreadingFactor); #endif - #ifdef RL_SX1276 + #ifdef RL_SX1262 pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, LOW); #ifdef DUAL_LORA @@ -366,7 +376,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 efc4ded..add108c 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -13,12 +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 - ; esp32-v3 + esp32-v3 [env] platform = https://github.com/platformio/platform-espressif32.git @@ -35,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 @@ -95,8 +95,9 @@ build_flags = -DLOPY4 ; -DLL2_DEBUG [env:esp32-v3] board = esp32dev +board_upload.maximum_size = 4194304 board_upload.maximum_ram_size = 532480 build_flags = -DESP32_V3 - -DRL_SX1276 + -DRL_SX1262 -I./src -DDUAL_LORA From e6573f716a8918584137539ed11f1a5457ccd49d Mon Sep 17 00:00:00 2001 From: code8buster Date: Thu, 18 Nov 2021 20:55:31 -0500 Subject: [PATCH 4/6] combined 1276/1262 ifdef --- firmware/main.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/main.ino b/firmware/main.ino index dba91c2..bc68fce 100644 --- a/firmware/main.ino +++ b/firmware/main.ino @@ -75,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 @@ -365,7 +366,7 @@ void setupLoRa() Layer1_1->setTxPower(txPower); Layer1_1->setSpreadingFactor(spreadingFactor); #endif - #ifdef RL_SX1262 + #if defined ( RL_SX1276 ) || defined ( RL_SX1262 ) pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, LOW); #ifdef DUAL_LORA From 412575a2108ab45132169a11bf3aa030b4aa112f Mon Sep 17 00:00:00 2001 From: code8buster Date: Mon, 22 Nov 2021 18:28:33 -0500 Subject: [PATCH 5/6] Commented all ARDUINO_LORA ifdefs since the compiler refuses to use the new sx1262 class --- firmware/main.ino | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/firmware/main.ino b/firmware/main.ino index bc68fce..dbeb2ca 100644 --- a/firmware/main.ino +++ b/firmware/main.ino @@ -1,5 +1,5 @@ #include - +#define RL_SX1262 // required for LoRa and/or AsyncSDServer libraries? #include #include @@ -15,16 +15,17 @@ #include #endif #include "config.h" - +/* #ifdef ARDUINO_LORA #include #endif - +*/ #ifdef RL_SX1276 #include #endif #ifdef RL_SX1262 #include +#undef ARDUINO_LORA #endif #include @@ -71,11 +72,11 @@ AsyncWebServer http_server(80); AsyncWebSocket ws_server("/ws"); 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 @@ -359,6 +360,7 @@ void setupLoRa() #ifdef LOPY4 SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI); //LORA_CS); #endif + /* #ifdef ARDUINO_LORA Layer1Class *Layer1_1 = new Layer1Class(); Layer1_1->setPins(LORA_CS, LORA_RST, LORA_IRQ); @@ -366,6 +368,7 @@ void setupLoRa() Layer1_1->setTxPower(txPower); Layer1_1->setSpreadingFactor(spreadingFactor); #endif + */ #if defined ( RL_SX1276 ) || defined ( RL_SX1262 ) pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, LOW); From 839072f75f86fbc670f7450d2a36acc5ad3e9788 Mon Sep 17 00:00:00 2001 From: code8buster Date: Tue, 23 Nov 2021 21:16:15 -0500 Subject: [PATCH 6/6] Uncommenting Arduino-LoRa lines, ifndefs added in Layer2 to fix preprocessor problems --- firmware/main.ino | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/firmware/main.ino b/firmware/main.ino index dbeb2ca..711f782 100644 --- a/firmware/main.ino +++ b/firmware/main.ino @@ -1,5 +1,5 @@ #include -#define RL_SX1262 + // required for LoRa and/or AsyncSDServer libraries? #include #include @@ -15,17 +15,16 @@ #include #endif #include "config.h" -/* + #ifdef ARDUINO_LORA #include #endif -*/ + #ifdef RL_SX1276 #include #endif #ifdef RL_SX1262 #include -#undef ARDUINO_LORA #endif #include @@ -72,11 +71,11 @@ AsyncWebServer http_server(80); AsyncWebSocket ws_server("/ws"); 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 @@ -360,15 +359,15 @@ 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 - */ + #if defined ( RL_SX1276 ) || defined ( RL_SX1262 ) pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, LOW);