OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::PressureAdvanceWizard Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/CalibrationWizard.hpp>

Inheritance diagram for Slic3r::GUI::PressureAdvanceWizard:
Collaboration diagram for Slic3r::GUI::PressureAdvanceWizard:

Public Member Functions

 PressureAdvanceWizard (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~PressureAdvanceWizard ()
void on_cali_job_finished (wxString evt_data) override
void on_cali_job_finished (wxCommandEvent &event)
CalibrationWizardPageStep * get_curr_step ()
void show_step (CalibrationWizardPageStep *step)
virtual void set_cali_style (CalibrationStyle style)
virtual void set_cali_method (CalibrationMethod method)
CalibMode get_calibration_mode ()
bool save_preset (const std::string &old_preset_name, const std::string &new_preset_name, const std::map< std::string, ConfigOption * > &key_values, wxString &message)
bool save_preset_with_index (const std::string &old_preset_name, const std::string &new_preset_name, const std::map< std::string, ConfigIndexValue > &key_values, wxString &message)
virtual void cache_preset_info (MachineObject *obj, float nozzle_dia, BedType bed_type)
virtual void recover_preset_info (MachineObject *obj)
virtual void back_preset_info (MachineObject *obj, bool cali_finish, bool back_cali_flag=true)
void msw_rescale ()
void on_sys_color_changed ()
bool built () const
bool build_step ()

Protected Member Functions

void create_pages ()
void on_cali_start ()
void on_cali_save ()
void on_cali_action (wxCommandEvent &evt)
void update (MachineObject *obj) override
void on_device_connected (MachineObject *obj) override
bool can_save_cali_result (const std::vector< PACalibResult > &new_pa_cali_results)
void on_cali_go_home ()
void add_page_step (CalibrationWizardPageStep *&step, std::function< CalibrationWizardPage *()> make)
void add_build_step (std::function< void()> step)
void add_build_steps_of (StagedBuild &child)

Protected Attributes

bool m_show_result_dialog = false
std::vector< PACalibResult > m_calib_results_history
int cali_version = -1
wxScrolledWindow * m_scrolledWindow
wxBoxSizer * m_all_pages_sizer
CalibMode m_mode
CalibrationStyle m_cali_style
CalibrationMethod m_cali_method { CalibrationMethod::CALI_METHOD_MANUAL }
MachineObject * curr_obj { nullptr }
MachineObject * last_obj { nullptr }
CalibrationWizardPageStep * m_curr_step { nullptr }
CalibrationWizardPageStep * start_step { nullptr }
CalibrationWizardPageStep * preset_step { nullptr }
CalibrationWizardPageStep * cali_step { nullptr }
CalibrationWizardPageStep * save_step { nullptr }
CalibrationWizardPageStep * cali_coarse_step { nullptr }
CalibrationWizardPageStep * coarse_save_step { nullptr }
CalibrationWizardPageStep * cali_fine_step { nullptr }
CalibrationWizardPageStep * fine_save_step { nullptr }
std::vector< CalibrationWizardPageStep * > m_page_steps
SecondaryCheckDialog * go_home_dialog = nullptr

Private Member Functions

StagedBuild * unfinished_child () const

Private Attributes

std::vector< std::function< void()> > m_steps
std::vector< StagedBuild * > m_children
size_t m_next_step { 0 }

Detailed Description

Constructor & Destructor Documentation

◆ PressureAdvanceWizard()

Slic3r::GUI::PressureAdvanceWizard::PressureAdvanceWizard ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
542 : CalibrationWizard(parent, CalibMode::Calib_PA_Line, id, pos, size, style)
543{
544 create_pages();
545}
#define style
Definition WipeTowerDialog.cpp:101
CalibrationWizard(wxWindow *parent, CalibMode mode, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition CalibrationWizard.cpp:104
void create_pages()
Definition CalibrationWizard.cpp:559
@ Calib_PA_Line
Definition calib.hpp:25

References Slic3r::GUI::CalibrationWizard::CalibrationWizard(), create_pages(), and style.

Here is the call graph for this function:

◆ ~PressureAdvanceWizard()

Slic3r::GUI::PressureAdvanceWizard::~PressureAdvanceWizard ( )
inline
132{};

Member Function Documentation

◆ add_build_step()

void Slic3r::GUI::StagedBuild::add_build_step ( std::function< void()> step)
inlineprotectedinherited
39{ m_steps.push_back(std::move(step)); }
std::vector< std::function< void()> > m_steps
Definition StagedBuild.hpp:57

References m_steps.

Referenced by Slic3r::GUI::StatusBasePanel::StatusBasePanel(), Slic3r::GUI::StatusPanel::StatusPanel(), add_build_steps_of(), Slic3r::GUI::CalibrationWizard::add_page_step(), Slic3r::GUI::StatusBasePanel::create_machine_control_page(), Slic3r::GUI::FlowRateWizard::create_pages(), Slic3r::GUI::PressureAdvanceWizard::create_pages(), Slic3r::GUI::AuxiliaryPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

Here is the caller graph for this function:

◆ add_build_steps_of()

void Slic3r::GUI::StagedBuild::add_build_steps_of ( StagedBuild & child)
inlineprotectedinherited
44 {
45 m_children.push_back(&child);
46 for (size_t i = child.m_next_step; i < child.m_steps.size(); ++i)
47 add_build_step([&child] { child.build_step(); });
48 }
std::vector< StagedBuild * > m_children
Definition StagedBuild.hpp:58
void add_build_step(std::function< void()> step)
Definition StagedBuild.hpp:39

References add_build_step(), build_step(), m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::ProjectPanel::ProjectPanel(), Slic3r::GUI::CalibrationPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_page_step()

void Slic3r::GUI::CalibrationWizard::add_page_step ( CalibrationWizardPageStep *& step,
std::function< CalibrationWizardPage *()> make )
protectedinherited
163{
164 add_build_step([this, &step, make = std::move(make)] {
165 step = new CalibrationWizardPageStep(make());
166 m_all_pages_sizer->Add(step->page, 1, wxEXPAND | wxALL, FromDIP(25));
167 step->page->Hide();
168 });
169}
wxBoxSizer * m_all_pages_sizer
Definition CalibrationWizard.hpp:103
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References Slic3r::GUI::StagedBuild::add_build_step(), and m_all_pages_sizer.

Referenced by Slic3r::GUI::FlowRateWizard::create_pages(), and Slic3r::GUI::PressureAdvanceWizard::create_pages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ back_preset_info()

void Slic3r::GUI::CalibrationWizard::back_preset_info ( MachineObject * obj,
bool cali_finish,
bool back_cali_flag = true )
virtualinherited
470{
471 if (!obj)
472 return;
473
474 PrinterCaliInfo printer_cali_info;
475 printer_cali_info.dev_id = obj->get_dev_id();
476 printer_cali_info.cali_finished = cali_finish;
477 printer_cali_info.cache_flow_ratio = obj->cache_flow_ratio;
478 printer_cali_info.selected_presets = obj->selected_cali_preset;
479 printer_cali_info.cache_flow_rate_calibration_type = obj->flow_ratio_calibration_type;
480 wxGetApp().app_config->save_printer_cali_infos(printer_cali_info, back_cali_flag);
481}

References Slic3r::PrinterCaliInfo::cache_flow_rate_calibration_type, Slic3r::MachineObject::cache_flow_ratio, Slic3r::PrinterCaliInfo::cache_flow_ratio, Slic3r::PrinterCaliInfo::cali_finished, Slic3r::PrinterCaliInfo::dev_id, Slic3r::MachineObject::flow_ratio_calibration_type, Slic3r::MachineObject::get_dev_id(), Slic3r::MachineObject::selected_cali_preset, and Slic3r::PrinterCaliInfo::selected_presets.

Referenced by Slic3r::GUI::FlowRateWizard::cache_coarse_info(), cache_preset_info(), on_cali_go_home(), Slic3r::GUI::FlowRateWizard::on_cali_save(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_save(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_step()

bool Slic3r::GUI::StagedBuild::build_step ( )
inlineinherited
27 {
28 if (m_next_step < m_steps.size()) {
29 // Copied out, since a step may queue more steps and reallocate m_steps.
30 auto step = std::move(m_steps[m_next_step++]);
31 step();
32 } else if (StagedBuild* child = unfinished_child()) {
33 child->build_step();
34 }
35 return !built();
36 }
size_t m_next_step
Definition StagedBuild.hpp:59
StagedBuild * unfinished_child() const
Definition StagedBuild.hpp:51
bool built() const
Definition StagedBuild.hpp:18

References built(), m_next_step, m_steps, and unfinished_child().

Referenced by add_build_steps_of().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ built()

bool Slic3r::GUI::StagedBuild::built ( ) const
inlineinherited
19 {
20 return m_next_step == m_steps.size() &&
21 std::all_of(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return child->built(); });
22 }

References m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::StatusPanel::~StatusPanel(), build_step(), Slic3r::GUI::CalibrationPanel::show_status(), Slic3r::GUI::MonitorPanel::show_status(), Slic3r::GUI::CalibrationPanel::update_all(), and Slic3r::GUI::MonitorPanel::update_all().

Here is the caller graph for this function:

◆ cache_preset_info()

void Slic3r::GUI::CalibrationWizard::cache_preset_info ( MachineObject * obj,
float nozzle_dia,
BedType bed_type )
virtualinherited
418{
419 if (!obj) return;
420
421 CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
422
423 std::map<int, Preset*> selected_filaments = preset_page->get_selected_filaments();
424
425 obj->selected_cali_preset.clear();
426 for (auto& item : selected_filaments) {
427 CaliPresetInfo result;
428 result.tray_id = item.first;
429 result.nozzle_diameter = nozzle_dia;
430 result.bed_type = bed_type;
431 result.filament_id = item.second->filament_id;
432 result.setting_id = item.second->setting_id;
433 result.name = item.second->name;
434
435 if (obj->is_multi_extruders()) {
436 int ams_id, slot_id, tray_id;
437 get_tray_ams_and_slot_id(curr_obj, result.tray_id, ams_id, slot_id, tray_id);
438 result.extruder_id = preset_page->get_extruder_id_by_tray_id(result.tray_id);
439 result.nozzle_diameter = preset_page->get_nozzle_diameter(result.extruder_id);
440 }
441 else {
442 result.extruder_id = 0;
443 }
444 result.nozzle_volume_type = preset_page->get_nozzle_volume_type(result.extruder_id);
445
446 obj->selected_cali_preset.push_back(result);
447 }
448
449 CaliPresetStage stage;
450 preset_page->get_cali_stage(stage, obj->cache_flow_ratio);
451
452 back_preset_info(obj, false);
453}
virtual void back_preset_info(MachineObject *obj, bool cali_finish, bool back_cali_flag=true)
Definition CalibrationWizard.cpp:469
MachineObject * curr_obj
Definition CalibrationWizard.hpp:108
CalibrationWizardPageStep * preset_step
Definition CalibrationWizard.hpp:114
void get_tray_ams_and_slot_id(MachineObject *obj, int in_tray_id, int &ams_id, int &slot_id, int &tray_id)
Definition CalibUtils.cpp:231
CaliPresetStage
Definition CalibrationWizardPresetPage.hpp:32

References back_preset_info(), Slic3r::CaliPresetInfo::bed_type, Slic3r::MachineObject::cache_flow_ratio, curr_obj, Slic3r::CaliPresetInfo::extruder_id, Slic3r::CaliPresetInfo::filament_id, Slic3r::GUI::CalibrationPresetPage::get_cali_stage(), Slic3r::GUI::CalibrationPresetPage::get_extruder_id_by_tray_id(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_diameter(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_volume_type(), Slic3r::GUI::CalibrationPresetPage::get_selected_filaments(), Slic3r::GUI::get_tray_ams_and_slot_id(), Slic3r::MachineObject::is_multi_extruders(), Slic3r::CaliPresetInfo::name, Slic3r::CaliPresetInfo::nozzle_diameter, Slic3r::CaliPresetInfo::nozzle_volume_type, preset_step, Slic3r::MachineObject::selected_cali_preset, Slic3r::CaliPresetInfo::setting_id, and Slic3r::CaliPresetInfo::tray_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_start(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_start(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ can_save_cali_result()

bool Slic3r::GUI::PressureAdvanceWizard::can_save_cali_result ( const std::vector< PACalibResult > & new_pa_cali_results)
protected
920{
921 if (!curr_obj)
922 return false;
923
924 std::vector<PACalibResult> to_save_result;
925 for (auto &result : new_pa_cali_results) {
926 auto iter = std::find_if(to_save_result.begin(), to_save_result.end(), [this, &result](const PACalibResult &item) {
927 bool has_same_name = (item.name == result.name && item.filament_id == result.filament_id);
928 if (curr_obj && curr_obj->is_multi_extruders()) {
929 has_same_name &= (item.extruder_id == result.extruder_id && item.nozzle_volume_type == result.nozzle_volume_type);
930 }
931 return has_same_name;
932 });
933 if (iter != to_save_result.end()) {
934 MessageDialog msg_dlg(nullptr, wxString::Format(_L("Only one of the results with the same name: %s will be saved. Are you sure you want to override the other results?"), iter->name), wxEmptyString,
935 wxICON_WARNING | wxYES_NO);
936 if (msg_dlg.ShowModal() != wxID_YES) {
937 return false;
938 } else {
939 break;
940 }
941 }
942 to_save_result.push_back(result);
943 }
944
945 std::string same_pa_names;
946 for (auto new_pa_cali_result : new_pa_cali_results) {
947 auto iter = std::find_if(curr_obj->pa_calib_tab.begin(), curr_obj->pa_calib_tab.end(), [this, &new_pa_cali_result](const PACalibResult &item) {
948 bool is_same_name = (item.name == new_pa_cali_result.name && item.filament_id == new_pa_cali_result.filament_id &&
949 item.nozzle_diameter == new_pa_cali_result.nozzle_diameter);
950 if (curr_obj && curr_obj->is_multi_extruders()) {
951 is_same_name &= (item.extruder_id == new_pa_cali_result.extruder_id && item.nozzle_volume_type == new_pa_cali_result.nozzle_volume_type);
952 }
953 return is_same_name;
954 });
955
956 if (iter != curr_obj->pa_calib_tab.end()) {
957 same_pa_names += new_pa_cali_result.name;
958 same_pa_names += ", ";
959 }
960 }
961
962 if (!same_pa_names.empty()) {
963 same_pa_names.erase(same_pa_names.size() - 2);
964 wxString duplicate_name_info = wxString::Format(_L("There is already a previous calibration result with the same name: %s. Only one result with a name is saved. Are you sure you want to overwrite the previous result\?"), same_pa_names);
965
966 if (curr_obj->is_multi_extruders())
967 duplicate_name_info = wxString::Format(_L("Within the same extruder, the name(%s) must be unique when the filament type, nozzle diameter, and nozzle flow are the same.\n"
968 "Are you sure you want to override the historical result?"), same_pa_names);
969
970 MessageDialog msg_dlg(nullptr, duplicate_name_info, wxEmptyString, wxICON_WARNING | wxYES_NO);
971 if (msg_dlg.ShowModal() != wxID_YES)
972 return false;
973 }
974
975 if (curr_obj->get_printer_series() != PrinterSeries::SERIES_X1 && curr_obj->pa_calib_tab.size() >= MAX_PA_HISTORY_RESULTS_NUMS) {
976 MessageDialog msg_dlg(nullptr, wxString::Format(_L_PLURAL("This machine type can only hold %d historical result per nozzle. This result will not be saved.", "This machine type can only hold %d historical results per nozzle. This result will not be saved.", MAX_PA_HISTORY_RESULTS_NUMS), MAX_PA_HISTORY_RESULTS_NUMS),
977 wxEmptyString, wxICON_WARNING | wxOK);
978 msg_dlg.ShowModal();
979 return false;
980 }
981 return true;
982}
@ SERIES_X1
Definition DevDefs.h:35
#define _L(s)
Definition OBJ.cpp:34
static const int MAX_PA_HISTORY_RESULTS_NUMS
Definition CalibrationWizard.cpp:49
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References _L, Slic3r::GUI::CalibrationWizard::curr_obj, and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_pages()

void Slic3r::GUI::PressureAdvanceWizard::create_pages ( )
protected
560{
561 add_page_step(start_step, [this] { return new CalibrationPAStartPage(m_scrolledWindow); });
562 add_page_step(preset_step, [this] { return new CalibrationPresetPage(m_scrolledWindow, m_mode, false); });
563 add_page_step(cali_step, [this] { return new CalibrationCaliPage(m_scrolledWindow, m_mode); });
564 add_page_step(save_step, [this] { return new CalibrationPASavePage(m_scrolledWindow); });
565
566 add_build_step([this] {
567 m_page_steps.push_back(start_step);
568 m_page_steps.push_back(preset_step);
569 m_page_steps.push_back(cali_step);
570 m_page_steps.push_back(save_step);
571
572 for (int i = 0; i < m_page_steps.size() -1; i++) {
573 m_page_steps[i]->chain(m_page_steps[i+1]);
574 }
575
576 for (int i = 0; i < m_page_steps.size(); i++) {
577 m_page_steps[i]->page->Bind(EVT_CALI_ACTION, &PressureAdvanceWizard::on_cali_action, this);
578 }
579
580 if (!m_page_steps.empty())
581 show_step(m_page_steps.front());
582 });
583}
void add_page_step(CalibrationWizardPageStep *&step, std::function< CalibrationWizardPage *()> make)
Definition CalibrationWizard.cpp:162
CalibMode m_mode
Definition CalibrationWizard.hpp:105
CalibrationWizardPageStep * cali_step
Definition CalibrationWizard.hpp:115
CalibrationWizardPageStep * start_step
Definition CalibrationWizard.hpp:113
wxScrolledWindow * m_scrolledWindow
Definition CalibrationWizard.hpp:102
void show_step(CalibrationWizardPageStep *step)
Definition CalibrationWizard.cpp:177
std::vector< CalibrationWizardPageStep * > m_page_steps
Definition CalibrationWizard.hpp:124
CalibrationWizardPageStep * save_step
Definition CalibrationWizard.hpp:116
void on_cali_action(wxCommandEvent &evt)
Definition CalibrationWizard.cpp:585

References Slic3r::GUI::StagedBuild::add_build_step(), Slic3r::GUI::CalibrationWizard::add_page_step(), Slic3r::GUI::CalibrationWizard::cali_step, Slic3r::GUI::CalibrationWizard::m_mode, Slic3r::GUI::CalibrationWizard::m_page_steps, Slic3r::GUI::CalibrationWizard::m_scrolledWindow, on_cali_action(), Slic3r::GUI::CalibrationWizard::preset_step, Slic3r::GUI::CalibrationWizard::save_step, Slic3r::GUI::CalibrationWizard::show_step(), and Slic3r::GUI::CalibrationWizard::start_step.

Referenced by PressureAdvanceWizard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_calibration_mode()

CalibMode Slic3r::GUI::CalibrationWizard::get_calibration_mode ( )
inlineinherited
82{ return m_mode; }

References m_mode.

◆ get_curr_step()

CalibrationWizardPageStep * Slic3r::GUI::CalibrationWizard::get_curr_step ( )
inlineinherited
68{ return m_curr_step; }
CalibrationWizardPageStep * m_curr_step
Definition CalibrationWizard.hpp:111

References m_curr_step.

Referenced by on_cali_go_home().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::CalibrationWizard::msw_rescale ( )
inherited
484{
485 for (int i = 0; i < m_page_steps.size(); i++) {
486 if (m_page_steps[i]->page)
487 m_page_steps[i]->page->msw_rescale();
488 }
489}

References m_page_steps.

◆ on_cali_action()

void Slic3r::GUI::PressureAdvanceWizard::on_cali_action ( wxCommandEvent & evt)
protected
586{
587 CaliPageActionType action = static_cast<CaliPageActionType>(evt.GetInt());
589 HistoryWindow history_dialog(this, m_calib_results_history, m_show_result_dialog);
590 history_dialog.on_device_connected(curr_obj);
591 history_dialog.ShowModal();
592 }
594 preset_step->page->set_cali_filament_mode(CalibrationFilamentMode::CALI_MODEL_SINGLE);
596 preset_step->page->on_device_connected(curr_obj);
597 show_step(m_curr_step->next);
598 }
600 if (curr_obj && curr_obj->is_support_new_auto_cali_method) {
602 }
603 else {
605 }
607 preset_step->page->set_cali_filament_mode(fila_mode);
608 preset_step->page->on_device_connected(curr_obj);
609 show_step(m_curr_step->next);
610 }
611 else if (action == CaliPageActionType::CALI_ACTION_NEXT) {
612 show_step(m_curr_step->next);
613 }
615 show_step(m_curr_step->next);
616 }
617 else if (action == CaliPageActionType::CALI_ACTION_PREV) {
618 show_step(m_curr_step->prev);
619 }
620 else if (action == CaliPageActionType::CALI_ACTION_CALI) {
622 }
623 else if (action == CaliPageActionType::CALI_ACTION_GO_HOME) {
625 } else if (action == CaliPageActionType::CALI_ACTION_PA_SAVE) {
626 on_cali_save();
627 }
628}
void on_cali_go_home()
Definition CalibrationWizard.cpp:499
virtual void set_cali_method(CalibrationMethod method)
Definition CalibrationWizard.cpp:250
void on_cali_start()
Definition CalibrationWizard.cpp:702
bool m_show_result_dialog
Definition CalibrationWizard.hpp:151
void on_cali_save()
Definition CalibrationWizard.cpp:984
std::vector< PACalibResult > m_calib_results_history
Definition CalibrationWizard.hpp:152
@ CALI_METHOD_AUTO
Definition CalibrationWizardPage.hpp:65
@ CALI_METHOD_MANUAL
Definition CalibrationWizardPage.hpp:64
@ CALI_METHOD_NEW_AUTO
Definition CalibrationWizardPage.hpp:66
CalibrationFilamentMode get_cali_filament_mode(MachineObject *obj, CalibMode mode)
Definition CalibrationWizardPage.cpp:86
CaliPageActionType
Definition CalibrationWizardPage.hpp:222
@ CALI_ACTION_NEXT
Definition CalibrationWizardPage.hpp:231
@ CALI_ACTION_PA_SAVE
Definition CalibrationWizardPage.hpp:233
@ CALI_ACTION_AUTO_CALI
Definition CalibrationWizardPage.hpp:225
@ CALI_ACTION_PREV
Definition CalibrationWizardPage.hpp:230
@ CALI_ACTION_MANUAL_CALI
Definition CalibrationWizardPage.hpp:224
@ CALI_ACTION_MANAGE_RESULT
Definition CalibrationWizardPage.hpp:223
@ CALI_ACTION_GO_HOME
Definition CalibrationWizardPage.hpp:238
@ CALI_ACTION_CALI_NEXT
Definition CalibrationWizardPage.hpp:232
@ CALI_ACTION_CALI
Definition CalibrationWizardPage.hpp:227
CalibrationFilamentMode
Definition CalibrationWizardPage.hpp:56
@ CALI_MODEL_SINGLE
Definition CalibrationWizardPage.hpp:58

References Slic3r::GUI::CALI_ACTION_AUTO_CALI, Slic3r::GUI::CALI_ACTION_CALI, Slic3r::GUI::CALI_ACTION_CALI_NEXT, Slic3r::GUI::CALI_ACTION_GO_HOME, Slic3r::GUI::CALI_ACTION_MANAGE_RESULT, Slic3r::GUI::CALI_ACTION_MANUAL_CALI, Slic3r::GUI::CALI_ACTION_NEXT, Slic3r::GUI::CALI_ACTION_PA_SAVE, Slic3r::GUI::CALI_ACTION_PREV, Slic3r::GUI::CALI_METHOD_AUTO, Slic3r::GUI::CALI_METHOD_MANUAL, Slic3r::GUI::CALI_METHOD_NEW_AUTO, Slic3r::GUI::CALI_MODEL_SINGLE, Slic3r::GUI::CalibrationWizard::curr_obj, Slic3r::GUI::get_cali_filament_mode(), m_calib_results_history, Slic3r::GUI::CalibrationWizard::m_curr_step, Slic3r::GUI::CalibrationWizard::m_mode, m_show_result_dialog, Slic3r::GUI::CalibrationWizard::on_cali_go_home(), on_cali_save(), on_cali_start(), Slic3r::GUI::HistoryWindow::on_device_connected(), Slic3r::GUI::CalibrationWizard::preset_step, Slic3r::GUI::CalibrationWizard::set_cali_method(), Slic3r::GUI::CalibrationWizard::show_step(), and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by create_pages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_go_home()

void Slic3r::GUI::CalibrationWizard::on_cali_go_home ( )
protectedinherited
500{
501 // can go home? confirm to continue
502 CalibrationMethod method;
503 int cali_stage = 0;
504 CalibMode obj_cali_mode = get_obj_calibration_mode(curr_obj, method, cali_stage);
505
506 bool double_confirm = false;
508 if (page_type == CaliPageType::CALI_PAGE_COARSE_SAVE ||
512 page_type == CaliPageType::CALI_PAGE_PA_SAVE) {
513 double_confirm = true;
514 }
515 if (obj_cali_mode == m_mode && curr_obj && (curr_obj->is_in_printing() || double_confirm)) {
516 if (go_home_dialog == nullptr)
517 go_home_dialog = new SecondaryCheckDialog(this, wxID_ANY, _L("Confirm"));
518
519 go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
520 if (curr_obj) {
521 curr_obj->command_task_abort();
522 } else {
523 assert(false);
524 }
525 if (!m_page_steps.empty()) {
527 show_step(m_page_steps.front());
528 }
529 });
530
531 go_home_dialog->update_text(_L("Are you sure to cancel the current calibration and return to the home page?"));
532 go_home_dialog->on_show();
533 } else {
534 if (!m_page_steps.empty()) {
535 back_preset_info(curr_obj, true, obj_cali_mode == m_mode);
536 show_step(m_page_steps.front());
537 }
538 }
539}
CalibrationWizardPage * page
Definition CalibrationWizard.hpp:40
CaliPageType get_page_type()
Definition CalibrationWizardPage.hpp:306
SecondaryCheckDialog * go_home_dialog
Definition CalibrationWizard.hpp:126
CalibrationWizardPageStep * get_curr_step()
Definition CalibrationWizard.hpp:68
CalibrationMethod
Definition CalibrationWizardPage.hpp:63
CaliPageType
Definition CalibrationWizardPage.hpp:81
@ CALI_PAGE_FINE_SAVE
Definition CalibrationWizardPage.hpp:87
@ CALI_PAGE_COARSE_SAVE
Definition CalibrationWizardPage.hpp:85
@ CALI_PAGE_FLOW_SAVE
Definition CalibrationWizardPage.hpp:89
@ CALI_PAGE_COMMON_SAVE
Definition CalibrationWizardPage.hpp:90
@ CALI_PAGE_PA_SAVE
Definition CalibrationWizardPage.hpp:88
CalibMode get_obj_calibration_mode(const MachineObject *obj)
Definition CalibrationWizardPage.cpp:108
CalibMode
Definition calib.hpp:23

References _L, back_preset_info(), Slic3r::GUI::CALI_PAGE_COARSE_SAVE, Slic3r::GUI::CALI_PAGE_COMMON_SAVE, Slic3r::GUI::CALI_PAGE_FINE_SAVE, Slic3r::GUI::CALI_PAGE_FLOW_SAVE, Slic3r::GUI::CALI_PAGE_PA_SAVE, curr_obj, get_curr_step(), Slic3r::GUI::get_obj_calibration_mode(), Slic3r::GUI::CalibrationWizardPage::get_page_type(), go_home_dialog, m_mode, m_page_steps, Slic3r::GUI::CalibrationWizardPageStep::page, and show_step().

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_action(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_action(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_job_finished() [1/2]

void Slic3r::GUI::CalibrationWizard::on_cali_job_finished ( wxCommandEvent & event)
inherited
172{
173 this->on_cali_job_finished(event.GetString());
174 event.Skip();
175}
void on_cali_job_finished(wxCommandEvent &event)
Definition CalibrationWizard.cpp:171

References on_cali_job_finished().

Referenced by CalibrationWizard(), and on_cali_job_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_job_finished() [2/2]

void Slic3r::GUI::PressureAdvanceWizard::on_cali_job_finished ( wxString evt_data)
overridevirtual

Reimplemented from Slic3r::GUI::CalibrationWizard.

548{
549 int cali_stage = 0;
550 CalibMode obj_cali_mode = CalibUtils::get_calib_mode_by_name(evt_data.ToStdString(), cali_stage);
551
552 if (obj_cali_mode == m_mode) {
554 }
555 // change ui, hide
556 static_cast<CalibrationPresetPage *>(preset_step->page)->on_cali_finished_job();
557}
static CalibMode get_calib_mode_by_name(const std::string name, int &cali_stage)
Definition CalibUtils.cpp:395

References Slic3r::GUI::CalibrationWizard::cali_step, Slic3r::GUI::CalibUtils::get_calib_mode_by_name(), Slic3r::GUI::CalibrationWizard::m_mode, Slic3r::GUI::CalibrationWizard::preset_step, and Slic3r::GUI::CalibrationWizard::show_step().

Here is the call graph for this function:

◆ on_cali_save()

void Slic3r::GUI::PressureAdvanceWizard::on_cali_save ( )
protected
985{
986 if (curr_obj) {
987 if (curr_obj->is_connecting() || !curr_obj->is_connected())
988 {
989 MessageDialog msg_dlg(nullptr, _L("Connecting to printer..."), wxEmptyString, wxOK);
990 msg_dlg.ShowModal();
991 return;
992 }
993
994 if (curr_obj->get_printer_series() == PrinterSeries::SERIES_X1) {
996 std::vector<PACalibResult> new_pa_cali_results;
997 auto save_page = static_cast<CalibrationPASavePage*>(save_step->page);
998 if (!save_page->get_auto_result(new_pa_cali_results)) {
999 return;
1000 }
1001 if (save_page->is_all_failed()) {
1002 MessageDialog msg_dlg(nullptr, _L("The failed test result has been dropped."), wxEmptyString, wxOK);
1003 msg_dlg.ShowModal();
1006 return;
1007 }
1008 if (!can_save_cali_result(new_pa_cali_results))
1009 return;
1010 CalibUtils::set_PA_calib_result(new_pa_cali_results, true);
1011 }
1013 PACalibResult new_pa_cali_result;
1014 auto save_page = static_cast<CalibrationPASavePage*>(save_step->page);
1015 if (!save_page->get_manual_result(new_pa_cali_result)) {
1016 return;
1017 }
1018 if (!can_save_cali_result({new_pa_cali_result}))
1019 return;
1020 CalibUtils::set_PA_calib_result({ new_pa_cali_result }, false);
1021 }
1022
1023 MessageDialog msg_dlg(nullptr, _L("Flow Dynamics Calibration result has been saved to the printer."), wxEmptyString, wxOK);
1024 msg_dlg.ShowModal();
1025 }
1026 else if (curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
1027 if (curr_obj->cali_version >= 0) {
1028 PACalibResult new_pa_cali_result;
1029 auto save_page = static_cast<CalibrationPASavePage *>(save_step->page);
1030 if (!save_page->get_manual_result(new_pa_cali_result)) {
1031 return;
1032 }
1033
1034 if (!can_save_cali_result({new_pa_cali_result}))
1035 return;
1036
1037 CalibUtils::set_PA_calib_result({new_pa_cali_result}, false);
1038 } else {
1039 auto save_page = static_cast<CalibrationPASavePage *>(save_step->page);
1040 float new_k_value = 0.0f;
1041 float new_n_value = 0.0f;
1042 if (!save_page->get_p1p_result(&new_k_value, &new_n_value)) {
1043 return;
1044 }
1045
1046 float nozzle_dia = 0.4;
1047 BedType plate_type = BedType::btDefault;
1048 CalibrationPresetPage *preset_page = (static_cast<CalibrationPresetPage *>(preset_step->page));
1049 preset_page->get_preset_info(nozzle_dia, plate_type);
1050 std::map<int, Preset *> selected_filaments = get_cached_selected_filament(curr_obj);
1051 if (selected_filaments.empty()) {
1052 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get selected filaments error";
1053 return;
1054 }
1055 int tray_id = selected_filaments.begin()->first;
1056 std::string setting_id = selected_filaments.begin()->second->setting_id;
1057
1058 int nozzle_temp = -1;
1059 int bed_temp = -1;
1060 float max_volumetric_speed = -1;
1061 if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) {
1062 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error";
1063 return;
1064 }
1065
1066 curr_obj->command_extrusion_cali_set(tray_id, setting_id, "", new_k_value, new_n_value, bed_temp, nozzle_temp, max_volumetric_speed);
1067
1068 }
1069
1070 MessageDialog msg_dlg(nullptr, _L("Flow Dynamics Calibration result has been saved to the printer."), wxEmptyString, wxOK);
1071 msg_dlg.ShowModal();
1072 }
1073 else {
1074 assert(false);
1075 }
1076 }
1079}
@ SERIES_P1P
Definition DevDefs.h:36
static void set_PA_calib_result(const std::vector< PACalibResult > &pa_calib_values, bool is_auto_cali)
Definition CalibUtils.cpp:634
CalibrationMethod m_cali_method
Definition CalibrationWizard.hpp:107
bool can_save_cali_result(const std::vector< PACalibResult > &new_pa_cali_results)
Definition CalibrationWizard.cpp:919
static bool get_preset_info(const DynamicConfig &config, const BedType plate_type, int &nozzle_temp, int &bed_temp, float &max_volumetric_speed)
Definition CalibrationWizard.cpp:675
std::map< int, Preset * > get_cached_selected_filament(MachineObject *obj)
Definition CalibrationWizard.cpp:51
BedType
Definition PrintConfig.hpp:507
@ btDefault
Definition PrintConfig.hpp:508

