Skip to content

Commit

Permalink
Add support for Sunlu
Browse files Browse the repository at this point in the history
  • Loading branch information
spuder committed Mar 1, 2025
1 parent 277ae0e commit 515a561
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions firmware/bambu.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace bambulabs

// Special cases for brand-specific codes
const std::unordered_map<std::string, std::unordered_map<std::string, std::string>> brand_specific_codes = {
{"PLA", {{"Bambu", "GFA00"}, {"PolyTerra", "GFL01"}, {"PolyLite", "GFL00"}}},
{"PLA", {{"Bambu", "GFA00"}, {"PolyTerra", "GFL01"}, {"PolyLite", "GFL00"}, {"Sunlu", "SNL02"}}},
{"PLA Aero", {{"Bambu", "GFG01"}}},
{"TPU", {{"Bambu", "GFU01"}}},
{"ABS", {{"Bambu", "GFB00"}, {"PolyLite", "GFB60"}}},
Expand All @@ -50,7 +50,7 @@ namespace bambulabs
{"PET-CF", {{"Bambu", "GFT00"}}},
{"PETG HF", {{"Bambu", "GFG02"}}},
{"PETG Translucent", {{"Bambu", "GFG01"}}},
{"PETG", {{"Bambu", "GFG00"}, {"PolyLite", "GFG60"}}}};
{"PETG", {{"Bambu", "GFG00"}, {"PolyLite", "GFG60"}, {"Sunlu", "SNL08"}}}};

// Function with two parameters
inline std::string get_bambu_code(const std::string &type, const std::string &brand = "")
Expand Down
47 changes: 24 additions & 23 deletions firmware/conf.d/filament.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ select:
- Overture
- PolyTerra
- PolyLite
- Sunlu
on_value:
then:
- script.execute: generate_filament_brand_code
Expand Down Expand Up @@ -184,29 +185,29 @@ select:
}
- script.execute: preview_rfid_data
switch:
- platform: template
name: "Include alpha value in filament color"
id: filament_include_alpha
state_topic:
icon: "mdi:palette-outline"
optimistic: true
web_server:
sorting_group_id: sorting_group_filament_settings
sorting_weight: 70
turn_on_action:
then:
- lambda: |-
id(filament_include_alpha).publish_state(true);
char hexStr[3];
sprintf(hexStr, "%02X", (int)id(filament_alpha_int).state);
id(filament_alpha).publish_state(hexStr);
- script.execute: preview_rfid_data
turn_off_action:
then:
- lambda: |-
id(filament_include_alpha).publish_state(false);
id(filament_alpha).publish_state("");
- script.execute: preview_rfid_data
- platform: template
name: "Include alpha value in filament color"
id: filament_include_alpha
state_topic:
icon: "mdi:palette-outline"
optimistic: true
web_server:
sorting_group_id: sorting_group_filament_settings
sorting_weight: 70
turn_on_action:
then:
- lambda: |-
id(filament_include_alpha).publish_state(true);
char hexStr[3];
sprintf(hexStr, "%02X", (int)id(filament_alpha_int).state);
id(filament_alpha).publish_state(hexStr);
- script.execute: preview_rfid_data
turn_off_action:
then:
- lambda: |-
id(filament_include_alpha).publish_state(false);
id(filament_alpha).publish_state("");
- script.execute: preview_rfid_data
number:
- platform: template
name: "Filament Min Temp"
Expand Down

0 comments on commit 515a561

Please sign in to comment.