More lehible links.

Fixed AP xreation on boot with wifi enabled.
This commit is contained in:
Blaz Kristan 2021-11-25 06:41:37 +01:00
parent d09d7521d6
commit 4292e26135
4 changed files with 21 additions and 9 deletions

View File

@ -9,6 +9,10 @@ body {
hr { hr {
border-color: #666; border-color: #666;
} }
a, a:hover {
color: #0af;
text-decoration: none;
}
button, .btn { button, .btn {
background: #333; background: #333;
color: #fff; color: #fff;

View File

@ -6,7 +6,7 @@
*/ */
// Autogenerated from wled00/data/style.css, do not edit!! // Autogenerated from wled00/data/style.css, do not edit!!
const char PAGE_settingsCss[] PROGMEM = R"=====(<style>body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%%;margin:0}hr{border-color:#666}.btn,button{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;border-radius:24px;display:inline-block;font-size:20px;margin:12px 8px 8px;padding:8px 12px;min-width:48px;cursor:pointer;text-decoration:none}.toprow{top:0;position:sticky;background-color:#222;z-index:1}.lnk{border:0}.helpB{text-align:left;position:absolute;width:60px}input{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}input:disabled{color:#888}input[type=text]{font-size:medium}input[type=number]{width:4em;font-size:medium;margin:2px}input[type=number].xxl{width:100px}input[type=number].xl{width:85px}input[type=number].l{width:64px}input[type=number].m{width:56px}input[type=number].s{width:48px}input[type=number].xs{width:40px}select{margin:2px;font-size:medium}input[type=checkbox]{transform:scale(1.5);margin-right:10px}select{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}td{padding:2px}.d5{width:4.5em!important}#toast{opacity:0;background-color:#444;border-radius:5px;bottom:64px;color:#fff;font-size:17px;padding:16px;pointer-events:none;position:fixed;text-align:center;z-index:5;transform:translateX(-50%%);max-width:90%%;left:50%%}#toast.show{opacity:1;background-color:#264;animation:fadein .5s,fadein .5s 2.5s reverse}#toast.error{opacity:1;background-color:#b21;animation:fadein .5s}</style>)====="; const char PAGE_settingsCss[] PROGMEM = R"=====(<style>body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%%;margin:0}hr{border-color:#666}a,a:hover{color:#0af;text-decoration:none}.btn,button{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;border-radius:24px;display:inline-block;font-size:20px;margin:12px 8px 8px;padding:8px 12px;min-width:48px;cursor:pointer;text-decoration:none}.toprow{top:0;position:sticky;background-color:#222;z-index:1}.lnk{border:0}.helpB{text-align:left;position:absolute;width:60px}input{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}input:disabled{color:#888}input[type=text]{font-size:medium}input[type=number]{width:4em;font-size:medium;margin:2px}input[type=number].xxl{width:100px}input[type=number].xl{width:85px}input[type=number].l{width:64px}input[type=number].m{width:56px}input[type=number].s{width:48px}input[type=number].xs{width:40px}select{margin:2px;font-size:medium}input[type=checkbox]{transform:scale(1.5);margin-right:10px}select{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}td{padding:2px}.d5{width:4.5em!important}#toast{opacity:0;background-color:#444;border-radius:5px;bottom:64px;color:#fff;font-size:17px;padding:16px;pointer-events:none;position:fixed;text-align:center;z-index:5;transform:translateX(-50%%);max-width:90%%;left:50%%}#toast.show{opacity:1;background-color:#264;animation:fadein .5s,fadein .5s 2.5s reverse}#toast.error{opacity:1;background-color:#b21;animation:fadein .5s}</style>)=====";
// Autogenerated from wled00/data/settings.htm, do not edit!! // Autogenerated from wled00/data/settings.htm, do not edit!!

View File

@ -106,6 +106,7 @@ void WLED::loop()
#endif #endif
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
stripMillis = millis() - stripMillis; stripMillis = millis() - stripMillis;
if (stripMillis > 50) DEBUG_PRINTLN("Slow strip.");
avgStripMillis += stripMillis; avgStripMillis += stripMillis;
if (stripMillis > maxStripMillis) maxStripMillis = stripMillis; if (stripMillis > maxStripMillis) maxStripMillis = stripMillis;
#endif #endif
@ -508,15 +509,15 @@ void WLED::initConnection()
lastReconnectAttempt = millis(); lastReconnectAttempt = millis();
if (!WLED_WIFI_CONFIGURED) { if (!WLED_WIFI_CONFIGURED) {
DEBUG_PRINT(F("No connection configured. ")); DEBUG_PRINTLN(F("No connection configured."));
if (!apActive) if (!apActive) initAP(); // instantly go to ap mode
initAP(); // instantly go to ap mode
return; return;
} else if (!apActive) { } else if (!apActive) {
if (apBehavior == AP_BEHAVIOR_ALWAYS) { if (apBehavior == AP_BEHAVIOR_ALWAYS) {
DEBUG_PRINTLN(F("Access point ALWAYS enabled."));
initAP(); initAP();
} else { } else {
DEBUG_PRINTLN(F("Access point disabled.")); DEBUG_PRINTLN(F("Access point disabled (init)."));
WiFi.softAPdisconnect(true); WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
} }
@ -613,8 +614,12 @@ void WLED::handleConnection()
if (now < 2000 && (!WLED_WIFI_CONFIGURED || apBehavior == AP_BEHAVIOR_ALWAYS)) if (now < 2000 && (!WLED_WIFI_CONFIGURED || apBehavior == AP_BEHAVIOR_ALWAYS))
return; return;
if (lastReconnectAttempt == 0)
if (lastReconnectAttempt == 0) {
DEBUG_PRINTLN(F("lastReconnectAttempt == 0"));
initConnection(); initConnection();
return;
}
// reconnect WiFi to clear stale allocations if heap gets too low // reconnect WiFi to clear stale allocations if heap gets too low
if (now - heapTime > 5000) { if (now - heapTime > 5000) {
@ -670,10 +675,13 @@ void WLED::handleConnection()
} }
if (now - lastReconnectAttempt > ((stac) ? 300000 : 18000) && WLED_WIFI_CONFIGURED) { if (now - lastReconnectAttempt > ((stac) ? 300000 : 18000) && WLED_WIFI_CONFIGURED) {
if (improvActive == 2) improvActive = 3; if (improvActive == 2) improvActive = 3;
DEBUG_PRINTLN(F("Last reconnect too old."));
initConnection(); initConnection();
} }
if (!apActive && now - lastReconnectAttempt > 12000 && (!wasConnected || apBehavior == AP_BEHAVIOR_NO_CONN)) if (!apActive && now - lastReconnectAttempt > 12000 && (!wasConnected || apBehavior == AP_BEHAVIOR_NO_CONN)) {
DEBUG_PRINTLN(F("Not connected AP."));
initAP(); initAP();
}
} else if (!interfacesInited) { //newly connected } else if (!interfacesInited) { //newly connected
DEBUG_PRINTLN(""); DEBUG_PRINTLN("");
DEBUG_PRINT(F("Connected! IP address: ")); DEBUG_PRINT(F("Connected! IP address: "));
@ -692,7 +700,7 @@ void WLED::handleConnection()
dnsServer.stop(); dnsServer.stop();
WiFi.softAPdisconnect(true); WiFi.softAPdisconnect(true);
apActive = false; apActive = false;
DEBUG_PRINTLN(F("Access point disabled.")); DEBUG_PRINTLN(F("Access point disabled (handle)."));
} }
} }
} }

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2111220 #define VERSION 2111241
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG