feat: add own_filaments.json and integrate custom filament loading in bambu.cpp
This commit is contained in:
parent
2948a35fa8
commit
08f37186b4
31
html/own_filaments.json
Normal file
31
html/own_filaments.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"TPU": "GFU99",
|
||||||
|
"PA": "GFN99",
|
||||||
|
"PA-CF": "GFN98",
|
||||||
|
"PLA": "GFL99",
|
||||||
|
"PLA Silk": "GFL96",
|
||||||
|
"PLA-CF": "GFL98",
|
||||||
|
"PLA High Speed": "GFL95",
|
||||||
|
"PETG": "GFG99",
|
||||||
|
"PETG-CF": "GFG98",
|
||||||
|
"PCTG": "GFG97",
|
||||||
|
"ABS": "GFB99",
|
||||||
|
"ABS+HS": "GFB99",
|
||||||
|
"PC": "GFC99",
|
||||||
|
"PC/ABS": "GFC99",
|
||||||
|
"ASA": "GFB98",
|
||||||
|
"PVA": "GFS99",
|
||||||
|
"HIPS": "GFS98",
|
||||||
|
"PPS-CF": "GFT98",
|
||||||
|
"PPS": "GFT97",
|
||||||
|
"PPA-CF": "GFN97",
|
||||||
|
"PPA-GF": "GFN96",
|
||||||
|
"PE": "GFP99",
|
||||||
|
"PE-CF": "GFP98",
|
||||||
|
"PP": "GFP97",
|
||||||
|
"PP-CF": "GFP96",
|
||||||
|
"PP-GF": "GFP95",
|
||||||
|
"EVA": "GFR99",
|
||||||
|
"PHA": "GFR98",
|
||||||
|
"BVOH": "GFS97"
|
||||||
|
}
|
@ -95,12 +95,37 @@ FilamentResult findFilamentIdx(String brand, String type) {
|
|||||||
// JSON-Dokument für die Filament-Daten erstellen
|
// JSON-Dokument für die Filament-Daten erstellen
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
|
|
||||||
|
// Laden der own_filaments.json
|
||||||
|
String ownFilament = "";
|
||||||
|
if (!loadJsonValue("/own_filaments.json", doc))
|
||||||
|
{
|
||||||
|
Serial.println("Fehler beim Laden der eigenen Filament-Daten");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Durchsuche direkt nach dem Type als Schlüssel
|
||||||
|
if (doc[type].is<String>()) {
|
||||||
|
ownFilament = doc[type].as<String>();
|
||||||
|
}
|
||||||
|
doc.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Laden der bambu_filaments.json
|
// Laden der bambu_filaments.json
|
||||||
if (!loadJsonValue("/bambu_filaments.json", doc)) {
|
if (!loadJsonValue("/bambu_filaments.json", doc))
|
||||||
|
{
|
||||||
Serial.println("Fehler beim Laden der Filament-Daten");
|
Serial.println("Fehler beim Laden der Filament-Daten");
|
||||||
return {"GFL99", "PLA"}; // Fallback auf Generic PLA
|
return {"GFL99", "PLA"}; // Fallback auf Generic PLA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wenn eigener Typ
|
||||||
|
if (ownFilament != "")
|
||||||
|
{
|
||||||
|
if (doc[ownFilament].is<String>())
|
||||||
|
{
|
||||||
|
return {ownFilament, doc[ownFilament].as<String>()};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Erst versuchen wir die exakte Brand + Type Kombination zu finden
|
// 1. Erst versuchen wir die exakte Brand + Type Kombination zu finden
|
||||||
String searchKey;
|
String searchKey;
|
||||||
if (brand == "Bambu" || brand == "Bambulab") {
|
if (brand == "Bambu" || brand == "Bambulab") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user