burner settings use min/max from telegram 4, fix max for values < 0

This commit is contained in:
MichaelDvP
2023-09-21 16:48:39 +02:00
parent 6655035561
commit 5abfdf1177
4 changed files with 27 additions and 7 deletions

View File

@@ -327,7 +327,7 @@ bool DeviceValue::get_custom_min(int16_t & val) {
bool has_min = (min_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
if (has_min) {
uint32_t v = Helpers::atoint(custom_fullname.substr(min_pos + 1).c_str());
int16_t v = Helpers::atoint(custom_fullname.substr(min_pos + 1).c_str());
if (fahrenheit) {
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
}
@@ -345,7 +345,7 @@ bool DeviceValue::get_custom_max(uint32_t & val) {
bool has_max = (max_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
if (has_max) {
int v = Helpers::atoint(custom_fullname.substr(max_pos + 1).c_str());
int32_t v = Helpers::atoint(custom_fullname.substr(max_pos + 1).c_str());
if (fahrenheit) {
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
}