fix bound check recursion bug
This commit is contained in:
parent
dfcc27420a
commit
b5b0c866f8
2 changed files with 10 additions and 5 deletions
|
@ -149,6 +149,7 @@ void CUDDisplay::begin(cud_display_cards_t cards)
|
|||
// If any of the bound is invalid, set all to default
|
||||
if (this->ac_temp_lower_bound.getIntValue() < AC_MIN_TEMP || this->ac_temp_upper_bound.getIntValue() > AC_MAX_TEMP || this->ac_temp_lower_bound.getIntValue() >= this->ac_temp_upper_bound.getIntValue())
|
||||
{
|
||||
ESP_LOGW("CUD Display", "Temperature Bounds are invalid, setting to default");
|
||||
this->ac_temp_lower_bound.setIntValue(DEFAULT_TEMP_LOWER_BOUND);
|
||||
this->ac_temp_upper_bound.setIntValue(DEFAULT_TEMP_UPPER_BOUND);
|
||||
}
|
||||
|
@ -539,9 +540,15 @@ void CUDDisplay::handle_bound_change(char *value)
|
|||
// Lower Bound can't be less than AC_MIN_TEMP
|
||||
// Upper Bound can't be more than AC_MAX_TEMP
|
||||
// If any of the bound is invalid, set all to default
|
||||
if (this->ac_temp_lower_bound.getIntValue() < AC_MIN_TEMP || this->ac_temp_upper_bound.getIntValue() > AC_MAX_TEMP || this->ac_temp_lower_bound.getIntValue() >= this->ac_temp_upper_bound.getIntValue())
|
||||
if (this->ac_temp_lower_bound.getIntValue() < AC_MIN_TEMP || this->ac_temp_lower_bound.getIntValue() >= this->ac_temp_upper_bound.getIntValue())
|
||||
{
|
||||
ESP_LOGV("CUD Display", "Invalid Lower Bound, Setting to Default");
|
||||
this->ac_temp_lower_bound.setIntValue(DEFAULT_TEMP_LOWER_BOUND);
|
||||
}
|
||||
|
||||
if (this->ac_temp_upper_bound.getIntValue() > AC_MAX_TEMP || this->ac_temp_lower_bound.getIntValue() >= this->ac_temp_upper_bound.getIntValue())
|
||||
{
|
||||
ESP_LOGV("CUD Display", "Invalid Upper Bound, Setting to Default");
|
||||
this->ac_temp_upper_bound.setIntValue(DEFAULT_TEMP_UPPER_BOUND);
|
||||
}
|
||||
// Does the current temperature exceed the new upper bound?, if it does, bound it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue