FIX: refix flowrate fine cali lacks a sending progressbar

JIRA: STUDIO-4013

Change-Id: Ie4989c9bd5a587de480b07ea9977523151d2489c
This commit is contained in:
liz.li 2023-10-12 17:14:28 +08:00 committed by Lane.Wei
parent e7ffce7f53
commit e697fee9ae
8 changed files with 48 additions and 50 deletions

View File

@ -510,10 +510,15 @@ void CalibrationPanel::update_print_error_info(int code, std::string msg, std::s
if (curr_selected >= 0 && curr_selected < CALI_MODE_COUNT) {
if (m_cali_panels[curr_selected]) {
auto page = m_cali_panels[curr_selected]->get_curr_step()->page;
if(page && page->get_page_type() == CaliPageType::CALI_PAGE_PRESET){
auto preset_page = static_cast<CalibrationPresetPage*>(page);
//if (preset_page->get_page_status() == CaliPresetPageStatus::CaliPresetStatusSending)
// ;// preset_page->update_print_error_info(code, msg, extra);
if (page) {
if (page->get_page_type() == CaliPageType::CALI_PAGE_PRESET) {
auto preset_page = static_cast<CalibrationPresetPage*>(page);
preset_page->update_print_error_info(code, msg, extra);
}
if (page->get_page_type() == CaliPageType::CALI_PAGE_COARSE_SAVE) {
auto corase_page = static_cast<CalibrationFlowCoarseSavePage*>(page);
corase_page->update_print_error_info(code, msg, extra);
}
}
}
}

View File

@ -951,6 +951,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow
cali_page->clear_last_job_status();
}
else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
CalibrationFlowCoarseSavePage* coarse_page = (static_cast<CalibrationFlowCoarseSavePage*>(coarse_save_step->page));
CalibInfo calib_info;
calib_info.dev_id = curr_obj->dev_id;
Preset* temp_filament_preset = nullptr;
@ -979,16 +980,17 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow
temp_filament_preset->config = preset->config;
calib_info.bed_type = plate_type;
calib_info.process_bar = preset_page->get_sending_progress_bar();
calib_info.printer_prest = preset_page->get_printer_preset(curr_obj, nozzle_dia);
calib_info.print_prest = preset_page->get_print_preset();
calib_info.params.mode = CalibMode::Calib_Flow_Rate;
if (stage == CaliPresetStage::CALI_MANUAL_STAGE_1) {
cali_stage = 1;
calib_info.process_bar = preset_page->get_sending_progress_bar();
}
else if (stage == CaliPresetStage::CALI_MANUAL_STAGE_2) {
cali_stage = 2;
calib_info.process_bar = coarse_page->get_sending_progress_bar();
temp_filament_preset->config.set_key_value("filament_flow_ratio", new ConfigOptionFloats{ cali_value });
}
calib_info.filament_prest = temp_filament_preset;
@ -1008,17 +1010,18 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow
msg_dlg.ShowModal();
return;
}
preset_page->on_cali_start_job();
if (temp_filament_preset)
delete temp_filament_preset;
if (cali_stage == 1) {
CalibrationCaliPage *cali_coarse_page = (static_cast<CalibrationCaliPage *>(cali_coarse_step->page));
cali_coarse_page->clear_last_job_status();
preset_page->on_cali_start_job();
}
else if (cali_stage == 2) {
CalibrationCaliPage *cali_fine_page = (static_cast<CalibrationCaliPage *>(cali_fine_step->page));
cali_fine_page->clear_last_job_status();
coarse_page->on_cali_start_job();
}
} else {
assert(false);
@ -1197,17 +1200,19 @@ void FlowRateWizard::on_cali_job_finished(wxString evt_data)
if (cali_stage == 1) {
if (m_curr_step != cali_coarse_step)
show_step(cali_coarse_step);
// change ui, hide
static_cast<CalibrationPresetPage*>(preset_step->page)->on_cali_finished_job();
}
else if (cali_stage == 2) {
if (m_curr_step != cali_fine_step) {
show_step(cali_fine_step);
}
// change ui, hide
static_cast<CalibrationFlowCoarseSavePage*>(coarse_save_step->page)->on_cali_finished_job();
}
else
show_step(cali_coarse_step);
}
// change ui, hide
static_cast<CalibrationPresetPage*>(preset_step->page)->on_cali_finished_job();
}
void FlowRateWizard::cache_coarse_info(MachineObject *obj)

View File

