Compare commits
10 Commits
463eaf4b6f
...
v1.2.75
Author | SHA1 | Date | |
---|---|---|---|
52cf46d7f8 | |||
84b05e48ce | |||
5c41d864c1 | |||
5dc3563da6 | |||
9e1b2943d6 | |||
7b89b04621 | |||
e140f8e003 | |||
3d0bdde476 | |||
3ac7d6b4f7 | |||
5f52775984 |
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,5 +1,26 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.2.75] - 2025-02-20
|
||||||
|
### Changed
|
||||||
|
- update webpages for version v1.2.75
|
||||||
|
- simplify OTA update handling by removing unnecessary variables and improving error reporting
|
||||||
|
|
||||||
|
|
||||||
|
## [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
|
## [1.2.72] - 2025-02-20
|
||||||
### Changed
|
### Changed
|
||||||
- update webpages for version v1.2.72
|
- update webpages for version v1.2.72
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.2.72</span></h1>
|
<h1>FilaMan<span class="version">v1.2.75</span></h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
version = "1.2.72"
|
version = "1.2.75"
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
@ -59,6 +59,12 @@ build_flags =
|
|||||||
-DOTA_PARTITION_SUBTYPE=0x10
|
-DOTA_PARTITION_SUBTYPE=0x10
|
||||||
-DPARTITION_TABLE_OFFSET=0x8000
|
-DPARTITION_TABLE_OFFSET=0x8000
|
||||||
-DPARTITION_TABLE_SIZE=0x1000
|
-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 =
|
extra_scripts =
|
||||||
scripts/extra_script.py
|
scripts/extra_script.py
|
||||||
@ -66,7 +72,6 @@ extra_scripts =
|
|||||||
pre:scripts/pre_spiffs.py ; wird als zweites ausgeführt
|
pre:scripts/pre_spiffs.py ; wird als zweites ausgeführt
|
||||||
pre:scripts/combine_html.py ; wird als drittes ausgeführt
|
pre:scripts/combine_html.py ; wird als drittes ausgeführt
|
||||||
scripts/gzip_files.py
|
scripts/gzip_files.py
|
||||||
# scripts/create_full_bin.py # Nicht mehr benötigt, da full.bin im Workflow erstellt wird
|
|
||||||
|
|
||||||
; Remove or comment out the targets line
|
; Remove or comment out the targets line
|
||||||
;targets = buildfs, build
|
;targets = buildfs, build
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
import os
|
|
||||||
import shutil
|
|
||||||
from platformio import util
|
|
||||||
|
|
||||||
Import("env")
|
|
||||||
|
|
||||||
def create_full_bin(source, target, env):
|
|
||||||
# Get paths
|
|
||||||
firmware_path = str(target[0])
|
|
||||||
build_dir = os.path.dirname(firmware_path)
|
|
||||||
project_dir = env.get("PROJECT_DIR")
|
|
||||||
|
|
||||||
# Create full binary
|
|
||||||
firmware_name = os.path.basename(firmware_path)
|
|
||||||
spiffs_bin = os.path.join(build_dir, "spiffs.bin")
|
|
||||||
full_bin = os.path.join(build_dir, "full.bin")
|
|
||||||
|
|
||||||
print("Creating full.bin...")
|
|
||||||
|
|
||||||
# Check if files exist
|
|
||||||
if not os.path.exists(firmware_path):
|
|
||||||
print("Error: Firmware binary not found!")
|
|
||||||
return
|
|
||||||
if not os.path.exists(spiffs_bin):
|
|
||||||
print("Error: SPIFFS binary not found!")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Calculate padding size
|
|
||||||
firmware_size = os.path.getsize(firmware_path)
|
|
||||||
padding_size = 0x3D0000 - firmware_size # SPIFFS start address - firmware size
|
|
||||||
|
|
||||||
# Create full binary
|
|
||||||
with open(full_bin, 'wb') as outfile:
|
|
||||||
# Copy firmware
|
|
||||||
with open(firmware_path, 'rb') as f:
|
|
||||||
outfile.write(f.read())
|
|
||||||
|
|
||||||
# Add padding
|
|
||||||
outfile.write(b'\xFF' * padding_size)
|
|
||||||
|
|
||||||
# Copy SPIFFS
|
|
||||||
with open(spiffs_bin, 'rb') as f:
|
|
||||||
outfile.write(f.read())
|
|
||||||
|
|
||||||
print(f"Created full.bin ({os.path.getsize(full_bin)} bytes)")
|
|
||||||
|
|
||||||
# Register the callback
|
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", create_full_bin)
|
|
80
src/ota.cpp
80
src/ota.cpp
@ -7,13 +7,10 @@
|
|||||||
#include "scale.h"
|
#include "scale.h"
|
||||||
#include "nfc.h"
|
#include "nfc.h"
|
||||||
|
|
||||||
// Magic byte patterns für verschiedene Image-Typen
|
|
||||||
const uint8_t FIRMWARE_MAGIC = 0xE9;
|
|
||||||
const uint8_t ESP_MAGIC = 0xE9;
|
const uint8_t ESP_MAGIC = 0xE9;
|
||||||
static bool tasksAreStopped = false;
|
static bool tasksAreStopped = false;
|
||||||
|
|
||||||
void stopAllTasks() {
|
void stopAllTasks() {
|
||||||
// Stop all tasks
|
|
||||||
Serial.println("Stopping RFID Reader");
|
Serial.println("Stopping RFID Reader");
|
||||||
if (RfidReaderTask) vTaskSuspend(RfidReaderTask);
|
if (RfidReaderTask) vTaskSuspend(RfidReaderTask);
|
||||||
Serial.println("Stopping Bambu");
|
Serial.println("Stopping Bambu");
|
||||||
@ -25,81 +22,40 @@ void stopAllTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
|
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;
|
|
||||||
|
|
||||||
// Offset-Definitionen aus dem Workflow
|
|
||||||
static const uint32_t BOOTLOADER_OFFSET = 0x1000;
|
|
||||||
static const uint32_t PARTITIONS_OFFSET = 0x8000;
|
|
||||||
static const uint32_t FIRMWARE_OFFSET = 0x10000;
|
|
||||||
static const uint32_t SPIFFS_OFFSET = 0x3D0000;
|
|
||||||
|
|
||||||
if (!index) {
|
if (!index) {
|
||||||
contentLength = request->contentLength();
|
Serial.printf("Update Start: %s\n", filename.c_str());
|
||||||
Serial.printf("Update size: %u bytes\n", contentLength);
|
if (request->contentLength() == 0) {
|
||||||
|
|
||||||
if (contentLength == 0) {
|
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid file size\"}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid file size\"}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop all tasks to save resources
|
|
||||||
if (!tasksAreStopped && (RfidReaderTask || BambuMqttTask || ScaleTask)) {
|
if (!tasksAreStopped && (RfidReaderTask || BambuMqttTask || ScaleTask)) {
|
||||||
stopAllTasks();
|
stopAllTasks();
|
||||||
tasksAreStopped = true;
|
tasksAreStopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
isFullImage = (contentLength > SPIFFS_OFFSET);
|
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) {
|
||||||
if (!isFullImage) {
|
|
||||||
// Regular 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("Firmware update started");
|
|
||||||
} else {
|
|
||||||
// Full image update - start with bootloader
|
|
||||||
if (!Update.begin(contentLength, U_FLASH)) {
|
|
||||||
Serial.printf("Not enough space for full image: %u required\n", contentLength);
|
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Not enough space available\"}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Serial.println("Full image update started");
|
|
||||||
}
|
|
||||||
currentOffset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write data
|
|
||||||
if (Update.write(data, len) != len) {
|
|
||||||
String errorMsg = Update.errorString();
|
|
||||||
if (errorMsg != "No Error") {
|
|
||||||
Update.printError(Serial);
|
Update.printError(Serial);
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Error writing update: " + errorMsg + "\"}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"OTA could not begin\"}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentOffset += len;
|
if (Update.write(data, len) != len) {
|
||||||
|
Update.printError(Serial);
|
||||||
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"OTA write failed\"}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (final) {
|
if (final) {
|
||||||
if (Update.end(true)) {
|
if (!Update.end(true)) {
|
||||||
Serial.println("Update complete");
|
Update.printError(Serial);
|
||||||
request->send(200, "application/json", "{\"status\":\"success\",\"message\":\"Update successful! Device will restart...\",\"restart\":true}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"OTA end failed\"}");
|
||||||
delay(1000);
|
return;
|
||||||
ESP.restart();
|
|
||||||
} else {
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
request->send(200, "application/json", "{\"status\":\"success\",\"message\":\"Update successful! Device will restart...\",\"restart\":true}");
|
||||||
|
delay(500);
|
||||||
|
ESP.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#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);
|
void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final);
|
||||||
|
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user