Compare commits
	
		
			3 Commits
		
	
	
		
			v1.4.14
			...
			9ed3c70c01
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9ed3c70c01 | |||
| e23f3a2151 | |||
| f73306f0b9 | 
| @@ -1,5 +1,10 @@ | |||||||
| # Changelog | # Changelog | ||||||
|  |  | ||||||
|  | ## [1.5.1] - 2025-03-30 | ||||||
|  | ### Changed | ||||||
|  | - update version to 1.5.1 and improve OTA update handling with task management | ||||||
|  |  | ||||||
|  |  | ||||||
| ## [1.4.14] - 2025-03-30 | ## [1.4.14] - 2025-03-30 | ||||||
| ### Added | ### Added | ||||||
| - add auto-tare functionality and update scale handling based on touch sensor connection | - add auto-tare functionality and update scale handling based on touch sensor connection | ||||||
|   | |||||||
| @@ -9,8 +9,8 @@ | |||||||
| ; https://docs.platformio.org/page/projectconf.html | ; https://docs.platformio.org/page/projectconf.html | ||||||
|  |  | ||||||
| [common] | [common] | ||||||
| version = "1.4.14" | version = "1.5.1" | ||||||
| to_old_version = "1.4.0" | to_old_version = "1.5.0" | ||||||
|  |  | ||||||
| ## | ## | ||||||
| [env:esp32dev] | [env:esp32dev] | ||||||
|   | |||||||
| @@ -190,7 +190,7 @@ void loop() { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Prüfen ob das Gewicht gleich bleibt und dann senden |     // Prüfen ob das Gewicht gleich bleibt und dann senden | ||||||
|     if (weight == lastWeight && weight > 5) |     if (abs(weight - lastWeight) <= 2 && weight > 5) | ||||||
|     { |     { | ||||||
|       weigthCouterToApi++; |       weigthCouterToApi++; | ||||||
|     }  |     }  | ||||||
|   | |||||||
							
								
								
									
										33
									
								
								src/ota.cpp
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								src/ota.cpp
									
									
									
									
									
								
							| @@ -1,6 +1,10 @@ | |||||||
| #include <Arduino.h> | #include <Arduino.h> | ||||||
| #include <website.h> | #include <website.h> | ||||||
| #include <commonFS.h> | #include <commonFS.h> | ||||||
|  | #include "scale.h" | ||||||
|  | #include "bambu.h" | ||||||
|  | #include "nfc.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| // Globale Variablen für Config Backups hinzufügen | // Globale Variablen für Config Backups hinzufügen | ||||||
| String bambuCredentialsBackup; | String bambuCredentialsBackup; | ||||||
| @@ -151,6 +155,25 @@ void handleUpdate(AsyncWebServer &server) { | |||||||
|  |  | ||||||
|     updateHandler->onUpload([](AsyncWebServerRequest *request, String filename, |     updateHandler->onUpload([](AsyncWebServerRequest *request, String filename, | ||||||
|                              size_t index, uint8_t *data, size_t len, bool final) { |                              size_t index, uint8_t *data, size_t len, bool final) { | ||||||
|  |  | ||||||
|  |         // Disable all Tasks | ||||||
|  |         if (BambuMqttTask != NULL)  | ||||||
|  |         { | ||||||
|  |             Serial.println("Delete BambuMqttTask"); | ||||||
|  |             vTaskDelete(BambuMqttTask); | ||||||
|  |             BambuMqttTask = NULL; | ||||||
|  |         } | ||||||
|  |         if (ScaleTask) { | ||||||
|  |             Serial.println("Delete ScaleTask"); | ||||||
|  |             vTaskDelete(ScaleTask); | ||||||
|  |             ScaleTask = NULL; | ||||||
|  |         } | ||||||
|  |         if (RfidReaderTask) { | ||||||
|  |             Serial.println("Delete RfidReaderTask"); | ||||||
|  |             vTaskDelete(RfidReaderTask); | ||||||
|  |             RfidReaderTask = NULL; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         if (!index) { |         if (!index) { | ||||||
|             updateTotalSize = request->contentLength(); |             updateTotalSize = request->contentLength(); | ||||||
|             updateWritten = 0; |             updateWritten = 0; | ||||||
| @@ -159,9 +182,9 @@ void handleUpdate(AsyncWebServer &server) { | |||||||
|             if (isSpiffsUpdate) { |             if (isSpiffsUpdate) { | ||||||
|                 // Backup vor dem Update |                 // Backup vor dem Update | ||||||
|                 sendUpdateProgress(0, "backup", "Backing up configurations..."); |                 sendUpdateProgress(0, "backup", "Backing up configurations..."); | ||||||
|                 delay(200); |                 vTaskDelay(200 / portTICK_PERIOD_MS); | ||||||
|                 backupJsonConfigs(); |                 backupJsonConfigs(); | ||||||
|                 delay(200); |                 vTaskDelay(200 / portTICK_PERIOD_MS); | ||||||
|                  |                  | ||||||
|                 const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_SPIFFS, NULL); |                 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)) { |                 if (!partition || !Update.begin(partition->size, U_SPIFFS)) { | ||||||
| @@ -169,14 +192,14 @@ void handleUpdate(AsyncWebServer &server) { | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 sendUpdateProgress(5, "starting", "Starting SPIFFS update..."); |                 sendUpdateProgress(5, "starting", "Starting SPIFFS update..."); | ||||||
|                 delay(200); |                 vTaskDelay(200 / portTICK_PERIOD_MS); | ||||||
|             } else { |             } else { | ||||||
|                 if (!Update.begin(updateTotalSize)) { |                 if (!Update.begin(updateTotalSize)) { | ||||||
|                     request->send(400, "application/json", "{\"success\":false,\"message\":\"Update initialization failed\"}"); |                     request->send(400, "application/json", "{\"success\":false,\"message\":\"Update initialization failed\"}"); | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 sendUpdateProgress(0, "starting", "Starting firmware update..."); |                 sendUpdateProgress(0, "starting", "Starting firmware update..."); | ||||||
|                 delay(200); |                 vTaskDelay(200 / portTICK_PERIOD_MS); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -202,7 +225,7 @@ void handleUpdate(AsyncWebServer &server) { | |||||||
|             if (currentProgress != lastProgress && (currentProgress % 10 == 0 || final)) { |             if (currentProgress != lastProgress && (currentProgress % 10 == 0 || final)) { | ||||||
|                 sendUpdateProgress(currentProgress, "uploading"); |                 sendUpdateProgress(currentProgress, "uploading"); | ||||||
|                 oledShowMessage("Update: " + String(currentProgress) + "%"); |                 oledShowMessage("Update: " + String(currentProgress) + "%"); | ||||||
|                 delay(50); |                 vTaskDelay(50 / portTICK_PERIOD_MS); | ||||||
|                 lastProgress = currentProgress; |                 lastProgress = currentProgress; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user