@ -754,7 +754,8 @@ void CaliPageActionPanel::enable_button(CaliPageActionType action_type, bool ena
}
}
CaliPageSendingPanel::CaliPageSendingPanel(wxWindow* parent, /*CalibMode cali_mode, CaliPageType page_type, */wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
CaliPageSendingPanel::CaliPageSendingPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style)
{
SetBackgroundColour(*wxWHITE);
SetMinSize({ FromDIP(475), FromDIP(200) });
@ -762,6 +763,9 @@ CaliPageSendingPanel::CaliPageSendingPanel(wxWindow* parent, /*CalibMode cali_mo
create(this);
Layout();
Fit();
Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {
show_send_failed_info(true);
});

View File

@ -226,8 +226,6 @@ class CaliPageSendingPanel : public wxPanel
{
public:
CaliPageSendingPanel(wxWindow* parent,
//CalibMode cali_mode,
//CaliPageType page_type,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,

View File

@ -688,14 +688,6 @@ void CalibrationPresetPage::create_page(wxWindow* parent)
m_sending_panel = new CaliPageSendingPanel(parent);
m_sending_panel->get_sending_progress_bar()->set_cancel_callback_fina([this]() {
BOOST_LOG_TRIVIAL(info) << "CalibrationWizard::print_job: enter canceled";
if (CalibUtils::print_job) {
if (CalibUtils::print_job->is_running()) {
BOOST_LOG_TRIVIAL(info) << "calibration_print_job: canceled";
CalibUtils::print_job->cancel();
}
CalibUtils::print_job->join();
}
on_cali_cancel_job();
});
m_sending_panel->Hide();
@ -1289,12 +1281,6 @@ void CalibrationPresetPage::Enable_Send_Button(bool enable)
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_CALI, enable);
}
void CalibrationPresetPage::prepare_mode()
{
Enable_Send_Button(true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_CALI, true);
}
float CalibrationPresetPage::get_nozzle_value()
{
double nozzle_value = 0.0;
@ -1430,10 +1416,21 @@ void CalibrationPresetPage::on_cali_finished_job()
update_print_status_msg(wxEmptyString, false);
Enable_Send_Button(true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_CALI, true);
Layout();
Fit();
}
void CalibrationPresetPage::on_cali_cancel_job()
{
BOOST_LOG_TRIVIAL(info) << "CalibrationWizard::print_job: enter canceled";
if (CalibUtils::print_job) {
if (CalibUtils::print_job->is_running()) {
BOOST_LOG_TRIVIAL(info) << "calibration_print_job: canceled";
CalibUtils::print_job->cancel();
}
CalibUtils::print_job->join();
}
m_sending_panel->reset();
m_sending_panel->Show(false);
update_print_status_msg(wxEmptyString, false);

View File

@ -129,14 +129,12 @@ enum CaliPresetPageStatus
{
CaliPresetStatusInit = 0,
CaliPresetStatusNormal,
//CaliPresetStatusSending,
CaliPresetStatusNoUserLogin,
CaliPresetStatusInvalidPrinter,
CaliPresetStatusConnectingServer,
CaliPresetStatusInUpgrading,
CaliPresetStatusInSystemPrinting,
CaliPresetStatusInPrinting,
//CaliPresetStatusSendingCanceled,
CaliPresetStatusLanModeNoSdcard,
CaliPresetStatusNoSdcard,
CaliPresetStatusNeedForceUpgrading,
@ -167,9 +165,7 @@ public:
void on_device_connected(MachineObject* obj) override;
//void update_print_error_info(int code, const std::string& msg, const std::string& extra);
//void show_send_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
void update_print_error_info(int code, const std::string& msg, const std::string& extra) { m_sending_panel->update_print_error_info(code, msg, extra); }
void set_cali_filament_mode(CalibrationFilamentMode mode) override;
@ -214,7 +210,6 @@ protected:
void create_selection_panel(wxWindow* parent);
void create_filament_list_panel(wxWindow* parent);
void create_ext_spool_panel(wxWindow* parent);
//void create_sending_panel(wxWindow* parent);
void init_selection_values();
void update_filament_combobox(std::string ams_id = "");
@ -246,8 +241,6 @@ protected:
void update_show_status();
void show_status(CaliPresetPageStatus status);
void Enable_Send_Button(bool enable);
void prepare_mode();
//void sending_mode();
bool is_blocking_printing();
bool need_check_sdcard(MachineObject* obj);
@ -281,15 +274,6 @@ protected:
FilamentComboBoxList m_filament_comboBox_list;
FilamentComboBox* m_virtual_tray_comboBox;
// m_sending panel widgets
//std::shared_ptr<BBLStatusBarSend> m_send_progress_bar;
//wxScrolledWindow* m_sw_print_failed_info { nullptr };
//Label* m_st_txt_error_code { nullptr };
//Label* m_st_txt_error_desc { nullptr };
//Label* m_st_txt_extra_info { nullptr };
//int m_print_error_code;
//std::string m_print_error_msg;
//std::string m_print_error_extra;
std::vector<AMSItem*> m_ams_item_list;

View File

@ -1272,14 +1272,6 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent)
m_sending_panel = new CaliPageSendingPanel(parent);
m_sending_panel->get_sending_progress_bar()->set_cancel_callback_fina([this]() {
BOOST_LOG_TRIVIAL(info) << "CalibrationWizard::print_job: enter canceled";
if (CalibUtils::print_job) {
if (CalibUtils::print_job->is_running()) {
BOOST_LOG_TRIVIAL(info) << "calibration_print_job: canceled";
CalibUtils::print_job->cancel();
}
CalibUtils::print_job->join();
}
on_cali_cancel_job();
});
m_sending_panel->Hide();
@ -1367,10 +1359,21 @@ void CalibrationFlowCoarseSavePage::on_cali_finished_job()
m_sending_panel->Show(false);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2, true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2, true);
Layout();
Fit();
}
void CalibrationFlowCoarseSavePage::on_cali_cancel_job()
{
BOOST_LOG_TRIVIAL(info) << "CalibrationWizard::print_job: enter canceled";
if (CalibUtils::print_job) {
if (CalibUtils::print_job->is_running()) {
BOOST_LOG_TRIVIAL(info) << "calibration_print_job: canceled";
CalibUtils::print_job->cancel();
}
CalibUtils::print_job->join();
}
m_sending_panel->reset();
m_sending_panel->Show(false);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2, true);

View File

@ -239,6 +239,8 @@ public:
virtual bool Show(bool show = true) override;
void update_print_error_info(int code, const std::string& msg, const std::string& extra) { m_sending_panel->update_print_error_info(code, msg, extra); }
void on_cali_start_job();
void on_cali_finished_job();