ENH: enable to enter 0 as default cooling temperature

jira: [STUDIO-11360]
Change-Id: Iaede485340c1a88a1a42eceeadf772332fe369a0
(cherry picked from commit 1fd53404176795581cb2fe1e6d69bfe425a04c23)
This commit is contained in:
xin.zhang
2025-04-09 09:31:49 +08:00
committed by Noisyfox
parent 377df07c67
commit aea87dbb66
3 changed files with 17 additions and 12 deletions

View File

@@ -61,25 +61,21 @@ bool TempInput::CheckIsValidVal(bool show_warning)
/*show temperature range warnings*/
auto tempint = std::stoi(temp.ToStdString());
if (tempint > max_temp)
if (additional_temps.count(tempint) == 0)
{
if (show_warning)
if (tempint > max_temp)
{
Warning(true, WARNING_TOO_HIGH);
if (show_warning) { Warning(true, WARNING_TOO_HIGH); }
return false;
}
return false;
}
else if (tempint < min_temp)
{
if (show_warning)
else if (tempint < min_temp)
{
Warning(true, WARNING_TOO_LOW);
if (show_warning) { Warning(true, WARNING_TOO_LOW); }
return false;
}
return false;
}
return true;
}

View File

@@ -6,6 +6,8 @@
#include <wx/stattext.h>
#include "StaticBox.hpp"
#include <unordered_set>
wxDECLARE_EVENT(wxCUSTOMEVT_SET_TEMP_FINISH, wxCommandEvent);
enum TempInputType {
@@ -34,6 +36,7 @@ class TempInput : public wxNavigationEnabled<StaticBox>
int max_temp = 0;
int min_temp = 0;
std::unordered_set<int> additional_temps;
bool warning_mode = false;
TempInputType m_input_type;
@@ -96,6 +99,7 @@ public:
void SetMaxTemp(int temp);
void SetMinTemp(int temp);
void AddTemp(int temp) { additional_temps.insert(temp); };
int GetType() { return temp_type; }