ESPHome  2022.6.2
climate_traits.cpp
Go to the documentation of this file.
1 #include "climate_traits.h"
2 #include <cstdio>
3 
4 namespace esphome {
5 namespace climate {
6 
8  // use printf %g to find number of digits based on temperature step
9  char buf[32];
10  sprintf(buf, "%.5g", this->visual_temperature_step_);
11  std::string str{buf};
12  size_t dot_pos = str.find('.');
13  if (dot_pos == std::string::npos)
14  return 0;
15 
16  return str.length() - dot_pos - 1;
17 }
18 
19 } // namespace climate
20 } // namespace esphome
int8_t get_temperature_accuracy_decimals() const
Definition: a4988.cpp:4