ENH:Reduce the number of page faults in AMS

Change-Id: I4bfb048ec62c35b515eecbb70c175fa0975d7f92
(cherry picked from commit 791be195475bd834c937fb63341713529e4f41b8)
This commit is contained in:
tao wang
2024-09-26 20:57:42 +08:00
committed by Noisyfox
parent a036994e0a
commit 7a197a3d8d
6 changed files with 27 additions and 35 deletions

View File

@@ -262,14 +262,6 @@ void MonitorPanel::select_machine(std::string machine_sn)
wxQueueEvent(this, event); wxQueueEvent(this, event);
} }
void MonitorPanel::on_update_all(wxMouseEvent &event)
{
if (update_flag) {
update_all();
Layout();
Refresh();
}
}
void MonitorPanel::on_timer(wxTimerEvent& event) void MonitorPanel::on_timer(wxTimerEvent& event)
{ {
@@ -306,7 +298,6 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
} }
Layout(); Layout();
Refresh();
} }
void MonitorPanel::on_printer_clicked(wxMouseEvent &event) void MonitorPanel::on_printer_clicked(wxMouseEvent &event)

View File

@@ -132,7 +132,6 @@ public:
StatusPanel* get_status_panel() {return m_status_info_panel;}; StatusPanel* get_status_panel() {return m_status_info_panel;};
void select_machine(std::string machine_sn); void select_machine(std::string machine_sn);
void on_update_all(wxMouseEvent &event);
void on_timer(wxTimerEvent& event); void on_timer(wxTimerEvent& event);
void on_select_printer(wxCommandEvent& event); void on_select_printer(wxCommandEvent& event);
void on_printer_clicked(wxMouseEvent &event); void on_printer_clicked(wxMouseEvent &event);

View File

@@ -2625,16 +2625,12 @@ void StatusPanel::update(MachineObject *obj)
auto delay1 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_utc_time - std::chrono::system_clock::now()).count(); auto delay1 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_utc_time - std::chrono::system_clock::now()).count();
auto delay2 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_push_time - std::chrono::system_clock::now()).count(); auto delay2 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_push_time - std::chrono::system_clock::now()).count();
auto delay = wxString::Format(" %ld/%ld", delay1, delay2); auto delay = wxString::Format(" %ld/%ld", delay1, delay2);
m_staticText_timelapse m_staticText_timelapse->SetLabel((obj->is_lan_mode_printer() ? "Local Mqtt" : obj->is_tunnel_mqtt ? "Tunnel Mqtt" : "Cloud Mqtt") + delay);
->SetLabel((obj->is_lan_mode_printer() ? "Local Mqtt" : obj->is_tunnel_mqtt ? "Tunnel Mqtt" : "Cloud Mqtt") + delay); m_bmToggleBtn_timelapse->Enable(!obj->is_lan_mode_printer());
m_bmToggleBtn_timelapse m_bmToggleBtn_timelapse->SetValue(obj->is_tunnel_mqtt);
->Enable(!obj->is_lan_mode_printer());
m_bmToggleBtn_timelapse
->SetValue(obj->is_tunnel_mqtt);
#endif #endif
m_machine_ctrl_panel->Freeze(); //m_machine_ctrl_panel->Freeze();
if (obj->is_in_printing() && !obj->can_resume()) if (obj->is_in_printing() && !obj->can_resume())
show_printing_status(false, true); show_printing_status(false, true);
else else
@@ -2676,7 +2672,6 @@ void StatusPanel::update(MachineObject *obj)
} else { } else {
m_options_btn->Hide(); m_options_btn->Hide();
} }
m_parts_btn->Show(); m_parts_btn->Show();
if (!obj->dev_connection_type.empty()) { if (!obj->dev_connection_type.empty()) {
@@ -2701,7 +2696,7 @@ void StatusPanel::update(MachineObject *obj)
update_camera_state(obj); update_camera_state(obj);
m_machine_ctrl_panel->Thaw(); //m_machine_ctrl_panel->Thaw();
} }
void StatusPanel::show_recenter_dialog() { void StatusPanel::show_recenter_dialog() {

View File

@@ -77,16 +77,20 @@ bool Button::SetFont(const wxFont& font)
void Button::SetIcon(const wxString& icon) void Button::SetIcon(const wxString& icon)
{ {
auto tmpBitmap = ScalableBitmap(this, icon.ToStdString(), this->active_icon.px_cnt());
if (!icon.IsEmpty()) { if (!icon.IsEmpty()) {
//BBS set button icon default size to 20 //BBS set button icon default size to 20
this->active_icon = ScalableBitmap(this, icon.ToStdString(), this->active_icon.px_cnt()); if (!tmpBitmap.bmp().IsSameAs(tmpBitmap.bmp())) {
this->active_icon = tmpBitmap;
Refresh();
}
} }
else else
{ {
this->active_icon = ScalableBitmap(); this->active_icon = ScalableBitmap();
}
Refresh(); Refresh();
} }
}
void Button::SetInactiveIcon(const wxString &icon) void Button::SetInactiveIcon(const wxString &icon)
{ {

View File

@@ -307,10 +307,12 @@ void TempInput::SetMinTemp(int temp) { min_temp = temp; }
void TempInput::SetLabel(const wxString &label) void TempInput::SetLabel(const wxString &label)
{ {
if (label != wxWindow::GetLabel()) {
wxWindow::SetLabel(label); wxWindow::SetLabel(label);
messureSize(); messureSize();
Refresh(); Refresh();
} }
}
void TempInput::SetTextColor(StateColor const &color) void TempInput::SetTextColor(StateColor const &color)
{ {

View File

@@ -77,6 +77,7 @@ public:
wxPopupTransientWindow *wdialog{nullptr}; wxPopupTransientWindow *wdialog{nullptr};
int temp_type; int temp_type;
bool actice = false; bool actice = false;
wxString currentTemp;
wxString erasePending(wxString &str); wxString erasePending(wxString &str);