From 87d8dbc55879020774663ffef4d8f68a431a673d Mon Sep 17 00:00:00 2001 From: Sottosistema W10 Date: Fri, 17 Sep 2021 20:53:54 +0200 Subject: [PATCH 1/3] Added images.h for future development --- include/images.h | 45 +++++++++++++++++++++++++++++++++++ src/TTGO_T-Beam_LoRa_APRS.ino | 14 ++++------- 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 include/images.h diff --git a/include/images.h b/include/images.h new file mode 100644 index 0000000..ad1a821 --- /dev/null +++ b/include/images.h @@ -0,0 +1,45 @@ +#pragma once + +#define SATELLITE_IMAGE_WIDTH 16 +#define SATELLITE_IMAGE_HEIGHT 15 +const uint8_t SATELLITE_IMAGE[] PROGMEM = {0x00, 0x08, 0x00, 0x1C, 0x00, 0x0E, 0x20, 0x07, 0x70, 0x02, + 0xF8, 0x00, 0xF0, 0x01, 0xE0, 0x03, 0xC8, 0x01, 0x9C, 0x54, + 0x0E, 0x52, 0x07, 0x48, 0x02, 0x26, 0x00, 0x10, 0x00, 0x0E}; + +const uint8_t imgSatellite[] PROGMEM = { 0x70, 0x71, 0x22, 0xFA, 0xFA, 0x22, 0x71, 0x70 }; +const uint8_t imgUSB[] PROGMEM = { 0x60, 0x60, 0x30, 0x18, 0x18, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x24, 0x24, 0x24, 0x3C }; +const uint8_t imgPower[] PROGMEM = { 0x40, 0x40, 0x40, 0x58, 0x48, 0x08, 0x08, 0x08, 0x1C, 0x22, 0x22, 0x41, 0x7F, 0x22, 0x22, 0x22 }; +const uint8_t imgUser[] PROGMEM = { 0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x42, 0x3C }; +const uint8_t imgPositionEmpty[] PROGMEM = { 0x20, 0x30, 0x28, 0x24, 0x42, 0xFF }; +const uint8_t imgPositionSolid[] PROGMEM = { 0x20, 0x30, 0x38, 0x3C, 0x7E, 0xFF }; +const uint8_t imgInfo[] PROGMEM = { 0xFF, 0x81, 0x81, 0xB5, 0xB5, 0x81, 0x81, 0xFF }; + +// We now programmatically draw our compass +#if 0 +const +#include "img/compass.xbm" +#endif + +#if 0 +const uint8_t activeSymbol[] PROGMEM = { + B00000000, + B00000000, + B00011000, + B00100100, + B01000010, + B01000010, + B00100100, + B00011000 +}; + +const uint8_t inactiveSymbol[] PROGMEM = { + B00000000, + B00000000, + B00000000, + B00000000, + B00011000, + B00011000, + B00000000, + B00000000 +}; +#endif diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 6508baa..468f4d4 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -397,11 +397,7 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3 display.println(Line4); display.setCursor(0,56); display.println(Line5); - if (enabled_oled){ - //axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // enable oled - //display.dim(false); - }else{ - //axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); // disable oled + if (!enabled_oled){ // disable oled display.dim(true); } display.display(); @@ -412,15 +408,15 @@ String getSatAndBatInfo() { String line5; if(gps_state == true){ if(InpVolts > 4){ - line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 2) + "V *"; + line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V *"; }else{ - line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 2) + "V"; + line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V"; } }else{ if(InpVolts > 4){ - line5 = "SAT: X BAT: " + String(BattVolts, 2) + "V *"; + line5 = "SAT: X BAT: " + String(BattVolts, 1) + "V *"; }else{ - line5 = "SAT: X BAT: " + String(BattVolts, 2) + "V"; + line5 = "SAT: X BAT: " + String(BattVolts, 1) + "V"; } } From ab3b3a3c372e26162b822ced8a91d7b17dc74d3a Mon Sep 17 00:00:00 2001 From: LucaIU2FRL Date: Sat, 18 Sep 2021 10:46:49 +0200 Subject: [PATCH 2/3] Added WiFi info screen at startup --- src/TTGO_T-Beam_LoRa_APRS.ino | 18 ++++++++++++++++++ src/taskWebServer.cpp | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 468f4d4..79dfe09 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -191,6 +191,13 @@ ulong oled_timer; // Variable to manually send beacon from html page bool manBeacon = false; +// Variable to show AP settings on OLED +bool apEnabled = false; +bool apConnected = false; +String infoApName = ""; +String infoApPass = ""; +String infoApAddr = ""; + #define ANGLE_AVGS 3 // angle averaging - x times float average_course[ANGLE_AVGS]; float avg_c_y, avg_c_x; @@ -878,6 +885,17 @@ void loop() { } } + // Show informations on WiFi Status + if (apConnected) { + enableOled(); // turn ON OLED temporary + writedisplaytext(" ((WiFi))","WiFi Client Mode","SSID: " + infoApName, "Pass: ********", "IP: " + infoApAddr, getSatAndBatInfo()); + apConnected=false; + } else if (apEnabled) { + enableOled(); // turn ON OLED temporary + writedisplaytext(" ((WiFi))","WiFi AP Mode","SSID: " + infoApName, "Pass: " + infoApPass, "IP: " + infoApAddr, getSatAndBatInfo()); + apEnabled=false; + } + if (manBeacon) { // Manually sending beacon from html page enableOled(); diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index ce39ab2..3ad432e 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -19,6 +19,13 @@ extern const char web_js_js_end[] asm("_binary_data_embed_js_js_out_end"); // Variable needed to send beacon from html page extern bool manBeacon; +// Variable to show AP status +extern bool apEnabled; +extern bool apConnected; +extern String infoApName; +extern String infoApPass; +extern String infoApAddr; + QueueHandle_t webListReceivedQueue = nullptr; std::list receivedPackets; const int MAX_RECEIVED_LIST_SIZE = 50; @@ -407,8 +414,16 @@ void handle_saveDeviceCfg(){ //Serial.println(WiFi.getMode()); if (WiFi.getMode() == 3){ Serial.println("Running AP. IP: " + WiFi.softAPIP().toString()); + apEnabled=true; + infoApName = apSSID.c_str(); + infoApPass = apSSID.c_str(); + infoApAddr = WiFi.softAPIP().toString(); } else if (WiFi.getMode() == 1) { Serial.println("Connected. IP: " + WiFi.localIP().toString()); + apConnected=true; + infoApName = wifi_ssid.c_str(); + infoApPass = wifi_password.c_str(); + infoApAddr = WiFi.localIP().toString(); } else { Serial.println("WiFi Mode: " + WiFi.getMode()); } From 1f56e83879cb0c6e9fd96fb5d93cf2bb1653e0b9 Mon Sep 17 00:00:00 2001 From: LucaIU2FRL Date: Sat, 18 Sep 2021 10:54:54 +0200 Subject: [PATCH 3/3] Modified Lora32 V2.1 as #47 --- src/TTGO_T-Beam_LoRa_APRS.ino | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 79dfe09..a6d9bd8 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -54,12 +54,20 @@ #define BUTTON 39 //pin number for Button on TTGO T-Beam #define BUZZER 15 // enter your buzzer pin gpio const byte TXLED = 4; //pin number for LED on TX Tracker +/* Original LORA32 V2.1 Setup #elif LORA32_21 #define I2C_SDA 4 #define I2C_SCL 15 #define BUTTON 2 //pin number for BUTTO #define BUZZER 13 // enter your buzzer pin gpio const byte TXLED = 4; //pin number for LED on TX Tracker +*/ +#elif LORA32_21 // Modified as in #47 + #define I2C_SDA 21 + #define I2C_SCL 22 + #define BUTTON 2 //pin number for BUTTO + #define BUZZER 13 // enter your buzzer pin gpio + const byte TXLED = 4; //pin number for LED on TX Tracker #elif LORA32_2 #define I2C_SDA 21 #define I2C_SCL 22