@@ -334,8 +334,6 @@ bool webServerAssignResources(int httpPort = 80)
334334 if (settings.enableCaptivePortal == true )
335335 {
336336 webServer->addHandler (new CaptiveRequestHandler ());
337-
338- // TODO: add a handler for /connecttest.txt
339337 }
340338
341339 // * index.html (not gz'd)
@@ -469,6 +467,11 @@ bool webServerAssignResources(int httpPort = 80)
469467 webServer->send_P (200 , " text/plain" , (const char *)icomoon_woof, sizeof (icomoon_woof));
470468 });
471469
470+ // https://lemariva.com/blog/2017/11/white-hacking-wemos-captive-portal-using-micropython
471+ webServer->on (" /connecttest.txt" , HTTP_GET, []() {
472+ webServer->send (200 , " text/plain" , " Microsoft Connect Test" );
473+ });
474+
472475 // Handler for the /uploadFile form POST
473476 webServer->on (
474477 " /uploadFile" , HTTP_POST, []() { webServer->send (200 , " text/plain" , " " ); },
@@ -1130,6 +1133,10 @@ void createDynamicDataString(char *settingsCSV)
11301133
11311134 stringRecord (settingsCSV, " batteryIconFileName" , batteryIconFileName);
11321135
1136+ // Limit batteryLevelPercent to sane levels
1137+ if (batteryLevelPercent > 100 )
1138+ batteryLevelPercent = 100 ;
1139+
11331140 // Determine battery percent
11341141 char batteryPercent[sizeof (" +100%__" )];
11351142 if (isCharging ())
0 commit comments