Compare commits

..

30 Commits

Author SHA1 Message Date
5dc3563da6 docs: update changelog for version 1.2.74
All checks were successful
Release Workflow / route (push) Successful in 7s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m17s
2025-02-20 14:46:12 +01:00
9e1b2943d6 docs: update webpages for version v1.2.74 2025-02-20 14:46:12 +01:00
7b89b04621 refactor: enhance OTA update process with improved handling of full image updates and SPIFFS data 2025-02-20 14:45:34 +01:00
e140f8e003 docs: update changelog for version 1.2.73
All checks were successful
Release Workflow / route (push) Successful in 6s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m14s
2025-02-20 14:31:44 +01:00
3d0bdde476 docs: update webpages for version v1.2.73 2025-02-20 14:31:44 +01:00
3ac7d6b4f7 refactor: improve OTA update process with enhanced size checks and progress logging 2025-02-20 14:31:10 +01:00
5f52775984 refactor: enhance OTA update process with improved size checks and debugging output 2025-02-20 14:28:11 +01:00
463eaf4b6f docs: update changelog for version 1.2.72
All checks were successful
Release Workflow / route (push) Successful in 13s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m16s
2025-02-20 14:17:34 +01:00
4bf6b11d3a docs: update webpages for version v1.2.72 2025-02-20 14:17:34 +01:00
b0c4af7c4e refactor: simplify OTA update process by removing unnecessary buffer and adjusting offsets 2025-02-20 14:16:49 +01:00
249e896ea4 docs: update changelog for version 1.2.71
Some checks failed
Release Workflow / route (push) Successful in 6s
Release Workflow / verify-provider (push) Successful in 2s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Has been cancelled
2025-02-20 14:09:21 +01:00
c74f587fff docs: update webpages for version v1.2.71 2025-02-20 14:09:21 +01:00
7a7ee72585 fix: update version number to v1.2.65 in HTML files and platformio.ini; add script to create full binary 2025-02-20 14:08:17 +01:00
3dd5fbc585 docs: update changelog for version 1.2.70
All checks were successful
Release Workflow / route (push) Successful in 7s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m23s
2025-02-20 12:01:08 +01:00
ed9c1487ed docs: update webpages for version v1.2.70 2025-02-20 12:01:08 +01:00
d8756421a1 fix: add logging to stopAllTasks for better debugging 2025-02-20 12:00:45 +01:00
d92c78f9d0 docs: update changelog for version 1.2.69
All checks were successful
Release Workflow / route (push) Successful in 11s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m21s
2025-02-20 11:54:38 +01:00
2d19ea745f docs: update webpages for version v1.2.69 2025-02-20 11:54:37 +01:00
13779cc9d7 docs: update changelog for version 1.2.68
Some checks failed
Release Workflow / route (push) Successful in 6s
Release Workflow / verify-provider (push) Successful in 2s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Has been cancelled
2025-02-20 11:53:15 +01:00
b6d5a8a00b docs: update webpages for version v1.2.68 2025-02-20 11:53:15 +01:00
f6319e79f0 fix: update stopAllTasks to suspend RfidReaderTask instead of NfcTask 2025-02-20 11:53:04 +01:00
6f24630a7d feat: add task handles for BambuMqttTask and ScaleTask; rename stopTasks to stopAllTasks 2025-02-20 11:52:36 +01:00
4475d21218 docs: update changelog for version 1.2.67
All checks were successful
Release Workflow / route (push) Successful in 6s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m6s
2025-02-20 11:42:41 +01:00
01a926a38d feat: improve OTA upload handling and add SPIFFS update support 2025-02-20 11:42:36 +01:00
6b966c02b3 docs: update webpages for version v1.2.67 2025-02-20 11:42:25 +01:00
1450e1ad2e docs: update changelog for version 1.2.66
All checks were successful
Release Workflow / route (push) Successful in 8s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m5s
2025-02-20 11:27:18 +01:00
3102a6c217 docs: update webpages for version v1.2.66 2025-02-20 11:27:18 +01:00
d5b2b2746d feat: enhance OTA upload to support SPIFFS updates 2025-02-20 11:27:11 +01:00
7e776d4816 docs: update changelog for version 1.2.65
All checks were successful
Release Workflow / route (push) Successful in 7s
Release Workflow / verify-provider (push) Successful in 5s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m8s
2025-02-20 11:16:54 +01:00
e84b2973c5 docs: update webpages for version v1.2.65 2025-02-20 11:16:53 +01:00
14 changed files with 247 additions and 40 deletions

View File

