mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	FIX: fix some issue in calibration
1.add part of x1c PAcalibrate save multi-filamnet-presets logic 2.fix a quit crash 3.fix keeping connecting device 4.part of UI refined Change-Id: I221984529bd09111d408b09defe5e30c9d100714
This commit is contained in:
		
							parent
							
								
									fb5a9062ff
								
							
						
					
					
						commit
						767edb03e0
					
				
					 9 changed files with 602 additions and 332 deletions
				
			
		|  | @ -50,7 +50,6 @@ void CalibrationPanel::init_timer() | |||
| } | ||||
| 
 | ||||
| void CalibrationPanel::on_timer(wxTimerEvent& event) { | ||||
|     // todo only update at CalibrationPanel
 | ||||
|     update_all(); | ||||
| } | ||||
| 
 | ||||
|  | @ -73,4 +72,23 @@ void CalibrationPanel::update_all() { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| bool CalibrationPanel::Show(bool show) { | ||||
|     if (show) { | ||||
|         m_refresh_timer->Stop(); | ||||
|         m_refresh_timer->SetOwner(this); | ||||
|         m_refresh_timer->Start(REFRESH_INTERVAL); | ||||
|         wxPostEvent(this, wxTimerEvent()); | ||||
|     } | ||||
|     else { | ||||
|         m_refresh_timer->Stop(); | ||||
|     } | ||||
|     return wxPanel::Show(show); | ||||
| } | ||||
| 
 | ||||
| CalibrationPanel::~CalibrationPanel() { | ||||
|     if (m_refresh_timer) | ||||
|         m_refresh_timer->Stop(); | ||||
|     delete m_refresh_timer; | ||||
| } | ||||
| 
 | ||||
| }} | ||||
|  | @ -10,10 +10,10 @@ class CalibrationPanel : public wxPanel | |||
| { | ||||
| public: | ||||
|     CalibrationPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); | ||||
|     ~CalibrationPanel() {}; | ||||
|     ~CalibrationPanel(); | ||||
|     Tabbook* get_tabpanel() { return m_tabpanel; }; | ||||
|     void update_all(); | ||||
| 
 | ||||
|     bool Show(bool show); | ||||
| protected: | ||||
|     void init_tabpanel(); | ||||
|     void init_timer(); | ||||
|  | @ -21,7 +21,6 @@ protected: | |||
| 
 | ||||
| private: | ||||
|     Tabbook*    m_tabpanel{ nullptr }; | ||||
|     //SideTools* m_side_tools{ nullptr };
 | ||||
| 
 | ||||
