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

Loading…
Cancel
Save