mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-24 03:12:07 +00:00
Add purification and don't-remind actions to the device error dialog
This commit is contained in:
@@ -312,6 +312,8 @@ void DeviceErrorDialog::init_button_list()
|
|||||||
init_button(CANCEL, _L("Cancel"));
|
init_button(CANCEL, _L("Cancel"));
|
||||||
init_button(STOP_DRYING, _L("Stop Drying"));
|
init_button(STOP_DRYING, _L("Stop Drying"));
|
||||||
init_button(PROCEED, _L("Proceed"));
|
init_button(PROCEED, _L("Proceed"));
|
||||||
|
init_button(DISABLE_PURIFICATION, _L("Disable Purification for This Print"));
|
||||||
|
init_button(DONT_REMIND_NEXT_TIME, _L("Don't Remind Me"));
|
||||||
init_button(DBL_CHECK_CANCEL, _L("Cancel"));
|
init_button(DBL_CHECK_CANCEL, _L("Cancel"));
|
||||||
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"));
|
||||||
@@ -598,6 +600,16 @@ void DeviceErrorDialog::on_button_click(ActionButton btn_id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DeviceErrorDialog::DISABLE_PURIFICATION: {
|
||||||
|
m_obj->command_purification_disable();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DeviceErrorDialog::DONT_REMIND_NEXT_TIME: {
|
||||||
|
if (!m_action_json.is_null()) {
|
||||||
|
m_obj->command_dont_remind_next_time(m_action_json);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case DeviceErrorDialog::ERROR_BUTTON_COUNT: break;
|
case DeviceErrorDialog::ERROR_BUTTON_COUNT: break;
|
||||||
|
|
||||||
case DeviceErrorDialog::DBL_CHECK_CANCEL: {
|
case DeviceErrorDialog::DBL_CHECK_CANCEL: {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
CANCEL = 37,
|
CANCEL = 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,
|
PROCEED = 41,
|
||||||
|
DISABLE_PURIFICATION = 54,
|
||||||
|
DONT_REMIND_NEXT_TIME = 57,
|
||||||
|
|
||||||
ERROR_BUTTON_COUNT,
|
ERROR_BUTTON_COUNT,
|
||||||
|
|
||||||
|
|||||||
@@ -2207,6 +2207,14 @@ int MachineObject::command_ack_proceed(json& proceed) {
|
|||||||
} else {
|
} else {
|
||||||
proceed["err_ignored"] = std::vector<int>{proceed["err_index"]};
|
proceed["err_ignored"] = std::vector<int>{proceed["err_index"]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& item : proceed["err_ignored"]) {
|
||||||
|
json error_item;
|
||||||
|
error_item["idx"] = item.get<int>();
|
||||||
|
error_item["mode"] = 0;
|
||||||
|
proceed["rm_idx"].push_back(error_item);
|
||||||
|
}
|
||||||
|
|
||||||
proceed["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
proceed["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
json j;
|
json j;
|
||||||
@@ -2214,6 +2222,52 @@ int MachineObject::command_ack_proceed(json& proceed) {
|
|||||||
return this->publish_json(j);
|
return this->publish_json(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_purification_disable()
|
||||||
|
{
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "close_air_filt";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
return this->publish_json(j, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_dont_remind_next_time(json& mqtt_guard_json)
|
||||||
|
{
|
||||||
|
if (!mqtt_guard_json.contains("command") ||
|
||||||
|
!mqtt_guard_json.contains("err_index") ||
|
||||||
|
mqtt_guard_json["err_index"].empty()) return -1;
|
||||||
|
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = mqtt_guard_json["command"].get<std::string>();
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
try {
|
||||||
|
int err_index = mqtt_guard_json["err_index"].get<int>();
|
||||||
|
|
||||||
|
if (mqtt_guard_json.contains("err_ignored") &&
|
||||||
|
mqtt_guard_json["err_ignored"].is_array()) {
|
||||||
|
j["print"]["err_ignored"] = mqtt_guard_json["err_ignored"];
|
||||||
|
j["print"]["err_ignored"].push_back(err_index);
|
||||||
|
} else {
|
||||||
|
j["print"]["err_ignored"] = std::vector<int>{err_index};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& item : j["print"]["err_ignored"]) {
|
||||||
|
if (!item.is_number_integer()) continue;
|
||||||
|
|
||||||
|
json item_json;
|
||||||
|
item_json["idx"] = item.get<int>();
|
||||||
|
item_json["mode"] = 1; // 1-next time ignore, 2-always ignore
|
||||||
|
j["print"]["rm_idx"].push_back(item_json);
|
||||||
|
}
|
||||||
|
} catch (const json::exception& e) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "JSON parsing error in command_dont_remind_next_time: " << e.what();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->publish_json(j, 1);
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -716,6 +716,8 @@ public:
|
|||||||
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(json& proceed);
|
int command_ack_proceed(json& proceed);
|
||||||
|
int command_purification_disable();
|
||||||
|
int command_dont_remind_next_time(json& mqtt_guard_json);
|
||||||
|
|
||||||
/* command upgrade */
|
/* command upgrade */
|
||||||
int command_upgrade_confirm();
|
int command_upgrade_confirm();
|
||||||
|
|||||||
Reference in New Issue
Block a user