mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 11:21:30 +00:00
fix: revert moonraker specific behavior
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "MsgDialog.hpp"
|
#include "MsgDialog.hpp"
|
||||||
#include "slic3r/Utils/Http.hpp"
|
#include "slic3r/Utils/Http.hpp"
|
||||||
#include "slic3r/Utils/MoonrakerPrinterAgent.hpp"
|
|
||||||
#include "libslic3r/Thread.hpp"
|
#include "libslic3r/Thread.hpp"
|
||||||
#include "DeviceErrorDialog.hpp"
|
#include "DeviceErrorDialog.hpp"
|
||||||
|
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include <wx/mstream.h>
|
#include <wx/mstream.h>
|
||||||
#include <wx/sstream.h>
|
#include <wx/sstream.h>
|
||||||
#include <wx/zstream.h>
|
#include <wx/zstream.h>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include "DeviceCore/DevBed.h"
|
#include "DeviceCore/DevBed.h"
|
||||||
#include "DeviceCore/DevCtrl.h"
|
#include "DeviceCore/DevCtrl.h"
|
||||||
@@ -2709,8 +2709,7 @@ void StatusPanel::on_subtask_partskip(wxCommandEvent &event)
|
|||||||
void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event)
|
void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
if (obj) {
|
if (obj) {
|
||||||
const bool was_resume = obj->can_resume();
|
if (obj->can_resume()) {
|
||||||
if (was_resume) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "monitor: resume current print task dev_id =" << obj->get_dev_id();
|
BOOST_LOG_TRIVIAL(info) << "monitor: resume current print task dev_id =" << obj->get_dev_id();
|
||||||
obj->command_task_resume();
|
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();
|
BOOST_LOG_TRIVIAL(info) << "monitor: pause current print task dev_id =" << obj->get_dev_id();
|
||||||
obj->command_task_pause();
|
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) {
|
if (obj) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "monitor: stop current print task dev_id =" << obj->get_dev_id();
|
BOOST_LOG_TRIVIAL(info) << "monitor: stop current print task dev_id =" << obj->get_dev_id();
|
||||||
obj->command_task_abort();
|
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)
|
void StatusPanel::update_subtask(MachineObject *obj)
|
||||||
{
|
{
|
||||||
if (!obj) return;
|
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 (m_current_print_mode != PRINGINT) {
|
||||||
if (calib_bitmap == nullptr) {
|
if (calib_bitmap == nullptr) {
|
||||||
m_calib_mode = get_obj_calibration_mode(obj, m_calib_method, cali_stage);
|
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);
|
update_basic_print_data(false);
|
||||||
} else {
|
} else {
|
||||||
if (!m_pause_resume_pending) {
|
if (obj->can_resume()) {
|
||||||
if (obj->can_resume()) {
|
m_project_task_panel->enable_pause_resume_button(true, "resume");
|
||||||
m_project_task_panel->enable_pause_resume_button(true, "resume");
|
} else {
|
||||||
} else {
|
m_project_task_panel->enable_pause_resume_button(true, "pause");
|
||||||
m_project_task_panel->enable_pause_resume_button(true, "pause");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_project_task_panel->enable_partskip_button(obj, true);
|
m_project_task_panel->enable_partskip_button(obj, true);
|
||||||
// update printing stage
|
// update printing stage
|
||||||
@@ -3903,9 +3868,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
|
|||||||
m_project_task_panel->market_scoring_hide();
|
m_project_task_panel->market_scoring_hide();
|
||||||
}
|
}
|
||||||
} else { // model printing is not finished, hide scoring page
|
} 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->market_scoring_hide();
|
||||||
m_project_task_panel->get_request_failed_panel()->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()
|
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_partskip_button(nullptr, false);
|
||||||
m_project_task_panel->enable_pause_resume_button(false, "pause_disable");
|
m_project_task_panel->enable_pause_resume_button(false, "pause_disable");
|
||||||
m_project_task_panel->enable_abort_button(false);
|
m_project_task_panel->enable_abort_button(false);
|
||||||
@@ -4075,12 +4036,6 @@ void StatusPanel::reset_printing_values()
|
|||||||
this->Layout();
|
this->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatusPanel::is_moonraker_agent() const
|
|
||||||
{
|
|
||||||
auto* agent = wxGetApp().getAgent();
|
|
||||||
return agent && std::dynamic_pointer_cast<Slic3r::MoonrakerPrinterAgent>(agent->get_printer_agent()) != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event)
|
void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
#include <wx/webrequest.h>
|
#include <wx/webrequest.h>
|
||||||
#include <chrono>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "MediaPlayCtrl.h"
|
#include "MediaPlayCtrl.h"
|
||||||
#include "WebMediaController.hpp"
|
#include "WebMediaController.hpp"
|
||||||
@@ -686,13 +685,6 @@ protected:
|
|||||||
CalibrationMethod m_calib_method;
|
CalibrationMethod m_calib_method;
|
||||||
int cali_stage;
|
int cali_stage;
|
||||||
PrintingTaskType m_current_print_mode = PrintingTaskType::NOT_CLEAR;
|
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 init_scaled_buttons();
|
||||||
void create_tasklist_info();
|
void create_tasklist_info();
|
||||||
@@ -795,7 +787,6 @@ protected:
|
|||||||
void update_calib_bitmap();
|
void update_calib_bitmap();
|
||||||
|
|
||||||
void reset_printing_values();
|
void reset_printing_values();
|
||||||
bool is_moonraker_agent() const;
|
|
||||||
void on_webrequest_state(wxWebRequestEvent &evt);
|
void on_webrequest_state(wxWebRequestEvent &evt);
|
||||||
bool is_task_changed(MachineObject* obj);
|
bool is_task_changed(MachineObject* obj);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user