diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp index fdeec610d5..ab5c61d26a 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp @@ -38,8 +38,6 @@ void DevAmsTray::UpdateColorFromStr(const std::string& color) } } -wxColour DevAmsTray::get_color() { return decode_color(color); } - void DevAmsTray::reset() { tag_uid = ""; @@ -66,7 +64,7 @@ void DevAmsTray::reset() } -bool DevAmsTray::is_tray_info_ready() +bool DevAmsTray::is_tray_info_ready() const { if (color.empty()) return false; if (type.empty()) return false; @@ -74,13 +72,13 @@ bool DevAmsTray::is_tray_info_ready() return true; } -bool DevAmsTray::is_unset_third_filament() +bool DevAmsTray::is_unset_third_filament() const { if (this->is_bbl) return false; return (color.empty() || type.empty()); } -std::string DevAmsTray::get_display_filament_type() +std::string DevAmsTray::get_display_filament_type() const { if (type == "PLA-S") return "Sup.PLA"; if (type == "PA-S") return "Sup.PA"; diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystem.h b/src/slic3r/GUI/DeviceCore/DevFilaSystem.h index 567bc6cf2b..8b05e022d8 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystem.h +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystem.h @@ -24,14 +24,6 @@ public: id = tray_id; } - static wxColour decode_color(const std::string& color); - - bool operator==(DevAmsTray const& o) const - { - return id == o.id && type == o.type && filament_setting_id == o.filament_setting_id && color == o.color; - } - bool operator!=(DevAmsTray const& o) const { return !operator==(o); } - std::string id; std::string tag_uid; // tag_uid std::string setting_id; // tray_info_idx @@ -61,16 +53,30 @@ public: int hold_count = 0; int remain = 0; // filament remain: 0 ~ 100 - void set_hold_count() { hold_count = HOLD_COUNT_MAX; } - void UpdateColorFromStr(const std::string& color); - wxColour get_color(); +public: + // operators + bool operator==(DevAmsTray const& o) const + { + return id == o.id && type == o.type && filament_setting_id == o.filament_setting_id && color == o.color; + } + bool operator!=(DevAmsTray const& o) const { return !operator==(o); } + // setters void reset(); + void UpdateColorFromStr(const std::string& color); + void set_hold_count() { hold_count = HOLD_COUNT_MAX; } - bool is_tray_info_ready(); - bool is_unset_third_filament(); - std::string get_display_filament_type(); + // getter + bool is_tray_info_ready() const; + bool is_unset_third_filament() const; + + wxColour get_color() const { return decode_color(color); }; + + std::string get_display_filament_type() const; std::string get_filament_type(); + + // static + static wxColour decode_color(const std::string& color); }; class DevAms diff --git a/src/slic3r/GUI/DeviceCore/DevMapping.cpp b/src/slic3r/GUI/DeviceCore/DevMapping.cpp index 52d324c646..e655f12db7 100644 --- a/src/slic3r/GUI/DeviceCore/DevMapping.cpp +++ b/src/slic3r/GUI/DeviceCore/DevMapping.cpp @@ -72,7 +72,7 @@ namespace Slic3r bool is_type_match = true; }; - static void _parse_tray_info(int ams_id, int slot_id, DevAmsTray tray, FilamentInfo& result) + static void _parse_tray_info(int ams_id, int slot_id, DevAms::AmsType type, DevAmsTray tray, FilamentInfo& result) { result.color = tray.color; result.type = tray.get_filament_type(); @@ -91,7 +91,14 @@ namespace Slic3r } else { - result.id = ams_id * 4 + slot_id; + if (type == DevAms::N3S) + { + result.id = ams_id + slot_id; + } + else + { + result.id = ams_id * 4 + slot_id; + } } } @@ -138,7 +145,7 @@ namespace Slic3r FilamentInfo info; if (tray->second->is_tray_info_ready()) { - _parse_tray_info(ams_id, tray_id, *(tray->second), info); + _parse_tray_info(ams_id, tray_id, ams_type, *(tray->second), info); } //first: left,nozzle=1,map=1 second: right,nozzle=0,map=2 @@ -179,7 +186,7 @@ namespace Slic3r } } FilamentInfo info; - _parse_tray_info(atoi(tray.id.c_str()), 0, tray, info); + _parse_tray_info(atoi(tray.id.c_str()), 0, DevAms::DUMMY, tray, info); tray_filaments.emplace(std::make_pair(info.tray_id, info)); } }