@ -1,5 +1,79 @@
# Changelog
## [1.2.74] - 2025-02-20
### Changed
- update webpages for version v1.2.74
- enhance OTA update process with improved handling of full image updates and SPIFFS data
## [1.2.73] - 2025-02-20
### Changed
- update webpages for version v1.2.73
- improve OTA update process with enhanced size checks and progress logging
### Fixed
- enhance OTA update process with improved size checks and debugging output
## [1.2.72] - 2025-02-20
### Changed
- update webpages for version v1.2.72
- simplify OTA update process by removing unnecessary buffer and adjusting offsets
## [1.2.71] - 2025-02-20
### Added
- update version number to v1.2.65 in HTML files and platformio.ini; add script to create full binary
### Changed
- update webpages for version v1.2.71
## [1.2.70] - 2025-02-20
### Added
- add logging to stopAllTasks for better debugging
### Changed
- update webpages for version v1.2.70
## [1.2.69] - 2025-02-20
### Changed
- update webpages for version v1.2.69
## [1.2.68] - 2025-02-20
### Added
- add task handles for BambuMqttTask and ScaleTask; rename stopTasks to stopAllTasks
### Changed
- update webpages for version v1.2.68
### Fixed
- update stopAllTasks to suspend RfidReaderTask instead of NfcTask
## [1.2.67] - 2025-02-20
### Added
- improve OTA upload handling and add SPIFFS update support
### Changed
- update webpages for version v1.2.67
## [1.2.66] - 2025-02-20
### Added
- enhance OTA upload to support SPIFFS updates
### Changed
- update webpages for version v1.2.66
## [1.2.65] - 2025-02-20
### Changed
- update webpages for version v1.2.65
## [1.2.64] - 2025-02-20
### Changed
- update webpages for version v1.2.64

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.2.64</span></h1>
<h1>FilaMan<span class="version">v1.2.74</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.2.64"
version = "1.2.74"
[env:esp32dev]
platform = espressif32
@ -59,6 +59,12 @@ build_flags =
-DOTA_PARTITION_SUBTYPE=0x10
-DPARTITION_TABLE_OFFSET=0x8000
-DPARTITION_TABLE_SIZE=0x1000
-DCONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=1
-DCONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=1
-DCONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON=1
-DCONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0x1000
-DCONFIG_PARTITION_TABLE_OFFSET=0x8000
-DCONFIG_PARTITION_TABLE_MD5=y
extra_scripts =
scripts/extra_script.py

View File

@ -36,4 +36,5 @@ void mqtt_loop(void * parameter);
bool setBambuSpool(String payload);
void bambu_restart();
extern TaskHandle_t BambuMqttTask;
#endif

View File

