From 179c93f96a3b9ac4037602c68d8e96c904dffff0 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Sun, 3 Dec 2023 13:17:51 -0300 Subject: [PATCH] added support for Heltec Lora32v2 --- platformio.ini | 16 +++++++++++++--- src/LoRa_APRS_iGate.cpp | 2 +- src/display.h | 5 ----- src/pins_config.h | 17 +++++++++++++++-- src/wifi_utils.cpp | 1 - 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/platformio.ini b/platformio.ini index 31a7e28..bc36c86 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,9 +8,11 @@ ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html -[env:ttgo-lora32-v21] +[platformio] +default_envs = ttgo-lora32-v21 + +[env] platform = espressif32 @ 6.3.1 -board = ttgo-lora32-v21 framework = arduino monitor_speed = 115200 lib_deps = @@ -24,4 +26,12 @@ lib_deps = mikalhart/TinyGPSPlus @ 1.0.3 adafruit/Adafruit Unified Sensor@^1.1.9 adafruit/Adafruit BME280 Library@^2.2.2 - adafruit/Adafruit BMP280 Library@^2.6.8 \ No newline at end of file + adafruit/Adafruit BMP280 Library@^2.6.8 + +[env:ttgo-lora32-v21] +board = ttgo-lora32-v21 +build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1 + +[env:heltec-lora32-v2] +board = ttgo-lora32-v21 +build_flags = -Werror -Wall -DHELTEC_V2 \ No newline at end of file diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index d0fef32..cc312f5 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -20,7 +20,7 @@ Configuration Config; WiFiClient espClient; -String versionDate = "2023.11.26"; +String versionDate = "2023.12.03"; int myWiFiAPIndex = 0; int myWiFiAPSize = Config.wifiAPs.size(); WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex]; diff --git a/src/display.h b/src/display.h index 5c2f29e..8b30c20 100644 --- a/src/display.h +++ b/src/display.h @@ -6,11 +6,6 @@ #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 -#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) -/*change to -#define OLED_RESET 16 -for HELTEC_WIFI_LORA_32_V2 screen to work -*/ void setup_display(); void display_toggle(bool toggle); diff --git a/src/pins_config.h b/src/pins_config.h index b3478cf..6e8f885 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -3,6 +3,10 @@ #include +#undef OLED_SDA +#undef OLED_SCL +#undef OLED_RST + #define LORA_SCK 5 // GPIO5 - SX1276 SCK #define LORA_MISO 19 // GPIO19 - SX1276 MISO #define LORA_MOSI 27 // GPIO27 - SX1276 MOSI @@ -10,8 +14,17 @@ #define LORA_RST 23 // GPIO14 - SX1276 RST #define LORA_IRQ 26 // GPIO26 - SX1276 IRQ ---->DIO0 -#define OLED_SDA 21 // change to "4" in Heltec WiFi Lora 32 V2 -#define OLED_SCL 22 // change to "15" in Heltec WiFi Lora 32 V2 +#ifdef TTGO_T_LORA_V2_1 +#define OLED_SDA 21 +#define OLED_SCL 22 +#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) +#endif + +#ifdef HELTEC_V2 +#define OLED_SDA 4 +#define OLED_SCL 15 +#define OLED_RESET 16 +#endif #define greenLed 25 // Green Led diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index b06f763..9ec139f 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -25,7 +25,6 @@ void checkWiFi() { void startWiFi() { int wifiCounter = 0; - int status = WL_IDLE_STATUS; if (stationMode!=6) { WiFi.mode(WIFI_STA); WiFi.disconnect();