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); 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() int MachineObject::command_stop_buzzer()
{ {
json j; json j;

View File

@ -1185,6 +1185,7 @@ public:
int command_hms_idle_ignore(const std::string &error_str, int type); 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_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_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*/ /* buzzer*/
int command_stop_buzzer(); int command_stop_buzzer();

View File

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

View File

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