diff --git a/src/HAP.cpp b/src/HAP.cpp index 75233ab..4660033 100644 --- a/src/HAP.cpp +++ b/src/HAP.cpp @@ -1284,6 +1284,10 @@ int HAPClient::getStatusURL(){ response+="\n"; response+="

"; + LOG2("\n>>>>>>>>>> "); + LOG2(client.remoteIP()); + LOG2(" >>>>>>>>>>\n"); + if(homeSpan.webLog.maxEntries>0){ response+="\n"; int lastIndex=homeSpan.webLog.nEntries-homeSpan.webLog.maxEntries; @@ -1305,15 +1309,19 @@ int HAPClient::getStatusURL(){ sprintf(clocktime,"Unknown"); response+="\n"; + + if(response.length()>1024){ // if response grows too big, transmit chunk and reset + LOG2(response); + client.print(response); + delay(1); // slight pause seems to be required + response.clear(); + } } response+="
EntryUp TimeLog TimeClientMessage
" + String(i+1) + "" + String(uptime) + "" + String(clocktime) + "" + homeSpan.webLog.log[index].clientIP + "" + String(homeSpan.webLog.log[index].message) + "
\n"; } response+=""; - LOG2("\n>>>>>>>>>> "); - LOG2(client.remoteIP()); - LOG2(" >>>>>>>>>>\n"); LOG2(response); LOG2("\n"); client.print(response); diff --git a/src/src.ino b/src/src.ino index bad272e..43b69e3 100644 --- a/src/src.ino +++ b/src/src.ino @@ -32,7 +32,10 @@ void setup() { Serial.begin(115200); - homeSpan.setLogLevel(2); + homeSpan.setLogLevel(2) + .enableWebLog(500,"pool.ntp.org","UTC") + .setWifiCallback(wifiEstablished) + ; homeSpan.begin(Category::Lighting,"HomeSpan Max"); @@ -51,7 +54,7 @@ void setup() { ps_new(Characteristic::On)(); ps_new(Characteristic::Brightness)(50,false); } - + } ////////////////////////////////////// @@ -61,3 +64,14 @@ void loop(){ homeSpan.poll(); } + +////////////////////////////////////// + +void wifiEstablished(){ + + for(int i=0;i<600;i++){ + WEBLOG("Here is a lot of log file text that should take up a lot of space: %d",i); + delay(30); +} + +}