Compare commits
15 Commits
024056cb7d
...
d2be752175
Author | SHA1 | Date | |
---|---|---|---|
d2be752175 | |||
97a050ace8 | |||
367e692c74 | |||
926a21249b | |||
2635c19667 | |||
|
6cc4efca0a | ||
1484a6b0da | |||
b5f0472af4 | |||
95c1bc823c | |||
491ba7f526 | |||
56d7d8596c | |||
1044e91a0a | |||
e459b53472 | |||
190e952ec4 | |||
89620a7f00 |
37
CHANGELOG.md
37
CHANGELOG.md
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
|
||||
##
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user