diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index b97d6210e1..3703b776e8 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -12,7 +12,6 @@ #include "MsgDialog.hpp" #include "slic3r/Utils/Http.hpp" -#include "slic3r/Utils/MoonrakerPrinterAgent.hpp" #include "libslic3r/Thread.hpp" #include "DeviceErrorDialog.hpp" @@ -23,6 +22,7 @@ #include #include #include +#include #include "DeviceCore/DevBed.h" #include "DeviceCore/DevCtrl.h" @@ -2709,8 +2709,7 @@ void StatusPanel::on_subtask_partskip(wxCommandEvent &event) void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event) { if (obj) { - const bool was_resume = obj->can_resume(); - if (was_resume) { + if (obj->can_resume()) { BOOST_LOG_TRIVIAL(info) << "monitor: resume current print task dev_id =" << obj->get_dev_id(); obj->command_task_resume(); } @@ -2718,13 +2717,6 @@ void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event) BOOST_LOG_TRIVIAL(info) << "monitor: pause current print task dev_id =" << obj->get_dev_id(); obj->command_task_pause(); } - if (is_moonraker_agent()) { - m_pause_resume_pending = true; - m_pause_resume_was_resume = was_resume; - m_pause_resume_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(6); - m_pause_resume_machine_id = obj->get_dev_id(); - m_project_task_panel->enable_pause_resume_button(false, was_resume ? "resume_disable" : "pause_disable"); - } } } @@ -2736,12 +2728,6 @@ void StatusPanel::on_subtask_abort(wxCommandEvent &event) if (obj) { BOOST_LOG_TRIVIAL(info) << "monitor: stop current print task dev_id =" << obj->get_dev_id(); obj->command_task_abort(); - if (is_moonraker_agent()) { - m_abort_pending = true; - m_abort_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(6); - m_abort_machine_id = obj->get_dev_id(); - m_project_task_panel->enable_abort_button(false); - } } }); } @@ -3715,25 +3701,6 @@ void StatusPanel::update_model_info() void StatusPanel::update_subtask(MachineObject *obj) { if (!obj) return; - const auto now = std::chrono::steady_clock::now(); - if (m_pause_resume_pending) { - if (!is_moonraker_agent() || m_pause_resume_machine_id != obj->get_dev_id() || - obj->can_resume() != m_pause_resume_was_resume) { - m_pause_resume_pending = false; - } else if (now >= m_pause_resume_deadline) { - BOOST_LOG_TRIVIAL(warning) << "StatusPanel: Moonraker pause/resume command did not change printer state"; - m_pause_resume_pending = false; - } - } - if (m_abort_pending) { - if (!is_moonraker_agent() || m_abort_machine_id != obj->get_dev_id() || obj->print_status == "FAILED" || - obj->print_status == "FINISH" || obj->print_status == "IDLE") { - m_abort_pending = false; - } else if (now >= m_abort_deadline) { - BOOST_LOG_TRIVIAL(warning) << "StatusPanel: Moonraker abort command did not change printer state"; - m_abort_pending = false; - } - } if (m_current_print_mode != PRINGINT) { if (calib_bitmap == nullptr) { m_calib_mode = get_obj_calibration_mode(obj, m_calib_method, cali_stage); @@ -3841,12 +3808,10 @@ void StatusPanel::update_subtask(MachineObject *obj) } update_basic_print_data(false); } else { - if (!m_pause_resume_pending) { - if (obj->can_resume()) { - m_project_task_panel->enable_pause_resume_button(true, "resume"); - } else { - m_project_task_panel->enable_pause_resume_button(true, "pause"); - } + if (obj->can_resume()) { + m_project_task_panel->enable_pause_resume_button(true, "resume"); + } else { + m_project_task_panel->enable_pause_resume_button(true, "pause"); } m_project_task_panel->enable_partskip_button(obj, true); // update printing stage @@ -3903,9 +3868,7 @@ void StatusPanel::update_subtask(MachineObject *obj) m_project_task_panel->market_scoring_hide(); } } else { // model printing is not finished, hide scoring page - if (!m_abort_pending) { - m_project_task_panel->enable_abort_button(true); - } + m_project_task_panel->enable_abort_button(true); m_project_task_panel->market_scoring_hide(); m_project_task_panel->get_request_failed_panel()->Hide(); } @@ -4048,8 +4011,6 @@ void StatusPanel::update_sdcard_subtask(MachineObject *obj) void StatusPanel::reset_printing_values() { - m_pause_resume_pending = false; - m_abort_pending = false; m_project_task_panel->enable_partskip_button(nullptr, false); m_project_task_panel->enable_pause_resume_button(false, "pause_disable"); m_project_task_panel->enable_abort_button(false); @@ -4075,12 +4036,6 @@ void StatusPanel::reset_printing_values() this->Layout(); } -bool StatusPanel::is_moonraker_agent() const -{ - auto* agent = wxGetApp().getAgent(); - return agent && std::dynamic_pointer_cast(agent->get_printer_agent()) != nullptr; -} - void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event) { if (!obj) return; diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 1478feef8b..0492acc69e 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "MediaPlayCtrl.h" #include "WebMediaController.hpp" @@ -686,13 +685,6 @@ protected: CalibrationMethod m_calib_method; int cali_stage; PrintingTaskType m_current_print_mode = PrintingTaskType::NOT_CLEAR; - bool m_pause_resume_pending = false; - bool m_pause_resume_was_resume = false; - std::chrono::steady_clock::time_point m_pause_resume_deadline; - std::string m_pause_resume_machine_id; - bool m_abort_pending = false; - std::chrono::steady_clock::time_point m_abort_deadline; - std::string m_abort_machine_id; void init_scaled_buttons(); void create_tasklist_info(); @@ -795,7 +787,6 @@ protected: void update_calib_bitmap(); void reset_printing_values(); - bool is_moonraker_agent() const; void on_webrequest_state(wxWebRequestEvent &evt); bool is_task_changed(MachineObject* obj);