ENH: support ams remain in popup

jira: [STUDIO-9942]
Change-Id: I8514d1a1ac8e893ed46f18e1a42261c3af3f294c
This commit is contained in:
xin.zhang 2025-03-14 15:58:25 +08:00 committed by lane.wei
parent 5e93d4c16c
commit 9fff7967f3
5 changed files with 150 additions and 72 deletions

View File

@ -1,15 +1,20 @@
<svg width="74" height="78" viewBox="0 0 74 78" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_21650_70750)">
<mask id="mask0_21650_70750" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="74" height="78">
<path d="M74 0H0V78H74V0Z" fill="white"/>
<svg width="74" height="82" viewBox="0 0 74 82" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_21731_45418)">
<mask id="mask0_21731_45418" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="4" width="74" height="78">
<path d="M74 4H0V82H74V4Z" fill="white"/>
</mask>
<g mask="url(#mask0_21650_70750)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.8 0C1.3 0 0 1.1 0 2.4V75.6C0 76.9 1.3 78 2.8 78H71.2C72.7 78 74 76.9 74 75.6V2.4C74 1.1 72.7 0 71.2 0H2.8ZM4.2 1.2C2.7 1.2 1.4 2.3 1.4 3.6V58.8C1.4 60.1 2.7 61.2 4.2 61.2H69.8C71.3 61.2 72.6 60.1 72.6 58.8V3.6C72.6 2.3 71.3 1.2 69.8 1.2H4.2Z" fill="#595959"/>
<g mask="url(#mask0_21731_45418)">
</g>
<mask id="mask1_21731_45418" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="74" height="82">
<path d="M74 0H0V82H74V0Z" fill="white"/>
</mask>
<g mask="url(#mask1_21731_45418)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.8 0.152344C1.3 0.152344 0 1.25439 0 2.55681V79.7479C0 81.0503 1.3 82.1523 2.8 82.1523H71.2C72.7 82.1523 74 81.0503 74 79.7479L74 2.55681C74 1.25439 72.7 0.152344 71.2 0.152344H2.8ZM4.2 1.35458C2.7 1.35458 1.4 2.45662 1.4 3.75904L1.4 62.9173C1.4 64.2197 2.7 65.3216 4.2 65.3216H69.8C71.3 65.3216 72.6 64.2197 72.6 62.9173L72.6 3.75904C72.6 2.45662 71.3 1.35458 69.8 1.35458H4.2Z" fill="#AAAAAA"/>
</g>
</g>
<defs>
<clipPath id="clip0_21650_70750">
<rect width="74" height="78" fill="white"/>
<clipPath id="clip0_21731_45418">
<rect width="74" height="82" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,12 +1,3 @@
<svg width="230" height="78" viewBox="0 0 230 78" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7_8)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.80488 0C1.25579 0 0 1.07452 0 2.4V75.6C0 76.9254 1.25579 78 2.80488 78H227.195C228.744 78 230 76.9254 230 75.6V2.4C230 1.07452 228.744 0 227.195 0H2.80488ZM4.20732 1.2C2.65822 1.2 1.40244 2.27452 1.40244 3.6V58.8C1.40244 60.1254 2.65822 61.2 4.20732 61.2H225.793C227.342 61.2 228.598 60.1254 228.598 58.8V3.6C228.598 2.27452 227.342 1.2 225.793 1.2H4.20732Z" fill="#595959"/>
<path d="M115.012 77.0102C118.885 77.0102 122.024 73.8739 122.024 70.0051C122.024 66.1363 118.885 63 115.012 63C111.139 63 108 66.1363 108 70.0051C108 73.8739 111.139 77.0102 115.012 77.0102Z" fill="#D9D9D9"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M115.257 68.9431V67.2031H117.817L117.818 69.7228L115.257 68.9431ZM117.816 72.8071H115.255V69.3277L117.816 70.1067V72.8071ZM112.207 67.2031V70.6825L114.768 69.9035L114.767 67.2031H112.207ZM114.767 72.8064H112.207V71.0671L114.768 70.2867L114.767 72.8064Z" fill="#545454"/>
</g>
<defs>
<clipPath id="clip0_7_8">
<rect width="230" height="78" fill="white"/>
</clipPath>
</defs>
<svg width="230" height="82" viewBox="0 0 230 82" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.80488 0C1.25579 0 0 1.07452 0 2.4V79.6C0 80.9254 1.25579 82 2.80488 82H227.195C228.744 82 230 80.9254 230 79.6V2.4C230 1.07452 228.744 0 227.195 0H2.80488ZM4.20732 1.2C2.65822 1.2 1.40244 2.27452 1.40244 3.6V62.8C1.40244 64.1254 2.65822 65.2 4.20732 65.2H225.793C227.342 65.2 228.598 64.1254 228.598 62.8V3.6C228.598 2.27452 227.342 1.2 225.793 1.2H4.20732Z" fill="#AAAAAA"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 533 B

