From 21c69a99e66da40331f099ab93614f89b6027f9c Mon Sep 17 00:00:00 2001 From: tao wang Date: Tue, 10 Sep 2024 13:56:52 +0800 Subject: [PATCH] ENH:show n3f/n3s version info jira:[for n3s] Change-Id: Ia0056dfdf7157036008cc63a37c9fd8076063a6a (cherry picked from commit a44ff5a95a6774b4eed1238bde12d0a750c24a10) --- src/slic3r/GUI/DeviceManager.cpp | 16 +++++++++++----- src/slic3r/GUI/GUI_App.cpp | 16 +++++++++++----- src/slic3r/GUI/UpgradePanel.cpp | 16 +++++++++++++++- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 1f539fa3de..ae6b0d1d9d 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1325,12 +1325,18 @@ wxString MachineObject::get_upgrade_result_str(int err_code) std::map MachineObject::get_ams_version() { + std::vector ams_type = {"ams", "n3f", "n3s"}; + std::map result; - for (int i = 0; i < 4; i++) { - std::string ams_id = "ams/" + std::to_string(i); - auto it = module_vers.find(ams_id); - if (it != module_vers.end()) { - result.emplace(std::pair(i, it->second)); + for (int i = 0; i < 8; i++) { + std::string ams_id; + for (auto type : ams_type ) + { + ams_id = type + "/" + std::to_string(i); + auto it = module_vers.find(ams_id); + if (it != module_vers.end()) { + result.emplace(std::pair(i, it->second)); + } } } return result; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index fd2a0e4ba5..14b272fe62 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3676,11 +3676,17 @@ void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const wxString GUI_App::transition_tridid(int trid_id) { - //wxString maping_dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - wxString maping_dict[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; - int id_index = ceil(trid_id / 4); - int id_suffix = (trid_id + 1) % 4 == 0 ? 4 : (trid_id + 1) % 4; - return wxString::Format("%s%d", maping_dict[id_index], id_suffix); + wxString maping_dict[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; + + if (trid_id >= 128 * 4) { + int id_index = 4 + trid_id % 128; + return wxString::Format("%s", maping_dict[id_index]); + } + else { + int id_index = ceil(trid_id / 4); + int id_suffix = id_suffix = (trid_id + 1) % 4 == 0 ? 4 : (trid_id + 1) % 4; + return wxString::Format("%s%d", maping_dict[id_index], id_suffix); + } } //BBS diff --git a/src/slic3r/GUI/UpgradePanel.cpp b/src/slic3r/GUI/UpgradePanel.cpp index e9384c385b..eecef3d0f4 100644 --- a/src/slic3r/GUI/UpgradePanel.cpp +++ b/src/slic3r/GUI/UpgradePanel.cpp @@ -688,9 +688,23 @@ void MachineInfoPanel::update_ams_ext(MachineObject *obj) amspanel->Show(); auto it = ver_list.find(atoi(iter->first.c_str())); + + if (it == ver_list.end()) { + continue; + } + auto ams_id = std::stoi(iter->second->id); - wxString ams_text = wxString::Format("AMS%s", std::to_string(ams_id + 1)); + size_t pos = it->second.name.find('/'); + wxString ams_device_name = "AMS-%s"; + + if (pos != std::string::npos) { + wxString result = it->second.name.substr(0, pos); + result.MakeUpper(); + ams_device_name = result + "-%s"; + } + + wxString ams_text = wxString::Format(ams_device_name, std::to_string(ams_id + 1)); ams_name = ams_text; if (it == ver_list.end()) {