diff --git a/esphome/components/esp32_hosted/update/esp32_hosted_update.cpp b/esphome/components/esp32_hosted/update/esp32_hosted_update.cpp index dcd6e643c2..abc5f29182 100644 --- a/esphome/components/esp32_hosted/update/esp32_hosted_update.cpp +++ b/esphome/components/esp32_hosted/update/esp32_hosted_update.cpp @@ -152,7 +152,7 @@ void Esp32HostedUpdate::setup() { void Esp32HostedUpdate::dump_config() { ESP_LOGCONFIG(TAG, - "ESP32 Hosted Update:\n" + "ESP32 Hostedd Update:\n" " Host Library Version: %s\n" " Coprocessor Version: %s\n" " Latest Version: %s", diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index fab701d5f1..682008c40e 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -375,7 +375,7 @@ json::SerializationBuffer<> WebServer::get_config_json() { JsonObject root = builder.root(); root[ESPHOME_F("title")] = App.get_friendly_name().empty() ? App.get_name().c_str() : App.get_friendly_name().c_str(); - char comment_buffer[Application::COMMENT_MAX_SIZE]; + char comment_buffer[Application::ESPHOME_COMMENT_SIZE_MAX]; App.get_comment_string(comment_buffer); root[ESPHOME_F("comment")] = comment_buffer; #if defined(USE_WEBSERVER_OTA_DISABLED) || !defined(USE_WEBSERVER_OTA) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 0bdfa2b586..4ed0224b19 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -215,8 +215,7 @@ void Application::loop() { void Application::process_dump_config_() { if (this->dump_config_at_ == 0) { char build_time_str[Application::BUILD_TIME_STR_SIZE]; - ESPHOME_strncpy_P(build_time_str, ESPHOME_BUILD_TIME_STR, sizeof(build_time_str)); - build_time_str[sizeof(build_time_str) - 1] = '\0'; + this->get_build_time_string(build_time_str); ESP_LOGI(TAG, "ESPHome version " ESPHOME_VERSION " compiled on %s", build_time_str); #ifdef ESPHOME_PROJECT_NAME ESP_LOGI(TAG, "Project " ESPHOME_PROJECT_NAME " version " ESPHOME_PROJECT_VERSION); @@ -750,27 +749,15 @@ void Application::get_build_time_string(std::span buf buffer[buffer.size() - 1] = '\0'; } -void Application::get_comment_string(std::span buffer) { +void Application::get_comment_string(std::span buffer) { ESPHOME_strncpy_P(buffer.data(), ESPHOME_COMMENT_STR, buffer.size()); buffer[buffer.size() - 1] = '\0'; } -std::string Application::get_comment() { - char buffer[COMMENT_MAX_SIZE]; - this->get_comment_string(buffer); - return std::string(buffer); -} - uint32_t Application::get_config_hash() { return ESPHOME_CONFIG_HASH; } uint32_t Application::get_config_version_hash() { return fnv1a_hash_extend(ESPHOME_CONFIG_HASH, ESPHOME_VERSION); } time_t Application::get_build_time() { return ESPHOME_BUILD_TIME; } -std::string Application::get_compilation_time() { - char buf[BUILD_TIME_STR_SIZE]; - this->get_build_time_string(buf); - return std::string(buf); -} - } // namespace esphome diff --git a/esphome/core/application.h b/esphome/core/application.h index ee5ec559f4..cd275bb97f 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -274,14 +274,14 @@ class Application { } /// Maximum size of the comment buffer (including null terminator) - static constexpr size_t COMMENT_MAX_SIZE = 256; + static constexpr size_t ESPHOME_COMMENT_SIZE_MAX = 256; /// Copy the comment string into the provided buffer - void get_comment_string(std::span buffer); + void get_comment_string(std::span buffer); /// Get the comment of this Application as a string std::string get_comment() { - char buffer[COMMENT_MAX_SIZE]; + char buffer[ESPHOME_COMMENT_SIZE_MAX]; this->get_comment_string(buffer); return std::string(buffer); }