diff --git a/CHANGELOG.md b/CHANGELOG.md index dc447d3c..6ee8f26f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added last-modified header to static contents - Added support for multi-button boards (SONOFF_4CH) - Added support for WorkChoice ecoPlug (ECOPLUG). Thanks to David Myers +- Added support for Sonoff SV +- Added DNS captive portal for AP mode - Force password changing if it's the default one - Comment out hardware selection in hardware.h if using Arduino IDE diff --git a/code/src/config/general.h b/code/src/config/general.h index 250ef440..f971ebb9 100644 --- a/code/src/config/general.h +++ b/code/src/config/general.h @@ -37,6 +37,7 @@ #define HTTP_USERNAME "admin" #define WS_BUFFER_SIZE 5 #define WS_TIMEOUT 1800000 +#define DNS_PORT 53 // ----------------------------------------------------------------------------- // OTA & NOFUSS diff --git a/code/src/main.ino b/code/src/main.ino index c87b5c2b..b72f3b0d 100644 --- a/code/src/main.ino +++ b/code/src/main.ino @@ -85,9 +85,12 @@ void welcome() { DEBUG_MSG("%s\n%s\n\n", (char *) APP_AUTHOR, (char *) APP_WEBSITE); //DEBUG_MSG("Device: %s\n", (char *) getIdentifier().c_str()); DEBUG_MSG("ChipID: %06X\n", ESP.getChipId()); + DEBUG_MSG("CPU frequency: %d MHz\n", ESP.getCpuFreqMHz()); DEBUG_MSG("Last reset reason: %s\n", (char *) ESP.getResetReason().c_str()); DEBUG_MSG("Memory size: %d bytes\n", ESP.getFlashChipSize()); DEBUG_MSG("Free heap: %d bytes\n", ESP.getFreeHeap()); + DEBUG_MSG("Firmware size: %d bytes\n", ESP.getSketchSize()); + DEBUG_MSG("Free firmware space: %d bytes\n", ESP.getFreeSketchSpace()); FSInfo fs_info; if (SPIFFS.info(fs_info)) { DEBUG_MSG("File system total size: %d bytes\n", fs_info.totalBytes); diff --git a/code/src/wifi.ino b/code/src/wifi.ino index 5a055020..f291af12 100644 --- a/code/src/wifi.ino +++ b/code/src/wifi.ino @@ -8,6 +8,9 @@ Copyright (C) 2016 by Xose PĂ©rez */ #include "JustWifi.h" +#include + +DNSServer dnsServer; // ----------------------------------------------------------------------------- // WIFI @@ -147,10 +150,19 @@ void wifiSetup() { } + // Configure captive portal + if (code == MESSAGE_ACCESSPOINT_CREATED) { + dnsServer.start(DNS_PORT, "*", WiFi.softAPIP()); + } + if (code == MESSAGE_DISCONNECTED) { + dnsServer.stop(); + } + }); } void wifiLoop() { jw.loop(); + dnsServer.processNextRequest(); }