ENH:allow fan control when printing

jira:[STUDIO-9700]

Change-Id: I3637705b8c9dfe1b35766bf35dab2a286ee1e7a1
This commit is contained in:
tao wang 2025-01-13 21:34:41 +08:00 committed by lane.wei
parent 44e056932f
commit 8f5887735a
2 changed files with 28 additions and 15 deletions

View File

@ -226,13 +226,20 @@ void FanOperate::set_fan_speeds(int g)
Refresh();
}
void FanOperate::add_fan_speeds()
bool FanOperate::check_printing_state()
{
if (m_obj && m_obj->is_in_printing()) {
MessageDialog msg_wingow(nullptr, _L("Changed fan speed during pringing may affect print quality, please choose carefully."), "", wxICON_WARNING | wxCANCEL | wxOK);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
return;
msg_wingow.SetButtonLabel(wxID_OK, _L("Change Anyway"));
if (msg_wingow.ShowModal() == wxID_CANCEL) { return false; }
}
return true;
}
void FanOperate::add_fan_speeds()
{
if (!check_printing_state()) {
return;
}
if (m_current_speeds + 1 > m_max_speeds) return;
@ -243,12 +250,9 @@ void FanOperate::add_fan_speeds()
void FanOperate::decrease_fan_speeds()
{
if (m_obj && m_obj->is_in_printing()) {
MessageDialog msg_wingow(nullptr, _L("Changed fan speed during pringing may affect print quality, please choose carefully."), "", wxICON_WARNING | wxCANCEL | wxOK);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
if (!check_printing_state()) {
return;
}
}
//turn off
if (m_current_speeds - 1 < m_min_speeds) {
@ -444,13 +448,20 @@ void FanControlNew::command_control_fan()
}
}
void FanControlNew::on_swith_fan(wxMouseEvent& evt)
bool FanControlNew::check_printing_state()
{
if (m_obj && m_obj->is_in_printing()) {
MessageDialog msg_wingow(nullptr, _L("Changed fan speed during pringing may affect print quality, please choose carefully."), "", wxICON_WARNING | wxCANCEL | wxOK);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
return;
msg_wingow.SetButtonLabel(wxID_OK, _L("Change Anyway"));
if (msg_wingow.ShowModal() == wxID_CANCEL) { return false; }
}
return true;
}
void FanControlNew::on_swith_fan(wxMouseEvent& evt)
{
if (!check_printing_state()) {
return;
}
int speed = 0;

View File

@ -104,6 +104,7 @@ public:
public:
void set_fan_speeds(int g);
bool check_printing_state();
void add_fan_speeds();
void decrease_fan_speeds();
private:
@ -157,6 +158,7 @@ public:
void update_obj_state(bool stat) { m_update_already = stat; };
void update_fan_data(const AirDuctData& data) { m_fan_data = data; };
void command_control_fan();
bool check_printing_state();
void set_machine_obj(MachineObject *obj);
void set_name(wxString name);
void set_part_id(int id){m_part_id = id;};