FIX: the status is not correct when change nozzle

jira: none
Change-Id: I8bb99c260234f07b8ef5bdc389e15a455770130b
This commit is contained in:
zhimin.zeng 2024-04-16 20:30:17 +08:00 committed by Lane.Wei
parent cf146f4fed
commit 11b7796faf
4 changed files with 14 additions and 6 deletions

View File

@ -55,9 +55,10 @@ static wxString get_preset_name_by_filament_id(std::string filament_id)
return preset_name;
}
HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history)
HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history, bool& show)
: DPIDialog(parent, wxID_ANY, _L("Flow Dynamics Calibration Result"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
, m_calib_results_history(calib_results_history)
, m_show_history_dialog(show)
{
this->SetBackgroundColour(*wxWHITE);
auto main_sizer = new wxBoxSizer(wxVERTICAL);
@ -138,11 +139,14 @@ HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>&
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(200);
Bind(wxEVT_TIMER, &HistoryWindow::on_timer, this);
m_show_history_dialog = true;
}
HistoryWindow::~HistoryWindow()
{
m_refresh_timer->Stop();
m_show_history_dialog = false;
}
void HistoryWindow::sync_history_result(MachineObject* obj)

View File

@ -11,7 +11,7 @@ namespace GUI {
class HistoryWindow : public DPIDialog {
public:
HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history);
HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history, bool& show);
~HistoryWindow();
void on_dpi_changed(const wxRect& suggested_rect) {}
void on_select_nozzle(wxCommandEvent& evt);
@ -33,6 +33,7 @@ protected:
wxTimer* m_refresh_timer { nullptr };
bool& m_show_history_dialog;
std::vector<PACalibResult> m_calib_results_history;
MachineObject* curr_obj { nullptr };
int history_version = -1;

View File

@ -430,7 +430,7 @@ void PressureAdvanceWizard::on_cali_action(wxCommandEvent& evt)
{
CaliPageActionType action = static_cast<CaliPageActionType>(evt.GetInt());
if (action == CaliPageActionType::CALI_ACTION_MANAGE_RESULT) {
HistoryWindow history_dialog(this, m_calib_results_history);
HistoryWindow history_dialog(this, m_calib_results_history, m_show_result_dialog);
history_dialog.on_device_connected(curr_obj);
history_dialog.ShowModal();
}
@ -473,9 +473,11 @@ void PressureAdvanceWizard::update(MachineObject* obj)
CalibrationWizard::update(obj);
if (obj->cali_version != -1 && obj->cali_version != cali_version) {
cali_version = obj->cali_version;
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
if (!m_show_result_dialog) {
if (obj->cali_version != -1 && obj->cali_version != cali_version) {
cali_version = obj->cali_version;
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
}
}
}

View File

@ -121,6 +121,7 @@ protected:
void on_device_connected(MachineObject* obj) override;
bool m_show_result_dialog = false;
std::vector<PACalibResult> m_calib_results_history;
int cali_version = -1;
};