References _L, Slic3r::GUI::CalibrationWizard::back_preset_info(), Slic3r::btDefault, Slic3r::GUI::CALI_METHOD_AUTO, Slic3r::GUI::CALI_METHOD_MANUAL, Slic3r::GUI::CALI_METHOD_NEW_AUTO, can_save_cali_result(), Slic3r::GUI::CalibrationWizard::curr_obj, Slic3r::GUI::get_cached_selected_filament(), Slic3r::GUI::CalibrationPresetPage::get_preset_info(), Slic3r::GUI::get_preset_info(), Slic3r::GUI::CalibrationWizard::m_cali_method, on_cali_save(), Slic3r::GUI::CalibrationWizard::preset_step, Slic3r::GUI::CalibrationWizard::save_step, SERIES_P1P, SERIES_X1, Slic3r::GUI::CalibUtils::set_PA_calib_result(), Slic3r::GUI::CalibrationWizard::show_step(), Slic3r::GUI::DPIAware< P >::ShowModal(), and Slic3r::GUI::CalibrationWizard::start_step.

Referenced by on_cali_action(), and on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_start()

void Slic3r::GUI::PressureAdvanceWizard::on_cali_start ( )
protected
703{
704 if (!curr_obj) {
705 MessageDialog msg_dlg(nullptr, _L("No Printer Connected!"), wxEmptyString, wxICON_WARNING | wxOK);
706 msg_dlg.ShowModal();
707 return;
708 }
709
710 if (curr_obj->is_connecting() || !curr_obj->is_connected()) {
711 MessageDialog msg_dlg(nullptr, _L("Printer is not connected yet."), wxEmptyString, wxICON_WARNING | wxOK);
712 msg_dlg.ShowModal();
713 return;
714 }
715
716 //clean PA result
717 curr_obj->reset_pa_cali_result();
718
719 std::string setting_id;
720 BedType plate_type = BedType::btDefault;
721
722 // save preset info to machine object
723 CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
724 std::map<int, Preset*> selected_filaments = preset_page->get_selected_filaments();
725 if (selected_filaments.empty()) {
726 MessageDialog msg_dlg(nullptr, _L("Please select filament to calibrate."), wxEmptyString, wxICON_WARNING | wxOK);
727 msg_dlg.ShowModal();
728 return;
729 }
730
731 float nozzle_dia = -1;
732 preset_page->get_preset_info(nozzle_dia, plate_type);
733
734 CalibrationWizard::cache_preset_info(curr_obj, nozzle_dia, plate_type);
735 if (/*nozzle_dia < 0 || */ plate_type == BedType::btDefault) {
736 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info, nozzle and plate type error";
737 return;
738 }
739
740 //std::string error_message;
741 wxString wx_err_string;
743 X1CCalibInfos calib_infos;
744 for (auto &item : selected_filaments) {
745 int nozzle_temp = -1;
746 int bed_temp = -1;
747 float max_volumetric_speed = -1;
748
749 if (!get_preset_info(item.second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) {
750 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error";
751 continue;
752 }
753
754 X1CCalibInfos::X1CCalibInfo calib_info;
755 get_tray_ams_and_slot_id(curr_obj, item.first, calib_info.ams_id, calib_info.slot_id, calib_info.tray_id);
756 calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(item.first);
757 calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
758 calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
759 calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id);
760 calib_info.filament_id = item.second->filament_id;
761 calib_info.setting_id = item.second->setting_id;
762 calib_info.bed_temp = bed_temp;
763 calib_info.nozzle_temp = nozzle_temp;
764 calib_info.max_volumetric_speed = max_volumetric_speed;
765 calib_infos.calib_datas.push_back(calib_info);
766 }
767 calib_infos.cali_mode = CalibMode::Calib_PA_Line;
768 CalibUtils::calib_PA(calib_infos, 0, wx_err_string); // mode = 0 for auto
769
770 if (!wx_err_string.empty()) {
771 MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK);
772 msg_dlg.ShowModal();
773 return;
774 }
775
776 show_step(m_curr_step->next);
778 if (selected_filaments.empty()) {
779 BOOST_LOG_TRIVIAL(warning) << "CaliPreset: selected filaments is empty";
780 return;
781 }
782 else {
783 int nozzle_temp = -1;
784 int bed_temp = -1;
785 float max_volumetric_speed = -1;
786 if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) {
787 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error";
788 return;
789 }
790
791 int selected_tray_id = 0;
792 CalibInfo calib_info;
793 calib_info.dev_id = curr_obj->get_dev_id();
794 get_tray_ams_and_slot_id(curr_obj, selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id);
795 calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(selected_filaments.begin()->first);
796 calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
797 calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
798 calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id);
799 calib_info.select_ams = std::to_string(selected_tray_id);
800 Preset *preset = selected_filaments.begin()->second;
801 Preset * temp_filament_preset = new Preset(preset->type, preset->name + "_temp");
802 temp_filament_preset->config = preset->config;
803 if (preset->type == Preset::TYPE_FILAMENT)
804 temp_filament_preset->filament_id = preset->filament_id;
805
806 calib_info.bed_type = plate_type;
807 calib_info.process_bar = preset_page->get_sending_progress_bar();
808 calib_info.printer_prest = preset_page->get_printer_preset(curr_obj, preset_page->get_nozzle_diameter(calib_info.extruder_id));
809 calib_info.print_prest = preset_page->get_print_preset();
810 calib_info.filament_prest = temp_filament_preset;
811
812 std::map<int, DynamicPrintConfig> filament_list = preset_page->get_filament_ams_list();
813 calib_info.filament_color = filament_list[selected_filaments.begin()->first].opt_string("filament_colour", 0u);
814
815 wxArrayString values = preset_page->get_custom_range_values();
816 if (values.size() != 3) {
817 MessageDialog msg_dlg(nullptr, _L("The input value size must be 3."), wxEmptyString, wxICON_WARNING | wxOK);
818 msg_dlg.ShowModal();
819 return;
820 } else {
821 values[0].ToDouble(&calib_info.params.start);
822 values[1].ToDouble(&calib_info.params.end);
823 values[2].ToDouble(&calib_info.params.step);
824 }
825 calib_info.params.mode = preset_page->get_pa_cali_method();
826 calib_info.params.print_numbers = true;
827
828 if (!is_pa_params_valid(calib_info.params))
829 return;
830
832 CalibrationCaliPage *cali_page = (static_cast<CalibrationCaliPage *>(cali_step->page));
833 if (calib_info.params.mode == CalibMode::Calib_PA_Line)
834 pa_cali_method = ManualPaCaliMethod::PA_LINE;
835 else if (calib_info.params.mode == CalibMode::Calib_PA_Pattern)
836 pa_cali_method = ManualPaCaliMethod::PA_PATTERN;
837
838 cali_page->set_pa_cali_image(int(pa_cali_method));
839 curr_obj->manual_pa_cali_method = pa_cali_method;
840
841 if (curr_obj->get_printer_series() != PrinterSeries::SERIES_X1 && curr_obj->pa_calib_tab.size() >= MAX_PA_HISTORY_RESULTS_NUMS) {
842 MessageDialog msg_dlg(nullptr, wxString::Format(_L("This machine type can only hold 16 historical results per nozzle. You can delete the existing historical results and then start calibration. Or you can continue the calibration, but you cannot create new calibration historical results.\nDo you still want to continue the calibration\?"), MAX_PA_HISTORY_RESULTS_NUMS), wxEmptyString, wxICON_WARNING | wxYES | wxCANCEL);
843 if (msg_dlg.ShowModal() != wxID_YES) {
844 return;
845 }
846 }
847
848 if (!CalibUtils::calib_generic_PA(calib_info, wx_err_string)) {
849 if (!wx_err_string.empty()) {
850 MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK);
851 msg_dlg.ShowModal();
852 }
853 return;
854 }
855
856 preset_page->on_cali_start_job();
857 }
859 if (selected_filaments.empty()) {
860 BOOST_LOG_TRIVIAL(warning) << "CaliPreset: selected filaments is empty";
861 return;
862 }
863
864 std::vector<CalibInfo> calib_infos;
865 for (auto &item : selected_filaments) {
866 int nozzle_temp = -1;
867 int bed_temp = -1;
868 float max_volumetric_speed = -1;
869
870 if (!get_preset_info(item.second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) {
871 BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error";
872 continue;
873 }
874
875 int selected_tray_id = 0;
876 CalibInfo calib_info;
877 calib_info.dev_id = curr_obj->get_dev_id();
878 get_tray_ams_and_slot_id(curr_obj, item.first, calib_info.ams_id, calib_info.slot_id, selected_tray_id);
879 calib_info.index = preset_page->get_index_by_tray_id(item.first);
880 calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(item.first);
881 calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id);
882 calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
883 calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
884 calib_info.select_ams = std::to_string(selected_tray_id);
885 Preset *preset = item.second;
886 Preset *temp_filament_preset = new Preset(preset->type, preset->name + "_temp");
887 temp_filament_preset->config = preset->config;
888
889 calib_info.bed_type = plate_type;
890 calib_info.process_bar = preset_page->get_sending_progress_bar();
891 calib_info.printer_prest = preset_page->get_printer_preset(curr_obj, preset_page->get_nozzle_diameter(calib_info.extruder_id));
892 calib_info.print_prest = preset_page->get_print_preset();
893 calib_info.filament_prest = temp_filament_preset;
894 std::map<int, DynamicPrintConfig> filament_list = preset_page->get_filament_ams_list();
895 calib_info.filament_color = filament_list[item.first].opt_string("filament_colour", 0u);
896 calib_info.params.mode = CalibMode::Calib_Auto_PA_Line;
897 calib_infos.emplace_back(calib_info);
898 }
899
900 if (!CalibUtils::calib_generic_auto_pa_cali(calib_infos, wx_err_string)) {
901 if (!wx_err_string.empty()) {
902 MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK);
903 msg_dlg.ShowModal();
904 }
905 return;
906 }
907
908 preset_page->on_cali_start_job();
909 } else {
910 assert(false);
911 BOOST_LOG_TRIVIAL(error) << "CaliPreset: unsupported printer type or cali method";
912 return;
913 }
914
915 CalibrationCaliPage* cali_page = (static_cast<CalibrationCaliPage*>(cali_step->page));
916 cali_page->clear_last_job_status();
917}
static void calib_PA(const X1CCalibInfos &calib_infos, int mode, wxString &error_message)
Definition CalibUtils.cpp:561
static bool calib_generic_auto_pa_cali(const std::vector< CalibInfo > &calib_info, wxString &error_message)
Definition CalibUtils.cpp:1019
static bool calib_generic_PA(const CalibInfo &calib_info, wxString &error_message)
Definition CalibUtils.cpp:1108
virtual void cache_preset_info(MachineObject *obj, float nozzle_dia, BedType bed_type)
Definition CalibrationWizard.cpp:417
@ TYPE_FILAMENT
Definition Preset.hpp:248
bool is_pa_params_valid(const Calib_Params &params)
Definition CalibrationWizard.cpp:92
ManualPaCaliMethod
Definition DevCalib.h:23
@ PA_PATTERN
Definition DevCalib.h:25
@ PA_LINE
Definition DevCalib.h:24
@ Calib_PA_Pattern
Definition calib.hpp:26
@ Calib_Auto_PA_Line
Definition calib.hpp:28
@ Preset
Definition calib.hpp:39

