1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-25 13:13:48 +01:00

[web_server] Reduce flash and RAM usage by optimizing string construction (#10986)

This commit is contained in:
J. Nick Koston
2025-10-05 15:42:23 -05:00
committed by GitHub
parent 84c3cf5f17
commit 5932a4bd0e
3 changed files with 72 additions and 47 deletions

View File

@@ -45,6 +45,9 @@
namespace esphome {
// Forward declaration to avoid circular dependency with string_ref.h
class StringRef;
/// @name STL backports
///@{
@@ -610,6 +613,8 @@ ParseOnOffState parse_on_off(const char *str, const char *on = nullptr, const ch
/// Create a string from a value and an accuracy in decimals.
std::string value_accuracy_to_string(float value, int8_t accuracy_decimals);
/// Create a string from a value, an accuracy in decimals, and a unit of measurement.
std::string value_accuracy_with_uom_to_string(float value, int8_t accuracy_decimals, StringRef unit_of_measurement);
/// Derive accuracy in decimals from an increment step.
int8_t step_to_accuracy_decimals(float step);