@ -3,73 +3,191 @@
#include <Update.h>
#include <SPIFFS.h>
#include "commonFS.h"
#include "bambu.h"
#include "scale.h"
#include "nfc.h"
// Magic byte patterns für verschiedene Image-Typen
const uint8_t FIRMWARE_MAGIC = 0xE9;
const uint8_t ESP_MAGIC = 0xE9;
static bool tasksAreStopped = false;
void stopAllTasks() {
// Stop all tasks
Serial.println("Stopping RFID Reader");
if (RfidReaderTask) vTaskSuspend(RfidReaderTask);
Serial.println("Stopping Bambu");
if (BambuMqttTask) vTaskSuspend(BambuMqttTask);
Serial.println("Stopping Scale");
if (ScaleTask) vTaskSuspend(ScaleTask);
vTaskDelay(100 / portTICK_PERIOD_MS);
Serial.println("All tasks stopped");
}
void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
static size_t contentLength = 0;
static bool isFullImage = false;
static uint32_t currentOffset = 0;
static uint8_t *spiffsBuffer = nullptr;
static size_t spiffsSize = 0x30000; // 192KB SPIFFS size
static size_t spiffsStored = 0;
if (!index) {
contentLength = request->contentLength();
Serial.printf("Update size: %u bytes\n", contentLength);
Serial.printf("Update size: %u bytes (0x%X)\n", contentLength, contentLength);
if (contentLength == 0) {
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid file size\"}");
return;
}
// Prüfe Magic Byte für Image-Typ
if (data[0] == ESP_MAGIC) {
// Normales Firmware Image oder full.bin
isFullImage = (contentLength > 0x3D0000);
if (!tasksAreStopped && (RfidReaderTask || BambuMqttTask || ScaleTask)) {
stopAllTasks();
tasksAreStopped = true;
}
isFullImage = (contentLength > 0x300000); // Über 3MB ist ein full image
if (isFullImage) {
// Alloziere Buffer für SPIFFS-Daten
spiffsBuffer = (uint8_t*)malloc(spiffsSize);
if (!spiffsBuffer) {
Serial.println("Failed to allocate SPIFFS buffer");
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Memory allocation failed\"}");
return;
}
memset(spiffsBuffer, 0xFF, spiffsSize);
spiffsStored = 0;
// Starte Update mit der Firmware-Größe
if (!Update.begin(0x3D0000, U_FLASH)) { // Nur bis zum SPIFFS-Start
Serial.println("Could not begin full image update");
free(spiffsBuffer);
spiffsBuffer = nullptr;
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Could not start full update\"}");
return;
}
} else {
// Normales Firmware-Update
if (!Update.begin(contentLength)) {
Serial.printf("Not enough space: %u required\n", contentLength);
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Not enough space available\"}");
return;
}
Serial.println(isFullImage ? "Full image update started" : "Firmware update started");
} else {
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid image format\"}");
return;
}
currentOffset = 0;
Serial.printf("%s update started\n", isFullImage ? "Full image" : "Firmware");
}
// Schreibe Daten
if (Update.write(data, len) != len) {
String errorMsg = Update.errorString();
if (errorMsg != "No Error") {
Update.printError(Serial);
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Error writing update: " + errorMsg + "\"}");
return;
if (isFullImage && currentOffset >= 0x3D0000) {
// SPIFFS-Daten sammeln
size_t spiffsOffset = currentOffset - 0x3D0000;
if (spiffsOffset < spiffsSize) {
size_t copyLen = min(len, spiffsSize - spiffsOffset);
memcpy(spiffsBuffer + spiffsOffset, data, copyLen);
spiffsStored += copyLen;
Serial.printf("Stored SPIFFS data: offset=0x%X, len=%u\n", spiffsOffset, copyLen);
}
// Nur die Firmware-Daten an Update.write() übergeben
return;
}
// Schreibe Firmware-Daten
size_t writeLen = isFullImage ? min(len, 0x3D0000 - currentOffset) : len;
if (writeLen > 0) {
if (Update.write(data, writeLen) != writeLen) {
String errorMsg = Update.errorString();
if (errorMsg != "No Error") {
Update.printError(Serial);
if (spiffsBuffer) {
free(spiffsBuffer);
spiffsBuffer = nullptr;
}
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Error writing update: " + errorMsg + "\"}");
return;
}
}
}
currentOffset += len;
// Progress logging
if ((currentOffset % 0x40000) == 0) {
Serial.printf("Update progress: 0x%X of 0x%X bytes (%.1f%%)\n",
currentOffset, contentLength, (currentOffset * 100.0) / contentLength);
}
if (final) {
if (Update.end(true)) {
Serial.println("Update complete");
request->send(200, "application/json", "{\"status\":\"success\",\"message\":\"Update successful! Device will restart...\",\"restart\":true}");
delay(1000);
ESP.restart();
} else {
bool success = true;
// Beende Firmware-Update
if (!Update.end(true)) {
success = false;
String errorMsg = Update.errorString();
if (errorMsg != "No Error") {
Update.printError(Serial);
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Update failed: " + errorMsg + "\"}");
} else {
request->send(200, "application/json", "{\"status\":\"success\",\"message\":\"Update successful! Device will restart...\",\"restart\":true}");
delay(1000);
ESP.restart();
if (spiffsBuffer) {
free(spiffsBuffer);
spiffsBuffer = nullptr;
}
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Firmware update failed: " + errorMsg + "\"}");
return;
}
}
// SPIFFS aktualisieren wenn es ein full image war
if (success && isFullImage && spiffsBuffer && spiffsStored > 0) {
Serial.printf("Starting SPIFFS update (size: 0x%X)\n", spiffsStored);
if (SPIFFS.begin(true)) {
SPIFFS.end(); // Unmount first
}
if (!Update.begin(spiffsSize, U_SPIFFS)) {
Serial.println("Could not begin SPIFFS update");
free(spiffsBuffer);
spiffsBuffer = nullptr;
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS update failed to start\"}");
return;
}
if (Update.write(spiffsBuffer, spiffsSize) != spiffsSize) {
Serial.println("SPIFFS Write Failed");
Update.printError(Serial);
free(spiffsBuffer);
spiffsBuffer = nullptr;
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS write failed\"}");
return;
}
if (!Update.end(true)) {
Serial.println("SPIFFS End Failed");
Update.printError(Serial);
free(spiffsBuffer);
spiffsBuffer = nullptr;
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS finish failed\"}");
return;
}
// Cleanup
free(spiffsBuffer);
spiffsBuffer = nullptr;
// Verify SPIFFS
if (!SPIFFS.begin(true)) {
Serial.println("SPIFFS mount after update failed");
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS verification failed\"}");
return;
}
SPIFFS.end();
}
// Alles erfolgreich
Serial.printf("Update complete: 0x%X bytes written\n", currentOffset);
request->send(200, "application/json", "{\"status\":\"success\",\"message\":\"Update successful! Device will restart...\",\"restart\":true}");
delay(500);
ESP.restart();
}
}

View File

@ -3,6 +3,12 @@
#include <ESPAsyncWebServer.h>
// Update size unknown constant, falls nicht bereits definiert
#ifndef UPDATE_SIZE_UNKNOWN
#define UPDATE_SIZE_UNKNOWN 0xFFFFFFFF
#endif
void stopAllTasks();
void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final);
#endif

View File

@ -15,4 +15,6 @@ extern uint8_t weigthCouterToApi;
extern uint8_t scale_tare_counter;
extern uint8_t pauseMainTask;
extern TaskHandle_t ScaleTask;
#endif

View File

@ -12,7 +12,7 @@ bool wm_nonblocking = false;
void initWiFi() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
esp_wifi_set_max_tx_power(72); // Setze maximale Sendeleistung auf 20dBm
//esp_wifi_set_max_tx_power(72); // Setze maximale Sendeleistung auf 20dBm
if(wm_nonblocking) wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(320); // Portal nach 5min schließen