diff --git a/lib/esp8266-oled-ssd1306/OLED_SSD1306_SH1106_images.h b/lib/esp8266-oled-ssd1306/OLED_SSD1306_SH1106_images.h index 8c35854cf..095ac8e22 100644 --- a/lib/esp8266-oled-ssd1306/OLED_SSD1306_SH1106_images.h +++ b/lib/esp8266-oled-ssd1306/OLED_SSD1306_SH1106_images.h @@ -1,31 +1,21 @@ -#define WiFi_Logo_width 60 -#define WiFi_Logo_height 36 -const char WiFi_Logo_bits[] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, - 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, - 0x00, 0xFF, 0xFF, 0xFF, 0x07, 0xC0, 0x83, 0x01, 0x80, 0xFF, 0xFF, 0xFF, - 0x01, 0x00, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0C, 0x00, - 0xC0, 0xFF, 0xFF, 0x7C, 0x00, 0x60, 0x0C, 0x00, 0xC0, 0x31, 0x46, 0x7C, - 0xFC, 0x77, 0x08, 0x00, 0xE0, 0x23, 0xC6, 0x3C, 0xFC, 0x67, 0x18, 0x00, - 0xE0, 0x23, 0xE4, 0x3F, 0x1C, 0x00, 0x18, 0x00, 0xE0, 0x23, 0x60, 0x3C, - 0x1C, 0x70, 0x18, 0x00, 0xE0, 0x03, 0x60, 0x3C, 0x1C, 0x70, 0x18, 0x00, - 0xE0, 0x07, 0x60, 0x3C, 0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C, - 0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00, - 0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00, 0xE0, 0x8F, 0x71, 0x3C, - 0x1C, 0x70, 0x18, 0x00, 0xC0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x08, 0x00, - 0xC0, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x0C, 0x00, 0x80, 0xFF, 0xFF, 0x1F, - 0x00, 0x00, 0x06, 0x00, 0x80, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x07, 0x00, - 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0xFF, 0xFF, - 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, - 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; +#define espeasy_logo_width 36 +#define espeasy_logo_height 36 +const char espeasy_logo_bits[] PROGMEM= { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0x40, 0xc0, 0x00, 0x00, 0x70, 0xf0, 0xe0, + 0x01, 0x00, 0x78, 0xf8, 0xf0, 0x01, 0x00, 0x3c, 0x7c, 0xf8, 0x00, 0x00, + 0x1e, 0x3e, 0x7c, 0x00, 0x00, 0x0f, 0x1f, 0x3e, 0x00, 0x80, 0x87, 0x0f, + 0x1f, 0x00, 0xc0, 0xc3, 0x87, 0x0f, 0x00, 0xe0, 0xe1, 0xc3, 0x07, 0x00, + 0xf0, 0xf0, 0xe1, 0xc3, 0x00, 0x78, 0xf8, 0xf0, 0xe1, 0x01, 0x30, 0x7c, + 0xf8, 0xf0, 0x00, 0x00, 0x3e, 0x7c, 0x78, 0x00, 0x00, 0x1f, 0x3e, 0x3c, + 0x00, 0x80, 0x0f, 0x1f, 0x1e, 0x00, 0xc0, 0x87, 0x0f, 0x0f, 0x00, 0xe0, + 0xc3, 0x87, 0x07, 0x00, 0xf0, 0xe1, 0xc3, 0x03, 0x00, 0xf0, 0xf0, 0xe1, + 0x01, 0x00, 0x78, 0xf8, 0xf0, 0x00, 0x00, 0x30, 0x7c, 0x78, 0x00, 0x00, + 0x00, 0x3e, 0x3c, 0x00, 0x00, 0x00, 0x1f, 0x1e, 0x00, 0x00, 0x80, 0x0f, + 0x0f, 0x78, 0x00, 0xc0, 0x87, 0x07, 0xfc, 0x00, 0xe0, 0xc3, 0x03, 0xfc, + 0x01, 0xf0, 0xe1, 0x01, 0xfc, 0x01, 0xf8, 0xf0, 0x00, 0xfc, 0x00, 0x78, + 0x70, 0x00, 0x78, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; const char activeSymbole[] PROGMEM = { B00000000, @@ -48,4 +38,3 @@ const char inactiveSymbole[] PROGMEM = { B00000000, B00000000 }; - diff --git a/lib/pubsubclient/src/PubSubClient.cpp b/lib/pubsubclient/src/PubSubClient.cpp index f26f0532b..c00c65453 100644 --- a/lib/pubsubclient/src/PubSubClient.cpp +++ b/lib/pubsubclient/src/PubSubClient.cpp @@ -420,7 +420,7 @@ boolean PubSubClient::publish_P(const char* topic, const uint8_t* payload, unsig lastOutActivity = millis(); - return rc == tlen + 4 + plength; + return rc == tlen + 3 + llen + plength; } boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length) { diff --git a/lib/pubsubclient/src/PubSubClient.h b/lib/pubsubclient/src/PubSubClient.h index d82d6ae7b..c6f8e6757 100644 --- a/lib/pubsubclient/src/PubSubClient.h +++ b/lib/pubsubclient/src/PubSubClient.h @@ -73,7 +73,7 @@ #define MQTTQOS1 (1 << 1) #define MQTTQOS2 (2 << 1) -#ifdef ESP8266 +#if defined(ESP8266) || defined(ESP32) #include #define MQTT_CALLBACK_SIGNATURE std::function callback #else diff --git a/src/Controller.ino b/src/Controller.ino index dd9c31b7b..743c9e3d1 100644 --- a/src/Controller.ino +++ b/src/Controller.ino @@ -120,9 +120,9 @@ void callback(char* c_topic, byte* b_payload, unsigned int length) { /*********************************************************************************************\ * Connect to MQTT message broker \*********************************************************************************************/ -void MQTTConnect(int controller_idx) +bool MQTTConnect(int controller_idx) { - if (!WiFiConnected(100)) return; + if (!WiFiConnected(100)) return false; if (MQTTclient.connected()) MQTTclient.disconnect(); ControllerSettingsStruct ControllerSettings; @@ -141,58 +141,52 @@ void MQTTConnect(int controller_idx) String LWTTopic = ControllerSettings.Subscribe; LWTTopic.replace(F("/#"), F("/status")); LWTTopic.replace(F("%sysname%"), Settings.Name); + LWTTopic += F("/LWT"); // Extend the topic for status updates of connected/disconnected status. - for (byte x = 1; x < 3; x++) - { - String log = ""; - boolean MQTTresult = false; + boolean MQTTresult = false; + uint8_t willQos = 0; + boolean willRetain = true; - if ((SecuritySettings.ControllerUser[controller_idx] != 0) && (SecuritySettings.ControllerPassword[controller_idx] != 0)) - MQTTresult = MQTTclient.connect(clientid.c_str(), SecuritySettings.ControllerUser[controller_idx], SecuritySettings.ControllerPassword[controller_idx], LWTTopic.c_str(), 0, 0, "Connection Lost"); - else - MQTTresult = MQTTclient.connect(clientid.c_str(), LWTTopic.c_str(), 0, 0, "Connection Lost"); - yield(); - - if (MQTTresult) - { - MQTTclient_should_reconnect = false; - log = F("MQTT : Connected to broker with client ID: "); - log += clientid; - addLog(LOG_LEVEL_INFO, log); - subscribeTo = ControllerSettings.Subscribe; - subscribeTo.replace(F("%sysname%"), Settings.Name); - MQTTclient.subscribe(subscribeTo.c_str()); - log = F("Subscribed to: "); - log += subscribeTo; - addLog(LOG_LEVEL_INFO, log); - - MQTTclient.publish(LWTTopic.c_str(), "Connected", 1); - - statusLED(true); - return; // end loop if succesfull - } - else - { - log = F("MQTT : ClientID "); - log += clientid; - log +=" failed to connected to broker"; - addLog(LOG_LEVEL_ERROR, log); - } - - delay(500); + if ((SecuritySettings.ControllerUser[controller_idx] != 0) && (SecuritySettings.ControllerPassword[controller_idx] != 0)) { + MQTTresult = MQTTclient.connect(clientid.c_str(), SecuritySettings.ControllerUser[controller_idx], SecuritySettings.ControllerPassword[controller_idx], + LWTTopic.c_str(), willQos, willRetain, "Connection Lost"); + } else { + MQTTresult = MQTTclient.connect(clientid.c_str(), LWTTopic.c_str(), willQos, willRetain, "Connection Lost"); } + yield(); + + if (!MQTTresult) { + addLog(LOG_LEVEL_ERROR, F("MQTT : Failed to connect to broker")); + return false; + } + MQTTclient_should_reconnect = false; + String log = F("MQTT : Connected to broker with client ID: "); + log += clientid; + addLog(LOG_LEVEL_INFO, log); + String subscribeTo = ControllerSettings.Subscribe; + subscribeTo.replace(F("%sysname%"), Settings.Name); + MQTTclient.subscribe(subscribeTo.c_str()); + log = F("Subscribed to: "); + log += subscribeTo; + addLog(LOG_LEVEL_INFO, log); + + if (MQTTclient.publish(LWTTopic.c_str(), "Connected")) { + statusLED(true); + return true; // end loop if succesfull + } + return false; } /*********************************************************************************************\ * Check connection MQTT message broker \*********************************************************************************************/ -void MQTTCheck(int controller_idx) +bool MQTTCheck(int controller_idx) { byte ProtocolIndex = getProtocolIndex(Settings.Protocol[controller_idx]); if (Protocol[ProtocolIndex].usesMQTT) { - if (MQTTclient_should_reconnect || !WiFiConnected(100) || !MQTTclient.connected()) + if (MQTTclient_should_reconnect || !WiFiConnected(10) || !MQTTclient.connected()) { if (MQTTclient_should_reconnect) { addLog(LOG_LEVEL_ERROR, F("MQTT : Intentional reconnect")); @@ -200,11 +194,13 @@ void MQTTCheck(int controller_idx) addLog(LOG_LEVEL_ERROR, F("MQTT : Connection lost")); connectionFailures += 2; } - MQTTConnect(controller_idx); - } - else if (connectionFailures) + return MQTTConnect(controller_idx); + } else if (connectionFailures) { connectionFailures--; + } } + // When no MQTT protocol is enabled, all is fine. + return true; } diff --git a/src/ESPEasy.ino b/src/ESPEasy.ino index a3966396a..d0403b87e 100644 --- a/src/ESPEasy.ino +++ b/src/ESPEasy.ino @@ -132,6 +132,10 @@ #define DEFAULT_TIME_ZONE 0 // Time Offset (in minutes) #define DEFAULT_USE_DST false // (true|false) Use Daily Time Saving +#define LOG_TO_SERIAL 1 +#define LOG_TO_SYSLOG 2 +#define LOG_TO_WEBLOG 3 +#define LOG_TO_SDCARD 4 #define DEFAULT_SYSLOG_IP "" // Syslog IP Address #define DEFAULT_SYSLOG_LEVEL 0 // Syslog Log Level #define DEFAULT_SERIAL_LOG_LEVEL LOG_LEVEL_INFO // Serial Log Level @@ -975,6 +979,7 @@ unsigned long timer100ms; unsigned long timer20ms; unsigned long timer1s; unsigned long timerwd; +unsigned long timermqtt; unsigned long lastSend; unsigned long lastWeb; unsigned int NC_Count = 0; @@ -1175,6 +1180,7 @@ void setup() timer100ms = 0; // timer for periodic actions 10 x per/sec timer1s = 0; // timer for periodic actions once per/sec timerwd = 0; // timer for watchdog once per 30 sec + timermqtt = 0; // Timer for the MQTT keep alive loop. PluginInit(); CPluginInit(); @@ -1190,12 +1196,14 @@ void setup() if (Settings.UDPPort != 0) portUDP.begin(Settings.UDPPort); +/* // Setup MQTT Client // ToDo TD-er: Controller index is forced to the first enabled MQTT controller. int enabledMqttController = firstEnabledMQTTController(); if (enabledMqttController >= 0) { MQTTConnect(enabledMqttController); } +*/ sendSysInfoUDP(3); @@ -1280,12 +1288,21 @@ void loop() if (timeOutReached(timer1s)) runOncePerSecond(); - } - //dont do this in backgroundtasks(), otherwise causes crashes. (https://github.com/letscontrolit/ESPEasy/issues/683) - int enabledMqttController = firstEnabledMQTTController(); - if (enabledMqttController >= 0) { - MQTTclient.loop(); + if (timeOutReached(timermqtt)) { + // MQTT_KEEPALIVE = 15 seconds. + timermqtt = millis() + 250; + //dont do this in backgroundtasks(), otherwise causes crashes. (https://github.com/letscontrolit/ESPEasy/issues/683) + int enabledMqttController = firstEnabledMQTTController(); + if (enabledMqttController >= 0) { + if (!MQTTclient.loop()) { + if (!MQTTCheck(enabledMqttController)) { + // Check failed, no need to retry it immediately. + timermqtt = millis() + 500; + } + } + } + } } backgroundtasks(); diff --git a/src/Misc.ino b/src/Misc.ino index 883ded607..22dde213c 100644 --- a/src/Misc.ino +++ b/src/Misc.ino @@ -1363,27 +1363,57 @@ void addLog(byte logLevel, const __FlashStringHelper* flashString) addLog(logLevel, s.c_str()); } +bool SerialAvailableForWrite() { + if (!Settings.UseSerial) return false; + if (!Serial.availableForWrite()) return false; // UART FIFO overflow or TX disabled. + return true; +} + +boolean loglevelActiveFor(byte destination, byte logLevel) { + byte logLevelSettings = 0; + switch (destination) { + case LOG_TO_SERIAL: { + if (!SerialAvailableForWrite()) return false; + logLevelSettings = Settings.SerialLogLevel; + break; + } + case LOG_TO_SYSLOG: { + logLevelSettings = Settings.SyslogLevel; + break; + } + case LOG_TO_WEBLOG: { + logLevelSettings = Settings.WebLogLevel; + break; + } + case LOG_TO_SDCARD: { + logLevelSettings = Settings.SDLogLevel; + break; + } + default: + return false; + } + return loglevelActive(logLevel, logLevelSettings); +} + + boolean loglevelActive(byte logLevel, byte logLevelSettings) { return (logLevel <= logLevelSettings); } -void addLog(byte loglevel, const char *line) +void addLog(byte logLevel, const char *line) { - if (Settings.UseSerial) - if (loglevelActive(loglevel, Settings.SerialLogLevel)) - Serial.println(line); - - if (loglevelActive(loglevel, Settings.SyslogLevel)) + if (loglevelActiveFor(LOG_TO_SERIAL, logLevel)) { + Serial.println(line); + } + if (loglevelActiveFor(LOG_TO_SYSLOG, logLevel)) { syslog(line); - - if (loglevelActive(loglevel, Settings.WebLogLevel)) - { + } + if (loglevelActiveFor(LOG_TO_WEBLOG, logLevel)) { Logging.add(line); } #ifdef FEATURE_SD - if (loglevelActive(loglevel, Settings.SDLogLevel)) - { + if (loglevelActiveFor(LOG_TO_SDCARD, logLevel)) { File logFile = SD.open("log.dat", FILE_WRITE); if (logFile) logFile.println(line); diff --git a/src/WebServer.ino b/src/WebServer.ino index d0904e1d3..e58bef1f3 100644 --- a/src/WebServer.ino +++ b/src/WebServer.ino @@ -175,6 +175,7 @@ void WebServerInit() WebServer.on("/rules", handle_rules); WebServer.on("/sysinfo", handle_sysinfo); WebServer.on("/pinstates", handle_pinstates); + WebServer.on("/favicon.ico", handle_favicon); #if defined(ESP8266) if (ESP.getFlashChipRealSize() > 524288) @@ -4494,7 +4495,15 @@ void handle_sysinfo() { reply += F("Allowed IP Range"); reply += describeAllowedIPrange(); - reply += F("STA MAC"); + reply += F("Serial Port available:"); + reply += String(SerialAvailableForWrite()); + reply += F(" ("); + reply += Serial.availableForWrite(); + reply += F(" , "); + reply += Serial.available(); + reply += F(")"); + + reply += F("STA MAC:"); uint8_t mac[] = {0, 0, 0, 0, 0, 0}; uint8_t* macread = WiFi.macAddress(mac); char macaddress[20]; @@ -4538,17 +4547,17 @@ void handle_sysinfo() { reply += F("Build Md5"); for (byte i = 0; i<16; i++) reply += String(CRCValues.compileTimeMD5[i],HEX); - + reply += F("Md5 check"); - if (! CRCValues.checkPassed()) + if (! CRCValues.checkPassed()) reply +="fail !"; else reply +="passed."; - + reply += F("Build time"); reply += String(CRCValues.compileDate); reply += " "; reply += String(CRCValues.compileTime); - + reply += F("

