FIX: add hms action buttons

jira: [STUDIO-10823]
Change-Id: I751f0951df439a5265cc53f5679fa69b8d1c728a
(cherry picked from commit 0ed457207e2ec31cca276667af9c4ffa392f9843)
This commit is contained in:
xin.zhang
2025-03-12 18:11:50 +08:00
committed by Noisyfox
parent ac4a4ca8ba
commit 9db67520c0
6 changed files with 151 additions and 4 deletions

View File

@@ -2018,6 +2018,50 @@ int MachineObject::command_task_resume()
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type)
{
json j;
j["print"]["command"] = "idle_ignore";
j["print"]["err"] = error_str;
j["print"]["type"] = type;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id)
{
json j;
j["print"]["command"] = "resume";
j["print"]["err"] = error_str;
j["print"]["param"] = "reserve";
j["print"]["job_id"] = job_id;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id)
{
json j;
j["print"]["command"] = "ignore";
j["print"]["err"] = error_str;
j["print"]["param"] = "reserve";
j["print"]["job_id"] = job_id;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_stop_buzzer()
{
json j;
j["print"]["command"] = "buzzer_ctrl";
j["print"]["mode"] = 0;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_set_bed(int temp)
{
std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str();