mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 23:01:09 -05:00
Moonraker printer agents: report a color list for every slot (#16630)
Moonraker agents now send cols and ctype for every tray, the same fields the Bambu AMS sends. A single-color tray sends its one color with ctype 1. A multi-color spool sends all its colors once an agent fills the new AmsTrayData::tray_colors. Sending cols for every tray keeps update_filament_multi_color() from stopping at the first tray that has none.
This commit is contained in:
1 parent
0ef9015904
commit
e00f4b7008
2 files changed
+15
No files matched your search
@@ -533,6 +533,18 @@ void MoonrakerPrinterAgent::build_ams_payload(int ams_count, int max_lane_index,
|
||||
tray_json["tray_info_idx"] = tray->tray_info_idx;
|
||||
tray_json["tray_type"] = tray->tray_type;
|
||||
tray_json["tray_color"] = normalize_color_value(tray->tray_color);
|
||||
// Sent for every tray, since update_filament_multi_color() stops at the first tray without "cols".
|
||||
// "ctype" uses the filament_colour_type values (0 = gradient, 1 = solid or segments).
|
||||
const bool multi = tray->tray_colors.size() > 1;
|
||||
nlohmann::json cols = nlohmann::json::array();
|
||||
if (multi) {
|
||||
for (const std::string& color : tray->tray_colors)
|
||||
cols.push_back(normalize_color_value(color));
|
||||
} else {
|
||||
cols.push_back(tray_json["tray_color"]);
|
||||
}
|
||||
tray_json["cols"] = cols;
|
||||
tray_json["ctype"] = multi && tray->colors_gradient ? 0 : 1;
|
||||
|
||||
// Add temperature data if provided
|
||||
if (tray->bed_temp > 0) {
|
||||
|
||||
@@ -102,6 +102,9 @@ protected:
|
||||
bool has_filament = false;
|
||||
std::string tray_type; // Material type (e.g., "PLA", "ASA")
|
||||
std::string tray_color; // Raw color (#RRGGBB, 0xRRGGBB, or RRGGBBAA)
|
||||
std::vector<std::string> tray_colors; // Optional: every color of a multi-color spool, in order (same formats).
|
||||
// Used when it holds two or more; otherwise tray_color is the only one.
|
||||
bool colors_gradient = false; // With tray_colors: blend them as a gradient instead of drawing segments
|
||||
std::string tray_info_idx; // Filament ID (optional)
|
||||
int bed_temp = 0; // Optional
|
||||
int nozzle_temp = 0; // Optional
|
||||
|
||||
Reference in new issue
Block a user