diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index e47c5bd2da..7224ec34e2 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -16,7 +16,6 @@ namespace GUI { #define EDIT_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24)) #define NEW_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(250), FromDIP(24)) #define HISTORY_WINDOW_ITEMS_COUNT 5 -static const wxString k_tips = "Please input a valid value (K in 0~0.3)"; static wxString get_preset_name_by_filament_id(std::string filament_id) { @@ -472,7 +471,7 @@ void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) { float k = 0.0f; if (!CalibUtils::validate_input_k_value(m_k_value->GetTextCtrl()->GetValue(), &k)) { - MessageDialog msg_dlg(nullptr, _L(k_tips), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; } @@ -678,7 +677,7 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event) float k = 0.0f; if (!CalibUtils::validate_input_k_value(m_k_value->GetTextCtrl()->GetValue(), &k)) { - MessageDialog msg_dlg(nullptr, _L(k_tips), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; } diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index 88aa3e605f..f6cbbc3065 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -15,8 +15,6 @@ wxDEFINE_EVENT(EVT_DEVICE_CHANGED, wxCommandEvent); wxDEFINE_EVENT(EVT_CALIBRATION_JOB_FINISHED, wxCommandEvent); static const wxString NA_STR = _L("N/A"); -static const float MIN_PA_K_VALUE = 0.0; -static const float MAX_PA_K_VALUE = 0.3; static const float MIN_PA_K_VALUE_STEP = 0.001; static const int MAX_PA_HISTORY_RESULTS_NUMS = 16; @@ -310,6 +308,9 @@ void CalibrationWizard::recover_preset_info(MachineObject *obj) void CalibrationWizard::back_preset_info(MachineObject *obj, bool cali_finish, bool back_cali_flag) { + if (!obj) + return; + PrinterCaliInfo printer_cali_info; printer_cali_info.dev_id = obj->dev_id; printer_cali_info.cali_finished = cali_finish; @@ -468,11 +469,11 @@ void PressureAdvanceWizard::on_cali_action(wxCommandEvent& evt) void PressureAdvanceWizard::update(MachineObject* obj) { + CalibrationWizard::update(obj); + if (!obj) return; - CalibrationWizard::update(obj); - if (!m_show_result_dialog) { if (obj->cali_version != -1 && obj->cali_version != cali_version) { cali_version = obj->cali_version; diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 287fa61361..246623fffe 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -8,7 +8,6 @@ namespace Slic3r { namespace GUI { #define CALIBRATION_SAVE_INPUT_SIZE wxSize(FromDIP(240), FromDIP(24)) #define FLOW_RATE_MAX_VALUE 1.15 -static const wxString k_tips = "Please input a valid value (K in 0~0.3)"; static wxString get_default_name(wxString filament_name, CalibMode mode){ PresetBundle* preset_bundle = wxGetApp().preset_bundle; @@ -362,7 +361,7 @@ void CaliPASaveAutoPanel::save_to_result_from_widgets(wxWindow* window, bool* ou if (input->get_type() == GridTextInputType::K) { float k = 0.0f; if (!CalibUtils::validate_input_k_value(input->GetTextCtrl()->GetValue(), &k)) { - *out_msg = _L("Please input a valid value (K in 0~0.3)"); + *out_msg = wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE); *out_is_valid = false; } else @@ -408,7 +407,7 @@ bool CaliPASaveAutoPanel::get_result(std::vector& out_result) { std::unordered_set, PACalibResult> set; for (auto& result : m_calib_results) { if (!set.insert({ result.second.name, result.second.filament_id }).second) { - MessageDialog msg_dlg(nullptr, _L("Only one of the results with the same name will be saved. Are you sure you want to overrides the other results?"), wxEmptyString, wxICON_WARNING | wxYES_NO); + MessageDialog msg_dlg(nullptr, _L("Only one of the results with the same name will be saved. Are you sure you want to override the other results?"), wxEmptyString, wxICON_WARNING | wxYES_NO); if (msg_dlg.ShowModal() != wxID_YES) { return false; } @@ -420,7 +419,7 @@ bool CaliPASaveAutoPanel::get_result(std::vector& out_result) { // Check for duplicate names from history for (auto& result : m_history_results) { if (!set.insert({ result.name, result.filament_id }).second) { - MessageDialog msg_dlg(nullptr, wxString::Format(_L("There is already a historical calibration result with the same name: %s. Only one of the results with the same name is saved. Are you sure you want to overrides the historical result?"), result.name), wxEmptyString, wxICON_WARNING | wxYES_NO); + MessageDialog msg_dlg(nullptr, wxString::Format(_L("There is already a historical calibration result with the same name: %s. Only one of the results with the same name is saved. Are you sure you want to override the historical result?"), result.name), wxEmptyString, wxICON_WARNING | wxYES_NO); if (msg_dlg.ShowModal() != wxID_YES) { return false; } @@ -529,7 +528,7 @@ void CaliPASaveManualPanel::set_pa_cali_method(ManualPaCaliMethod method) m_complete_text->SetLabel(_L("Please find the best line on your plate")); set_save_img(); } else if (method == ManualPaCaliMethod::PA_PATTERN) { - m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion")); + m_complete_text->SetLabel(_L("Please find the corner with perfect degree of extrusion")); if (wxGetApp().app_config->get_language_code() == "zh-cn") { m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result_CN", 350)); } else { @@ -546,7 +545,7 @@ bool CaliPASaveManualPanel::get_result(PACalibResult& out_result) { // Check if the value is valid float k; if (!CalibUtils::validate_input_k_value(m_k_val->GetTextCtrl()->GetValue(), &k)) { - MessageDialog msg_dlg(nullptr, _L(k_tips), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return false; } @@ -581,7 +580,6 @@ bool CaliPASaveManualPanel::get_result(PACalibResult& out_result) { bool CaliPASaveManualPanel::Show(bool show) { if (show) { if (m_obj) { - assert(m_obj->selected_cali_preset.size() <= 1); if (!m_obj->selected_cali_preset.empty()) { wxString default_name = get_default_name(m_obj->selected_cali_preset[0].name, CalibMode::Calib_PA_Line); set_default_name(default_name); @@ -683,7 +681,7 @@ void CaliPASaveP1PPanel::set_pa_cali_method(ManualPaCaliMethod method) set_save_img(); } else if (method == ManualPaCaliMethod::PA_PATTERN) { - m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion")); + m_complete_text->SetLabel(_L("Please find the corner with perfect degree of extrusion")); if (wxGetApp().app_config->get_language_code() == "zh-cn") { m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result_CN", 350)); } else { @@ -695,7 +693,7 @@ void CaliPASaveP1PPanel::set_pa_cali_method(ManualPaCaliMethod method) bool CaliPASaveP1PPanel::get_result(float* out_k, float* out_n){ // Check if the value is valid if (!CalibUtils::validate_input_k_value(m_k_val->GetTextCtrl()->GetValue(), out_k)) { - MessageDialog msg_dlg(nullptr, _L(k_tips), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return false; } diff --git a/src/slic3r/GUI/CalibrationWizardStartPage.cpp b/src/slic3r/GUI/CalibrationWizardStartPage.cpp index 946cd871f2..c2e6c683b2 100644 --- a/src/slic3r/GUI/CalibrationWizardStartPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardStartPage.cpp @@ -117,7 +117,7 @@ void CalibrationPAStartPage::create_page(wxWindow* parent) _L("About this calibration"), _L("Please find the details of Flow Dynamics Calibration from our wiki.\ \n\nUsually the calibration is unnecessary. When you start a single color/material print, with the \"flow dynamics calibration\" option checked in the print start menu, the printer will follow the old way, calibrate the filament before the print; When you start a multi color/material print, the printer will use the default compensation parameter for the filament during every filament switch which will have a good result in most cases.\ -\n\nPlease note there are a few cases that will make the calibration result not reliable: using a texture plate to do the calibration; the build plate does not have good adhesion (please wash the build plate or apply gluestick!) ...You can find more from our wiki.\ +\n\nPlease note that there are a few cases that can make the calibration results unreliable, such as insufficient adhesion on the build plate. Improving adhesion can be achieved by washing the build plate or applying glue. For more information on this topic, please refer to our Wiki.\ \n\nThe calibration results have about 10 percent jitter in our test, which may cause the result not exactly the same in each calibration. We are still investigating the root cause to do improvements with new updates.")); m_top_sizer->Add(m_about_title); m_top_sizer->Add(m_about_content); diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index d66c7a8b2c..a79dd0a027 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -786,7 +786,20 @@ static float calc_color_distance(wxColour c1, wxColour c2) return DeltaE76(lab[0][0], lab[0][1], lab[0][2], lab[1][0], lab[1][1], lab[1][2]); } -int MachineObject::ams_filament_mapping(std::vector filaments, std::vector& result, std::vector exclude_id) +void MachineObject::get_ams_colors(std::vector &ams_colors) { + ams_colors.clear(); + ams_colors.reserve(amsList.size()); + for (auto ams = amsList.begin(); ams != amsList.end(); ams++) { + for (auto tray = ams->second->trayList.begin(); tray != ams->second->trayList.end(); tray++) { + if (tray->second->is_tray_info_ready()) { + auto ams_color = AmsTray::decode_color(tray->second->color); + ams_colors.emplace_back(ams_color); + } + } + } +} + +int MachineObject::ams_filament_mapping(std::vector filaments, std::vector &result, std::vector exclude_id) { if (filaments.empty()) return -1; @@ -1386,6 +1399,7 @@ void MachineObject::parse_status(int flag) } is_support_filament_tangle_detect = ((flag >> 19) & 0x1) != 0; + is_support_user_preset = ((flag >> 22) & 0x1) != 0; if (xcam_filament_tangle_detect_count > 0) xcam_filament_tangle_detect_count--; else { diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 6aca7ee5f6..be177bba5a 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -526,6 +526,7 @@ public: bool can_unload_filament(); bool is_support_ams_mapping(); + void get_ams_colors(std::vector& ams_colors); int ams_filament_mapping(std::vector filaments, std::vector &result, std::vector exclude_id = std::vector()); bool is_valid_mapping_result(std::vector& result, bool check_empty_slot = false); // exceed index start with 0 diff --git a/src/slic3r/GUI/MultiMachine.cpp b/src/slic3r/GUI/MultiMachine.cpp index fc7f91daa7..220c3cab77 100644 --- a/src/slic3r/GUI/MultiMachine.cpp +++ b/src/slic3r/GUI/MultiMachine.cpp @@ -160,7 +160,7 @@ wxString DeviceItem::get_state_device() str_state_device.push_back(_L("Printing Finish")); str_state_device.push_back(_L("Printing Failed")); str_state_device.push_back(_L("Printing")); - str_state_device.push_back(_L("PrintingPause")); + str_state_device.push_back(_L("Printing Pause")); str_state_device.push_back(_L("Prepare")); str_state_device.push_back(_L("Slicing")); str_state_device.push_back(_L("syncing")); diff --git a/src/slic3r/GUI/MultiMachinePage.cpp b/src/slic3r/GUI/MultiMachinePage.cpp index ae13c30840..9aed022ba3 100644 --- a/src/slic3r/GUI/MultiMachinePage.cpp +++ b/src/slic3r/GUI/MultiMachinePage.cpp @@ -316,7 +316,7 @@ MultiMachinePickPage::MultiMachinePickPage(Plater* plater /*= nullptr*/) auto line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); line_top->SetBackgroundColour(wxColour(166, 169, 170)); - m_label = new Label(this, _L("Select connected printetrs (0/6)")); + m_label = new Label(this, _L("Select connected printers (0/6)")); scroll_macine_list = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); scroll_macine_list->SetSize(wxSize(FromDIP(400), FromDIP(10 * 30))); @@ -372,7 +372,7 @@ void MultiMachinePickPage::update_selected_count() } m_selected_count = count; - m_label->SetLabel(wxString::Format(_L("Select Connected Printetrs (%d/6)"), m_selected_count)); + m_label->SetLabel(wxString::Format(_L("Select Connected Printers (%d/6)"), m_selected_count)); if (m_selected_count > PICK_DEVICE_MAX) { MessageDialog msg_wingow(nullptr, wxString::Format(_L("The maximum number of printers that can be selected is %d"), PICK_DEVICE_MAX), "", wxAPPLY | wxOK); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index 878f71eb58..b5f9aaf0ed 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -14,6 +14,9 @@ namespace Slic3r { namespace GUI { +const float MIN_PA_K_VALUE = 0.0; +const float MAX_PA_K_VALUE = 1.0; + std::unique_ptr CalibUtils::print_worker; wxString wxstr_temp_dir = fs::path(fs::temp_directory_path() / "calib").wstring(); static const std::string temp_dir = wxstr_temp_dir.utf8_string(); diff --git a/src/slic3r/Utils/CalibUtils.hpp b/src/slic3r/Utils/CalibUtils.hpp index e470efa62a..2fd42a2547 100644 --- a/src/slic3r/Utils/CalibUtils.hpp +++ b/src/slic3r/Utils/CalibUtils.hpp @@ -10,6 +10,9 @@ class ProgressIndicator; class Preset; namespace GUI { +extern const float MIN_PA_K_VALUE; +extern const float MAX_PA_K_VALUE; + class CalibInfo { public: