Compare commits

...

15 Commits

Author SHA1 Message Date
d2be752175 docs: update changelog and header for version v1.4.8
All checks were successful
Release Workflow / detect-provider (push) Successful in 4s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m46s
2025-03-29 07:58:12 +01:00
97a050ace8 docs: update platformio.ini for version v1.4.8 2025-03-29 07:58:12 +01:00
367e692c74
Merge pull request #30 from janecker/main
Fix memory leak issue in HTTPClient
2025-03-29 07:55:45 +01:00
926a21249b
Merge branch 'testing' into main 2025-03-29 07:55:33 +01:00
2635c19667 fix: improve HTTP client configuration and clear update documents after API calls 2025-03-29 07:52:49 +01:00
Jan Philipp Ecker
6cc4efca0a Fixes memory leak in HTTPClient by disabling connection reuse 2025-03-28 22:40:50 +01:00
1484a6b0da fix: update reload logic after removing and saving Bambu credentials for better cache handling 2025-03-27 19:13:57 +01:00
b5f0472af4 docs: update changelog and header for version v1.4.7
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m10s
2025-03-27 18:54:33 +01:00
95c1bc823c docs: update platformio.ini for version v1.4.7 2025-03-27 18:54:33 +01:00
491ba7f526 Merge branch 'testing' 2025-03-27 18:54:15 +01:00
56d7d8596c style: update remove button for Bambu credentials with red background 2025-03-27 18:07:33 +01:00
1044e91a0a feat: add forced cache refresh after removing and saving Bambu credentials 2025-03-27 18:03:40 +01:00
e459b53472 feat: add functionality to remove Bambu credentials and update API handling 2025-03-27 18:01:15 +01:00
190e952ec4 docs: update changelog and header for version v1.4.6
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m57s
2025-03-26 11:52:46 +01:00
89620a7f00 docs: update platformio.ini for version v1.4.6 2025-03-26 11:52:46 +01:00
9 changed files with 129 additions and 1 deletions

View File

@ -1,5 +1,42 @@
# Changelog
## [1.4.8] - 2025-03-29
### Changed
- update platformio.ini for version v1.4.8
- Merge pull request #30 from janecker/main
- Merge branch 'testing' into main
### Fixed
- improve HTTP client configuration and clear update documents after API calls
- Fixes memory leak in HTTPClient by disabling connection reuse
- update reload logic after removing and saving Bambu credentials for better cache handling
## [1.4.7] - 2025-03-27
### Added
- add forced cache refresh after removing and saving Bambu credentials
- add functionality to remove Bambu credentials and update API handling
- add rfid_bambu.html and update bambu connection handling
### Changed
- update platformio.ini for version v1.4.7
- Merge branch 'testing'
- update remove button for Bambu credentials with red background
- Merge pull request #28 from tugsi/main
### Fixed
- handle Bambu connection state by introducing bambuDisabled flag
- Fix rfid.js-Failure with X1-Series, if you wanna send a Spool to AMS: - Uncaught TypeError: Cannot read properties of undefined (reading 'replace') at handleSpoolIn (rfid.js:493:67) at HTMLButtonElement.onclick ((Index):1:1) handleSpoolIn @ rfid.js:493 onclick @ (Index):1
## [1.4.6] - 2025-03-26
### Changed
- update platformio.ini for version v1.4.6
### Fixed
- handle potential undefined value for tray_info_idx in handleSpoolIn function, by @tugsi
## [1.4.5] - 2025-03-25
### Changed
- update platformio.ini for version v1.4.5

View File

