ENH:Reduce the number of page faults on the device

Change-Id: I72e140de35d06308f8aa45f4254e049a83abc432
This commit is contained in:
tao wang 2024-08-12 14:21:48 +08:00 committed by Lane.Wei
parent 8c852bc925
commit 66403ba19f
5 changed files with 97 additions and 61 deletions

View File

@ -288,8 +288,8 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
{
if (update_flag) {
update_all();
Layout();
Refresh();
//Layout();
//Refresh();
}
}
@ -297,8 +297,8 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
{
if (update_flag) {
update_all();
Layout();
Refresh();
//Layout();
//Refresh();
}
}
@ -371,6 +371,7 @@ void MonitorPanel::update_all()
return;
}
//BBS check mqtt connections if user is login
if (wxGetApp().is_user_login()) {
dev->check_pushing();
@ -420,7 +421,6 @@ void MonitorPanel::update_all()
show_status(MONITOR_NORMAL);
if (m_status_info_panel->IsShown()) {
m_status_info_panel->update(obj);
}

View File

@ -2405,27 +2405,34 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
if (m_current_support_aux_fan != is_suppt_aux_fun) {
if (is_suppt_aux_fun) {
m_switch_printing_fan->Show();
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE);
m_switch_cham_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE);
m_switch_cham_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE);
if (!m_switch_printing_fan->IsShown()) {
m_switch_printing_fan->Show();
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE);
m_switch_cham_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE);
m_switch_cham_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE);
}
}
else {
m_switch_printing_fan->Hide();
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE);
m_switch_cham_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE);
m_switch_cham_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE);
if (m_switch_printing_fan->IsShown()) {
m_switch_printing_fan->Hide();
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE);
m_switch_cham_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE);
m_switch_cham_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE);
}
}
m_misc_ctrl_sizer->Layout();
}
if (!is_suppt_aux_fun && !is_suppt_cham_fun) {
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_1FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_1FAN_SIZE);
m_misc_ctrl_sizer->Layout();
if (!m_switch_nozzle_fan->IsShown()) {
m_switch_nozzle_fan->Show();
m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_1FAN_SIZE);
m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_1FAN_SIZE);
m_misc_ctrl_sizer->Layout();
}
}
@ -2491,21 +2498,27 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
void StatusPanel::update_extruder_status(MachineObject* obj)
{
if (!obj) return;
if (obj->is_filament_at_extruder()) {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD) {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_filled_load);
}
else {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_filled_unload);
}
}
else {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD) {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_empty_load);
} else {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_empty_unload);
}
}
wxBitmap tmp;
if (obj->is_filament_at_extruder()) {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD) {
tmp = m_bitmap_extruder_filled_load;
}
else {
tmp = m_bitmap_extruder_filled_unload;
}
}
else {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD) {
tmp = m_bitmap_extruder_empty_load;
}
else {
tmp = m_bitmap_extruder_empty_unload;
}
}
if (tmp.GetBitmapData() != m_bitmap_extruder_now) {
m_bitmap_extruder_now = tmp.GetBitmapData();
m_bitmap_extruder_img->SetBitmap(tmp);
}
}
void StatusPanel::update_ams(MachineObject *obj)
@ -3145,7 +3158,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
reset_printing_values();
}
this->Layout();
m_project_task_panel->Layout();
}
void StatusPanel::update_cloud_subtask(MachineObject *obj)
@ -3231,7 +3244,6 @@ void StatusPanel::reset_printing_values()
m_start_loading_thumbnail = false;
m_load_sdcard_thumbnail = false;
skip_print_error = 0;
this->Layout();
}
void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event)

View File

@ -273,6 +273,7 @@ protected:
wxBitmap m_bitmap_extruder_filled_load;
wxBitmap m_bitmap_extruder_empty_unload;
wxBitmap m_bitmap_extruder_filled_unload;
wxBitmapRefData* m_bitmap_extruder_now;
CameraRecordingStatus m_state_recording{CameraRecordingStatus::RECORDING_NONE};
CameraTimelapseStatus m_state_timelapse{CameraTimelapseStatus::TIMELAPSE_NONE};

View File

@ -52,10 +52,11 @@ void ImageSwitchButton::SetLabels(wxString const &lbl_on, wxString const &lbl_of
labels[0] = lbl_on;
labels[1] = lbl_off;
auto fina_txt = GetValue() ? labels[0] : labels[1];
if (GetToolTipText() != fina_txt)
if (GetToolTipText() != fina_txt) {
SetToolTip(fina_txt);
messureSize();
Refresh();
messureSize();
Refresh();
}
}
void ImageSwitchButton::SetImages(ScalableBitmap &img_on, ScalableBitmap &img_off)
@ -76,9 +77,11 @@ void ImageSwitchButton::SetTextColor(StateColor const &color)
void ImageSwitchButton::SetValue(bool value)
{
m_on_off = value;
messureSize();
Refresh();
if (m_on_off != value) {
m_on_off = value;
messureSize();
Refresh();
}
}
void ImageSwitchButton::SetPadding(int padding)
@ -236,16 +239,20 @@ void FanSwitchButton::SetTextColor(StateColor const& color)
void FanSwitchButton::SetValue(bool value)
{
m_on_off = value;
messureSize();
Refresh();
if (m_on_off != value) {
m_on_off = value;
messureSize();
Refresh();
}
}
void FanSwitchButton::SetPadding(int padding)
{
m_padding = padding;
messureSize();
Refresh();
if (m_padding != padding) {
m_padding = padding;
messureSize();
Refresh();
}
}
void FanSwitchButton::messureSize()
@ -325,8 +332,10 @@ void FanSwitchButton::Rescale()
void FanSwitchButton::setFanValue(int val)
{
m_speed = val;
Refresh();
if (m_speed != val) {
m_speed = val;
Refresh();
}
}
void FanSwitchButton::mouseDown(wxMouseEvent& event)

View File

@ -162,26 +162,36 @@ wxString TempInput::erasePending(wxString &str)
void TempInput::SetTagTemp(int temp)
{
text_ctrl->SetValue(wxString::Format("%d", temp));
messureSize();
Refresh();
auto tp = wxString::Format("%d", temp);
if ((text_ctrl->GetValue() != wxString("_")) && (text_ctrl->GetValue() != tp) ) {
text_ctrl->SetValue(tp);
messureSize();
Refresh();
}
}
void TempInput::SetTagTemp(wxString temp)
{
text_ctrl->SetValue(temp);
messureSize();
Refresh();
if (text_ctrl->GetValue() != temp) {
text_ctrl->SetValue(temp);
messureSize();
Refresh();
}
}
void TempInput::SetCurrTemp(int temp)
{
SetLabel(wxString::Format("%d", temp));
auto tp = wxString::Format("%d", temp);
if (GetLabel() != tp) {
SetLabel(tp);
}
}
void TempInput::SetCurrTemp(wxString temp)
{
SetLabel(temp);
if (GetLabel() != temp) {
SetLabel(temp);
}
}
void TempInput::Warning(bool warn, WarningType type)
@ -245,14 +255,18 @@ void TempInput::Warning(bool warn, WarningType type)
void TempInput::SetIconActive()
{
actice = true;
Refresh();
if (!actice) {
actice = true;
Refresh();
}
}
void TempInput::SetIconNormal()
{
actice = false;
Refresh();
if (actice) {
actice = false;
Refresh();
}
}
void TempInput::SetMaxTemp(int temp) { max_temp = temp; }