mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +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:
@@ -1900,16 +1900,28 @@ int MachineObject::command_ams_calibrate(int ams_id)
|
||||
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
|
||||
<< ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max;
|
||||
json j;
|
||||
j["print"]["command"] = "ams_filament_setting";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["ams_id"] = ams_id;
|
||||
j["print"]["tray_id"] = tray_id;
|
||||
j["print"]["ams_id"] = tag_ams_id;
|
||||
j["print"]["slot_id"] = tag_slot_id;
|
||||
j["print"]["tray_id"] = tag_tray_id;
|
||||
j["print"]["tray_info_idx"] = filament_id;
|
||||
j["print"]["setting_id"] = setting_id;
|
||||
// format "FFFFFFFF" RGBA
|
||||
@@ -4098,7 +4110,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
|
||||
<< " 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;
|
||||
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;
|
||||
} catch (...) {
|
||||
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());
|
||||
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;
|
||||
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 (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user