mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	NEW: add limitation of bed temperature
Change-Id: Ib25f28d8803a022678d67ee05cf1d0c48e8727c4 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
		
							parent
							
								
									1d827bd968
								
							
						
					
					
						commit
						3034ec7425
					
				
					 4 changed files with 49 additions and 0 deletions
				
			
		|  | @ -21,6 +21,7 @@ | |||
|                 "FUNC_ALTER_RESOLUTION": false | ||||
|             }, | ||||
|             "camera_resolution":["720p"], | ||||
|             "bed_temperature_limit": 100, | ||||
|             "model_id": "C11", | ||||
|             "printer_type": "C11" | ||||
|         }, | ||||
|  |  | |||
|  | @ -1138,6 +1138,7 @@ void MachineObject::parse_state_changed_event() | |||
| 
 | ||||
| void MachineObject::parse_status(int flag) | ||||
| { | ||||
|     is_220V_voltage             = ((flag >> 3) & 0x1) != 0; | ||||
|     if (xcam_auto_recovery_hold_count > 0) | ||||
|         xcam_auto_recovery_hold_count--; | ||||
|     else { | ||||
|  | @ -1164,6 +1165,22 @@ PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl) | |||
|     return PrintingSpeedLevel::SPEED_LEVEL_INVALID; | ||||
| } | ||||
| 
 | ||||
| int MachineObject::get_bed_temperature_limit() | ||||
| { | ||||
|     if (printer_type == "BL-P001" || printer_type == "BL-P002") { | ||||
|         if (is_220V_voltage) | ||||
|             return 110; | ||||
|         else { | ||||
|             return 120; | ||||
|         } | ||||
|     } else { | ||||
|         int limit = BED_TEMP_LIMIT; | ||||
|         DeviceManager::get_bed_temperature_limit(printer_type, limit); | ||||
|         return limit; | ||||
|     } | ||||
|     return BED_TEMP_LIMIT; | ||||
| } | ||||
| 
 | ||||
| bool MachineObject::is_sdcard_printing() | ||||
| { | ||||
|     if (can_abort() | ||||
|  | @ -1772,6 +1789,7 @@ void MachineObject::reset() | |||
|     BOOST_LOG_TRIVIAL(trace) << "reset dev_id=" << dev_id; | ||||
|     last_update_time = std::chrono::system_clock::now(); | ||||
|     m_push_count = 0; | ||||
|     is_220V_voltage = false; | ||||
|     camera_recording = false; | ||||
|     camera_recording_when_printing = false; | ||||
|     camera_timelapse = false; | ||||
|  | @ -3595,6 +3613,22 @@ std::vector<std::string> DeviceManager::get_resolution_supported(std::string typ | |||
|     return resolution_supported; | ||||
| } | ||||
| 
 | ||||
| bool DeviceManager::get_bed_temperature_limit(std::string type_str, int &limit) | ||||
| { | ||||
|     bool result = false; | ||||
|     if (DeviceManager::function_table.contains("printers")) { | ||||
|         for (auto printer : DeviceManager::function_table["printers"]) { | ||||
|             if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) { | ||||
|                 if (printer.contains("bed_temperature_limit")) { | ||||
|                     limit = printer["bed_temperature_limit"].get<int>(); | ||||
|                     return true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
| 
 | ||||
| bool DeviceManager::load_functional_config(std::string config_file) | ||||
| { | ||||
|     std::ifstream json_file(config_file.c_str()); | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ | |||
| #define FILAMENT_MAX_TEMP       300 | ||||
| #define FILAMENT_DEF_TEMP       220 | ||||
| #define FILAMENT_MIN_TEMP       120 | ||||
| #define BED_TEMP_LIMIT          120 | ||||
| 
 | ||||
| #define HOLD_COUNT_MAX          3 | ||||
| 
 | ||||
|  | @ -499,6 +500,10 @@ public: | |||
| 
 | ||||
|     /* printing */ | ||||
|     std::string print_type; | ||||
|     float   nozzle { 0.0f }; | ||||
|     bool    is_220V_voltage { false }; | ||||
| 
 | ||||
| 
 | ||||
|     int     mc_print_stage; | ||||
|     int     mc_print_sub_stage; | ||||
|     int     mc_print_error_code; | ||||
|  | @ -536,6 +541,7 @@ public: | |||
|     PrintingSpeedLevel printing_speed_lvl; | ||||
|     int                printing_speed_mag = 100; | ||||
|     PrintingSpeedLevel _parse_printing_speed_lvl(int lvl); | ||||
|     int get_bed_temperature_limit(); | ||||
| 
 | ||||
|     /* camera */ | ||||
|     bool has_ipcam { false }; | ||||
|  | @ -747,6 +753,7 @@ public: | |||
|     static bool is_function_supported(std::string type_str, std::string function_name); | ||||
|     static std::vector<std::string> get_resolution_supported(std::string type_str); | ||||
| 
 | ||||
|     static bool get_bed_temperature_limit(std::string type_str, int& limit); | ||||
|     static bool load_functional_config(std::string config_file); | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1590,6 +1590,7 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj) | |||
|     if (!obj) return; | ||||
| 
 | ||||
|     m_tempCtrl_bed->SetCurrTemp((int) obj->bed_temp); | ||||
|     m_tempCtrl_bed->SetMaxTemp(obj->get_bed_temperature_limit()); | ||||
| 
 | ||||
|     // update temprature if not input temp target
 | ||||
|     if (m_temp_bed_timeout > 0) { | ||||
|  | @ -2243,6 +2244,12 @@ void StatusPanel::on_set_bed_temp() | |||
|         long bed_temp; | ||||
|         if (str.ToLong(&bed_temp) && obj) { | ||||
|             set_hold_count(m_temp_bed_timeout); | ||||
|             int limit = obj->get_bed_temperature_limit(); | ||||
|             if (bed_temp >= limit) { | ||||
|                 BOOST_LOG_TRIVIAL(info) << "can not set over limit = " << limit << ", set temp = " << bed_temp; | ||||
|                 bed_temp = limit; | ||||
|                 m_tempCtrl_bed->SetTagTemp(wxString::Format("%d", bed_temp)); | ||||
|             } | ||||
|             obj->command_set_bed(bed_temp); | ||||
|         } | ||||
|     } catch (...) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Stone Li
						Stone Li