|     CalibrationWizard* m_pa_panel{ nullptr }; | ||||
|     CalibrationWizard* m_flow_panel{ nullptr }; | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -15,6 +15,7 @@ | |||
| namespace Slic3r { namespace GUI { | ||||
| 
 | ||||
| wxDECLARE_EVENT(EVT_CALIBRATION_TRAY_SELECTION_CHANGED, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_CALIBRATION_NOTIFY_CHANGE_PAGES, SimpleEvent); | ||||
| 
 | ||||
| enum FilamentSelectMode { | ||||
|     FSMCheckBoxMode, | ||||
|  | @ -31,6 +32,7 @@ public: | |||
|     void load_tray_from_ams(int id, DynamicPrintConfig& tray); | ||||
|     void update_from_preset(); | ||||
|     int get_tray_id() { return m_tray_id; } | ||||
|     std::string get_tray_name() { return m_tray_name; } | ||||
|     CalibrateFilamentComboBox* GetComboBox() { return m_comboBox; } | ||||
|     CheckBox* GetCheckBox() { return m_checkBox; } | ||||
|     void SetCheckBox(CheckBox* cb) { m_checkBox = cb; } | ||||
|  | @ -42,6 +44,7 @@ public: | |||
| 
 | ||||
| protected: | ||||
|     int m_tray_id; | ||||
|     std::string m_tray_name; | ||||
| 
 | ||||
|     CheckBox* m_checkBox{nullptr}; | ||||
|     //RadioBox* m_radioBox;
 | ||||
|  | @ -61,7 +64,6 @@ public: | |||
|     void show_page(CalibrationWizardPage* page); | ||||
|     void show_send_progress_bar(bool show); | ||||
|     void update_printer_selections(); | ||||
|     void update_ams(MachineObject* obj); | ||||
|     void update_print_progress(); | ||||
|     void update_filaments_from_preset(); | ||||
| 
 | ||||
|  | @ -70,6 +72,7 @@ protected: | |||
|     virtual bool start_calibration(std::vector<int> tray_ids) = 0; | ||||
|     virtual bool save_calibration_result() = 0; | ||||
|     virtual bool recommend_input_value(); | ||||
|     virtual void request_calib_result() {}; | ||||
| 
 | ||||
| protected: | ||||
|     MachineObject* curr_obj{ nullptr }; | ||||
|  | @ -129,7 +132,7 @@ protected: | |||
|     PageButton* m_btn_recali; | ||||
| 
 | ||||
|     // save panel
 | ||||
|     wxPanel* m_save_panel; | ||||
|     //wxPanel* m_save_panel;
 | ||||
| 
 | ||||
| 
 | ||||
|     void add_presets_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer); | ||||
|  | @ -144,7 +147,7 @@ protected: | |||
|     std::vector<int> get_selected_tray(); | ||||
|     FilamentComboBoxList get_selected_filament_comboBox(); | ||||
| 
 | ||||
|     virtual void on_select_printer(wxCommandEvent& evt); | ||||
|     void on_select_printer(wxCommandEvent& evt); | ||||
|     void on_select_nozzle(wxCommandEvent& evt); | ||||
|     void on_select_tray(SimpleEvent& evt); | ||||
|     void on_select_bed_type(wxCommandEvent& evt); | ||||
|  | @ -160,7 +163,7 @@ protected: | |||
| private: | ||||
|     void create_presets_panel(); | ||||
|     void create_print_panel(); | ||||
|     void create_save_panel(); | ||||
|     //void create_save_panel();
 | ||||
|     void create_send_progress_bar(); | ||||
| 
 | ||||
|     void init_presets_selections(); | ||||
|  | @ -174,21 +177,31 @@ public: | |||
|     PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); | ||||
|     ~PressureAdvanceWizard() {}; | ||||
| protected: | ||||
|     void create_low_end_pages(); | ||||
|     void create_high_end_pages(); | ||||
|     virtual void create_pages() override; | ||||
|     virtual bool start_calibration(std::vector<int> tray_ids) override; | ||||
|     virtual bool save_calibration_result() override; | ||||
|     virtual bool recommend_input_value() override; | ||||
|     virtual void request_calib_result() override; | ||||
| 
 | ||||
|     void sync_save_page_data(); | ||||
|     void switch_pages(SimpleEvent& evt); | ||||
| private: | ||||
|     // page 1
 | ||||
|     CalibrationWizardPage* m_page1; | ||||
|     CalibrationWizardPage* m_page1{ nullptr }; | ||||
| 
 | ||||
|     // page 2
 | ||||
|     CalibrationWizardPage* m_page2; | ||||
|     CalibrationWizardPage* m_page2{ nullptr }; | ||||
| 
 | ||||
|     // page 3
 | ||||
|     CalibrationWizardPage* m_page3; | ||||
|     CalibrationWizardPage* m_low_end_page3{ nullptr }; | ||||
|     TextInput* m_k_val; | ||||
|     TextInput* m_n_val; | ||||
| 
 | ||||
|     CalibrationWizardPage* m_high_end_page3{ nullptr }; | ||||
|     std::vector<PACalibResult> m_calib_results; | ||||
|     wxPanel* m_grid_panel; | ||||
| }; | ||||
| 
 | ||||
| class FlowRateWizard : public CalibrationWizard { | ||||
|  | @ -202,8 +215,9 @@ protected: | |||
|     virtual bool start_calibration(std::vector<int> tray_ids) override; | ||||
|     virtual bool save_calibration_result() override; | ||||
|     virtual bool recommend_input_value() override; | ||||
|     virtual void request_calib_result() override; | ||||
| 
 | ||||
|     virtual void on_select_printer(wxCommandEvent& evt) override; | ||||
|     void switch_pages(SimpleEvent& evt); | ||||
| private: | ||||
|     // page 1
 | ||||
|     CalibrationWizardPage* m_page1{ nullptr }; | ||||
|  | @ -212,16 +226,16 @@ private: | |||
|     CalibrationWizardPage* m_page2{ nullptr }; | ||||
| 
 | ||||
|     // page 3
 | ||||
|     CalibrationWizardPage* m_page3{ nullptr }; | ||||
|     CalibrationWizardPage* m_high_end_page3{ nullptr }; | ||||
|     CalibrationWizardPage* m_low_end_page3{ nullptr }; | ||||
|     ComboBox* m_optimal_block_coarse; | ||||
|     CalibrationWizardPage* m_high_end_page3{ nullptr }; | ||||
|     std::vector<FlowRatioCalibResult> m_calib_results; | ||||
| 
 | ||||
|     // page 4
 | ||||
|     CalibrationWizardPage* m_page4{ nullptr }; | ||||
|     //BBLStatusBarSend* m_progress_bar2;
 | ||||
|     CalibrationWizardPage* m_low_end_page4{ nullptr }; | ||||
| 
 | ||||
|     // page 5
 | ||||
|     CalibrationWizardPage* m_page5{ nullptr }; | ||||
|     CalibrationWizardPage* m_low_end_page5{ nullptr }; | ||||
|     ComboBox* m_optimal_block_fine; | ||||
| 
 | ||||
|     void on_fine_tune(wxCommandEvent&); | ||||
|  | @ -263,10 +277,10 @@ private: | |||
| 
 | ||||
|     // page 2
 | ||||
|     CalibrationWizardPage* m_page2; | ||||
|     TextInput* m_optimal_temp; | ||||
| 
 | ||||
|     // page 3
 | ||||
|     CalibrationWizardPage* m_page3; | ||||
|     TextInput* m_optimal_temp; | ||||
| }; | ||||
| 
 | ||||
| class VFAWizard : public CalibrationWizard {}; | ||||
|  |  | |||
|  | @ -74,7 +74,8 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, co | |||
|     m_title->Wrap(-1); | ||||
|     m_title->SetFont(Label::Head_16); | ||||
|     title_sizer->Add(m_title, 0, wxALL | wxEXPAND, 0); | ||||
|     title_sizer->Add(0, 0, 1, wxEXPAND, 0); | ||||
| 
 | ||||
|     title_sizer->AddStretchSpacer(); | ||||
| 
 | ||||
|     m_index = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_index->Wrap(-1); | ||||
|  | @ -83,12 +84,30 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, co | |||
| 
 | ||||
|     page_sizer->Add(title_sizer, 0, wxEXPAND, 0); | ||||
| 
 | ||||
|     page_sizer->Add(0, FromDIP(20), 0, wxEXPAND, 0); | ||||
| 
 | ||||
|     m_top_sizer = new wxBoxSizer(wxVERTICAL); | ||||
|     page_sizer->AddSpacer(FromDIP(20)); | ||||
| 
 | ||||
|     m_top_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
|     m_top_sizer->AddSpacer(FromDIP(180)); | ||||
|     m_preset_text = new wxStaticText(this, wxID_ANY, _L("Preset"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_preset_text->SetFont(::Label::Head_14); | ||||
|     m_top_sizer->Add(m_preset_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15)); | ||||
|     auto line1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, {FromDIP(250), 1}); | ||||
|     line1->SetBackgroundColour(*wxBLACK); | ||||
|     m_top_sizer->Add(line1, 1, wxALIGN_CENTER, 0); | ||||
|     m_calibration_text = new wxStaticText(this, wxID_ANY, _L("Calibration"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_calibration_text->SetFont(::Label::Head_14); | ||||
|     m_top_sizer->Add(m_calibration_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15)); | ||||
|     auto line2 = new wxPanel(this, wxID_ANY, wxDefaultPosition, { FromDIP(250), 1}); | ||||
|     line2->SetBackgroundColour(*wxBLACK); | ||||
|     m_top_sizer->Add(line2, 1, wxALIGN_CENTER, 0); | ||||
|     m_record_text = new wxStaticText(this, wxID_ANY, _L("Record"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_record_text->SetFont(::Label::Head_14); | ||||
|     m_top_sizer->Add(m_record_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15)); | ||||
|     m_top_sizer->AddSpacer(FromDIP(180)); | ||||
|     page_sizer->Add(m_top_sizer, 0, wxEXPAND, 0); | ||||
| 
 | ||||
|     page_sizer->AddSpacer(FromDIP(40)); | ||||
| 
 | ||||
|     m_content_sizer = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     page_sizer->Add(m_content_sizer, 0, wxEXPAND, 0); | ||||
|  | @ -113,6 +132,18 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, co | |||
|     m_btn_next->Bind(wxEVT_BUTTON, &CalibrationWizardPage::on_click_next, this); | ||||
| } | ||||
| 
 | ||||
| void CalibrationWizardPage::set_highlight_step_text(wxString text) { | ||||
|     m_preset_text->SetForegroundColour(wxColour(181, 181, 181)); | ||||
|     m_calibration_text->SetForegroundColour(wxColour(181, 181, 181)); | ||||
|     m_record_text->SetForegroundColour(wxColour(181, 181, 181)); | ||||
|     if(text == "Preset") | ||||
|         m_preset_text->SetForegroundColour(*wxBLACK); | ||||
|     if (text == "Calibration") | ||||
|         m_calibration_text->SetForegroundColour(*wxBLACK); | ||||
|     if (text == "Record") | ||||
|         m_record_text->SetForegroundColour(*wxBLACK); | ||||
| } | ||||
| 
 | ||||
| void CalibrationWizardPage::on_click_prev(wxCommandEvent&) | ||||
| { | ||||
|     IntEvent e(EVT_CALIBRATIONPAGE_PREV, static_cast<int>(m_btn_prev->GetButtonType()), m_parent); | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ public: | |||
|         return next; | ||||
|     } | ||||
| 
 | ||||
|     wxBoxSizer* get_top_vsizer() { return m_top_sizer; } | ||||
|     wxBoxSizer* get_top_hsizer() { return m_top_sizer; } | ||||
|     wxBoxSizer* get_content_vsizer() { return m_content_sizer; } | ||||
|     wxBoxSizer* get_btn_hsizer() { return m_btn_sizer; } | ||||
|     PageButton* get_prev_btn() { return m_btn_prev; } | ||||
|  | @ -56,11 +56,15 @@ public: | |||
| 
 | ||||
|     void set_page_title(wxString title) { m_title->SetLabel(title); } | ||||
|     void set_page_index(wxString index) { m_index->SetLabel(index); } | ||||
|     void set_highlight_step_text(wxString text); | ||||
| 
 | ||||
| private: | ||||
|     wxStaticText* m_title; | ||||
|     wxStaticText* m_index; | ||||
|     wxBoxSizer* m_top_sizer; | ||||
|     wxStaticText* m_preset_text; | ||||
|     wxStaticText* m_calibration_text; | ||||
|     wxStaticText* m_record_text; | ||||
|     wxBoxSizer* m_content_sizer; | ||||
|     wxBoxSizer* m_btn_sizer; | ||||
|     PageButton* m_btn_prev; | ||||
|  |  | |||
|  | @ -229,6 +229,7 @@ public: | |||
|     void update() override; | ||||
|     void OnSelect(wxCommandEvent &evt) override; | ||||
|     const Preset* get_selected_preset() { return m_selected_preset; } | ||||
|     std::string get_tray_name() { return m_tray_name; } | ||||
|     bool is_tray_exist() { return m_filament_exist; } | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -147,6 +147,19 @@ bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos) | |||
|     return pa_calib_infos.size() > 0; | ||||
| } | ||||
| 
 | ||||
| void CalibUtils::set_PA_calib_result(const std::vector<PACalibResult>& pa_calib_values) | ||||
| { | ||||
|     DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); | ||||
|     if (!dev) | ||||
|         return; | ||||
| 
 | ||||
|     MachineObject* obj_ = dev->get_selected_machine(); | ||||
|     if (obj_ == nullptr) | ||||
|         return; | ||||
| 
 | ||||
|     obj_->command_set_pa_calibration(pa_calib_values); | ||||
| } | ||||
| 
 | ||||
| void CalibUtils::calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message) | ||||
| { | ||||
|     DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); | ||||
|  |  | |||
|  | @ -47,6 +47,7 @@ public: | |||
|     static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results); | ||||
|     static void emit_get_PA_calib_infos(); | ||||
|     static bool get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos); | ||||
|     static void set_PA_calib_result(const std::vector<PACalibResult>& pa_calib_values); | ||||
| 
 | ||||
|     static void calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message); | ||||
|     static void emit_get_flow_ratio_calib_results(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 liz.li
						liz.li