NEW:Use new command for chamber temperature settings

jira:[STUDIO-4296]

Change-Id: Ic70a6f6dc412cde7f6d9d6361f8646df59df56b9
(cherry picked from commit c504fefc684bdd29f3ef28d75393a73a0170b075)
This commit is contained in:
tao wang 2023-08-31 12:25:45 +08:00 committed by Lane.Wei
parent 3e6234284c
commit 5ec0a28d05

View file

@ -1791,8 +1791,12 @@ int MachineObject::command_set_nozzle(int temp)
int MachineObject::command_set_chamber(int temp)
{
std::string gcode_str = (boost::format("M141 S%1%\n") % temp).str();
return this->publish_gcode(gcode_str);
json j;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["command"] = "set_ctt";
j["print"]["ctt_val"] = temp;
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_ams_switch(int tray_index, int old_temp, int new_temp)
@ -2887,6 +2891,30 @@ int MachineObject::parse_json(std::string payload)
}
}
if (jj.contains("command")) {
if (jj["command"].get<std::string>() == "ams_change_filament") {
if (jj.contains("errno")) {
if (jj["errno"].is_number()) {
if (jj["errno"].get<int>() == -2) {
wxString text = _L("The current chamber temperature or the target chamber temperature exceeds 45\u2103.In order to avoid extruder clogging,low temperature filament(PLA/PETG/TPU) is not allowed to be loaded.");
GUI::wxGetApp().show_dialog(text);
}
}
}
}
if (jj["command"].get<std::string>() == "set_ctt") {
if (m_agent && is_studio_cmd(sequence_id)) {
if (jj["errno"].is_number()) {
if (jj["errno"].get<int>() == -2) {
wxString text = _L("Low temperature filament(PLA/PETG/TPU) is loaded in the extruder.In order to avoid extruder clogging,it is not allowed to set the chamber temperature above 45\u2103.");
GUI::wxGetApp().show_dialog(text);
}
}
}
}
if (jj["command"].get<std::string>() == "push_status") {
m_push_count++;
last_push_time = std::chrono::system_clock::now();