Add setup page for device registration and configuration

- Created a new HTML file for device setup with a form for API URL and registration code.
- Implemented JavaScript for handling registration and displaying status messages.
- Updated upgrade and WiFi pages to include navigation to the new setup page.
- Refactored display functions to improve readability and consistency.
- Replaced occurrences of `oledShowMessage` with `oledDisplayText` for uniformity.
- Updated WebSocket handling in the upgrade and WiFi pages for better connection management.
- Adjusted delays in various functions to use `pdMS_TO_TICKS` for better timing accuracy.
- Removed unused routes and cleaned up the website code for improved maintainability.
This commit is contained in:
Manuel Weiser committed 2026-02-19 11:40:42 +01:00
1 parent 1d0b01ba6e
commit 823d1f8c7e
15 files changed
+163 -447

No files matched your search

+6 -6
View File
@@ -33,7 +33,7 @@ void startMDNS() {
if (!MDNS.begin("filaman")) {
Serial.println("Error setting up MDNS responder!");
while(1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
MDNS.addService("http", "tcp", 80);
@@ -43,7 +43,7 @@ void startMDNS() {
void configModeCallback (WiFiManager *myWiFiManager) {
Serial.println("Entered config mode");
oledShowTopRow();
oledShowMessage("WiFi Config Mode");
oledDisplayText("WiFi Config Mode");
}
void initWiFi() {
@@ -69,7 +69,7 @@ void initWiFi() {
Serial.println("Failed to connect or hit timeout");
// ESP.restart();
oledShowTopRow();
oledShowMessage("WiFi not connected Check Portal");
oledDisplayText("WiFi not connected Check Portal");
}
else {
wifiOn = true;
@@ -92,15 +92,15 @@ void checkWiFiConnection() {
Serial.println("WiFi connection lost. Reconnecting...");
wifiOn = false;
oledShowTopRow();
oledShowMessage("WiFi reconnecting");
oledDisplayText("WiFi reconnecting");
WiFi.reconnect(); // Versuche, die Verbindung wiederherzustellen
vTaskDelay(5000 / portTICK_PERIOD_MS); // Warte 5 Sekunden, bevor erneut geprüft wird
vTaskDelay(pdMS_TO_TICKS(5000)); // Warte 5 Sekunden, bevor erneut geprüft wird
if (WiFi.status() != WL_CONNECTED)
{
Serial.println("Failed to reconnect. Restarting WiFi...");
WiFi.disconnect();
Serial.println("WiFi disconnected.");
vTaskDelay(1000 / portTICK_PERIOD_MS);
vTaskDelay(pdMS_TO_TICKS(1000));
wifiErrorCounter++;
//wifiSettings();