Merge pull request #26 from tugsi/main
Fix BufferSize for larger JSONs from X-Series
This commit is contained in:
		
							
								
								
									
										84
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										84
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,5 +1,89 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## [1.4.4] - 2025-03-23 | ||||
| ### Added | ||||
| - add error handling for missing vendor IDs in filament data | ||||
|  | ||||
| ### Changed | ||||
| - update platformio.ini for version v1.4.4 | ||||
|  | ||||
| ### Fixed | ||||
| - adjust weight threshold for tare check to allow negative values | ||||
|  | ||||
|  | ||||
| ## [1.4.3] - 2025-03-23 | ||||
| ### Changed | ||||
| - update platformio.ini for version v1.4.3 | ||||
|  | ||||
|  | ||||
| ## [1.4.2] - 2025-03-23 | ||||
| ### Added | ||||
| - add WiFi connection check and restart Bambu if not connected | ||||
|  | ||||
| ### Changed | ||||
| - update platformio.ini for version v1.4.2 | ||||
| - increase stack size for BambuMqtt task | ||||
| - update Discord Link | ||||
| - update Discord Link | ||||
| - remove commented-out subscription topic in MQTT setup | ||||
|  | ||||
| ### Fixed | ||||
| - use unique client ID for MQTT connection to avoid conflicts | ||||
| - reload page after firmware update completion | ||||
| - increase WiFi connection timeout from 5 to 10 seconds | ||||
| - ensure valid URL format and remove trailing slash in setupWebserver | ||||
|  | ||||
|  | ||||
| ## [1.4.1] - 2025-03-10 | ||||
| ### Added | ||||
| - added new .step, now with correct individual parts | ||||
| - added changelog | ||||
| - Add files via upload | ||||
| - added .stp files of modifications | ||||
| - added merged picture | ||||
| - added pictures of components bought from AliE | ||||
| - Add files via upload | ||||
| - added pictures for heat insert location | ||||
| - added pictures showing heat insert location | ||||
| - remove unnecessary delay in MQTT setup and add delay before restart | ||||
| - add new 3D print file for Filaman scale | ||||
| - added Discord Server | ||||
|  | ||||
| ### Changed | ||||
| - update platformio.ini for version v1.4.1 | ||||
| - refactor length calculation to convert total length to meters before formatting | ||||
| - Merge pull request #16 from spitzbirne32/main | ||||
| - improved housing to show display better | ||||
| - removed CAD, as they were all duplicates | ||||
| - typo in AliE link | ||||
| - Delete usermod/spitzbirne32/STL/README.md | ||||
| - Update README.md | ||||
| - moved pictures of parts into dedicated folders | ||||
| - Update README.md | ||||
| - Update README.md | ||||
| - Update README.md | ||||
| - Delete usermod/spitzbirne32/STL/ScaleTop_Heatinsert_Location_usermod_spitzbirne32_.png | ||||
| - Delete usermod/spitzbirne32/STL/Housing_Heatinsert_Location_usermod_spitzbirne32_.png | ||||
| - created folders | ||||
| - Update README.md | ||||
| - Update README.md | ||||
| - Create README.md | ||||
| - Update README.md | ||||
| - Update README.md | ||||
| - Create README.md | ||||
| - Merge pull request #15 from ManuelW77/main | ||||
| - Merge pull request #14 from janecker/scale-calibration-rework | ||||
| - Reworks the scale calibration handling | ||||
| - remove redundant scale calibration checks and enhance task management | ||||
| - enhance AMS data handling and streamline spool auto-setting logic | ||||
| - adjust stack size and improve scale calibration logic | ||||
| - update labels and input types for better clarity and functionality | ||||
| - update documentation for clarity and accuracy | ||||
|  | ||||
| ### Fixed | ||||
| - correct typo in console log for total length | ||||
|  | ||||
|  | ||||
| ## [1.4.0] - 2025-03-01 | ||||
| ### Added | ||||
| - add support for Spoolman Octoprint Plugin in README files | ||||
|   | ||||
| @@ -9,7 +9,7 @@ Das System integriert sich nahtlos mit der [Spoolman](https://github.com/Donkie/ | ||||
| Weitere Bilder finden Sie im [img Ordner](/img/) | ||||
| oder auf meiner Website: [FilaMan Website](https://www.filaman.app)   | ||||
| Deutsches Erklärvideo: [Youtube](https://youtu.be/uNDe2wh9SS8?si=b-jYx4I1w62zaOHU)   | ||||
| Discord Server: [https://discord.gg/vMAx2gf5](https://discord.gg/vMAx2gf5) | ||||
| Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v) | ||||
|  | ||||
| ### Es gibt jetzt auch ein Wiki, dort sind nochmal alle Funktionen beschrieben: [Wiki](https://github.com/ManuelW77/Filaman/wiki) | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,7 @@ The system integrates seamlessly with [Bambulab](https://bambulab.com/en-us) 3D | ||||
| More Images can be found in the [img Folder](/img/)   | ||||
| or my website: [FilaMan Website](https://www.filaman.app)   | ||||
| german explanatory video: [Youtube](https://youtu.be/uNDe2wh9SS8?si=b-jYx4I1w62zaOHU)   | ||||
| Discord Server: [https://discord.gg/vMAx2gf5](https://discord.gg/vMAx2gf5) | ||||
| Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v) | ||||
|  | ||||
| ### Now more detailed informations about the usage: [Wiki](https://github.com/ManuelW77/Filaman/wiki) | ||||
|  | ||||
|   | ||||
| @@ -86,10 +86,10 @@ function populateVendorDropdown(data, selectedSmId = null) { | ||||
|     }); | ||||
|  | ||||
|     // Nach der Schleife: Formatierung der Gesamtlänge | ||||
|     console.log("Total Length: ", totalLength); | ||||
|     const formattedLength = totalLength > 1000  | ||||
|         ? (totalLength / 1000).toFixed(2) + " km"  | ||||
|         : totalLength.toFixed(2) + " m"; | ||||
|     const lengthInM = totalLength / 1000;  // erst in m umrechnen | ||||
|     const formattedLength = lengthInM > 1000  | ||||
|         ? (lengthInM / 1000).toFixed(2) + " km"  | ||||
|         : lengthInM.toFixed(2) + " m"; | ||||
|  | ||||
|     // Formatierung des Gesamtgewichts (von g zu kg zu t) | ||||
|     const weightInKg = totalWeight / 1000;  // erst in kg umrechnen | ||||
| @@ -147,6 +147,13 @@ function updateFilamentDropdown(selectedSmId = null) { | ||||
|  | ||||
|     if (vendorId) { | ||||
|         const filteredFilaments = spoolsData.filter(spool => { | ||||
|             if (!spool?.filament?.vendor?.id) { | ||||
|                 console.log('Problem aufgetreten bei: ', spool?.filament?.vendor); | ||||
|                 console.log('Problematische Spulen:',  | ||||
|                     spoolsData.filter(spool => !spool?.filament?.vendor?.id)); | ||||
|                 return false; | ||||
|             } | ||||
|  | ||||
|             const hasValidNfcId = spool.extra &&  | ||||
|                                  spool.extra.nfc_id &&  | ||||
|                                  spool.extra.nfc_id !== '""' &&  | ||||
| @@ -240,18 +247,6 @@ async function fetchSpoolData() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| /* | ||||
| // Exportiere Funktionen | ||||
| window.getSpoolData = () => spoolsData; | ||||
| window.reloadSpoolData = initSpoolman; | ||||
| window.populateVendorDropdown = populateVendorDropdown; | ||||
| window.updateFilamentDropdown = updateFilamentDropdown; | ||||
| window.toggleFilamentDropdown = () => { | ||||
|     const content = document.getElementById("filament-dropdown-content"); | ||||
|     content.classList.toggle("show"); | ||||
| }; | ||||
| */ | ||||
|  | ||||
| // Event Listener | ||||
| document.addEventListener('DOMContentLoaded', () => { | ||||
|     initSpoolman(); | ||||
|   | ||||
| @@ -129,6 +129,7 @@ | ||||
|                             if (data.status === 'success' || lastReceivedProgress >= 98) { | ||||
|                                 clearTimeout(wsReconnectTimer); | ||||
|                                 setTimeout(() => { | ||||
|                                     window.location.reload(true); | ||||
|                                     window.location.href = '/'; | ||||
|                                 }, 30000); | ||||
|                             } | ||||
| @@ -148,6 +149,7 @@ | ||||
|                         status.style.display = 'block'; | ||||
|                         clearTimeout(wsReconnectTimer); | ||||
|                         setTimeout(() => { | ||||
|                             window.location.reload(true); | ||||
|                             window.location.href = '/'; | ||||
|                         }, 30000); | ||||
|                     } else { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| ; https://docs.platformio.org/page/projectconf.html | ||||
|  | ||||
| [common] | ||||
| version = "1.4.0" | ||||
| version = "1.4.4" | ||||
| to_old_version = "1.4.0" | ||||
|  | ||||
| ## | ||||
|   | ||||
| @@ -17,7 +17,7 @@ PubSubClient client(sslClient); | ||||
|  | ||||
| TaskHandle_t BambuMqttTask; | ||||
|  | ||||
| String report_topic = ""; | ||||
| String topic = ""; | ||||
| //String request_topic = ""; | ||||
| const char* bambu_username = "bblp"; | ||||
| const char* bambu_ip = nullptr; | ||||
| @@ -91,7 +91,7 @@ bool loadBambuCredentials() { | ||||
|         bambu_accesscode = g_bambu_accesscode.c_str(); | ||||
|         bambu_serialnr = g_bambu_serialnr.c_str(); | ||||
|  | ||||
|         report_topic = "device/" + String(bambu_serialnr) + "/report"; | ||||
|         topic = "device/" + String(bambu_serialnr); | ||||
|         //request_topic = "device/" + String(bambu_serialnr) + "/request"; | ||||
|         return true; | ||||
|     } | ||||
| @@ -199,7 +199,7 @@ FilamentResult findFilamentIdx(String brand, String type) { | ||||
| bool sendMqttMessage(const String& payload) { | ||||
|     Serial.println("Sending MQTT message"); | ||||
|     Serial.println(payload); | ||||
|     if (client.publish(report_topic.c_str(), payload.c_str()))  | ||||
|     if (client.publish((String(topic) + "/request").c_str(), payload.c_str()))  | ||||
|     { | ||||
|         return true; | ||||
|     } | ||||
| @@ -553,10 +553,11 @@ void reconnect() { | ||||
|         oledShowTopRow(); | ||||
|  | ||||
|         // Attempt to connect | ||||
|         if (client.connect(bambu_serialnr, bambu_username, bambu_accesscode)) { | ||||
|         String clientId = String(bambu_serialnr) + "_" + String(random(0, 100)); | ||||
|         if (client.connect(clientId.c_str(), bambu_username, bambu_accesscode)) { | ||||
|             Serial.println("MQTT re/connected"); | ||||
|  | ||||
|             client.subscribe(report_topic.c_str()); | ||||
|             client.subscribe((String(topic) + "/report").c_str()); | ||||
|             bambu_connected = true; | ||||
|             oledShowTopRow(); | ||||
|         } else { | ||||
| @@ -619,12 +620,12 @@ bool setupMqtt() { | ||||
|  | ||||
|         // Verbinden mit dem MQTT-Server | ||||
|         bool connected = true; | ||||
|         if (client.connect(bambu_serialnr, bambu_username, bambu_accesscode))  | ||||
|         String clientId = String(bambu_serialnr) + "_" + String(random(0, 100)); | ||||
|         if (client.connect(clientId.c_str(), bambu_username, bambu_accesscode))  | ||||
|         { | ||||
|             client.setCallback(mqtt_callback); | ||||
|             client.setBufferSize(5120); | ||||
|             // Optional: Topic abonnieren | ||||
|             client.subscribe(report_topic.c_str()); | ||||
|             client.setBufferSize(15488); | ||||
|             client.subscribe((String(topic) + "/report").c_str()); | ||||
|             //client.subscribe(request_topic.c_str()); | ||||
|             Serial.println("MQTT-Client initialisiert"); | ||||
|  | ||||
| @@ -635,7 +636,7 @@ bool setupMqtt() { | ||||
|             xTaskCreatePinnedToCore( | ||||
|                 mqtt_loop, /* Function to implement the task */ | ||||
|                 "BambuMqtt", /* Name of the task */ | ||||
|                 8192,  /* Stack size in words */ | ||||
|                 10240,  /* Stack size in words */ | ||||
|                 NULL,  /* Task input parameter */ | ||||
|                 mqttTaskPrio,  /* Priority of the task */ | ||||
|                 &BambuMqttTask,  /* Task handle. */ | ||||
|   | ||||
							
								
								
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -92,12 +92,19 @@ void loop() { | ||||
|   unsigned long currentMillis = millis(); | ||||
|  | ||||
|   // Überprüfe regelmäßig die WLAN-Verbindung | ||||
|   if (intervalElapsed(currentMillis, lastWifiCheckTime, wifiCheckInterval)) { | ||||
|   if (intervalElapsed(currentMillis, lastWifiCheckTime, wifiCheckInterval))  | ||||
|   { | ||||
|     checkWiFiConnection(); | ||||
|   } | ||||
|  | ||||
|   // Wenn Bambu auto set Spool aktiv | ||||
|   if (autoSendToBambu && autoSetToBambuSpoolId > 0) { | ||||
|   if (autoSendToBambu && autoSetToBambuSpoolId > 0)  | ||||
|   { | ||||
|     if (!bambu_connected)  | ||||
|     { | ||||
|       bambu_restart(); | ||||
|     } | ||||
|  | ||||
|     if (intervalElapsed(currentMillis, lastAutoSetBambuAmsTime, autoSetBambuAmsInterval))  | ||||
|     { | ||||
|       if (hasReadRfidTag == 0) | ||||
| @@ -152,7 +159,7 @@ void loop() { | ||||
|     lastWeightReadTime = currentMillis; | ||||
|  | ||||
|     // Prüfen ob die Waage korrekt genullt ist | ||||
|     if ((weight > 0 && weight < 5) || weight < 0) | ||||
|     if ((weight > 0 && weight < 5) || weight < -1) | ||||
|     { | ||||
|       if(scaleTareCounter < 5) | ||||
|       { | ||||
|   | ||||
| @@ -286,6 +286,14 @@ void setupWebserver(AsyncWebServer &server) { | ||||
|         } | ||||
|  | ||||
|         String url = request->getParam("url")->value(); | ||||
|         if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) { | ||||
|             url = "http://" + url; | ||||
|         } | ||||
|         // Remove trailing slash if exists | ||||
|         if (url.length() > 0 && url.charAt(url.length()-1) == '/') { | ||||
|             url = url.substring(0, url.length()-1); | ||||
|         } | ||||
|          | ||||
|         bool octoEnabled = (request->getParam("octoEnabled")->value() == "true") ? true : false; | ||||
|         String octoUrl = request->getParam("octoUrl")->value(); | ||||
|         String octoToken = (request->getParam("octoToken")->value() != "") ? request->getParam("octoToken")->value() : ""; | ||||
| @@ -300,7 +308,7 @@ void setupWebserver(AsyncWebServer &server) { | ||||
|         request->send(200, "application/json", jsonResponse); | ||||
|     }); | ||||
|  | ||||
|     // Route für das Überprüfen der Spoolman-Instanz | ||||
|     // Route für das Überprüfen der Bambu-Instanz | ||||
|     server.on("/api/bambu", HTTP_GET, [](AsyncWebServerRequest *request){ | ||||
|         if (!request->hasParam("bambu_ip") || !request->hasParam("bambu_serialnr") || !request->hasParam("bambu_accesscode")) { | ||||
|             request->send(400, "application/json", "{\"success\": false, \"error\": \"Missing parameter\"}"); | ||||
|   | ||||
| @@ -59,7 +59,7 @@ void initWiFi() { | ||||
|   if(wm_nonblocking) wm.setConfigPortalBlocking(false); | ||||
|   //wm.setConfigPortalTimeout(320); // Portal nach 5min schließen | ||||
|   wm.setWiFiAutoReconnect(true); | ||||
|   wm.setConnectTimeout(5); | ||||
|   wm.setConnectTimeout(10); | ||||
|  | ||||
|   oledShowTopRow(); | ||||
|   oledShowMessage("WiFi Setup"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user