mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
ENH: support proceed action
Jira: [STUDIO-13620] Change-Id: I4ec96fc3adab517196b9725a54241575288c3bbf (cherry picked from commit 240e26147917c32749427f31ebe7623500334ed6)
This commit is contained in:
@@ -172,7 +172,9 @@ void DeviceErrorDialog::init_button_list()
|
|||||||
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
|
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
|
||||||
init_button(TURN_OFF_FIRE_ALARM, _L("Got it, Turn off the Fire Alarm."));
|
init_button(TURN_OFF_FIRE_ALARM, _L("Got it, Turn off the Fire Alarm."));
|
||||||
init_button(RETRY_PROBLEM_SOLVED, _L("Retry (problem solved)"));
|
init_button(RETRY_PROBLEM_SOLVED, _L("Retry (problem solved)"));
|
||||||
|
init_button(CANCLE, _L("Cancle"));
|
||||||
init_button(STOP_DRYING, _L("Stop Drying"));
|
init_button(STOP_DRYING, _L("Stop Drying"));
|
||||||
|
init_button(PROCEED, _L("Proceed"));
|
||||||
init_button(DBL_CHECK_CANCEL, _L("Cancle"));
|
init_button(DBL_CHECK_CANCEL, _L("Cancle"));
|
||||||
init_button(DBL_CHECK_DONE, _L("Done"));
|
init_button(DBL_CHECK_DONE, _L("Done"));
|
||||||
init_button(DBL_CHECK_RETRY, _L("Retry"));
|
init_button(DBL_CHECK_RETRY, _L("Retry"));
|
||||||
@@ -433,10 +435,24 @@ void DeviceErrorDialog::on_button_click(ActionButton btn_id)
|
|||||||
m_obj->command_ams_control("resume");
|
m_obj->command_ams_control("resume");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DeviceErrorDialog::CANCLE: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
case DeviceErrorDialog::STOP_DRYING: {
|
case DeviceErrorDialog::STOP_DRYING: {
|
||||||
m_obj->command_ams_drying_stop();
|
m_obj->command_ams_drying_stop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DeviceErrorDialog::PROCEED: {
|
||||||
|
if(!m_action_json.is_null()){
|
||||||
|
try{
|
||||||
|
ActionProceed proceed = m_action_json.get<ActionProceed>();
|
||||||
|
m_obj->command_ack_proceed(proceed);
|
||||||
|
} catch(...){
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "DeviceErrorDialog: Action Proceed missing params.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case DeviceErrorDialog::ERROR_BUTTON_COUNT: break;
|
case DeviceErrorDialog::ERROR_BUTTON_COUNT: break;
|
||||||
|
|
||||||
case DeviceErrorDialog::DBL_CHECK_CANCEL: {
|
case DeviceErrorDialog::DBL_CHECK_CANCEL: {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "Widgets/StateColor.hpp"
|
#include "Widgets/StateColor.hpp"
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
class Label;
|
class Label;
|
||||||
class Button;
|
class Button;
|
||||||
@@ -16,6 +17,15 @@ class MachineObject;//Previous definitions
|
|||||||
|
|
||||||
namespace GUI {
|
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
|
class DeviceErrorDialog : public DPIDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -42,7 +52,9 @@ public:
|
|||||||
|
|
||||||
RETRY_PROBLEM_SOLVED = 34,
|
RETRY_PROBLEM_SOLVED = 34,
|
||||||
STOP_DRYING = 35,
|
STOP_DRYING = 35,
|
||||||
|
CANCLE = 37,
|
||||||
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
|
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
|
||||||
|
PROCEED = 41,
|
||||||
|
|
||||||
ERROR_BUTTON_COUNT,
|
ERROR_BUTTON_COUNT,
|
||||||
|
|
||||||
@@ -53,6 +65,8 @@ public:
|
|||||||
DBL_CHECK_RESUME = 10003,
|
DBL_CHECK_RESUME = 10003,
|
||||||
DBL_CHECK_OK = 10004,
|
DBL_CHECK_OK = 10004,
|
||||||
};
|
};
|
||||||
|
/* action params json */
|
||||||
|
nlohmann::json m_action_json;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeviceErrorDialog(MachineObject* obj,
|
DeviceErrorDialog(MachineObject* obj,
|
||||||
@@ -66,6 +80,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
wxString show_error_code(int error_code);
|
wxString show_error_code(int error_code);
|
||||||
|
void set_action_json(const nlohmann::json &action_json) { m_action_json = action_json; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init_button_list();
|
void init_button_list();
|
||||||
|
|||||||
@@ -2111,6 +2111,20 @@ int MachineObject::command_xcam_control(std::string module_name, bool on_off, st
|
|||||||
return this->publish_json(j);
|
return this->publish_json(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_ack_proceed(GUI::ActionProceed& proceed) {
|
||||||
|
if(proceed.command.empty()) return -1;
|
||||||
|
|
||||||
|
proceed.err_ignored.push_back(proceed.err_index);
|
||||||
|
|
||||||
|
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;
|
||||||
|
return this->publish_json(j);
|
||||||
|
}
|
||||||
|
|
||||||
int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl)
|
int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl)
|
||||||
{
|
{
|
||||||
bool print_halt = (lvl == "never_halt") ? false:true;
|
bool print_halt = (lvl == "never_halt") ? false:true;
|
||||||
@@ -2984,6 +2998,16 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
|||||||
{
|
{
|
||||||
if (jj["err_code"].is_number()) { add_command_error_code_dlg(jj["err_code"].get<int>());}
|
if (jj["err_code"].is_number()) { add_command_error_code_dlg(jj["err_code"].get<int>());}
|
||||||
}
|
}
|
||||||
|
/* proceed action*/
|
||||||
|
else if (is_studio_cmd(sequence_id) && jj.contains("command") && jj.contains("err_code") && jj.contains("err_index")) {
|
||||||
|
json action_json;
|
||||||
|
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();
|
||||||
|
|
||||||
|
add_command_error_code_dlg(jj["err_code"].get<int>(), action_json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jj["command"].get<std::string>() == "push_status") {
|
if (jj["command"].get<std::string>() == "push_status") {
|
||||||
@@ -5326,11 +5350,11 @@ std::string MachineObject::get_error_code_str(int error_code)
|
|||||||
return print_error_str;
|
return print_error_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineObject::add_command_error_code_dlg(int command_err)
|
void MachineObject::add_command_error_code_dlg(int command_err, json action_json)
|
||||||
{
|
{
|
||||||
if (command_err > 0 && !Slic3r::GUI::wxGetApp().get_hms_query()->is_internal_error(this, command_err))
|
if (command_err > 0 && !Slic3r::GUI::wxGetApp().get_hms_query()->is_internal_error(this, command_err))
|
||||||
{
|
{
|
||||||
GUI::wxGetApp().CallAfter([this, command_err, token = std::weak_ptr<int>(m_token)]
|
GUI::wxGetApp().CallAfter([this, command_err, action_json, token = std::weak_ptr<int>(m_token)]
|
||||||
{
|
{
|
||||||
if (token.expired()) { return;}
|
if (token.expired()) { return;}
|
||||||
GUI::DeviceErrorDialog* device_error_dialog = new GUI::DeviceErrorDialog(this, (wxWindow*)GUI::wxGetApp().mainframe);
|
GUI::DeviceErrorDialog* device_error_dialog = new GUI::DeviceErrorDialog(this, (wxWindow*)GUI::wxGetApp().mainframe);
|
||||||
@@ -5340,6 +5364,7 @@ void MachineObject::add_command_error_code_dlg(int command_err)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!action_json.is_null()) device_error_dialog->set_action_json(action_json);
|
||||||
device_error_dialog->show_error_code(command_err);
|
device_error_dialog->show_error_code(command_err);
|
||||||
m_command_error_code_dlgs.insert(device_error_dialog);
|
m_command_error_code_dlgs.insert(device_error_dialog);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "DeviceCore/DevDefs.h"
|
#include "DeviceCore/DevDefs.h"
|
||||||
#include "DeviceCore/DevConfigUtil.h"
|
#include "DeviceCore/DevConfigUtil.h"
|
||||||
#include "DeviceCore/DevFirmware.h"
|
#include "DeviceCore/DevFirmware.h"
|
||||||
|
#include "DeviceErrorDialog.hpp"
|
||||||
|
|
||||||
#include <wx/object.h>
|
#include <wx/object.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
@@ -401,7 +401,7 @@ public:
|
|||||||
std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); }
|
std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); }
|
||||||
|
|
||||||
std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs;
|
std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs;
|
||||||
void add_command_error_code_dlg(int command_err);
|
void add_command_error_code_dlg(int command_err, json action_json=json{});
|
||||||
|
|
||||||
int curr_layer = 0;
|
int curr_layer = 0;
|
||||||
int total_layers = 0;
|
int total_layers = 0;
|
||||||
@@ -685,6 +685,7 @@ public:
|
|||||||
int command_set_printer_nozzle(std::string nozzle_type, float diameter);
|
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_set_printer_nozzle2(int id, std::string nozzle_type, float diameter);
|
||||||
int command_get_access_code();
|
int command_get_access_code();
|
||||||
|
int command_ack_proceed(GUI::ActionProceed& proceed);
|
||||||
|
|
||||||
/* command upgrade */
|
/* command upgrade */
|
||||||
int command_upgrade_confirm();
|
int command_upgrade_confirm();
|
||||||
|
|||||||
Reference in New Issue
Block a user