@ -57,6 +57,31 @@
toggleOctoFields();
};
function removeBambuCredentials() {
fetch('/api/bambu?remove=true')
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('bambuIp').value = '';
document.getElementById('bambuSerial').value = '';
document.getElementById('bambuCode').value = '';
document.getElementById('autoSend').checked = false;
document.getElementById('autoSendTime').value = '';
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials removed!';
// Reload with forced cache refresh after short delay
setTimeout(() => {
window.location.reload(true);
window.location.href = '/';
}, 1500);
} else {
document.getElementById('bambuStatusMessage').innerText = 'Error while removing Bambu Credentials.';
}
})
.catch(error => {
document.getElementById('bambuStatusMessage').innerText = 'Error while removing: ' + error.message;
});
}
function checkSpoolmanInstance() {
const url = document.getElementById('spoolmanUrl').value;
const spoolmanOctoEnabled = document.getElementById('spoolmanOctoEnabled').checked;
@ -89,6 +114,11 @@
.then(data => {
if (data.healthy) {
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials saved!';
// Reload with forced cache refresh after short delay
setTimeout(() => {
window.location.reload(true);
window.location.href = '/';
}, 1500);
} else {
document.getElementById('bambuStatusMessage').innerText = 'Error while saving Bambu Credentials.';
}
@ -162,6 +192,7 @@
</div>
<button style="margin: 0;" onclick="saveBambuCredentials()">Save Bambu Credentials</button>
<button style="margin: 0; background-color: red;" onclick="removeBambuCredentials()">Remove Credentials</button>
<p id="bambuStatusMessage"></p>
</div>
</div>

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.4.5"
version = "1.4.8"
to_old_version = "1.4.0"
##

View File

@ -94,6 +94,8 @@ void sendToApi(void *parameter) {
String octoToken = params->octoToken;
HTTPClient http;
http.setReuse(false);
http.begin(spoolsUrl);
http.addHeader("Content-Type", "application/json");
if (octoEnabled && octoToken != "") http.addHeader("X-Api-Key", octoToken);
@ -111,6 +113,7 @@ void sendToApi(void *parameter) {
}
http.end();
vTaskDelay(50 / portTICK_PERIOD_MS);
// Speicher freigeben
delete params;
@ -165,6 +168,8 @@ bool updateSpoolTagId(String uidString, const char* payload) {
NULL // Task-Handle (nicht benötigt)
);
updateDoc.clear();
return true;
}
@ -201,6 +206,8 @@ uint8_t updateSpoolWeight(String spoolId, uint16_t weight) {
NULL // Task-Handle (nicht benötigt)
);
updateDoc.clear();
return 1;
}
@ -238,6 +245,8 @@ bool updateSpoolOcto(int spoolId) {
NULL // Task-Handle (nicht benötigt)
);
updateDoc.clear();
return true;
}

View File

@ -38,6 +38,32 @@ int ams_count = 0;
String amsJsonData; // Speichert das fertige JSON für WebSocket-Clients
AMSData ams_data[MAX_AMS]; // Definition des Arrays;
bool removeBambuCredentials() {
if (BambuMqttTask) {
vTaskDelete(BambuMqttTask);
}
if (!removeJsonValue("/bambu_credentials.json")) {
Serial.println("Fehler beim Löschen der Bambu-Credentials.");
return false;
}
// Löschen der globalen Variablen
g_bambu_ip = "";
g_bambu_accesscode = "";
g_bambu_serialnr = "";
bambu_ip = nullptr;
bambu_accesscode = nullptr;
bambu_serialnr = nullptr;
autoSendToBambu = false;
autoSetToBambuSpoolId = 0;
ams_count = 0;
amsJsonData = "";
bambuDisabled = true;
return true;
}
bool saveBambuCredentials(const String& ip, const String& serialnr, const String& accesscode, bool autoSend, const String& autoSendTime) {
if (BambuMqttTask) {
vTaskDelete(BambuMqttTask);

View File

@ -32,6 +32,7 @@ extern bool autoSendToBambu;
extern int autoSetToBambuSpoolId;
extern bool bambuDisabled;
bool removeBambuCredentials();
bool loadBambuCredentials();
bool saveBambuCredentials(const String& bambu_ip, const String& bambu_serialnr, const String& bambu_accesscode, const bool autoSend, const String& autoSendTime);
bool setupMqtt();

View File

@ -1,6 +1,20 @@
#include "commonFS.h"
#include <LittleFS.h>
bool removeJsonValue(const char* filename) {
File file = LittleFS.open(filename, "r");
if (!file) {
return true;
}
file.close();
if (!LittleFS.remove(filename)) {
Serial.print("Fehler beim Löschen der Datei: ");
Serial.println(filename);
return false;
}
return true;
}
bool saveJsonValue(const char* filename, const JsonDocument& doc) {
File file = LittleFS.open(filename, "w");
if (!file) {

View File

@ -5,6 +5,7 @@
#include <ArduinoJson.h>
#include <LittleFS.h>
bool removeJsonValue(const char* filename);
bool saveJsonValue(const char* filename, const JsonDocument& doc);
bool loadJsonValue(const char* filename, JsonDocument& doc);
void initializeFileSystem();

View File

@ -313,6 +313,15 @@ void setupWebserver(AsyncWebServer &server) {
// Route für das Überprüfen der Bambu-Instanz
server.on("/api/bambu", HTTP_GET, [](AsyncWebServerRequest *request){
if (request->hasParam("remove")) {
if (removeBambuCredentials()) {
request->send(200, "application/json", "{\"success\": true}");
} else {
request->send(500, "application/json", "{\"success\": false, \"error\": \"Fehler beim Löschen der Bambu-Credentials\"}");
}
return;
}
if (!request->hasParam("bambu_ip") || !request->hasParam("bambu_serialnr") || !request->hasParam("bambu_accesscode")) {
request->send(400, "application/json", "{\"success\": false, \"error\": \"Missing parameter\"}");
return;