ESP board

"); reply += F("ESP Chip ID"); @@ -4678,3 +4687,112 @@ String getValueSymbol(byte index) ret += F(";"); return ret; } + + +/*********************************************************************************************\ + * ESP Easy logo Favicon.ico 16x16 8 bit +\*********************************************************************************************/ +// Generated using xxd: xxd -i favicon.ico > favicon.ino +static const char favicon_8b_ico[] PROGMEM = { + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x00, + 0x20, 0x00, 0x68, 0x04, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x12, 0x0b, + 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xef, 0xc0, 0x89, 0x11, 0xfe, 0xfb, 0xf8, 0xac, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf3, + 0xe9, 0xac, 0xef, 0xc0, 0x89, 0x11, 0xfe, 0xfb, 0xf8, 0xac, 0xf1, 0xc8, + 0x95, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfc, 0xf3, 0xe9, 0xac, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd9, 0x69, + 0x00, 0xff, 0xd9, 0x69, 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd9, 0x69, 0x00, 0xff, 0xd9, 0x69, 0x00, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xc8, + 0x95, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xd8, 0x63, 0x00, 0xff, 0xef, 0xbc, + 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbc, 0x80, 0xff, 0xd8, 0x63, + 0x00, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf1, + 0xe6, 0xac, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xf1, 0xc8, + 0x95, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc2, + 0x8a, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xc2, 0x8a, 0xff, 0xf1, 0xc8, 0x95, 0xff, 0xfe, 0xfb, + 0xf8, 0xac, 0xef, 0xc0, 0x89, 0x11, 0xfb, 0xf1, 0xe6, 0xac, 0xfe, 0xfa, + 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfa, + 0xf5, 0xff, 0xfe, 0xfa, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfb, + 0xf8, 0xac, 0xef, 0xc0, 0x89, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +unsigned int favicon_8b_ico_len = 1150; + +void handle_favicon() { + WebServer.send_P(200, PSTR("image/x-icon"), favicon_8b_ico, favicon_8b_ico_len); +} diff --git a/src/_P036_FrameOLED.ino b/src/_P036_FrameOLED.ino index 667115312..2c7673404 100644 --- a/src/_P036_FrameOLED.ino +++ b/src/_P036_FrameOLED.ino @@ -225,7 +225,7 @@ boolean Plugin_036(byte function, struct EventStruct *event, String& string) // Display the device name, logo, time and wifi display_header(); - // display_logo(); + display_logo(); display->display(); // Set up the display timer @@ -503,8 +503,14 @@ void display_title(String& title) { } void display_logo() { - // draw an xbm image. - display->drawXbm(34, 14, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits); + display->setTextAlignment(TEXT_ALIGN_LEFT); + display->setFont(ArialMT_Plain_16); + display->setColor(BLACK); + display->fillRect(0, 14, 128, 64); + display->setColor(WHITE); + display->drawString(65, 15, F("ESP")); + display->drawString(65, 34, F("Easy")); + display->drawXbm(24, 14, espeasy_logo_width, espeasy_logo_height, espeasy_logo_bits); } // Draw the frame position