Round up temperature step

Partially solves #2063
This commit is contained in:
Edward Firmo
2024-04-24 11:13:02 +02:00
parent 79253683f9
commit baef06fadf
2 changed files with 10 additions and 12 deletions

View File

@@ -173,8 +173,8 @@ script:
auto CelsiusToFahrenheit = [](float celsius) -> float {
return (celsius * 9 / 5) + 32;
};
std::string temp_units = "${temp_units}";
bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
const std::string temp_units = "${temp_units}";
const bool temp_unit_fahrenheit = (temp_units == "°F" || temp_units == "F" || temp_units == "°f" || temp_units == "f");
ClimateTraits traits = thermostat_embedded->get_traits();
disp1->set_component_text("page_label", id(addon_climate_friendly_name).c_str());
@@ -187,7 +187,7 @@ script:
float temp_current = thermostat_embedded->current_temperature;
if (temp_unit_fahrenheit) {
//temp_step = CelsiusToFahrenheit(temp_step);
temp_step = temp_step * 1.8;
temp_step = std::ceil(temp_step * 1.8);
temp_offset = CelsiusToFahrenheit(temp_offset);
temp_max = CelsiusToFahrenheit(temp_max);
temp_target = CelsiusToFahrenheit(temp_target);