ENH: support the react of actions for HMS actions

jira: [STUDIO-11664]
Change-Id: I5444748946e5baa219d6d413efd4e954dc578064
This commit is contained in:
xin.zhang 2025-04-18 11:05:17 +08:00 committed by lane.wei
parent 6e03f9e2df
commit 69f0bafd8a
4 changed files with 79 additions and 25 deletions

View File

@ -2090,6 +2090,17 @@ int MachineObject::command_hms_ignore(const std::string& error_str, const std::s
return this->publish_json(j.dump(), 1);
}
int MachineObject::command_hms_stop(const std::string &error_str, const std::string &job_id) {
json j;
j["print"]["command"] = "stop";
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;

View File

@ -1185,6 +1185,7 @@ public:
int command_hms_idle_ignore(const std::string &error_str, int type);
int command_hms_resume(const std::string& error_str, const std::string& job_id);
int command_hms_ignore(const std::string& error_str, const std::string& job_id);
int command_hms_stop(const std::string &error_str, const std::string &job_id);
/* buzzer*/
int command_stop_buzzer();

View File

@ -185,7 +185,7 @@ public:
NO_REMINDER_NEXT_TIME = 23,
IGNORE_NO_REMINDER_NEXT_TIME = 25,
//LOAD_FILAMENT = 26, /*TODO*/
//LOAD_FILAMENT = 26*/
IGNORE_RESUME = 27,
PROBLEM_SOLVED_RESUME = 28,
STOP_BUZZER = 29,

View File

@ -4664,30 +4664,72 @@ void StatusPanel::on_print_error_dlg_btn_clicked(wxCommandEvent& event)
{
if (obj)
{
int id = event.GetInt();
if (id == PrintErrorDialog::NO_REMINDER_NEXT_TIME)
{
obj->command_hms_idle_ignore(std::to_string(before_error_code), 0);/*the type is 0, supported by AP*/
}
else if (id == PrintErrorDialog::IGNORE_NO_REMINDER_NEXT_TIME)
{
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
}
else if (id == PrintErrorDialog::IGNORE_RESUME)
{
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
}
else if (id == PrintErrorDialog::PROBLEM_SOLVED_RESUME)
{
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
}
else if (id == PrintErrorDialog::STOP_BUZZER)
{
obj->command_stop_buzzer();
}
else if (id == PrintErrorDialog::CONTINUE || id == PrintErrorDialog::RETRY_PROBLEM_SOLVED)
{
obj->command_ams_control("resume");
PrintErrorDialog::PrintErrorButton btn_id = static_cast<PrintErrorDialog::PrintErrorButton>(event.GetInt());
switch (btn_id) {
case Slic3r::GUI::PrintErrorDialog::RESUME_PRINTING: {
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::RESUME_PRINTING_DEFECTS: {
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::RESUME_PRINTING_PROBELM_SOLVED: {
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::STOP_PRINTING: {
obj->command_hms_stop(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::CHECK_ASSISTANT: {
wxGetApp().mainframe->m_monitor->jump_to_HMS(event); // go to assistant page
break;
}
case Slic3r::GUI::PrintErrorDialog::FILAMENT_EXTRUDED: {
obj->command_ams_control("done");
break;
}
case Slic3r::GUI::PrintErrorDialog::RETRY_FILAMENT_EXTRUDED: {
obj->command_ams_control("resume");
break;
}
case Slic3r::GUI::PrintErrorDialog::CONTINUE: {
obj->command_ams_control("resume");
break;
}
case Slic3r::GUI::PrintErrorDialog::LOAD_VIRTUAL_TRAY: break;/*Unknown what it is*/
case Slic3r::GUI::PrintErrorDialog::OK_BUTTON: break;/*do nothing*/
case Slic3r::GUI::PrintErrorDialog::FILAMENT_LOAD_RESUME: {
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::NO_REMINDER_NEXT_TIME: {
obj->command_hms_idle_ignore(std::to_string(before_error_code), 0); /*the type is 0, supported by AP*/
break;
}
case Slic3r::GUI::PrintErrorDialog::IGNORE_NO_REMINDER_NEXT_TIME: {
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::IGNORE_RESUME: {
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::PROBLEM_SOLVED_RESUME: {
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
break;
}
case Slic3r::GUI::PrintErrorDialog::STOP_BUZZER: {
obj->command_stop_buzzer();
break;
}
case Slic3r::GUI::PrintErrorDialog::RETRY_PROBLEM_SOLVED: {
obj->command_ams_control("resume");
break;
}
case Slic3r::GUI::PrintErrorDialog::ERROR_BUTTON_COUNT: break;
default: break;
}
if (m_print_error_dlg) { m_print_error_dlg->on_hide(); }