FIX: update proceed action ack param

Jira: [STUDIO-14689]
Change-Id: If424997b9ed05ab95f048424b8950f927ea9b608
(cherry picked from commit 8c712f49caf7a7f0d0fcef7a7c392170ae699ba4)
This commit is contained in:
hemai 2025-09-24 15:29:21 +08:00 committed by Noisyfox
parent 1ea5aa9017
commit 4a51ef7f91
4 changed files with 15 additions and 28 deletions

View file

@ -449,8 +449,7 @@ void DeviceErrorDialog::on_button_click(ActionButton btn_id)
case DeviceErrorDialog::PROCEED: {
if(!m_action_json.is_null()){
try{
ActionProceed proceed = m_action_json.get<ActionProceed>();
m_obj->command_ack_proceed(proceed);
m_obj->command_ack_proceed(m_action_json);
} catch(...){
BOOST_LOG_TRIVIAL(error) << "DeviceErrorDialog: Action Proceed missing params.";
}

View file

@ -17,15 +17,6 @@ class MachineObject;//Previous definitions
namespace GUI {
struct ActionProceed{
std::string command;
uint16_t err_index;
uint32_t err_code;
std::vector<uint16_t> err_ignored;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Slic3r::GUI::ActionProceed, command, err_index, err_code, err_ignored);
class DeviceErrorDialog : public DPIDialog
{
public:

View file

@ -2115,17 +2115,19 @@ int MachineObject::command_xcam_control(std::string module_name, bool on_off, st
return this->publish_json(j);
}
int MachineObject::command_ack_proceed(GUI::ActionProceed& proceed) {
if(proceed.command.empty()) return -1;
int MachineObject::command_ack_proceed(json& proceed) {
if (proceed["command"].empty()) return -1;
proceed.err_ignored.push_back(proceed.err_index);
proceed["err_code"] = 0;
if (proceed.contains("err_ignored")) {
proceed["err_ignored"].push_back(proceed["err_index"]);
} else {
proceed["err_ignored"] = std::vector<int>{proceed["err_index"]};
}
proceed["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
json j;
j["print"]["command"] = proceed.command;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["err_code"] = 0;
j["print"]["err_index"] = proceed.err_index;
j["print"]["err_ignored"] = proceed.err_ignored;
j["print"] = proceed;
return this->publish_json(j);
}
@ -3013,14 +3015,9 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
{
if (jj["err_code"].is_number())
{
json action_json;
if (jj.contains("err_index")) {
/* proceed action*/
action_json["command"] = jj["command"];
action_json["err_code"] = jj["err_code"];
action_json["err_index"] = jj["err_index"];
action_json["err_ignored"] = jj.contains("err_ignored") ? jj["err_ignored"] : json::array();
}
/* proceed action*/
json action_json = jj.contains("err_index") ? jj : json();
add_command_error_code_dlg(jj["err_code"].get<int>(), action_json);
}
}

View file

@ -683,7 +683,7 @@ public:
int command_set_printer_nozzle(std::string nozzle_type, float diameter);
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter);
int command_get_access_code();
int command_ack_proceed(GUI::ActionProceed& proceed);
int command_ack_proceed(json& proceed);
/* command upgrade */
int command_upgrade_confirm();