References _L, Slic3r::GUI::CalibInfo::ams_id, Slic3r::X1CCalibInfos::X1CCalibInfo::ams_id, Slic3r::X1CCalibInfos::X1CCalibInfo::bed_temp, Slic3r::GUI::CalibInfo::bed_type, Slic3r::btDefault, Slic3r::GUI::CalibrationWizard::cache_preset_info(), Slic3r::GUI::CALI_METHOD_AUTO, Slic3r::GUI::CALI_METHOD_MANUAL, Slic3r::GUI::CALI_METHOD_NEW_AUTO, Slic3r::X1CCalibInfos::cali_mode, Slic3r::GUI::CalibrationWizard::cali_step, Slic3r::Calib_Auto_PA_Line, Slic3r::X1CCalibInfos::calib_datas, Slic3r::GUI::CalibUtils::calib_generic_auto_pa_cali(), Slic3r::GUI::CalibUtils::calib_generic_PA(), Slic3r::GUI::CalibUtils::calib_PA(), Slic3r::Calib_PA_Line, Slic3r::Calib_PA_Pattern, Slic3r::GUI::CalibrationCaliPage::clear_last_job_status(), Slic3r::Preset::config, Slic3r::GUI::CalibrationWizard::curr_obj, Slic3r::GUI::CalibInfo::dev_id, Slic3r::Calib_Params::end, Slic3r::GUI::CalibInfo::extruder_id, Slic3r::X1CCalibInfos::X1CCalibInfo::extruder_id, Slic3r::GUI::CalibInfo::extruder_type, Slic3r::X1CCalibInfos::X1CCalibInfo::extruder_type, Slic3r::GUI::CalibInfo::filament_color, Slic3r::Preset::filament_id, Slic3r::X1CCalibInfos::X1CCalibInfo::filament_id, Slic3r::GUI::CalibInfo::filament_prest, Slic3r::GUI::CalibrationPresetPage::get_custom_range_values(), Slic3r::GUI::CalibrationPresetPage::get_extruder_id_by_tray_id(), Slic3r::GUI::CalibrationPresetPage::get_extruder_type(), Slic3r::GUI::CalibrationPresetPage::get_filament_ams_list(), Slic3r::GUI::CalibrationPresetPage::get_index_by_tray_id(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_diameter(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_volume_type(), Slic3r::GUI::CalibrationPresetPage::get_pa_cali_method(), Slic3r::GUI::CalibrationPresetPage::get_preset_info(), Slic3r::GUI::get_preset_info(), Slic3r::GUI::CalibrationPresetPage::get_print_preset(), Slic3r::GUI::CalibrationPresetPage::get_printer_preset(), Slic3r::GUI::CalibrationPresetPage::get_selected_filaments(), Slic3r::GUI::CalibrationPresetPage::get_sending_progress_bar(), Slic3r::GUI::get_tray_ams_and_slot_id(), Slic3r::GUI::CalibInfo::index, Slic3r::GUI::is_pa_params_valid(), Slic3r::GUI::CalibrationWizard::m_cali_method, Slic3r::GUI::CalibrationWizard::m_curr_step, Slic3r::GUI::MAX_PA_HISTORY_RESULTS_NUMS, Slic3r::X1CCalibInfos::X1CCalibInfo::max_volumetric_speed, Slic3r::Calib_Params::mode, Slic3r::Preset::name, Slic3r::GUI::CalibInfo::nozzle_diameter, Slic3r::X1CCalibInfos::X1CCalibInfo::nozzle_diameter, Slic3r::X1CCalibInfos::X1CCalibInfo::nozzle_temp, Slic3r::GUI::CalibInfo::nozzle_volume_type, Slic3r::X1CCalibInfos::X1CCalibInfo::nozzle_volume_type, Slic3r::GUI::CalibrationPresetPage::on_cali_start_job(), Slic3r::PA_LINE, Slic3r::PA_PATTERN, Slic3r::GUI::CalibInfo::params, Slic3r::Preset, Slic3r::GUI::CalibrationWizard::preset_step, Slic3r::Calib_Params::print_numbers, Slic3r::GUI::CalibInfo::print_prest, Slic3r::GUI::CalibInfo::printer_prest, Slic3r::GUI::CalibInfo::process_bar, Slic3r::GUI::CalibInfo::select_ams, SERIES_X1, Slic3r::GUI::CalibrationCaliPage::set_pa_cali_image(), Slic3r::X1CCalibInfos::X1CCalibInfo::setting_id, Slic3r::GUI::CalibrationWizard::show_step(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::CalibInfo::slot_id, Slic3r::X1CCalibInfos::X1CCalibInfo::slot_id, Slic3r::Calib_Params::start, Slic3r::Calib_Params::step, Slic3r::X1CCalibInfos::X1CCalibInfo::tray_id, Slic3r::Preset::type, and Slic3r::Preset::TYPE_FILAMENT.

Referenced by on_cali_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_device_connected()

void Slic3r::GUI::PressureAdvanceWizard::on_device_connected ( MachineObject * obj)
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::CalibrationWizard.

650{
652
653 CalibrationMethod method;
654 int cali_stage = 0;
655 CalibMode obj_cali_mode = get_obj_calibration_mode(obj, method, cali_stage);
656 obj->manual_pa_cali_method = ManualPaCaliMethod(cali_stage);
657
658 // show cali step when obj is in pa calibration
659 if (obj) {
661
662 if (m_curr_step != cali_step) {
663 if (obj_cali_mode == m_mode) {
664 if (!obj->cali_finished && (obj->is_in_printing() || obj->is_printing_finished())) {
666 CalibrationCaliPage *cali_page = (static_cast<CalibrationCaliPage *>(cali_step->page));
667 cali_page->set_pa_cali_image(cali_stage);
669 }
670 }
671 }
672 }
673}
virtual void on_device_connected(MachineObject *obj)
Definition CalibrationWizard.cpp:218

References Slic3r::MachineObject::cali_finished, Slic3r::GUI::CalibrationWizard::cali_step, Slic3r::GUI::get_obj_calibration_mode(), Slic3r::MachineObject::is_in_printing(), Slic3r::MachineObject::is_printing_finished(), Slic3r::GUI::CalibrationWizard::m_curr_step, Slic3r::GUI::CalibrationWizard::m_mode, Slic3r::MachineObject::manual_pa_cali_method, Slic3r::GUI::CalibrationWizard::on_device_connected(), Slic3r::GUI::CalibrationWizard::set_cali_method(), Slic3r::GUI::CalibrationCaliPage::set_pa_cali_image(), and Slic3r::GUI::CalibrationWizard::show_step().

Here is the call graph for this function:

◆ on_sys_color_changed()

void Slic3r::GUI::CalibrationWizard::on_sys_color_changed ( )
inherited
492{
493 for (int i = 0; i < m_page_steps.size(); i++) {
494 if (m_page_steps[i]->page)
495 m_page_steps[i]->page->on_sys_color_changed();
496 }
497}

References m_page_steps.

◆ recover_preset_info()

void Slic3r::GUI::CalibrationWizard::recover_preset_info ( MachineObject * obj)
virtualinherited
456{
457 std::vector<PrinterCaliInfo> back_infos = wxGetApp().app_config->get_printer_cali_infos();
458 for (const auto& back_info : back_infos) {
459 if (obj && (obj->get_dev_id() == back_info.dev_id) ) {
460 obj->set_dev_id(back_info.dev_id);
461 obj->cali_finished = back_info.cali_finished;
462 obj->cache_flow_ratio = back_info.cache_flow_ratio;
463 obj->selected_cali_preset = back_info.selected_presets;
464 obj->flow_ratio_calibration_type = back_info.cache_flow_rate_calibration_type;
465 }
466 }
467}

References Slic3r::MachineObject::cache_flow_ratio, Slic3r::MachineObject::cali_finished, Slic3r::MachineObject::flow_ratio_calibration_type, Slic3r::MachineObject::get_dev_id(), Slic3r::MachineObject::selected_cali_preset, and Slic3r::MachineObject::set_dev_id().

Referenced by on_device_connected().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_preset()

bool Slic3r::GUI::CalibrationWizard::save_preset ( const std::string & old_preset_name,
const std::string & new_preset_name,
const std::map< std::string, ConfigOption * > & key_values,
wxString & message )
inherited
260{
261 if (new_preset_name.empty()) {
262 message = _L("The name cannot be empty.");
263 return false;
264 }
265
266 PresetCollection *filament_presets = &wxGetApp().preset_bundle->filaments;
267 Preset* preset = filament_presets->find_preset(old_preset_name);
268 if (!preset) {
269 message = wxString::Format(_L("The selected preset: %s was not found."), old_preset_name);
270 return false;
271 }
272
273 Preset temp_preset = *preset;
274
275 std::string new_name = filament_presets->get_preset_name_by_alias(new_preset_name);
276 bool exist_preset = false;
277 // If name is current, get the editing preset
278 Preset *new_preset = filament_presets->find_preset(new_name);
279 if (new_preset) {
280 if (new_preset->is_system) {
281 message = _L("The name cannot be the same as the system preset name.");
282 return false;
283 }
284
285 if (new_preset != preset) {
286 message = _L("The name is the same as another existing preset name");
287 return false;
288 }
289 if (new_preset != &filament_presets->get_edited_preset()) new_preset = &temp_preset;
290 exist_preset = true;
291 } else {
292 new_preset = &temp_preset;
293 }
294
295 for (auto item : key_values) {
296 new_preset->config.set_key_value(item.first, item.second);
297 }
298
299 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
300 filament_presets->save_current_preset(new_name, false, false, new_preset);
301
302 // BBS create new settings
303 new_preset = filament_presets->find_preset(new_name, false, true);
304 // Preset* preset = &m_presets.preset(it - m_presets.begin(), true);
305 if (!new_preset) {
306 BOOST_LOG_TRIVIAL(info) << "create new preset failed";
307 message = _L("create new preset failed.");
308 return false;
309 }
310
311 // set sync_info for sync service
312 if (exist_preset) {
313 new_preset->sync_info = "update";
314 BOOST_LOG_TRIVIAL(info) << "sync_preset: update preset = " << new_preset->name;
315 } else {
316 new_preset->sync_info = "create";
317 if (wxGetApp().is_user_login()) new_preset->user_id = wxGetApp().getAgent()->get_user_id();
318 BOOST_LOG_TRIVIAL(info) << "sync_preset: create preset = " << new_preset->name;
319 }
320 new_preset->save_info();
321
322 // Mark the print & filament enabled if they are compatible with the currently selected preset.
323 // If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are
324 // no more compatible.
325 wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
326
327 // BBS if create a new prset name, preset changed from preset name to new preset name
328 if (!exist_preset) { wxGetApp().plater()->sidebar().update_presets_from_to(Preset::Type::TYPE_FILAMENT, old_preset_name, new_preset->name); }
329
330 // todo: zhimin
331 // wxGetApp().mainframe->update_filament_tab_ui();
332 return true;
333}
@ Never
Definition Preset.hpp:523

References _L, Slic3r::Preset::config, Slic3r::PresetCollection::find_preset(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PresetCollection::get_preset_name_by_alias(), Slic3r::Preset::is_system, Slic3r::Preset::name, Slic3r::Never, Slic3r::PresetCollection::save_current_preset(), Slic3r::Preset::save_info(), Slic3r::DynamicConfig::set_key_value(), Slic3r::Preset::sync_info, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::user_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_save(), and Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_preset_with_index()

bool Slic3r::GUI::CalibrationWizard::save_preset_with_index ( const std::string & old_preset_name,
const std::string & new_preset_name,
const std::map< std::string, ConfigIndexValue > & key_values,
wxString & message )
inherited
336{
337 if (new_preset_name.empty()) {
338 message = _L("The name cannot be empty.");
339 return false;
340 }
341
342 PresetCollection *filament_presets = &wxGetApp().preset_bundle->filaments;
343 Preset *preset = filament_presets->find_preset(old_preset_name);
344 if (!preset) {
345 message = wxString::Format(_L("The selected preset: %s was not found."), old_preset_name);
346 return false;
347 }
348
349 Preset temp_preset = *preset;
350
351 std::string new_name = filament_presets->get_preset_name_by_alias(new_preset_name);
352 bool exist_preset = false;
353 // If name is current, get the editing preset
354 Preset *new_preset = filament_presets->find_preset(new_name);
355 if (new_preset) {
356 if (new_preset->is_system) {
357 message = _L("The name cannot be the same as the system preset name.");
358 return false;
359 }
360
361 if (new_preset != preset) {
362 message = _L("The name is the same as another existing preset name");
363 return false;
364 }
365 if (new_preset != &filament_presets->get_edited_preset())
366 new_preset = &temp_preset;
367 exist_preset = true;
368 } else {
369 new_preset = &temp_preset;
370 }
371
372 for (auto item : key_values) {
373 auto config_opt = new_preset->config.option<ConfigOptionFloatsNullable>(item.first);
374 if (config_opt) {
375 auto& config_value = config_opt->values;
376 config_value[item.second.index] = item.second.value;
377 }
378 else {
379 message = wxString::Format(_L("Could not find parameter: %s."), item.first);
380 }
381 }
382
383 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
384 filament_presets->save_current_preset(new_name, false, false, new_preset);
385
386 // BBS create new settings
387 new_preset = filament_presets->find_preset(new_name, false, true);
388 // Preset* preset = &m_presets.preset(it - m_presets.begin(), true);
389 if (!new_preset) {
390 BOOST_LOG_TRIVIAL(info) << "create new preset failed";
391 message = _L("create new preset failed.");
392 return false;
393 }
394
395 // set sync_info for sync service
396 if (exist_preset) {
397 new_preset->sync_info = "update";
398 BOOST_LOG_TRIVIAL(info) << "sync_preset: update preset = " << new_preset->name;
399 } else {
400 new_preset->sync_info = "create";
401 if (wxGetApp().is_user_login()) new_preset->user_id = wxGetApp().getAgent()->get_user_id();
402 BOOST_LOG_TRIVIAL(info) << "sync_preset: create preset = " << new_preset->name;
403 }
404 new_preset->save_info();
405
406 // Mark the print & filament enabled if they are compatible with the currently selected preset.
407 // If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are
408 // no more compatible.
409 wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
410
411 // BBS if create a new prset name, preset changed from preset name to new preset name
412 if (!exist_preset) { wxGetApp().plater()->sidebar().update_presets_from_to(Preset::Type::TYPE_FILAMENT, old_preset_name, new_preset->name); }
413
414 return true;
415}
ConfigOptionFloatsTempl< true > ConfigOptionFloatsNullable
Definition Config.hpp:1016

References _L, Slic3r::Preset::config, Slic3r::PresetCollection::find_preset(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PresetCollection::get_preset_name_by_alias(), Slic3r::Preset::is_system, Slic3r::Preset::name, Slic3r::Never, Slic3r::ConfigBase::option(), Slic3r::PresetCollection::save_current_preset(), Slic3r::Preset::save_info(), Slic3r::Preset::sync_info, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::user_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_cali_method()

void Slic3r::GUI::CalibrationWizard::set_cali_method ( CalibrationMethod method)
virtualinherited

Reimplemented in Slic3r::GUI::FlowRateWizard.

251{
252 m_cali_method = method;
253 for (int i = 0; i < m_page_steps.size(); i++) {
254 if (m_page_steps[i]->page)
255 m_page_steps[i]->page->set_cali_method(method);
256 }
257}

References m_cali_method, and m_page_steps.

Referenced by Slic3r::GUI::PressureAdvanceWizard::on_cali_action(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_device_connected(), Slic3r::GUI::PressureAdvanceWizard::on_device_connected(), and Slic3r::GUI::FlowRateWizard::set_cali_method().

Here is the caller graph for this function:

◆ set_cali_style()

virtual void Slic3r::GUI::CalibrationWizard::set_cali_style ( CalibrationStyle style)
inlinevirtualinherited
76 {
78 }
CalibrationStyle m_cali_style
Definition CalibrationWizard.hpp:106

References m_cali_style, and style.

◆ show_step()

◆ unfinished_child()

StagedBuild * Slic3r::GUI::StagedBuild::unfinished_child ( ) const
inlineprivateinherited
52 {
53 auto it = std::find_if(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return !child->built(); });
54 return it == m_children.end() ? nullptr : *it;
55 }

References m_children.

Referenced by build_step().

Here is the caller graph for this function:

◆ update()

void Slic3r::GUI::PressureAdvanceWizard::update ( MachineObject * obj)
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::CalibrationWizard.

631{
633
634 if (!obj)
635 return;
636
638 if (obj->cali_version != -1 && obj->cali_version != cali_version) {
639 cali_version = obj->cali_version;
640 PACalibExtruderInfo cali_info;
641 cali_info.nozzle_diameter = obj->GetExtderSystem()->GetNozzleDiameter(0);
642 cali_info.use_extruder_id = false;
643 cali_info.use_nozzle_volume_type = false;
645 }
646 }
647}
static void emit_get_PA_calib_infos(const PACalibExtruderInfo &cali_info)
Definition CalibUtils.cpp:605
virtual void update(MachineObject *obj)
Definition CalibrationWizard.cpp:195
int cali_version
Definition CalibrationWizard.hpp:153

References cali_version, Slic3r::MachineObject::cali_version, Slic3r::GUI::CalibUtils::emit_get_PA_calib_infos(), Slic3r::MachineObject::GetExtderSystem(), Slic3r::DevExtderSystem::GetNozzleDiameter(), m_show_result_dialog, Slic3r::PACalibExtruderInfo::nozzle_diameter, Slic3r::GUI::CalibrationWizard::update(), Slic3r::PACalibExtruderInfo::use_extruder_id, and Slic3r::PACalibExtruderInfo::use_nozzle_volume_type.

Here is the call graph for this function:

Member Data Documentation

◆ cali_coarse_step

◆ cali_fine_step

◆ cali_step

◆ cali_version

int Slic3r::GUI::PressureAdvanceWizard::cali_version = -1
protected

Referenced by update().

◆ coarse_save_step

◆ curr_obj

◆ fine_save_step

CalibrationWizardPageStep* Slic3r::GUI::CalibrationWizard::fine_save_step { nullptr }
protectedinherited

◆ go_home_dialog

SecondaryCheckDialog* Slic3r::GUI::CalibrationWizard::go_home_dialog = nullptr
protectedinherited

Referenced by on_cali_go_home().

◆ last_obj

MachineObject* Slic3r::GUI::CalibrationWizard::last_obj { nullptr }
protectedinherited
109{ nullptr };

◆ m_all_pages_sizer

wxBoxSizer* Slic3r::GUI::CalibrationWizard::m_all_pages_sizer
protectedinherited

◆ m_cali_method

◆ m_cali_style

CalibrationStyle Slic3r::GUI::CalibrationWizard::m_cali_style
protectedinherited

Referenced by set_cali_style().

◆ m_calib_results_history

std::vector<PACalibResult> Slic3r::GUI::PressureAdvanceWizard::m_calib_results_history
protected

Referenced by on_cali_action().

◆ m_children

std::vector<StagedBuild*> Slic3r::GUI::StagedBuild::m_children
privateinherited

◆ m_curr_step

◆ m_mode

◆ m_next_step

size_t Slic3r::GUI::StagedBuild::m_next_step { 0 }
privateinherited
59{ 0 };

Referenced by add_build_steps_of(), build_step(), and built().

◆ m_page_steps

◆ m_scrolledWindow

wxScrolledWindow* Slic3r::GUI::CalibrationWizard::m_scrolledWindow
protectedinherited

◆ m_show_result_dialog

bool Slic3r::GUI::PressureAdvanceWizard::m_show_result_dialog = false
protected

Referenced by on_cali_action(), and update().

◆ m_steps

std::vector<std::function<void()> > Slic3r::GUI::StagedBuild::m_steps
privateinherited

◆ preset_step

◆ save_step

◆ start_step


The documentation for this class was generated from the following files: