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 dd50850..d7e4c18 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 @@ -209,6 +217,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; @@ -415,11 +430,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(); @@ -430,15 +441,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"; } } @@ -968,6 +979,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 460b0c4..b3608ca 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; @@ -418,8 +425,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()); }