Browse Source

Fixed infinite loop in AP-mode

master
Torsten Stauder 5 years ago
parent
commit
53160d3e62
  1. 16
      src/main.cpp

16
src/main.cpp

@ -206,6 +206,7 @@ uint8_t currentVolume = initVolume;
static const char accessPointNetworkSSID[] PROGMEM = "Tonuino"; // Access-point's SSID
IPAddress apIP(192, 168, 4, 1); // Access-point's static IP
IPAddress apNetmask(255, 255, 255, 0); // Access-point's netmask
bool accessPointStarted = false;
// FTP
char ftpUser[10] = "esp32"; // FTP-user
@ -1980,12 +1981,17 @@ void trackQueueDispatcher(const char *_itemToPlay, const uint32_t _lastPlayPos,
#endif
} else {
loggerNl((char *) FPSTR(webstreamNotAvailable), LOGLEVEL_ERROR);
#ifdef NEOPIXEL_ENABLE
showLedError = true;
#endif
playProperties.playMode = NO_PLAYLIST;
}
break;
}
default:
loggerNl((char *) FPSTR(modeDoesNotExist), LOGLEVEL_ERROR);
playProperties.playMode = NO_PLAYLIST;
#ifdef NEOPIXEL_ENABLE
showLedError = true;
#endif
@ -2412,9 +2418,10 @@ void accessPointStart(const char *SSID, IPAddress ip, IPAddress netmask) {
server.begin();
loggerNl((char *) FPSTR(httpReady), LOGLEVEL_NOTICE);
while (true) {
accessPointStarted = true;
/*while (true) {
server.handleClient(); // Wird endlos ausgeführt damit das WLAN Setup erfolgen kann
}
}*/
}
@ -2717,6 +2724,7 @@ void setup() {
lastTimeActiveTimestamp = millis(); // initial set after boot
if (wifiManager() == WL_CONNECTED) {
wServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", "Hello, world");
});
@ -2744,8 +2752,8 @@ void setup() {
});
wServer.onNotFound(notFound);
wServer.begin();
}
bootComplete = true;
/*char *sdC = (char *) calloc(16384, sizeof(char));
@ -2783,8 +2791,10 @@ void loop() {
lastTimeActiveTimestamp = millis(); // Re-adjust timer while client is connected to avoid ESP falling asleep
}
#endif
if (wifiManager() == WL_CONNECTED || accessPointStarted) {
server.handleClient();
}
}
// Some mp3-lib-stuff (slightly changed from default)

Loading…
Cancel
Save