FIX: hide fan when device not in fdm

JIRA: none

Change-Id: I14a6e01b4e0950ca1bc3c805fe00313cfd7caf06
This commit is contained in:
Kunlong Ma 2025-01-12 17:43:22 +08:00 committed by lane.wei
parent 5bd6cf87e2
commit c12b4f1391
5 changed files with 27 additions and 10 deletions

View File

@ -5906,7 +5906,8 @@ void MachineObject::parse_new_info(json print)
} }
if (device.contains("type")) { if (device.contains("type")) {
int type = device["type"]; //FDM:1<<0 Laser:1<< Cut:1<<2 int type = device["type"].get<int>(); // FDM:1<<0 Laser:1<< Cut:1<<2
is_fdm = type & 1;
} }
if (device.contains("bed_temp")) { if (device.contains("bed_temp")) {

View File

@ -1020,6 +1020,9 @@ public:
bool is_makeworld_subtask(); bool is_makeworld_subtask();
/* device type */
bool is_fdm{ true };
inline bool is_fdm_type() const { return is_fdm; }
int m_plate_index { -1 }; int m_plate_index { -1 };
std::string m_gcode_file; std::string m_gcode_file;

View File

@ -2861,12 +2861,21 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
// update extruder icon // update extruder icon
update_extruder_status(obj); update_extruder_status(obj);
bool is_suppt_part_fun = true; if (obj->is_fdm_type()) {
bool is_suppt_aux_fun = obj->is_support_aux_fan; if (!m_fan_panel->IsShown())
bool is_suppt_cham_fun = obj->is_support_chamber_fan; m_fan_panel->Show();
if (m_fan_control_popup) { bool is_suppt_part_fun = true;
m_fan_control_popup->update_fan_data(obj); bool is_suppt_aux_fun = obj->is_support_aux_fan;
bool is_suppt_cham_fun = obj->is_support_chamber_fan;
if (m_fan_control_popup) { m_fan_control_popup->update_fan_data(obj); }
} else {
if (m_fan_panel->IsShown()) {
m_fan_panel->Hide();
}
if (m_fan_control_popup && m_fan_control_popup->Show())
m_fan_control_popup->Hide();
} }
//update cham fan //update cham fan
/*other*/ /*other*/

View File

@ -563,8 +563,8 @@ void FanControlNew::post_event()
Description:FanControlPopupNew Description:FanControlPopupNew
**************************************************/ **************************************************/
static void nop_deleter_fan_control_popup(FanControlPopupNew *) {} static void nop_deleter_fan_control_popup(FanControlPopupNew *) {}
FanControlPopupNew::FanControlPopupNew(wxWindow* parent, MachineObject* obj,AirDuctData data) FanControlPopupNew::FanControlPopupNew(wxWindow* parent, MachineObject* obj, const AirDuctData& data)
:PopupWindow(parent, wxBORDER_NONE) : PopupWindow(parent, wxBORDER_NONE)
{ {
SetBackgroundColour(*wxWHITE); SetBackgroundColour(*wxWHITE);
init_names(); init_names();
@ -573,8 +573,12 @@ FanControlPopupNew::FanControlPopupNew(wxWindow* parent, MachineObject* obj,AirD
m_obj = obj; m_obj = obj;
m_sizer_main = new wxBoxSizer(wxVERTICAL); m_sizer_main = new wxBoxSizer(wxVERTICAL);
int part_size = data.parts.size();
int grid_column = part_size > 1 ? 2 : 1;
m_radio_btn_sizer = new wxGridSizer(0, 2, FromDIP(3), FromDIP(3)); m_radio_btn_sizer = new wxGridSizer(0, 2, FromDIP(3), FromDIP(3));
m_sizer_fanControl = new wxGridSizer(0, 2, FromDIP(3), FromDIP(10)); m_sizer_fanControl = new wxGridSizer(0, grid_column, FromDIP(3), FromDIP(10));
m_mode_sizer = new wxBoxSizer(wxHORIZONTAL); m_mode_sizer = new wxBoxSizer(wxHORIZONTAL);

View File

@ -175,7 +175,7 @@ public:
class FanControlPopupNew : public PopupWindow class FanControlPopupNew : public PopupWindow
{ {
public: public:
FanControlPopupNew(wxWindow* parent, MachineObject* obj, AirDuctData data); FanControlPopupNew(wxWindow* parent, MachineObject* obj, const AirDuctData& data);
~FanControlPopupNew() {}; ~FanControlPopupNew() {};