mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Fix Captive Portal
This commit is contained in:
parent
b4a973dda5
commit
8490240f7f
@ -498,7 +498,7 @@ bool wifiEvery5Seconds()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(WiFi.getMode() == WIFI_AP) {
|
if(WiFi.getMode() != WIFI_STA) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1455,12 +1455,15 @@ static void webHandleGuiConfig()
|
|||||||
httpMessage += getOption(-1, F("None"));
|
httpMessage += getOption(-1, F("None"));
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
uint8_t pins[] = {0, 5, 12, 13, 15, 16, 17, 18, 19, 21, 22, 23, 26, 27, 32};
|
// uint8_t pins[] = {0, 5, 12, 13, 15, 16, 17, 18, 19, 21, 22, 23, 26, 27, 32};
|
||||||
for(uint8_t i = 0; i < sizeof(pins); i++) {
|
// for(uint8_t i = 0; i < sizeof(pins); i++) {
|
||||||
// if(!gpioIsSystemPin(pins[i])) {
|
for(uint8_t gpio = 0; gpio < NUM_DIGITAL_PINS; gpio++) {
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("GPIO %d"), pins[i]);
|
if(!gpioIsSystemPin(gpio)) {
|
||||||
httpMessage += getOption(pins[i], buffer);
|
snprintf_P(buffer, sizeof(buffer), PSTR("GPIO %d"), gpio);
|
||||||
// }
|
httpMessage += getOption(gpio, buffer);
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(TAG_HTTP, F("pin %d"), gpio);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
httpMessage += getOption(5, F("D1 - GPIO 5"));
|
httpMessage += getOption(5, F("D1 - GPIO 5"));
|
||||||
@ -2471,13 +2474,11 @@ static inline void webStartConfigPortal()
|
|||||||
dnsServer.start(DNS_PORT, "*", apIP);
|
dnsServer.start(DNS_PORT, "*", apIP);
|
||||||
#endif // HASP_USE_CAPTIVE_PORTAL
|
#endif // HASP_USE_CAPTIVE_PORTAL
|
||||||
|
|
||||||
#if HASP_USE_WIFI > 0
|
webServer.on(F("/vars.css"), httpHandleFileUri);
|
||||||
// reply to all requests with same HTML
|
|
||||||
// webServer.onNotFound([]() { webHandleWifiConfig(); });
|
|
||||||
#endif
|
|
||||||
|
|
||||||
webServer.on(F("/style.css"), httpHandleFileUri);
|
webServer.on(F("/style.css"), httpHandleFileUri);
|
||||||
webServer.on(F("/script.js"), httpHandleFileUri);
|
webServer.on(F("/script.js"), httpHandleFileUri);
|
||||||
|
// reply to all requests with same HTML
|
||||||
|
webServer.onNotFound(webHandleWifiConfig);
|
||||||
|
|
||||||
LOG_TRACE(TAG_HTTP, F("Wifi access point"));
|
LOG_TRACE(TAG_HTTP, F("Wifi access point"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user