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:
1 parent
1d0b01ba6e
commit
823d1f8c7e
15 files changed
+163
-447
No files matched your search
+8
-9
@@ -6,8 +6,7 @@
|
||||
|
||||
|
||||
// Globale Variablen für Config Backups hinzufügen
|
||||
String bambuCredentialsBackup;
|
||||
String spoolmanUrlBackup;
|
||||
String filamanConfigBackup;
|
||||
|
||||
// Globale Variable für den Update-Typ
|
||||
static int currentUpdateCommand = 0;
|
||||
@@ -56,7 +55,7 @@ void restoreJsonConfigs() {
|
||||
|
||||
void espRestart() {
|
||||
yield();
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||
|
||||
ESP.restart();
|
||||
}
|
||||
@@ -137,9 +136,9 @@ void handleUpdate(AsyncWebServer &server) {
|
||||
if (isSpiffsUpdate) {
|
||||
// Backup vor dem Update
|
||||
sendUpdateProgress(0, "backup", "Backing up configurations...");
|
||||
vTaskDelay(200 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
backupJsonConfigs();
|
||||
vTaskDelay(200 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
|
||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, NULL);
|
||||
if (!partition || !Update.begin(partition->size, U_SPIFFS)) {
|
||||
@@ -147,14 +146,14 @@ void handleUpdate(AsyncWebServer &server) {
|
||||
return;
|
||||
}
|
||||
sendUpdateProgress(5, "starting", "Starting SPIFFS update...");
|
||||
vTaskDelay(200 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
} else {
|
||||
if (!Update.begin(updateTotalSize)) {
|
||||
request->send(400, "application/json", "{\"success\":false,\"message\":\"Update initialization failed\"}");
|
||||
return;
|
||||
}
|
||||
sendUpdateProgress(0, "starting", "Starting firmware update...");
|
||||
vTaskDelay(200 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +179,7 @@ void handleUpdate(AsyncWebServer &server) {
|
||||
if (currentProgress != lastProgress && (currentProgress % 10 == 0 || final)) {
|
||||
sendUpdateProgress(currentProgress, "uploading");
|
||||
oledShowProgressBar(currentProgress, 100, "Update", "Download");
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(50));
|
||||
lastProgress = currentProgress;
|
||||
}
|
||||
}
|
||||
@@ -204,7 +203,7 @@ void handleUpdate(AsyncWebServer &server) {
|
||||
|
||||
// Erste 100% Nachricht
|
||||
ws.textAll("{\"type\":\"updateProgress\",\"progress\":100,\"status\":\"success\",\"message\":\"Update successful! Restarting device...\"}");
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
|
||||
AsyncWebServerResponse *response = request->beginResponse(200, "application/json",
|
||||
"{\"success\":true,\"message\":\"Update successful! Restarting device...\"}");
|
||||
|
||||
Reference in new issue
Block a user