fix: update version number to v1.2.65 in HTML files and platformio.ini; add script to create full binary
This commit is contained in:
parent
3dd5fbc585
commit
7a7ee72585
@ -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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70</span></h1>
|
<h1>FilaMan<span class="version">v1.2.65</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.70"
|
version = "1.2.65"
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
@ -66,6 +66,7 @@ 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 ; Neues Skript zur Erstellung der full.bin
|
||||||
|
|
||||||
; Remove or comment out the targets line
|
; Remove or comment out the targets line
|
||||||
;targets = buildfs, build
|
;targets = buildfs, build
|
||||||
|
48
scripts/create_full_bin.py
Normal file
48
scripts/create_full_bin.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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)
|
92
src/ota.cpp
92
src/ota.cpp
@ -10,13 +10,16 @@
|
|||||||
// Magic byte patterns für verschiedene Image-Typen
|
// Magic byte patterns für verschiedene Image-Typen
|
||||||
const uint8_t FIRMWARE_MAGIC = 0xE9;
|
const uint8_t FIRMWARE_MAGIC = 0xE9;
|
||||||
const uint8_t ESP_MAGIC = 0xE9;
|
const uint8_t ESP_MAGIC = 0xE9;
|
||||||
|
static bool tasksAreStopped = false;
|
||||||
|
|
||||||
void stopAllTasks() {
|
void stopAllTasks() {
|
||||||
// Stop all tasks
|
// Stop all tasks
|
||||||
Serial.println("Stopping all tasks");
|
Serial.println("Stopping RFID Reader");
|
||||||
vTaskSuspend(RfidReaderTask);
|
if (RfidReaderTask) vTaskSuspend(RfidReaderTask);
|
||||||
vTaskSuspend(BambuMqttTask);
|
Serial.println("Stopping Bambu");
|
||||||
vTaskSuspend(ScaleTask);
|
if (BambuMqttTask) vTaskSuspend(BambuMqttTask);
|
||||||
|
Serial.println("Stopping Scale");
|
||||||
|
if (ScaleTask) vTaskSuspend(ScaleTask);
|
||||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
Serial.println("All tasks stopped");
|
Serial.println("All tasks stopped");
|
||||||
}
|
}
|
||||||
@ -27,11 +30,15 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
static uint32_t currentOffset = 0;
|
static uint32_t currentOffset = 0;
|
||||||
static uint8_t *spiffsBuffer = nullptr;
|
static uint8_t *spiffsBuffer = nullptr;
|
||||||
static size_t spiffsSize = 0;
|
static size_t spiffsSize = 0;
|
||||||
static const uint32_t SPIFFS_START = 0x310000; // SPIFFS start in full.bin
|
static const uint32_t SPIFFS_START = 0x3D0000; // Korrigierter SPIFFS start address aus partitions.csv
|
||||||
|
static const uint32_t SPIFFS_SIZE = 0x30000; // Korrigierte SPIFFS size aus partitions.csv
|
||||||
|
|
||||||
stopAllTasks();
|
// Stop all tasks to save resources
|
||||||
|
if (!tasksAreStopped && (RfidReaderTask || BambuMqttTask || ScaleTask)) {
|
||||||
|
stopAllTasks();
|
||||||
|
tasksAreStopped = true;
|
||||||
|
}
|
||||||
|
|
||||||
Serial.println("Start Main Upgrad Function");
|
|
||||||
if (!index) {
|
if (!index) {
|
||||||
// Reset static variables
|
// Reset static variables
|
||||||
if (spiffsBuffer) {
|
if (spiffsBuffer) {
|
||||||
@ -48,26 +55,31 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data[0] == ESP_MAGIC) {
|
if (data[0] == ESP_MAGIC) {
|
||||||
isFullImage = (contentLength > 0x3D0000);
|
isFullImage = (contentLength > SPIFFS_START);
|
||||||
|
|
||||||
// Korrektur: Bei full.bin die gesamte Größe verwenden
|
|
||||||
if (!Update.begin(contentLength, U_FLASH)) {
|
|
||||||
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");
|
|
||||||
|
|
||||||
if (isFullImage) {
|
if (isFullImage) {
|
||||||
spiffsSize = 0x0F0000; // 960KB SPIFFS size
|
if (!Update.begin(SPIFFS_START, U_FLASH)) {
|
||||||
|
Serial.printf("Not enough space for firmware: %u required\n", SPIFFS_START);
|
||||||
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Not enough space available\"}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
spiffsSize = SPIFFS_SIZE;
|
||||||
spiffsBuffer = (uint8_t*)malloc(spiffsSize);
|
spiffsBuffer = (uint8_t*)malloc(spiffsSize);
|
||||||
if (!spiffsBuffer) {
|
if (!spiffsBuffer) {
|
||||||
Serial.println("Failed to allocate SPIFFS buffer");
|
Serial.println("Failed to allocate SPIFFS buffer");
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Memory allocation failed\"}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Memory allocation failed\"}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(spiffsBuffer, 0xFF, spiffsSize); // Initialize buffer with 0xFF
|
memset(spiffsBuffer, 0xFF, spiffsSize);
|
||||||
|
Serial.println("Full image update started");
|
||||||
|
} else {
|
||||||
|
if (!Update.begin(contentLength, U_FLASH)) {
|
||||||
|
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 {
|
} else {
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid image format\"}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Invalid image format\"}");
|
||||||
@ -77,28 +89,34 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFullImage) {
|
if (isFullImage) {
|
||||||
// Zuerst vollständiges Firmware-Update durchführen
|
// Firmware Teil
|
||||||
if (Update.write(data, len) != len) {
|
if (currentOffset < SPIFFS_START) {
|
||||||
String errorMsg = Update.errorString();
|
size_t writeLen = min(len, (size_t)(SPIFFS_START - currentOffset));
|
||||||
if (errorMsg != "No Error") {
|
if (Update.write(data, writeLen) != writeLen) {
|
||||||
Update.printError(Serial);
|
String errorMsg = Update.errorString();
|
||||||
if (spiffsBuffer) free(spiffsBuffer);
|
if (errorMsg != "No Error") {
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Error writing firmware: " + errorMsg + "\"}");
|
Update.printError(Serial);
|
||||||
return;
|
if (spiffsBuffer) free(spiffsBuffer);
|
||||||
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"Error writing firmware: " + errorMsg + "\"}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPIFFS-Daten separat sammeln
|
// SPIFFS Teil
|
||||||
if (currentOffset >= SPIFFS_START) {
|
if (currentOffset + len > SPIFFS_START) {
|
||||||
uint32_t spiffsOffset = currentOffset - SPIFFS_START;
|
uint32_t spiffsOffset = (currentOffset >= SPIFFS_START) ?
|
||||||
|
(currentOffset - SPIFFS_START) : 0;
|
||||||
|
uint32_t dataOffset = (currentOffset < SPIFFS_START) ?
|
||||||
|
(SPIFFS_START - currentOffset) : 0;
|
||||||
|
|
||||||
if (spiffsOffset < spiffsSize) {
|
if (spiffsOffset < spiffsSize) {
|
||||||
size_t copyLen = min(len, spiffsSize - spiffsOffset);
|
size_t copyLen = min(len - dataOffset, spiffsSize - spiffsOffset);
|
||||||
memcpy(spiffsBuffer + spiffsOffset, data, copyLen);
|
memcpy(spiffsBuffer + spiffsOffset, data + dataOffset, copyLen);
|
||||||
Serial.printf("Collecting SPIFFS data at offset %u, length %u\n", spiffsOffset, copyLen);
|
Serial.printf("Collecting SPIFFS data: offset=%u, len=%u\n", spiffsOffset, copyLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Normal firmware update
|
|
||||||
if (Update.write(data, len) != len) {
|
if (Update.write(data, len) != len) {
|
||||||
String errorMsg = Update.errorString();
|
String errorMsg = Update.errorString();
|
||||||
if (errorMsg != "No Error") {
|
if (errorMsg != "No Error") {
|
||||||
@ -118,12 +136,10 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
if (isFullImage && spiffsBuffer) {
|
if (isFullImage && spiffsBuffer) {
|
||||||
Serial.println("Starting SPIFFS update");
|
Serial.println("Starting SPIFFS update");
|
||||||
|
|
||||||
// Unmount SPIFFS first
|
if (SPIFFS.begin(true)) {
|
||||||
if (SPIFFS.begin()) {
|
|
||||||
SPIFFS.end();
|
SPIFFS.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update SPIFFS
|
|
||||||
if (!Update.begin(spiffsSize, U_SPIFFS)) {
|
if (!Update.begin(spiffsSize, U_SPIFFS)) {
|
||||||
Serial.println("Could not begin SPIFFS update");
|
Serial.println("Could not begin SPIFFS update");
|
||||||
free(spiffsBuffer);
|
free(spiffsBuffer);
|
||||||
@ -131,6 +147,7 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Serial.printf("Writing SPIFFS data: %u bytes\n", spiffsSize);
|
||||||
if (Update.write(spiffsBuffer, spiffsSize) != spiffsSize) {
|
if (Update.write(spiffsBuffer, spiffsSize) != spiffsSize) {
|
||||||
Serial.println("SPIFFS Write Failed");
|
Serial.println("SPIFFS Write Failed");
|
||||||
Update.printError(Serial);
|
Update.printError(Serial);
|
||||||
@ -151,7 +168,6 @@ void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t ind
|
|||||||
spiffsBuffer = nullptr;
|
spiffsBuffer = nullptr;
|
||||||
Serial.println("SPIFFS update complete");
|
Serial.println("SPIFFS update complete");
|
||||||
|
|
||||||
// Verify SPIFFS
|
|
||||||
if (!SPIFFS.begin(true)) {
|
if (!SPIFFS.begin(true)) {
|
||||||
Serial.println("SPIFFS mount after update failed");
|
Serial.println("SPIFFS mount after update failed");
|
||||||
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS verification failed\"}");
|
request->send(400, "application/json", "{\"status\":\"error\",\"message\":\"SPIFFS verification failed\"}");
|
||||||
|
@ -12,7 +12,7 @@ bool wm_nonblocking = false;
|
|||||||
void initWiFi() {
|
void initWiFi() {
|
||||||
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
|
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);
|
if(wm_nonblocking) wm.setConfigPortalBlocking(false);
|
||||||
wm.setConfigPortalTimeout(320); // Portal nach 5min schließen
|
wm.setConfigPortalTimeout(320); // Portal nach 5min schließen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user