mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 03:43:52 +00:00
ENH:command ams filament settings is compatible with all AMS
jira:[none] Change-Id: I622300794d1fa14826847229737b1f6f2ae490db (cherry picked from commit c2adbe140b134b958f589ba178286e245a09adbf)
This commit is contained in:
@@ -499,25 +499,9 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
// set filament
|
if(m_is_third){
|
||||||
if (is_virtual_tray()) {
|
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int,
|
||||||
auto tar_tray = VIRTUAL_TRAY_ID;
|
nozzle_temp_max_int);
|
||||||
|
|
||||||
if (!obj->is_enable_np) {
|
|
||||||
tar_tray = VIRTUAL_TRAY_ID;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tar_tray = 0;
|
|
||||||
}
|
|
||||||
obj->command_ams_filament_settings(ams_id, tar_tray, ams_filament_id, ams_setting_id, color_str, m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
}
|
|
||||||
else if(m_is_third){
|
|
||||||
if (obj->is_enable_np) {
|
|
||||||
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, color_str, m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, color_str, m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set k / n value
|
// set k / n value
|
||||||
@@ -629,16 +613,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||||||
|
|
||||||
// set filament
|
// set filament
|
||||||
if (m_is_third) {
|
if (m_is_third) {
|
||||||
if (is_virtual_tray()) {
|
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
||||||
obj->command_ams_filament_settings(ams_id, VIRTUAL_TRAY_ID, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (obj->is_enable_np) {
|
|
||||||
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
} else {
|
|
||||||
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset param
|
//reset param
|
||||||
|
|||||||
@@ -1900,16 +1900,28 @@ int MachineObject::command_ams_calibrate(int ams_id)
|
|||||||
return this->publish_gcode(gcode_cmd);
|
return this->publish_gcode(gcode_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MachineObject::command_ams_filament_settings(int ams_id, int tray_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
|
int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(info) << "command_ams_filament_settings, ams_id = " << ams_id << ", tray_id = " << tray_id << ", tray_color = " << tray_color
|
int tag_tray_id = 0;
|
||||||
|
int tag_ams_id = ams_id;
|
||||||
|
int tag_slot_id = slot_id;
|
||||||
|
|
||||||
|
if (tag_ams_id == VIRTUAL_TRAY_ID) {
|
||||||
|
tag_tray_id = VIRTUAL_TRAY_ID;
|
||||||
|
} else {
|
||||||
|
tag_tray_id = tag_slot_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "command_ams_filament_settings, ams_id = " << tag_ams_id << ", slot_id = " << tag_slot_id << ", tray_id = " << tag_tray_id << ", tray_color = " << tray_color
|
||||||
<< ", tray_type = " << tray_type << ", filament_id = " << filament_id
|
<< ", tray_type = " << tray_type << ", filament_id = " << filament_id
|
||||||
<< ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max;
|
<< ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max;
|
||||||
json j;
|
json j;
|
||||||
j["print"]["command"] = "ams_filament_setting";
|
j["print"]["command"] = "ams_filament_setting";
|
||||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
j["print"]["ams_id"] = ams_id;
|
j["print"]["ams_id"] = tag_ams_id;
|
||||||
j["print"]["tray_id"] = tray_id;
|
j["print"]["slot_id"] = tag_slot_id;
|
||||||
|
j["print"]["tray_id"] = tag_tray_id;
|
||||||
j["print"]["tray_info_idx"] = filament_id;
|
j["print"]["tray_info_idx"] = filament_id;
|
||||||
j["print"]["setting_id"] = setting_id;
|
j["print"]["setting_id"] = setting_id;
|
||||||
// format "FFFFFFFF" RGBA
|
// format "FFFFFFFF" RGBA
|
||||||
@@ -4098,7 +4110,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
|
||||||
<< " ams settings_id is not exist in filament_list and reset, ams_id: " << ams_id
|
<< " ams settings_id is not exist in filament_list and reset, ams_id: " << ams_id
|
||||||
<< " tray_id" << tray_id << "filament_id: " << curr_tray->setting_id;
|
<< " tray_id" << tray_id << "filament_id: " << curr_tray->setting_id;
|
||||||
this->command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), "", "", std::string(col_buf), "", 0, 0);
|
command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), "", "", std::string(col_buf), "", 0, 0);
|
||||||
continue;
|
continue;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
BOOST_LOG_TRIVIAL(info)
|
BOOST_LOG_TRIVIAL(info)
|
||||||
@@ -4306,7 +4318,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
||||||
try {
|
try {
|
||||||
BOOST_LOG_TRIVIAL(info) << "vt_tray.setting_id is not exist in filament_list and reset vt_tray and the filament_id is: " << vt_tray.setting_id;
|
BOOST_LOG_TRIVIAL(info) << "vt_tray.setting_id is not exist in filament_list and reset vt_tray and the filament_id is: " << vt_tray.setting_id;
|
||||||
this->command_ams_filament_settings(255, std::stoi(vt_tray.id), "", "", std::string(col_buf), "", 0, 0);
|
this->command_ams_filament_settings(VIRTUAL_TRAY_ID, std::stoi(vt_tray.id), "", "", std::string(col_buf), "", 0, 0);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -913,7 +913,7 @@ public:
|
|||||||
int command_ams_switch_filament(bool switch_filament);
|
int command_ams_switch_filament(bool switch_filament);
|
||||||
int command_ams_air_print_detect(bool air_print_detect);
|
int command_ams_air_print_detect(bool air_print_detect);
|
||||||
int command_ams_calibrate(int ams_id);
|
int command_ams_calibrate(int ams_id);
|
||||||
int command_ams_filament_settings(int ams_id, int tray_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max);
|
int command_ams_filament_settings(int ams_id, int slot_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max);
|
||||||
int command_ams_select_tray(std::string tray_id);
|
int command_ams_select_tray(std::string tray_id);
|
||||||
int command_ams_refresh_rfid(std::string tray_id);
|
int command_ams_refresh_rfid(std::string tray_id);
|
||||||
int command_ams_control(std::string action);
|
int command_ams_control(std::string action);
|
||||||
|
|||||||
Reference in New Issue
Block a user