Webui small fixes (#3713)

This commit is contained in:
anatoly-savchenkov
2022-08-15 01:28:29 +03:00
committed by GitHub
parent e008b054cb
commit 01a4443b6c
5 changed files with 604 additions and 589 deletions
+1 -10
View File
@@ -1,19 +1,10 @@
#include "climate_traits.h"
#include <cstdio>
namespace esphome {
namespace climate {
int8_t ClimateTraits::get_temperature_accuracy_decimals() const {
// use printf %g to find number of digits based on temperature step
char buf[32];
sprintf(buf, "%.5g", this->visual_temperature_step_);
std::string str{buf};
size_t dot_pos = str.find('.');
if (dot_pos == std::string::npos)
return 0;
return str.length() - dot_pos - 1;
return step_to_accuracy_decimals(this->visual_temperature_step_);
}
} // namespace climate