1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 00:22:21 +01:00

[version] Reduce flash usage by optimizing string concatenation in setup() (#10890)

This commit is contained in:
J. Nick Koston
2025-09-25 19:12:39 -05:00
committed by GitHub
parent 2b12ff5874
commit 195d1be4a9

View File

@@ -2,6 +2,7 @@
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/version.h" #include "esphome/core/version.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace version { namespace version {
@@ -12,7 +13,7 @@ void VersionTextSensor::setup() {
if (this->hide_timestamp_) { if (this->hide_timestamp_) {
this->publish_state(ESPHOME_VERSION); this->publish_state(ESPHOME_VERSION);
} else { } else {
this->publish_state(ESPHOME_VERSION " " + App.get_compilation_time()); this->publish_state(str_sprintf(ESPHOME_VERSION " %s", App.get_compilation_time().c_str()));
} }
} }
float VersionTextSensor::get_setup_priority() const { return setup_priority::DATA; } float VersionTextSensor::get_setup_priority() const { return setup_priority::DATA; }