Browse Source

Allow extra options to be added to the root page (#53)

* Null check for _savecallback

* Bump version number

* Add ability to extend options page

* Bump version number
Paul Andrews 5 years ago
parent
commit
3c3c1cb9a7
4 changed files with 11 additions and 2 deletions
  1. 6 0
      ESPAsyncWiFiManager.cpp
  2. 3 0
      ESPAsyncWiFiManager.h
  3. 1 1
      library.json
  4. 1 1
      library.properties

+ 6 - 0
ESPAsyncWiFiManager.cpp

@@ -750,6 +750,7 @@ void AsyncWiFiManager::handleRoot(AsyncWebServerRequest *request) {
   page += "</h1>";
   page += F("<h3>AsyncWiFiManager</h3>");
   page += FPSTR(HTTP_PORTAL_OPTIONS);
+  page += _customOptionsElement;
   page += FPSTR(HTTP_END);
 
   request->send(200, "text/html", page);
@@ -1114,6 +1115,11 @@ void AsyncWiFiManager::setCustomHeadElement(const char* element) {
   _customHeadElement = element;
 }
 
+//sets a custom element to add to options page
+void AsyncWiFiManager::setCustomOptionsElement(const char* element) {
+  _customOptionsElement = element;
+}
+
 //if this is true, remove duplicated Access Points - defaut true
 void AsyncWiFiManager::setRemoveDuplicateAPs(boolean removeDuplicates) {
   _removeDuplicateAPs = removeDuplicates;

+ 3 - 0
ESPAsyncWiFiManager.h

@@ -167,6 +167,8 @@ public:
   void          setCustomHeadElement(const char* element);
   //if this is true, remove duplicated Access Points - defaut true
   void          setRemoveDuplicateAPs(boolean removeDuplicates);
+  //sets a custom element to add to options page
+  void          setCustomOptionsElement(const char* element);
 
 private:
   AsyncWebServer *server;
@@ -218,6 +220,7 @@ private:
   boolean       _tryWPS                 = false;
 #endif
   const char*   _customHeadElement      = "";
+  const char*   _customOptionsElement   = "";
 
   //String        getEEPROMString(int start, int len);
   //void          setEEPROMString(int start, int len, String string);

+ 1 - 1
library.json

@@ -9,5 +9,5 @@
   },
   "frameworks": "arduino",
   "platforms": ["espressif8266", "espressif32"],
-  "version": "0.20"
+  "version": "0.21"
 }

+ 1 - 1
library.properties

@@ -1,5 +1,5 @@
 name=ESP Async WiFi Manager
-version=0.20
+version=0.21
 author=alanswx
 maintainer=alanswx
 sentence=ESP8266 and ESP32 Async WiFi Connection manager with fallback web configuration portal