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);
}
void MonitorPanel::on_update_all(wxMouseEvent &event)
{
if (update_flag) {
update_all();
Layout();
Refresh();
}
}
void MonitorPanel::on_timer(wxTimerEvent& event)
{
@ -306,7 +298,6 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
}
Layout();
Refresh();
}
void MonitorPanel::on_printer_clicked(wxMouseEvent &event)

View file

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

View file

@ -2622,19 +2622,15 @@ void StatusPanel::update(MachineObject *obj)
//m_project_task_panel->Thaw();
#if !BBL_RELEASE_TO_PUBLIC
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 delay = wxString::Format(" %ld/%ld", delay1, delay2);
m_staticText_timelapse
->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
->SetValue(obj->is_tunnel_mqtt);
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 delay = wxString::Format(" %ld/%ld", delay1, delay2);
m_staticText_timelapse->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->SetValue(obj->is_tunnel_mqtt);
#endif
m_machine_ctrl_panel->Freeze();
//m_machine_ctrl_panel->Freeze();
if (obj->is_in_printing() && !obj->can_resume())
show_printing_status(false, true);
else
@ -2661,7 +2657,7 @@ void StatusPanel::update(MachineObject *obj)
calibration_dlg->update_machine_obj(obj);
calibration_dlg->update_cali(obj);
}
if (obj->is_support_first_layer_inspect
@ -2676,7 +2672,6 @@ void StatusPanel::update(MachineObject *obj)
} else {
m_options_btn->Hide();
}
m_parts_btn->Show();
if (!obj->dev_connection_type.empty()) {
@ -2701,7 +2696,7 @@ void StatusPanel::update(MachineObject *obj)
update_camera_state(obj);
m_machine_ctrl_panel->Thaw();
//m_machine_ctrl_panel->Thaw();
}
void StatusPanel::show_recenter_dialog() {
@ -2839,12 +2834,12 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
m_bpButton_e_10->Enable();
m_bpButton_e_down_10->Enable();
m_bpButton_z_10->SetIcon("monitor_bed_up");
m_bpButton_z_1->SetIcon("monitor_bed_up");
m_bpButton_z_down_1->SetIcon("monitor_bed_down");
m_bpButton_z_down_10->SetIcon("monitor_bed_down");
m_bpButton_e_10->SetIcon("monitor_extruder_up");
m_bpButton_e_down_10->SetIcon("monitor_extrduer_down");
m_bpButton_z_10->SetIcon("monitor_bed_up");
m_bpButton_z_1->SetIcon("monitor_bed_up");
m_bpButton_z_down_1->SetIcon("monitor_bed_down");
m_bpButton_z_down_10->SetIcon("monitor_bed_down");
m_bpButton_e_10->SetIcon("monitor_extruder_up");
m_bpButton_e_down_10->SetIcon("monitor_extrduer_down");
m_staticText_z_tip->SetForegroundColour(TEXT_LIGHT_FONT_COL);
m_extruder_label->SetForegroundColour(TEXT_LIGHT_FONT_COL);

View file

@ -77,15 +77,19 @@ bool Button::SetFont(const wxFont& font)
void Button::SetIcon(const wxString& icon)
{
auto tmpBitmap = ScalableBitmap(this, icon.ToStdString(), this->active_icon.px_cnt());
if (!icon.IsEmpty()) {
//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
{
this->active_icon = ScalableBitmap();
Refresh();
}
Refresh();
}
void Button::SetInactiveIcon(const wxString &icon)

View file

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

View file

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