mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-13 23:01:20 +10:00
added some http debugging
This commit is contained in:
+19
-1
@@ -1041,6 +1041,7 @@ uint8_t WiFiManager::connectWifi(String ssid, String pass, bool connect) {
|
||||
#endif
|
||||
}
|
||||
// if ssid argument provided connect to that
|
||||
// NOTE: this also catches preload() _defaultssid @todo rework
|
||||
if (ssid != "") {
|
||||
wifiConnectNew(ssid,pass,connect);
|
||||
// @todo connect=false seems to disconnect sta in begin() so not sure if _connectonsave is useful at all
|
||||
@@ -1812,6 +1813,22 @@ void WiFiManager::handleWifiSave() {
|
||||
_ssid = server->arg(F("s")).c_str();
|
||||
_pass = server->arg(F("p")).c_str();
|
||||
|
||||
#ifdef WM_DEBUG_LEVEL
|
||||
String requestinfo = "SERVER_REQUEST\n----------------\n";
|
||||
requestinfo += "URI: ";
|
||||
requestinfo += server->uri();
|
||||
requestinfo += "\nMethod: ";
|
||||
requestinfo += (server->method() == HTTP_GET) ? "GET" : "POST";
|
||||
requestinfo += "\nArguments: ";
|
||||
requestinfo += server->args();
|
||||
requestinfo += "\n";
|
||||
for (uint8_t i = 0; i < server->args(); i++) {
|
||||
requestinfo += " " + server->argName(i) + ": " + server->arg(i) + "\n";
|
||||
}
|
||||
|
||||
DEBUG_WM(DEBUG_MAX,requestinfo);
|
||||
#endif
|
||||
|
||||
// set static ips from server args
|
||||
if (server->arg(FPSTR(S_ip)) != "") {
|
||||
//_sta_static_ip.fromString(server->arg(FPSTR(S_ip));
|
||||
@@ -3289,7 +3306,7 @@ template <typename Generic, typename Genericb>
|
||||
void WiFiManager::DEBUG_WM(wm_debuglevel_t level,Generic text,Genericb textb) {
|
||||
if(!_debug || _debugLevel < level) return;
|
||||
|
||||
if(_debugLevel >= DEBUG_MAX){
|
||||
if(_debugLevel > DEBUG_MAX){
|
||||
#ifdef ESP8266
|
||||
// uint32_t free;
|
||||
// uint16_t max;
|
||||
@@ -3312,6 +3329,7 @@ void WiFiManager::DEBUG_WM(wm_debuglevel_t level,Generic text,Genericb textb) {
|
||||
_debugPort.printf("[MEM] free: %5d | max: %5d | frag: %3d%% \n", free, max, frag);
|
||||
#endif
|
||||
}
|
||||
|
||||
_debugPort.print(_debugPrefix);
|
||||
if(_debugLevel >= debugLvlShow) _debugPort.print("["+(String)level+"] ");
|
||||
_debugPort.print(text);
|
||||
|
||||
+6
-5
@@ -760,11 +760,12 @@ class WiFiManager
|
||||
|
||||
// debugging
|
||||
typedef enum {
|
||||
DEBUG_ERROR = 0,
|
||||
DEBUG_NOTIFY = 1, // default stable
|
||||
DEBUG_VERBOSE = 2,
|
||||
DEBUG_DEV = 3, // default dev
|
||||
DEBUG_MAX = 4
|
||||
DEBUG_SILENT = 0, // debug OFF but still compiled for runtime
|
||||
DEBUG_ERROR = 1, // error only
|
||||
DEBUG_NOTIFY = 2, // default stable,INFO
|
||||
DEBUG_VERBOSE = 3, // move verbose info
|
||||
DEBUG_DEV = 4, // development useful debugging info
|
||||
DEBUG_MAX = 5 // MAX extra dev auditing, var dumps etc (MAX+1 will print timing,mem and frag info)
|
||||
} wm_debuglevel_t;
|
||||
|
||||
boolean _debug = true;
|
||||
|
||||
Reference in New Issue
Block a user