mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-26 01:28:37 -07:00
FIX: change AMS n3s ams_id & tray_id from 512 to 128
Jira: [STUDIO-13477] Change-Id: I3844cb59df18220a22d8ff7524216b9fff2b6632 (cherry picked from commit 8c7b66d24b1e795c3070883f3f439cf160b38037)
This commit is contained in:
parent
a5c6450cc5
commit
5f1ff2f9a9
5 changed files with 85 additions and 74 deletions
|
|
@ -228,14 +228,24 @@ void MaterialItem::render(wxDC &dc)
|
|||
dc.DrawText(m_material_name, wxPoint((GetSize().x - material_txt_size.x) / 2, ((float)GetSize().y * 2 / 5 - material_txt_size.y) / 2));
|
||||
|
||||
|
||||
auto mapping_txt_size = dc.GetTextExtent(mapping_txt);
|
||||
|
||||
dc.SetTextForeground(wxColour(0x26, 0x2E, 0x30));
|
||||
dc.SetFont(::Label::Head_12);
|
||||
m_text_pos_y =((float)GetSize().y * 3 / 5 - mapping_txt_size.y) / 2 + (float)GetSize().y * 2 / 5;
|
||||
|
||||
auto mapping_txt_size = wxSize(0, 0);
|
||||
if (mapping_txt.size() >= 4) {
|
||||
mapping_txt.insert(mapping_txt.size() / 2, "\n");
|
||||
mapping_txt_size = dc.GetTextExtent(mapping_txt);
|
||||
m_text_pos_y = ((float) GetSize().y * 3 / 5 - mapping_txt_size.y) / 2 + (float) GetSize().y * 2 / 5 - mapping_txt_size.y / 2;
|
||||
m_text_pos_x = mapping_txt_size.x / 4;
|
||||
} else {
|
||||
mapping_txt_size = dc.GetTextExtent(mapping_txt);
|
||||
m_text_pos_y = ((float) GetSize().y * 3 / 5 - mapping_txt_size.y) / 2 + (float) GetSize().y * 2 / 5;
|
||||
m_text_pos_x = 0;
|
||||
}
|
||||
|
||||
if (m_match) {
|
||||
dc.DrawText(mapping_txt, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(8) - FromDIP(LEFT_OFFSET), m_text_pos_y));
|
||||
dc.DrawText(mapping_txt, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(8) - FromDIP(LEFT_OFFSET) + m_text_pos_x, m_text_pos_y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1162,71 +1172,71 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
|
|||
int ams_type = ams_iter->second->type;
|
||||
int nozzle_id = ams_iter->second->nozzle;
|
||||
|
||||
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->get_ams_device_name(),
|
||||
ams_iter->second->trayList.size());
|
||||
ams_mapping_item_container->SetName(nozzle_id == 0 ? m_right_marea_panel->GetName() : m_left_marea_panel->GetName());
|
||||
ams_mapping_item_container->SetSizer(sizer_mapping_list);
|
||||
ams_mapping_item_container->Layout();
|
||||
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->get_ams_device_name(),
|
||||
ams_iter->second->trayList.size());
|
||||
ams_mapping_item_container->SetName(nozzle_id == 0 ? m_right_marea_panel->GetName() : m_left_marea_panel->GetName());
|
||||
ams_mapping_item_container->SetSizer(sizer_mapping_list);
|
||||
ams_mapping_item_container->Layout();
|
||||
|
||||
m_has_unmatch_filament = false;
|
||||
m_has_unmatch_filament = false;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "ams_mapping ams id " << ams_iter->first.c_str();
|
||||
BOOST_LOG_TRIVIAL(trace) << "ams_mapping ams id " << ams_iter->first.c_str();
|
||||
|
||||
Ams * ams_group = ams_iter->second;
|
||||
std::vector<TrayData> tray_datas;
|
||||
std::map<std::string, AmsTray *>::iterator tray_iter;
|
||||
Ams * ams_group = ams_iter->second;
|
||||
std::vector<TrayData> tray_datas;
|
||||
std::map<std::string, AmsTray *>::iterator tray_iter;
|
||||
|
||||
for (tray_iter = ams_group->trayList.begin(); tray_iter != ams_group->trayList.end(); tray_iter++) {
|
||||
AmsTray *tray_data = tray_iter->second;
|
||||
TrayData td;
|
||||
for (tray_iter = ams_group->trayList.begin(); tray_iter != ams_group->trayList.end(); tray_iter++) {
|
||||
AmsTray *tray_data = tray_iter->second;
|
||||
TrayData td;
|
||||
if (ams_type == AMSModel::GENERIC_AMS || ams_type == AMSModel::AMS_LITE || ams_type == AMSModel::N3F_AMS) {
|
||||
td.id = ams_indx * AMS_TOTAL_COUNT + atoi(tray_data->id.c_str());
|
||||
} else if (ams_type == AMSModel::N3S_AMS) {
|
||||
td.id = ams_indx + atoi(tray_data->id.c_str());
|
||||
}
|
||||
td.ams_id = std::stoi(ams_iter->second->id);
|
||||
td.slot_id = std::stoi(tray_iter->second->id);
|
||||
|
||||
td.id = ams_indx * AMS_TOTAL_COUNT + atoi(tray_data->id.c_str());
|
||||
td.ams_id = std::stoi(ams_iter->second->id);
|
||||
td.slot_id = std::stoi(tray_iter->second->id);
|
||||
|
||||
if (!tray_data->is_exists) {
|
||||
td.type = EMPTY;
|
||||
if (!tray_data->is_exists) {
|
||||
td.type = EMPTY;
|
||||
} else {
|
||||
if (!tray_data->is_tray_info_ready()) {
|
||||
td.type = THIRD;
|
||||
} else {
|
||||
if (!tray_data->is_tray_info_ready()) {
|
||||
td.type = THIRD;
|
||||
} 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();
|
||||
td.ctype = tray_data->ctype;
|
||||
for (auto col : tray_data->cols) { td.material_cols.push_back(AmsTray::decode_color(col)); }
|
||||
}
|
||||
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();
|
||||
td.ctype = tray_data->ctype;
|
||||
for (auto col : tray_data->cols) { td.material_cols.push_back(AmsTray::decode_color(col)); }
|
||||
}
|
||||
|
||||
tray_datas.push_back(td);
|
||||
}
|
||||
|
||||
ams_mapping_item_container->Show();
|
||||
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);
|
||||
tray_datas.push_back(td);
|
||||
}
|
||||
|
||||
if (nozzle_id == 0) {
|
||||
has_right_ams = true;
|
||||
if (ams_mapping_item_container->get_slots_num() == 1) {
|
||||
right_one_slot_containers.push_back(ams_mapping_item_container);
|
||||
} else {
|
||||
right_four_slot_containers.push_back(ams_mapping_item_container);
|
||||
}
|
||||
} else if (nozzle_id == 1) {
|
||||
has_left_ams = true;
|
||||
if (ams_mapping_item_container->get_slots_num() == 1) {
|
||||
left_one_slot_containers.push_back(ams_mapping_item_container);
|
||||
} else {
|
||||
left_four_slots_containers.push_back(ams_mapping_item_container);
|
||||
}
|
||||
ams_mapping_item_container->Show();
|
||||
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);
|
||||
|
||||
if (nozzle_id == 0) {
|
||||
has_right_ams = true;
|
||||
if (ams_mapping_item_container->get_slots_num() == 1) {
|
||||
right_one_slot_containers.push_back(ams_mapping_item_container);
|
||||
} else {
|
||||
right_four_slot_containers.push_back(ams_mapping_item_container);
|
||||
}
|
||||
} else if (nozzle_id == 1) {
|
||||
has_left_ams = true;
|
||||
if (ams_mapping_item_container->get_slots_num() == 1) {
|
||||
left_one_slot_containers.push_back(ams_mapping_item_container);
|
||||
} else {
|
||||
left_four_slots_containers.push_back(ams_mapping_item_container);
|
||||
}
|
||||
} else if (ams_type == 4) { // 4:n3s
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2355,7 +2365,7 @@ void AmsReplaceMaterialDialog::update_to_nozzle(int nozzle_id)
|
|||
AmsTray* cur_tray = id2tray[elem.first];
|
||||
if (cur_tray)
|
||||
{
|
||||
auto tray_name = wxGetApp().transition_tridid(elem.first, elem.first > 127).ToStdString();
|
||||
auto tray_name = wxGetApp().transition_tridid(elem.first).ToStdString();
|
||||
auto it = std::find(m_tray_used.begin(), m_tray_used.end(), tray_name);
|
||||
if (it != m_tray_used.end())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ struct TrayData
|
|||
class MaterialItem: public wxPanel
|
||||
{
|
||||
protected:
|
||||
int m_text_pos_x = 0;
|
||||
int m_text_pos_y = -1;
|
||||
bool m_dropdown_allow_painted = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@
|
|||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include "fast_float/fast_float.h"
|
||||
#include <wx/dir.h>
|
||||
#include "fast_float/fast_float.h"
|
||||
|
||||
#include "Widgets/AMSItem.hpp"
|
||||
|
||||
#define CALI_DEBUG
|
||||
#define MINUTE_30 1800000 //ms
|
||||
|
|
@ -1027,11 +1029,17 @@ int MachineObject::ams_filament_mapping(
|
|||
std::map<int, FilamentInfo> tray_filaments; // tray_index : tray_color
|
||||
bool left_nozzle_has_ams = false, right_nozzle_has_ams = false;
|
||||
for (auto ams = amsList.begin(); ams != amsList.end(); ams++) {
|
||||
std::string ams_id = ams->second->id;
|
||||
std::string ams_id = ams->second->id;
|
||||
int ams_type = ams->second->type;
|
||||
for (auto tray = ams->second->trayList.begin(); tray != ams->second->trayList.end(); tray++) {
|
||||
int ams_id = atoi(ams->first.c_str());
|
||||
int tray_id = atoi(tray->first.c_str());
|
||||
int tray_index = ams_id * 4 + tray_id;
|
||||
int tray_index = 0;
|
||||
if (ams_type == GUI::AMSModel::GENERIC_AMS || ams_type == GUI::AMSModel::AMS_LITE || ams_type == GUI::AMSModel::N3F_AMS) {
|
||||
tray_index = ams_id * 4 + tray_id;
|
||||
} else if (ams_type == GUI::AMSModel::N3S_AMS) {
|
||||
tray_index = ams_id + tray_id;
|
||||
}
|
||||
// skip exclude id
|
||||
for (int i = 0; i < exclude_id.size(); i++) {
|
||||
if (tray_index == exclude_id[i])
|
||||
|
|
|
|||
|
|
@ -3857,24 +3857,17 @@ wxString GUI_App::transition_tridid(int trid_id) const
|
|||
int id_index = trid_id / 4;
|
||||
return wxString::Format("%s", maping_dict[id_index]);
|
||||
}
|
||||
else {
|
||||
int id_index = ceil(trid_id / 4);
|
||||
int id_suffix = trid_id % 4 + 1;
|
||||
return wxString::Format("%s%d", maping_dict[id_index], id_suffix);
|
||||
}
|
||||
}
|
||||
|
||||
wxString GUI_App::transition_tridid(int trid_id, bool is_n3s) const
|
||||
{
|
||||
if (is_n3s)
|
||||
{
|
||||
else if (trid_id >= 0x80 && trid_id <= 0x87) { // n3s
|
||||
const char base = 'A' + (trid_id - 128);
|
||||
wxString prefix("HT-");
|
||||
prefix.append(base);
|
||||
return prefix;
|
||||
}
|
||||
|
||||
return transition_tridid(trid_id);
|
||||
else {
|
||||
int id_index = std::clamp((int)ceil(trid_id / 4), 0, 25);
|
||||
int id_suffix = trid_id % 4 + 1;
|
||||
return wxString::Format("%s%d", maping_dict[id_index], id_suffix);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS
|
||||
|
|
|
|||
|
|
@ -444,7 +444,6 @@ public:
|
|||
void load_gcode(wxWindow* parent, wxString& input_file) const;
|
||||
|
||||
wxString transition_tridid(int trid_id) const;
|
||||
wxString transition_tridid(int trid_id, bool is_n3s) const;
|
||||
void ShowUserGuide();
|
||||
void ShowDownNetPluginDlg();
|
||||
void ShowUserLogin(bool show = true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue