mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
add setDarkMode alias
This commit is contained in:
@@ -2907,6 +2907,18 @@ void WiFiManager::setClass(String str){
|
||||
_bodyClass = str;
|
||||
}
|
||||
|
||||
/**
|
||||
* setDarkMode
|
||||
* @param bool enable, enable dark mode via invert class
|
||||
*/
|
||||
void WiFiManager::setDarkMode(bool enable){
|
||||
_bodyClass = enable ? "invert" : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* setHttpPort
|
||||
* @param uint16_t port webserver port number default 80
|
||||
*/
|
||||
void WiFiManager::setHttpPort(uint16_t port){
|
||||
_httpPort = port;
|
||||
}
|
||||
|
||||
+8
-4
@@ -55,7 +55,7 @@
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
|
||||
#define WIFI_getChipId() ESP.getChipId()
|
||||
#define WIFI_getChipId() ESP.getChipId()
|
||||
#define WM_WIFIOPEN ENC_TYPE_NONE
|
||||
|
||||
#elif defined(ESP32)
|
||||
@@ -349,9 +349,12 @@ class WiFiManager
|
||||
// set the country code for wifi settings, CN
|
||||
void setCountry(String cc);
|
||||
|
||||
// set body class (invert), may be used for hacking in alt classes in the future
|
||||
// set body class (invert), may be used for hacking in alt classes
|
||||
void setClass(String str);
|
||||
|
||||
// set dark mode via invert class
|
||||
void setDarkMode(bool enable);
|
||||
|
||||
// get default ap esp uses , esp_chipid etc
|
||||
String getDefaultAPName();
|
||||
|
||||
@@ -587,11 +590,12 @@ class WiFiManager
|
||||
// build debuglevel support
|
||||
// @todo use DEBUG_ESP_x?
|
||||
|
||||
// Testing debug level memory
|
||||
// Set default debug level
|
||||
#ifndef WM_DEBUG_LEVEL
|
||||
#define WM_DEBUG_LEVEL DEBUG_DEV
|
||||
#define WM_DEBUG_LEVEL DEBUG_DEV // development default, not release
|
||||
#endif
|
||||
|
||||
// override debug level OFF
|
||||
#ifdef WM_NODEBUG
|
||||
#undef WM_DEBUG_LEVEL
|
||||
#endif
|
||||
|
||||
@@ -84,10 +84,7 @@ void setup() {
|
||||
|
||||
//reset settings - for testing
|
||||
// wm.resetSettings();
|
||||
// wm.erase();
|
||||
|
||||
// invert theme, dark
|
||||
wm.setClass("invert");
|
||||
// wm.erase();
|
||||
|
||||
// setup some parameters
|
||||
WiFiManagerParameter custom_html("<p>This Is Custom HTML</p>"); // only custom html
|
||||
@@ -119,14 +116,20 @@ void setup() {
|
||||
custom_html.setValue("test",4);
|
||||
custom_token.setValue("test",4);
|
||||
|
||||
// invert theme, dark
|
||||
wm.setDarkMode(true);
|
||||
|
||||
// show scan RSSI as percentage, instead of signal stength graphic
|
||||
// wm.setScanDispPerc(true);
|
||||
|
||||
/*
|
||||
Set cutom menu via menu[] or vector
|
||||
const char* menu[] = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"};
|
||||
wm.setMenu(menu,9); // custom menu array must provide length
|
||||
*/
|
||||
|
||||
std::vector<const char *> menu = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"};
|
||||
// wm.setMenu(menu); // custom menu, pass vector
|
||||
std::vector<const char *> menu = {"wifi","wifinoscan","info","param","close","sep","erase","update","restart","exit"};
|
||||
wm.setMenu(menu); // custom menu, pass vector
|
||||
|
||||
// wm.setParamsPage(true); // move params to seperate page, not wifi, do not combine with setmenu!
|
||||
|
||||
|
||||
@@ -51,13 +51,15 @@ void loop() {
|
||||
void doWiFiManager(){
|
||||
// is auto timeout portal running
|
||||
if(portalRunning){
|
||||
wm.process();
|
||||
wm.process(); // do processing
|
||||
|
||||
// check for timeout
|
||||
if((millis()-startTime) > (timeout*1000)){
|
||||
Serial.println("portaltimeout");
|
||||
portalRunning = false;
|
||||
if(startAP){
|
||||
wm.stopConfigPortal();
|
||||
}
|
||||
}
|
||||
else{
|
||||
wm.stopWebPortal();
|
||||
}
|
||||
|
||||
+11
-5
@@ -14,16 +14,22 @@
|
||||
#define _WM_STRINGS_H_
|
||||
|
||||
#ifndef WIFI_MANAGER_OVERRIDE_STRINGS
|
||||
// !!! THIS DOES NOT WORK, you cannot define in a sketch, if anyone one knows how to order includes to be able to do this help!
|
||||
// !!! ABOVE WILL NOT WORK if you define in your sketch, must be build flag, if anyone one knows how to order includes to be able to do this it would be neat.. I have seen it done..
|
||||
|
||||
const char HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html>"
|
||||
"<html lang='en'><head>"
|
||||
"<meta name='format-detection' content='telephone=no'>"
|
||||
"<meta charset='UTF-8'>"
|
||||
"<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>"
|
||||
"<title>{v}</title>";
|
||||
|
||||
const char HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html><html lang='en'><head><meta name='format-detection' content='telephone=no'><meta charset='UTF-8'><meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/><title>{v}</title>";
|
||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){"
|
||||
"document.getElementById('s').value=l.innerText||l.textContent;"
|
||||
"p = l.nextElementSibling.classList.contains('l');"
|
||||
"document.getElementById('p').disabled = !p;"
|
||||
"if(p)document.getElementById('p').focus();}</script>";
|
||||
"if(p)document.getElementById('p').focus();}</script>"; // @todo add button states, disable on click , show ack , spinner etc
|
||||
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body class='{c}'><div class='wrap'>";
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body class='{c}'><div class='wrap'>"; // {c} = _bodyclass
|
||||
// example of embedded logo, base64 encoded inline, No styling here
|
||||
// const char HTTP_ROOT_MAIN[] PROGMEM = "<img title=' alt=' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADQElEQVRoQ+2YjW0VQQyE7Q6gAkgFkAogFUAqgFQAVACpAKiAUAFQAaECQgWECggVGH1PPrRvn3dv9/YkFOksoUhhfzwz9ngvKrc89JbnLxuA/63gpsCmwCADWwkNEji8fVNgotDM7osI/x777x5l9F6JyB8R4eeVql4P0y8yNsjM7KGIPBORp558T04A+CwiH1UVUItiUQmZ2XMReSEiAFgjAPBeVS96D+sCYGaUx4cFbLfmhSpnqnrZuqEJgJnd8cQplVLciAgX//Cf0ToIeOB9wpmloLQAwpnVmAXgdf6pwjpJIz+XNoeZQQZlODV9vhc1Tuf6owrAk/8qIhFbJH7eI3eEzsvydQEICqBEkZwiALfF70HyHPpqScPV5HFjeFu476SkRA0AzOfy4hYwstj2ZkDgaphE7m6XqnoS7Q0BOPs/sw0kDROzjdXcCMFCNwzIy0EcRcOvBACfh4k0wgOmBX4xjfmk4DKTS31hgNWIKBCI8gdzogTgjYjQWFMw+o9LzJoZ63GUmjWm2wGDc7EvDDOj/1IVMIyD9SUAL0WEhpriRlXv5je5S+U1i2N88zdPuoVkeB+ls4SyxCoP3kVm9jsjpEsBLoOBNC5U9SwpGdakFkviuFP1keblATkTENTYcxkzgxTKOI3jyDxqLkQT87pMA++H3XvJBYtsNbBN6vuXq5S737WqHkW1VgMQNXJ0RshMqbbT33sJ5kpHWymzcJjNTeJIymJZtSQd9NHQHS1vodoFoTMkfbJzpRnLzB2vi6BZAJxWaCr+62BC+jzAxVJb3dmmiLzLwZhZNPE5e880Suo2AZgB8e8idxherqUPnT3brBDTlPxO3Z66rVwIwySXugdNd+5ejhqp/+NmgIwGX3Py3QBmlEi54KlwmjkOytQ+iJrLJj23S4GkOeecg8G091no737qvRRdzE+HLALQoMTBbJgBsCj5RSWUlUVJiZ4SOljb05eLFWgoJ5oY6yTyJp62D39jDANoKKcSocPJD5dQYzlFAFZJflUArgTPZKZwLXAnHmerfJquUkKZEgyzqOb5TuDt1P3nwxobqwPocZA11m4A1mBx5IxNgRH21ti7KbAGiyNn3HoF/gJ0w05A8xclpwAAAABJRU5ErkJggg==' /><h1>{v}</h1><h3>WiFiManager</h3>";
|
||||
const char HTTP_ROOT_MAIN[] PROGMEM = "<h1>{v}</h1><h3>WiFiManager</h3>";
|
||||
@@ -43,7 +49,7 @@ const char * const HTTP_PORTAL_MENU[] PROGMEM = {
|
||||
// const char HTTP_PORTAL_OPTIONS[] PROGMEM = strcat(HTTP_PORTAL_MENU[0] , HTTP_PORTAL_MENU[3] , HTTP_PORTAL_MENU[7]);
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "";
|
||||
const char HTTP_ITEM_QI[] PROGMEM = "<div role='img' aria-label='{r}%' title='{r}%' class='q q-{q} {i} {h}'></div>"; // rssi icons
|
||||
const char HTTP_ITEM_QP[] PROGMEM = "<div class='q {h}'>{r}%</div>"; // rssi percentage
|
||||
const char HTTP_ITEM_QP[] PROGMEM = "<div class='q {h}'>{r}%</div>"; // rssi percentage {h} = hidden showperc pref
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a>{qi}{qp}</div>"; // {q} = HTTP_ITEM_QI, {r} = HTTP_ITEM_QP
|
||||
// const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> {R} {r}% {q} {e}</div>"; // test all tokens
|
||||
|
||||
|
||||
Reference in New Issue
Block a user