View File

@ -27,6 +27,9 @@ namespace Slic3r { namespace GUI {
#define MATERIAL_ITEM_SIZE wxSize(FromDIP(65), FromDIP(50))
#define MATERIAL_REC_WHEEL_SIZE wxSize(FromDIP(17), FromDIP(16))
#define MAPPING_ITEM_REAL_SIZE wxSize(FromDIP(48), FromDIP(60))
#define MAPPING_ITEM_REMAIN_AREA_H FromDIP(10)
wxDEFINE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent);
const int LEFT_OFFSET = 2;
MaterialItem::MaterialItem(wxWindow *parent, wxColour mcolour, wxString mname)
@ -821,7 +824,7 @@ void AmsMapingPopup::update_ams_data_multi_machines()
if (m_amsmapping_container_list.size() > m_amsmapping_container_list_index ) {
m_amsmapping_container_list[m_amsmapping_container_list_index]->Show();
add_ams_mapping(tray_datas, m_amsmapping_container_list[m_amsmapping_container_list_index], m_amsmapping_container_sizer_list[m_amsmapping_container_list_index]);
add_ams_mapping(tray_datas, m_ams_remain_detect_flag, m_amsmapping_container_list[m_amsmapping_container_list_index], m_amsmapping_container_sizer_list[m_amsmapping_container_list_index]);
}
Layout();
@ -925,6 +928,7 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
if (!obj) {return;}
m_ams_remain_detect_flag = obj->ams_calibrate_remain_flag;
for (auto& ams_container : m_amsmapping_container_list) {
ams_container->Destroy();
@ -1013,6 +1017,7 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
}
else {
td.type = NORMAL;
td.remain = tray_data->remain;
td.colour = AmsTray::decode_color(tray_data->color);
td.name = tray_data->get_display_filament_type();
td.filament_type = tray_data->get_filament_type();
@ -1047,7 +1052,8 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
if (ams_type >=1 || ams_type <= 3) { //1:ams 2:ams-lite 3:n3f
auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL);
auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0? m_right_marea_panel:m_left_marea_panel, ams_iter->second->trayList.size());
auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0 ? m_right_marea_panel : m_left_marea_panel,
ams_iter->second->get_ams_device_name(), ams_iter->second->trayList.size());
ams_mapping_item_container->SetSizer(sizer_mapping_list);
ams_mapping_item_container->Layout();
@ -1076,6 +1082,7 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
}
else {
td.type = NORMAL;
td.remain = tray_data->remain;
td.colour = AmsTray::decode_color(tray_data->color);
td.name = tray_data->get_display_filament_type();
td.filament_type = tray_data->get_filament_type();
@ -1090,7 +1097,7 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
}
ams_mapping_item_container->Show();
add_ams_mapping(tray_datas, ams_mapping_item_container, sizer_mapping_list);
add_ams_mapping(tray_datas, obj->ams_calibrate_remain_flag, ams_mapping_item_container, sizer_mapping_list);
m_amsmapping_container_sizer_list.push_back(sizer_mapping_list);
m_amsmapping_container_list.push_back(ams_mapping_item_container);
@ -1155,6 +1162,7 @@ std::vector<TrayData> AmsMapingPopup::parse_ams_mapping(std::map<std::string, Am
}
else {
td.type = NORMAL;
td.remain = tray_data->remain;
td.colour = AmsTray::decode_color(tray_data->color);
td.name = tray_data->get_display_filament_type();
td.filament_type = tray_data->get_filament_type();
@ -1168,7 +1176,7 @@ std::vector<TrayData> AmsMapingPopup::parse_ams_mapping(std::map<std::string, Am
return m_tray_data;
}
void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow* container, wxBoxSizer* sizer)
void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, bool remain_detect_flag, wxWindow* container, wxBoxSizer* sizer)
{
sizer->Add(0,0,0,wxLEFT,FromDIP(6));
@ -1189,9 +1197,9 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow*
if (tray_data[i].type == NORMAL) {
if (is_match_material(tray_data[i].filament_type)) {
m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]);
m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, remain_detect_flag, tray_data[i]);
} else {
m_mapping_item->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true);
m_mapping_item->set_data(wxColour(0xEE, 0xEE, 0xEE), tray_data[i].name, remain_detect_flag, tray_data[i], true);
m_has_unmatch_filament = true;
}
@ -1205,7 +1213,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow*
// temp
if (tray_data[i].type == EMPTY) {
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", tray_data[i]);
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", remain_detect_flag, tray_data[i]);
m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) {
return; //not allowed to map to empty slots
m_mapping_item->send_event(m_current_filament_id);
@ -1215,7 +1223,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow*
// third party
if (tray_data[i].type == THIRD) {
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data[i]);
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", remain_detect_flag, tray_data[i]);
m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) {
m_mapping_item->send_event(m_current_filament_id);
Dismiss();
@ -1235,10 +1243,10 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// set button
if (tray_data.type == NORMAL) {
if (is_match_material(tray_data.filament_type)) {
item->set_data(tray_data.colour, tray_data.name, tray_data);
item->set_data(tray_data.colour, tray_data.name, false, tray_data);
}
else {
item->set_data(wxColour(0xEE, 0xEE, 0xEE), tray_data.name, tray_data, true);
item->set_data(wxColour(0xEE, 0xEE, 0xEE), tray_data.name, false, tray_data, true);
m_has_unmatch_filament = true;
}
@ -1252,7 +1260,7 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// temp
if (tray_data.type == EMPTY) {
item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", tray_data);
item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", false, tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data,item](wxMouseEvent& e) {
item->send_event(m_current_filament_id);
Dismiss();
@ -1261,7 +1269,7 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// third party
if (tray_data.type == THIRD) {
item->set_data(tray_data.colour, "?", tray_data);
item->set_data(tray_data.colour, "?", false, tray_data);
//item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
item->send_event(m_current_filament_id);
@ -1337,6 +1345,39 @@ void MappingItem::paintEvent(wxPaintEvent &evt)
// PrepareDC(dc);
}
static void _DrawRemainArea(const MappingItem *item, const TrayData &dd, bool support_remain_dect, wxDC &dc)
{
int to_paint_remain = dd.remain;
/*paint invalid data as 100*/
if (!support_remain_dect) { to_paint_remain = 100;}
if (dd.ams_id == VIRTUAL_TRAY_MAIN_ID || dd.ams_id == VIRTUAL_TRAY_DEPUTY_ID) { to_paint_remain = 100; }
if (0 > to_paint_remain || to_paint_remain > 100) { to_paint_remain = 100; }
wxSize size = item->GetSize();
int x_margin = item->FromDIP(4);
int y_margin = item->FromDIP(2);
int full_range_width = size.x;
/*range background*/
dc.SetPen(wxColour(0xE4E4E4));
dc.SetBrush(wxColour(0xE4E4E4));
int bg_height = item->FromDIP(6);
int bg_width = full_range_width - (2 * x_margin);
dc.DrawRoundedRectangle(x_margin, y_margin, bg_width, bg_height, item->FromDIP(2));
/*remain fill*/
if (!dd.name.empty())
{
dc.SetPen(dd.colour);
dc.SetBrush(dd.colour);
int border = item->FromDIP(1);
int remain_width = (bg_width - (2 * border)) * to_paint_remain / 100;
int remain_height = bg_height - (2 * border);
dc.DrawRoundedRectangle(x_margin + border, y_margin + border, remain_width, remain_height, item->FromDIP(2));
}
}
void MappingItem::render(wxDC &dc)
{
wxSize size = GetSize();
@ -1358,12 +1399,16 @@ void MappingItem::render(wxDC &dc)
doRender(dc);
#endif
/*remain*/
_DrawRemainArea(this, m_tray_data, m_support_remain_detect, dc);
auto top = MAPPING_ITEM_REMAIN_AREA_H;
// checked
if (m_checked)
{
dc.DrawBitmap(mapping_item_checked.bmp(), size.x - mapping_item_checked.GetBmpWidth() - FromDIP(4), 0);
dc.DrawBitmap(mapping_item_checked.bmp(), size.x - mapping_item_checked.GetBmpWidth() - FromDIP(4), top);
}
auto top = mapping_item_checked.GetBmpHeight() - FromDIP(4);
top += 0.5 * mapping_item_checked.GetBmpHeight();
// materials name
dc.SetFont(::Label::Head_13);
@ -1384,14 +1429,15 @@ void MappingItem::render(wxDC &dc)
dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, top));
}
void MappingItem::set_data(wxColour colour, wxString name, TrayData data, bool unmatch)
void MappingItem::set_data(wxColour colour, wxString name, bool remain_dect, TrayData data, bool unmatch)
{
m_unmatch = unmatch;
m_tray_data = data;
if (m_coloul != colour || m_name != name) {
if (m_coloul != colour || m_name != name || (m_support_remain_detect != remain_dect)) {
m_coloul = colour;
m_name = name;
m_support_remain_detect = remain_dect;
Refresh();
}
@ -1431,7 +1477,7 @@ void MappingItem::doRender(wxDC &dc)
//gradient
if (m_tray_data.ctype == 0) {
for (int i = 0; i < m_tray_data.material_cols.size() - 1; i++) {
auto rect = wxRect(left, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y);
auto rect = wxRect(left, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2 + MAPPING_ITEM_REMAIN_AREA_H, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y);
dc.GradientFillLinear(rect, m_tray_data.material_cols[i], m_tray_data.material_cols[i + 1], wxEAST);
left += gwidth;
}
@ -1441,28 +1487,23 @@ void MappingItem::doRender(wxDC &dc)
for (int i = 0; i < cols_size; i++) {
dc.SetBrush(wxBrush(m_tray_data.material_cols[i]));
float x = (float)MAPPING_ITEM_REAL_SIZE.x * i / cols_size;
dc.DrawRectangle(x, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, (float)MAPPING_ITEM_REAL_SIZE.x / cols_size, MAPPING_ITEM_REAL_SIZE.y);
dc.DrawRectangle(x, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2 + MAPPING_ITEM_REMAIN_AREA_H, (float) MAPPING_ITEM_REAL_SIZE.x / cols_size, MAPPING_ITEM_REAL_SIZE.y);
}
}
}
else if (color.Alpha() == 0 && !m_unmatch) {
dc.DrawBitmap( m_transparent_mapping_item.bmp(), 0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2);
dc.DrawBitmap(m_transparent_mapping_item.bmp(), 0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2 + MAPPING_ITEM_REMAIN_AREA_H);
}
else {
dc.DrawRectangle(0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y);
dc.DrawRectangle(0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2 + MAPPING_ITEM_REMAIN_AREA_H, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y);
}
wxColour side_colour = wxColour(0xE4E4E4);
dc.SetPen(side_colour);
dc.SetBrush(wxBrush(side_colour));
#ifdef __APPLE__
dc.DrawRectangle(0, 0, FromDIP(4), size.y);
dc.DrawRectangle(size.x - FromDIP(4), 0, FromDIP(4), size.y);
#else
dc.DrawRectangle(0, 0, FromDIP(4), size.y);
dc.DrawRectangle(size.x - FromDIP(4), 0, FromDIP(4), size.y);
#endif // __APPLE__
dc.DrawRectangle(0, MAPPING_ITEM_REMAIN_AREA_H, FromDIP(4), size.y);
dc.DrawRectangle(size.x - FromDIP(4), MAPPING_ITEM_REMAIN_AREA_H, FromDIP(4), size.y);
}
@ -1873,7 +1914,7 @@ bool AmsIntroducePopup::ProcessLeftDown(wxMouseEvent& event) {
}
MappingContainer::MappingContainer(wxWindow* parent, int slots_num)
MappingContainer::MappingContainer(wxWindow *parent, const wxString &ams_type, int slots_num)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
{
#ifdef __WINDOWS__
@ -1882,18 +1923,19 @@ MappingContainer::MappingContainer(wxWindow* parent, int slots_num)
SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
Bind(wxEVT_PAINT, &MappingContainer::paintEvent, this);
m_ams_type = ams_type;
m_slots_num = slots_num;
if (slots_num == 1)
{
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_1", this, 78);
SetMinSize(wxSize(FromDIP(74), FromDIP(78)));
SetMaxSize(wxSize(FromDIP(230), FromDIP(78)));
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_1", this, 82);
SetMinSize(wxSize(FromDIP(74), FromDIP(82)));
SetMaxSize(wxSize(FromDIP(74), FromDIP(82)));
}
else
{
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_4", this, 78);
SetMinSize(wxSize(FromDIP(230), FromDIP(78)));
SetMaxSize(wxSize(FromDIP(230), FromDIP(78)));
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_4", this, 82);
SetMinSize(wxSize(FromDIP(230), FromDIP(82)));
SetMaxSize(wxSize(FromDIP(230), FromDIP(82)));
}
}
@ -1932,6 +1974,12 @@ void MappingContainer::render(wxDC& dc)
void MappingContainer::doRender(wxDC& dc)
{
dc.DrawBitmap(ams_mapping_item_container, 0, 0);
dc.SetFont(::Label::Head_11);
auto size = GetSize();
auto extent = dc.GetTextExtent(m_ams_type);
dc.SetTextForeground(wxColour("#F1F1F1"));
dc.DrawText(m_ams_type, FromDIP(10), size.GetHeight() - extent.GetHeight());
}
AmsReplaceMaterialDialog::AmsReplaceMaterialDialog(wxWindow* parent)

View File

@ -38,6 +38,8 @@
#include <wx/simplebook.h>
#include <wx/hashmap.h>
#define MAPPING_ITEM_INVALID_REMAIN -1
namespace Slic3r { namespace GUI {
@ -60,6 +62,7 @@ struct TrayData
TrayType type;
int id;
int ctype = 0;
int remain = MAPPING_ITEM_INVALID_REMAIN;
std::string name;
std::string filament_type;
wxColour colour;
@ -159,7 +162,7 @@ public:
public:
void update_data(TrayData data);
void send_event(int fliament_id);
void set_data(wxColour colour, wxString name, TrayData data, bool unmatch = false);
void set_data(wxColour colour, wxString name, bool remain_detect, TrayData data, bool unmatch = false);
void set_checked(bool checked);
void set_tray_index(wxString t_index) { m_tray_index = t_index; };
@ -172,16 +175,18 @@ private:
private:
bool m_checked = false;
bool m_support_remain_detect = false;
};
class MappingContainer : public wxPanel
{
private:
int m_slots_num = 4;/*1 or 4*/
wxString m_ams_type;
wxBitmap ams_mapping_item_container;
public:
MappingContainer(wxWindow* parent, int slots_num = 4);
MappingContainer(wxWindow* parent, const wxString& ams_type, int slots_num = 4);
~MappingContainer();
public:
@ -196,6 +201,7 @@ protected:
class AmsMapingPopup : public PopupWindow
{
bool m_use_in_sync_dialog = false;
bool m_ams_remain_detect_flag = false;
wxStaticText* m_title_text{ nullptr };
public:
@ -252,8 +258,8 @@ public:
void update_title(MachineObject* obj);
void update_items_check_state(const std::vector<FilamentInfo>& ams_mapping_result);
void update_ams_data_multi_machines();
void add_ams_mapping(std::vector<TrayData> tray_data, wxWindow* container, wxBoxSizer* sizer);
void add_ext_ams_mapping(TrayData tray_data, MappingItem* item);
void add_ams_mapping(std::vector<TrayData> tray_data, bool remain_detect_flag, wxWindow *container, wxBoxSizer *sizer);
void add_ext_ams_mapping(TrayData tray_data, MappingItem *item);
void set_current_filament_id(int id) { m_current_filament_id = id; };
int get_current_filament_id(){return m_current_filament_id;};
bool is_match_material(std::string material);

View File

@ -357,25 +357,53 @@ public:
#define INVALID_AMS_TEMPERATURE std::numeric_limits<float>::min()
class Ams {
class Ams
{
public:
Ams(std::string ams_id, int nozzle_id, int type_id) {
id = ams_id;
Ams(std::string ams_id, int nozzle_id, int type_id)
{
id = ams_id;
nozzle = nozzle_id;
type = type_id;
type = type_id;
}
std::string id;
int left_dry_time = 0;
int humidity = 5;
int humidity_raw = -1;// the percentage, -1 means invalid. eg. 100 means 100%
float current_temperature = INVALID_AMS_TEMPERATURE; // the temperature
bool startup_read_opt{true};
bool tray_read_opt{false};
bool is_exists{false};
std::map<std::string, AmsTray*> trayList;
std::string id;
int left_dry_time = 0;
int humidity = 5;
int humidity_raw = -1; // the percentage, -1 means invalid. eg. 100 means 100%
float current_temperature = INVALID_AMS_TEMPERATURE; // the temperature
bool startup_read_opt{true};
bool tray_read_opt{false};
bool is_exists{false};
std::map<std::string, AmsTray *> trayList;
int nozzle;
int type{1}; //0:dummy 1:ams 2:ams-lite 3:n3f 4:n3s
int nozzle;
int type{1}; // 0:dummy 1:ams 2:ams-lite 3:n3f 4:n3s
public:
wxString get_ams_device_name() const
{
wxString ams_device_name;
if (type == 1) {
ams_device_name = "AMS-%d";
} else if (type == 2) {
ams_device_name = "AMS Lite-%d";
} else if (type == 3) {
ams_device_name = "AMS 2 PRO-%d";
} else if (type == 4) {
ams_device_name = "AMS HT-%d";
} else {
assert(0);
ams_device_name = "AMS-%d";
}
int num_id;
try {
num_id = std::stoi(id);
} catch (...) {}
int loc = (num_id > 127) ? (num_id - 127) : (num_id + 1);
return wxString::Format(ams_device_name, loc);
};
};
enum PrinterFirmwareType {