Heltec WT added1
This commit is contained in:
parent
c54843622c
commit
ad507cb4c9
|
|
@ -30,9 +30,7 @@ debug_tool = esp-prog
|
|||
lib_deps =
|
||||
bblanchon/ArduinoJson @ 6.21.3
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
jgromes/RadioLib @ 6.1.0
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
jgromes/RadioLib @ 6.1.0
|
||||
adafruit/Adafruit Unified Sensor@^1.1.9
|
||||
adafruit/Adafruit BME280 Library@^2.2.2
|
||||
adafruit/Adafruit BMP280 Library@^2.6.8
|
||||
|
|
@ -51,6 +49,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:heltec-lora32-v2]
|
||||
|
|
@ -62,6 +62,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:heltec_wifi_lora_32_V3]
|
||||
|
|
@ -74,6 +76,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:ESP32_DIY_LoRa]
|
||||
|
|
@ -85,6 +89,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:ESP32_DIY_1W_LoRa]
|
||||
|
|
@ -96,6 +102,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:ttgo-t-beam-v1_2]
|
||||
|
|
@ -108,6 +116,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
lewisxhe/XPowersLib@^0.1.8
|
||||
|
||||
|
||||
|
|
@ -121,6 +131,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
lewisxhe/XPowersLib@^0.1.8
|
||||
|
||||
|
||||
|
|
@ -134,6 +146,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
lewisxhe/XPowersLib@^0.1.8
|
||||
|
||||
|
||||
|
|
@ -147,6 +161,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
lewisxhe/XPowersLib@^0.1.8
|
||||
|
||||
|
||||
|
|
@ -159,6 +175,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:heltec_wireless_stick]
|
||||
|
|
@ -171,6 +189,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:heltec_ht-ct62]
|
||||
|
|
@ -183,6 +203,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:WEMOS-LOLIN32-OLED-DIY]
|
||||
|
|
@ -194,6 +216,8 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:ESP32_DIY_LoRa_A7670]
|
||||
|
|
@ -205,9 +229,12 @@ build_flags =
|
|||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
vshymanskyy/TinyGSM@^0.11.7
|
||||
vshymanskyy/StreamDebugger@^1.0.1
|
||||
|
||||
|
||||
[env:ttgo-lora32-v21-915]
|
||||
board = ttgo-lora32-v21
|
||||
build_flags =
|
||||
|
|
@ -216,4 +243,44 @@ build_flags =
|
|||
-DHAS_SX1276
|
||||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
${common.lib_deps}
|
||||
adafruit/Adafruit GFX Library @ 1.11.5
|
||||
adafruit/Adafruit SSD1306 @ 2.5.7
|
||||
|
||||
|
||||
[env:heltec_wireless_tracker]
|
||||
board = esp32-s3-devkitc-1
|
||||
board_build.mcu = esp32s3
|
||||
build_flags =
|
||||
-Werror -Wall
|
||||
-DHELTEC_WIRELESS_TRACKER
|
||||
-DHAS_SX1262
|
||||
-DHAS_TFT
|
||||
-D USER_SETUP_LOADED
|
||||
-D TFT_WIDTH=80
|
||||
-D TFT_HEIGHT=160
|
||||
-D ST7735_DRIVER
|
||||
-D ST7735_GREENTAB160x80
|
||||
-D TFT_RGB_ORDER=TFT_BGR
|
||||
-D TFT_MOSI=42
|
||||
-D TFT_SCLK=41
|
||||
-D TFT_CS=38
|
||||
-D TFT_DC=40
|
||||
-D TFT_RST=39
|
||||
-D TFT_BL=21
|
||||
-D TFT_BACKLIGHT_ON=1
|
||||
-D TOUCH_CS=-1
|
||||
-D LOAD_GLCD
|
||||
-D LOAD_FONT2
|
||||
-D LOAD_FONT4
|
||||
-D LOAD_FONT6
|
||||
-D LOAD_FONT7
|
||||
-D LOAD_FONT8
|
||||
-D SPI_FREQUENCY=27000000
|
||||
-D USE_HSPI_PORT
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
bodmer/TFT_eSPI@^2.5.43
|
||||
|
|
@ -1,3 +1,17 @@
|
|||
/*______________________________________________________________________________________________________________
|
||||
|
||||
██╗ ██████╗ ██████╗ █████╗ █████╗ ██████╗ ██████╗ ███████╗ ██╗ ██████╗ █████╗ ████████╗███████╗
|
||||
██║ ██╔═══██╗██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██║██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝
|
||||
██║ ██║ ██║██████╔╝███████║ ███████║██████╔╝██████╔╝███████╗ ██║██║ ███╗███████║ ██║ █████╗
|
||||
██║ ██║ ██║██╔══██╗██╔══██║ ██╔══██║██╔═══╝ ██╔══██╗╚════██║ ██║██║ ██║██╔══██║ ██║ ██╔══╝
|
||||
███████╗╚██████╔╝██║ ██║██║ ██║ ██║ ██║██║ ██║ ██║███████║ ██║╚██████╔╝██║ ██║ ██║ ███████╗
|
||||
╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝
|
||||
|
||||
Ricardo Guzman - CA2RXU
|
||||
https://github.com/richonguzman/LoRa_APRS_Tracker
|
||||
(donations : http://paypal.me/richonguzman)
|
||||
______________________________________________________________________________________________________________*/
|
||||
|
||||
#include <ElegantOTA.h>
|
||||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
|
|
@ -27,7 +41,7 @@
|
|||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
String versionDate = "2024.05.08";
|
||||
String versionDate = "2024.05.11";
|
||||
uint8_t myWiFiAPIndex = 0;
|
||||
int myWiFiAPSize = Config.wifiAPs.size();
|
||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace BME_Utils {
|
|||
status = bme.begin(0x76); // Don't forget to join pins for righ direction on BME280!
|
||||
if (!status) {
|
||||
Serial.println("Could not find a valid BME280 or BMP280 sensor, check wiring!");
|
||||
show_display("ERROR", "", "BME/BMP sensor active", "but no sensor found...", "", 2000);
|
||||
show_display("ERROR", "", "BME/BMP sensor active", "but no sensor found...", 2000);
|
||||
} else {
|
||||
#ifdef BME280Sensor
|
||||
bme.setSampling(Adafruit_BME280::MODE_FORCED,
|
||||
|
|
|
|||
450
src/display.cpp
450
src/display.cpp
|
|
@ -1,185 +1,367 @@
|
|||
#include <Adafruit_SSD1306.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Wire.h>
|
||||
#include "configuration.h"
|
||||
#include "pins_config.h"
|
||||
#include "display.h"
|
||||
|
||||
|
||||
#ifdef HAS_DISPLAY
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);
|
||||
#ifdef HAS_TFT
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
#define bigSizeFont 2
|
||||
#define smallSizeFont 1
|
||||
#define lineSpacing 9
|
||||
#endif
|
||||
#else
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#if defined(HELTEC_V3)
|
||||
#define OLED_DISPLAY_HAS_RST_PIN
|
||||
#endif
|
||||
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
String oldHeader, oldFirstLine, oldSecondLine, oldThirdLine, oldFourthLine, oldFifthLine, oldSixthLine;
|
||||
|
||||
void cleanTFT() {
|
||||
#ifdef HAS_TFT
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool shouldCleanTFT3(String header, String line1, String line2, String line3) {
|
||||
if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3) {
|
||||
oldHeader = header;
|
||||
oldFirstLine = line1;
|
||||
oldSecondLine = line2;
|
||||
oldThirdLine = line3;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool shouldCleanTFT6(String header, String line1, String line2, String line3, String line4, String line5, String line6) {
|
||||
if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3 || oldFourthLine != line4 || oldFifthLine != line5 || oldSixthLine != line6) {
|
||||
oldHeader = header;
|
||||
oldFirstLine = line1;
|
||||
oldSecondLine = line2;
|
||||
oldThirdLine = line3;
|
||||
oldFourthLine = line4;
|
||||
oldFifthLine = line5;
|
||||
oldSixthLine = line6;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void setup_display() {
|
||||
#ifdef HAS_DISPLAY
|
||||
Wire.begin(OLED_SDA, OLED_SCL);
|
||||
delay(500);
|
||||
#ifdef HAS_TFT
|
||||
tft.init();
|
||||
tft.begin();
|
||||
tft.setRotation(1);
|
||||
tft.setTextFont(0);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
#else
|
||||
#ifdef OLED_DISPLAY_HAS_RST_PIN
|
||||
pinMode(OLED_RST, OUTPUT);
|
||||
digitalWrite(OLED_RST, LOW);
|
||||
delay(20);
|
||||
digitalWrite(OLED_RST, HIGH);
|
||||
#endif
|
||||
Wire.begin(OLED_SDA, OLED_SCL);
|
||||
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
if (Config.display.turn180) {
|
||||
display.setRotation(2);
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(1000);
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
if (Config.display.turn180) {
|
||||
display.setRotation(2);
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
void display_toggle(bool toggle) {
|
||||
#ifdef HAS_DISPLAY
|
||||
if (toggle) {
|
||||
display.ssd1306_command(SSD1306_DISPLAYON);
|
||||
#ifdef HAS_TFT
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#else
|
||||
display.ssd1306_command(SSD1306_DISPLAYON);
|
||||
#endif
|
||||
} else {
|
||||
display.ssd1306_command(SSD1306_DISPLAYOFF);
|
||||
#ifdef HAS_TFT
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#else
|
||||
display.ssd1306_command(SSD1306_DISPLAYOFF);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, int wait) {
|
||||
void show_display(String header, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
cleanTFT();
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, int wait) {
|
||||
void show_display(String header, String line1, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line2);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
cleanTFT();
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(header);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line1);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, String line3, int wait) {
|
||||
void show_display(String header, String line1, String line2, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line3);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
cleanTFT();
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(line1);
|
||||
tft.setCursor(0, ((lineSpacing * 3) - 2));
|
||||
tft.print(line2);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line2);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, String line3, String line4, int wait) {
|
||||
void show_display(String header, String line1, String line2, String line3, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line4);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
if (shouldCleanTFT3(header, line1, line2, line3)) {
|
||||
cleanTFT();
|
||||
}
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(line1);
|
||||
tft.setCursor(0, ((lineSpacing * 3) - 2));
|
||||
tft.print(line2);
|
||||
tft.setCursor(0, ((lineSpacing * 4) - 2));
|
||||
tft.print(line3);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line3);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, int wait) {
|
||||
void show_display(String header, String line1, String line2, String line3, String line4, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line4);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line5);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
cleanTFT();
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(line1);
|
||||
tft.setCursor(0, ((lineSpacing * 3) - 2));
|
||||
tft.print(line2);
|
||||
tft.setCursor(0, ((lineSpacing * 4) - 2));
|
||||
tft.print(line3);
|
||||
tft.setCursor(0, ((lineSpacing * 5) - 2));
|
||||
tft.print(line4);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line4);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, int wait) {
|
||||
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line4);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line5);
|
||||
display.setCursor(0, 40);
|
||||
display.println(line6);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
cleanTFT();
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(line1);
|
||||
tft.setCursor(0, ((lineSpacing * 3) - 2));
|
||||
tft.print(line2);
|
||||
tft.setCursor(0, ((lineSpacing * 4) - 2));
|
||||
tft.print(line3);
|
||||
tft.setCursor(0, ((lineSpacing * 5) - 2));
|
||||
tft.print(line4);
|
||||
tft.setCursor(0, ((lineSpacing * 6) - 2));
|
||||
tft.print(line5);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setCursor(0, 8);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line4);
|
||||
display.setCursor(0, 40);
|
||||
display.println(line5);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, int wait) {
|
||||
void show_display(String header, String line1, String line2, String line3, String line4, String line5, String line6, int wait) {
|
||||
#ifdef HAS_DISPLAY
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(2);
|
||||
display.setCursor(0, 0);
|
||||
display.println(line1);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line4);
|
||||
display.setCursor(0, 40);
|
||||
display.println(line5);
|
||||
display.setCursor(0, 48);
|
||||
display.println(line6);
|
||||
display.setCursor(0, 56);
|
||||
display.println(line7);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
delay(wait);
|
||||
#ifdef HAS_TFT
|
||||
if (shouldCleanTFT6(header, line1, line2, line3, line4, line5, line6)) {
|
||||
cleanTFT();
|
||||
}
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK);
|
||||
tft.setTextSize(bigSizeFont);
|
||||
tft.setCursor(0, 0);
|
||||
tft.print(header);
|
||||
tft.setTextSize(smallSizeFont);
|
||||
tft.setCursor(0, ((lineSpacing * 2) - 2));
|
||||
tft.print(line1);
|
||||
tft.setCursor(0, ((lineSpacing * 3) - 2));
|
||||
tft.print(line2);
|
||||
tft.setCursor(0, ((lineSpacing * 4) - 2));
|
||||
tft.print(line3);
|
||||
tft.setCursor(0, ((lineSpacing * 5) - 2));
|
||||
tft.print(line4);
|
||||
tft.setCursor(0, ((lineSpacing * 6) - 2));
|
||||
tft.print(line5);
|
||||
tft.setCursor(0, ((lineSpacing * 7) - 2));
|
||||
tft.print(line6);
|
||||
#else
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(2);
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 16);
|
||||
display.println(line1);
|
||||
display.setCursor(0, 24);
|
||||
display.println(line2);
|
||||
display.setCursor(0, 32);
|
||||
display.println(line3);
|
||||
display.setCursor(0, 40);
|
||||
display.println(line4);
|
||||
display.setCursor(0, 48);
|
||||
display.println(line5);
|
||||
display.setCursor(0, 56);
|
||||
display.println(line6);
|
||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(1);
|
||||
display.display();
|
||||
#endif
|
||||
delay(wait);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -3,20 +3,20 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
|
||||
#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
|
||||
|
||||
|
||||
void cleanTFT();
|
||||
bool shouldCleanTFT3(String header, String line1, String line2, String line3);
|
||||
bool shouldCleanTFT6(String header, String line1, String line2, String line3, String line4, String line5, String line6);
|
||||
void setup_display();
|
||||
void display_toggle(bool toggle);
|
||||
|
||||
void show_display(String line1, int wait = 0);
|
||||
void show_display(String line1, String line2, int wait = 0);
|
||||
void show_display(String line1, String line2, String line3, int wait = 0);
|
||||
void show_display(String line1, String line2, String line3, String line4, int wait = 0);
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, int wait = 0);
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, int wait = 0);
|
||||
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, int wait = 0);
|
||||
/*void show_display(String header, int wait = 0);
|
||||
void show_display(String header, String line1, int wait = 0);
|
||||
void show_display(String header, String line1, String line2, int wait = 0);*/
|
||||
void show_display(String header, String line1, String line2, String line3, int wait = 0);
|
||||
/*void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0);
|
||||
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0);*/
|
||||
void show_display(String header, String line1, String line2, String line3, String line4, String line5, String line6, int wait = 0);
|
||||
|
||||
#endif
|
||||
|
|
@ -95,6 +95,16 @@
|
|||
#define A7670_RX_PIN 27
|
||||
#endif
|
||||
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
#define RADIO_SCLK_PIN 9
|
||||
#define RADIO_MISO_PIN 11
|
||||
#define RADIO_MOSI_PIN 10
|
||||
#define RADIO_CS_PIN 8
|
||||
#define RADIO_RST_PIN 12
|
||||
#define RADIO_DIO1_PIN 14 // SX1262 IRQ
|
||||
#define RADIO_BUSY_PIN 13 // SX1262 BUSY
|
||||
#endif
|
||||
|
||||
|
||||
// OLED
|
||||
#if defined(TTGO_T_LORA32_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915)
|
||||
|
|
@ -125,7 +135,6 @@
|
|||
#define HAS_DISPLAY
|
||||
#endif
|
||||
|
||||
|
||||
// Leds and other stuff
|
||||
#ifdef HELTEC_HTCT62
|
||||
#define BATTERY_PIN 1
|
||||
|
|
@ -140,6 +149,7 @@
|
|||
#define VEXT_CTRL 36
|
||||
#define ADC_CTRL 37
|
||||
#endif
|
||||
|
||||
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
||||
#define INTERNAL_LED_PIN 2
|
||||
#endif
|
||||
|
|
@ -148,7 +158,14 @@
|
|||
#define BATTERY_PIN 35
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
#define INTERNAL_LED_PIN 18
|
||||
#define BATTERY_PIN 1
|
||||
#define ADC_CTRL 2 // HELTEC Wireless Tracker ADC_CTRL = HIGH powers the voltage divider to read BatteryPin. Only on V05 = V1.1
|
||||
#define VEXT_CTRL 3 // To turn on GPS and TFT
|
||||
#define BOARD_I2C_SDA 7
|
||||
#define BOARD_I2C_SCL 6
|
||||
#endif
|
||||
|
||||
#ifdef ESP32_C3_DIY_LoRa
|
||||
#define OLED_SDA 8
|
||||
|
|
|
|||
|
|
@ -145,6 +145,11 @@ namespace POWER_Utils {
|
|||
#ifdef ADC_CTRL
|
||||
pinMode(ADC_CTRL, OUTPUT);
|
||||
#endif
|
||||
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
Wire.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);
|
||||
#endif
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace WIFI_Utils {
|
|||
WiFi.disconnect();
|
||||
delay(500);
|
||||
unsigned long start = millis();
|
||||
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||
show_display("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
while (WiFi.status() != WL_CONNECTED && wifiCounter<myWiFiAPSize) {
|
||||
|
|
@ -72,7 +72,7 @@ namespace WIFI_Utils {
|
|||
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
start = millis();
|
||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||
show_display("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||
WiFi.disconnect();
|
||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
}
|
||||
|
|
@ -84,17 +84,17 @@ namespace WIFI_Utils {
|
|||
if (WiFi.status() == WL_CONNECTED) {
|
||||
Serial.print("Connected as ");
|
||||
Serial.println(WiFi.localIP());
|
||||
show_display("", "", " Connected!!", "" , " loading ...", 1000);
|
||||
show_display("", " Connected!!", "" , " loading ...", 1000);
|
||||
} else if (WiFi.status() != WL_CONNECTED) {
|
||||
startAP = true;
|
||||
|
||||
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
||||
show_display("", "", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||
show_display("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||
}
|
||||
WiFiConnected = !startAP;
|
||||
if (startAP) {
|
||||
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
||||
show_display("", "", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
|
||||
show_display("", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
|
||||
|
||||
startAutoAP();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue