mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-01 12:20:47 -07:00
FIX: auto mapping for N3S
JIRA: [STUDIO-13844] Change-Id: I9840e120c9857dc33923858b022da439e5b92784 (cherry picked from commit d8a07b47fbfa2b628d56658e9c45b0926eb6fcd8)
This commit is contained in:
parent
bdf413fb58
commit
52e9e0ae08
3 changed files with 34 additions and 23 deletions
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue