mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	ENH:synchronize the status of AMS and printers
Change-Id: Ied38fbee8d78a984df9d7a46d3f69b54fea7fef2
This commit is contained in:
		
							parent
							
								
									cb2f6dd772
								
							
						
					
					
						commit
						1eb96b6979
					
				
					 4 changed files with 62 additions and 23 deletions
				
			
		|  | @ -2042,7 +2042,12 @@ void StatusPanel::update_ams(MachineObject *obj) | |||
|                 } | ||||
|             } else if (obj->ams_status_sub == 0x05) { | ||||
|                 if (!obj->is_ams_unload()) { | ||||
|                     m_ams_control->SetFilamentStep(FilamentStep::STEP_PUSH_NEW_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     if(m_is_load_with_temp){ | ||||
|                         m_ams_control->SetFilamentStep(FilamentStep::STEP_CUT_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     }else{ | ||||
|                         m_ams_control->SetFilamentStep(FilamentStep::STEP_PUSH_NEW_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     } | ||||
|                      | ||||
|                 } | ||||
|                 else { | ||||
|                     m_ams_control->SetFilamentStep(FilamentStep::STEP_PUSH_NEW_FILAMENT, FilamentStepType::STEP_TYPE_UNLOAD); | ||||
|  | @ -2056,7 +2061,11 @@ void StatusPanel::update_ams(MachineObject *obj) | |||
|                 } | ||||
|             } else if (obj->ams_status_sub == 0x07) { | ||||
|                 if (!obj->is_ams_unload()) { | ||||
|                     m_ams_control->SetFilamentStep(FilamentStep::STEP_PURGE_OLD_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     if (m_is_load_with_temp) { | ||||
|                         m_ams_control->SetFilamentStep(FilamentStep::STEP_PULL_CURR_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     }else{ | ||||
|                         m_ams_control->SetFilamentStep(FilamentStep::STEP_PURGE_OLD_FILAMENT, FilamentStepType::STEP_TYPE_LOAD); | ||||
|                     } | ||||
|                 } | ||||
|                 else { | ||||
|                     m_ams_control->SetFilamentStep(FilamentStep::STEP_PURGE_OLD_FILAMENT, FilamentStepType::STEP_TYPE_UNLOAD); | ||||
|  | @ -2144,23 +2153,23 @@ void StatusPanel::update_ams_control_state(bool is_support_virtual_tray, bool is | |||
|         enable[ACTION_BTN_UNLOAD] = false; | ||||
|     } | ||||
| 
 | ||||
|     /*if (obj->ams_status_main == AMS_STATUS_MAIN_FILAMENT_CHANGE) {
 | ||||
|     if (obj->ams_status_main == AMS_STATUS_MAIN_FILAMENT_CHANGE) { | ||||
|         enable[ACTION_BTN_LOAD] = false; | ||||
|         enable[ACTION_BTN_UNLOAD] = false; | ||||
|     }*/ | ||||
|     } | ||||
| 
 | ||||
|     // select current
 | ||||
|     if (is_curr_tray_selected) { | ||||
|         enable[ACTION_BTN_LOAD] = false; | ||||
|     } | ||||
| 
 | ||||
|     /*if (!obj->is_filament_at_extruder()) {
 | ||||
|     if (!obj->is_filament_at_extruder()) { | ||||
|         enable[ACTION_BTN_UNLOAD] = false; | ||||
|     } | ||||
| 
 | ||||
|     if (obj->m_tray_now == "255") { | ||||
|         enable[ACTION_BTN_UNLOAD] = false; | ||||
|     }*/ | ||||
| //    if (obj->m_tray_now == "255") {
 | ||||
| //        enable[ACTION_BTN_UNLOAD] = false;
 | ||||
| //    }
 | ||||
| 
 | ||||
|     m_ams_control->SetActionState(enable); | ||||
| } | ||||
|  | @ -2587,6 +2596,14 @@ void StatusPanel::on_ams_load_curr() | |||
|         std::string                            curr_ams_id = m_ams_control->GetCurentAms(); | ||||
|         std::string                            curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id); | ||||
| 
 | ||||
|         m_ams_control->UpdateStepCtrl(obj->is_filament_at_extruder()); | ||||
|         if(!obj->is_filament_at_extruder()){ | ||||
|             m_is_load_with_temp = true; | ||||
|         }else{ | ||||
|             m_is_load_with_temp = false; | ||||
|         } | ||||
|          | ||||
|          | ||||
|         //virtual tray
 | ||||
|         if (curr_ams_id.compare(std::to_string(VIRTUAL_TRAY_ID)) == 0) { | ||||
|             /*if (con_load_dlg == nullptr) {
 | ||||
|  |  | |||
|  | @ -290,6 +290,7 @@ protected: | |||
|     int          m_last_timelapse = -1; | ||||
|     int          m_last_extrusion = -1; | ||||
|     int          m_last_vcamera   = -1; | ||||
|     bool         m_is_load_with_temp = false; | ||||
| 
 | ||||
|     wxWebRequest web_request; | ||||
|     bool bed_temp_input    = false; | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| namespace Slic3r { namespace GUI { | ||||
| 
 | ||||
| static const int LOAD_STEP_COUNT    = 5; | ||||
| static const int LOAD_WITH_TEMP_STEP_COUNT    = 3; | ||||
| static const int UNLOAD_STEP_COUNT  = 3; | ||||
| static const int VT_LOAD_STEP_COUNT = 4; | ||||
| 
 | ||||
|  | @ -2197,7 +2198,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons | |||
|     AddPage(m_amswin, wxEmptyString, false); | ||||
|     AddPage(m_simplebook_calibration, wxEmptyString, false); | ||||
| 
 | ||||
|     UpdateStepCtrl(); | ||||
|     UpdateStepCtrl(false); | ||||
| 
 | ||||
|     m_button_extrusion_cali->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_extrusion_cali), NULL, this); | ||||
|     m_button_extruder_feed->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_filament_load), NULL, this); | ||||
|  | @ -2403,15 +2404,35 @@ void AMSControl::msw_rescale() | |||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
| void AMSControl::UpdateStepCtrl() | ||||
| void AMSControl::UpdateStepCtrl(bool is_extrusion) | ||||
| { | ||||
|     wxString FILAMENT_LOAD_STEP_STRING[LOAD_STEP_COUNT] = { | ||||
|         _L("Heat the nozzle"), | ||||
|         _L("Cut filament"), | ||||
|         _L("Pull back current filament"), | ||||
|         _L("Push new filament into extruder"), | ||||
|         _L("Purge old filament"), | ||||
|     }; | ||||
|     m_filament_load_step->DeleteAllItems(); | ||||
|     m_filament_unload_step->DeleteAllItems(); | ||||
|     m_filament_vt_load_step->DeleteAllItems(); | ||||
|      | ||||
|     if(is_extrusion){ | ||||
|         wxString FILAMENT_LOAD_STEP_STRING[LOAD_STEP_COUNT] = { | ||||
|             _L("Heat the nozzle"), | ||||
|             _L("Cut filament"), | ||||
|             _L("Pull back current filament"), | ||||
|             _L("Push new filament into extruder"), | ||||
|             _L("Purge old filament"), | ||||
|         }; | ||||
|          | ||||
|         for (int i = 0; i < LOAD_STEP_COUNT; i++) { | ||||
|             m_filament_load_step->AppendItem(FILAMENT_LOAD_STEP_STRING[i]); | ||||
|         } | ||||
|     }else{ | ||||
|         wxString FILAMENT_LOAD_STEP_STRING[LOAD_WITH_TEMP_STEP_COUNT] = { | ||||
|             _L("Heat the nozzle"), | ||||
|             _L("Push new filament into extruder"), | ||||
|             _L("Purge old filament"), | ||||
|         }; | ||||
|          | ||||
|         for (int i = 0; i < LOAD_WITH_TEMP_STEP_COUNT; i++) { | ||||
|             m_filament_load_step->AppendItem(FILAMENT_LOAD_STEP_STRING[i]); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     wxString VT_TRAY_LOAD_STEP_STRING[VT_LOAD_STEP_COUNT] = { | ||||
|         _L("Heat the nozzle"), | ||||
|  | @ -2426,9 +2447,9 @@ void AMSControl::UpdateStepCtrl() | |||
|         _L("Pull back current filament") | ||||
|     }; | ||||
| 
 | ||||
|     for (int i = 0; i < LOAD_STEP_COUNT; i++) { | ||||
|         m_filament_load_step->AppendItem(FILAMENT_LOAD_STEP_STRING[i]); | ||||
|     } | ||||
| //    for (int i = 0; i < LOAD_STEP_COUNT; i++) {
 | ||||
| //        m_filament_load_step->AppendItem(FILAMENT_LOAD_STEP_STRING[i]);
 | ||||
| //    }
 | ||||
|     for (int i = 0; i < UNLOAD_STEP_COUNT; i++) { | ||||
|         m_filament_unload_step->AppendItem(FILAMENT_UNLOAD_STEP_STRING[i]); | ||||
|     } | ||||
|  | @ -2687,7 +2708,7 @@ void AMSControl::SwitchAms(std::string ams_id) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void AMSControl::SetFilamentStep(int item_idx, FilamentStepType f_type) | ||||
| void AMSControl::SetFilamentStep(int item_idx, FilamentStepType f_type, bool is_extrusion_exist) | ||||
| { | ||||
|     if (item_idx == FilamentStep::STEP_IDLE) { | ||||
|         m_simplebook_right->SetSelection(0); | ||||
|  |  | |||
|  | @ -588,11 +588,11 @@ public: | |||
|     void PlayRridLoading(wxString amsid, wxString canid); | ||||
|     void StopRridLoading(wxString amsid, wxString canid); | ||||
| 
 | ||||
|     void SetFilamentStep(int item_idx, FilamentStepType f_type); | ||||
|     void SetFilamentStep(int item_idx, FilamentStepType f_type, bool is_extrusion_exist = false); | ||||
|     void ShowFilamentTip(bool hasams = true); | ||||
| 
 | ||||
|     void SetHumidity(std::string amsid, int humidity); | ||||
|     void UpdateStepCtrl(); | ||||
|     void UpdateStepCtrl(bool is_extrusion_exist); | ||||
|     void CreateAms(); | ||||
|     void UpdateAms(std::vector<AMSinfo> info, bool keep_selection = true, bool has_extrusion_cali = true, bool is_reset = false); | ||||
|     void AddAms(AMSinfo info, bool refresh = true); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang