This commit is contained in:
J. Nick Koston
2025-12-18 06:58:32 -10:00
parent 12d8e2ada2
commit 5547f9f5d6
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ std::string WebServer::get_config_json() {
root[ESPHOME_F("title")] = App.get_friendly_name().empty() ? App.get_name() : App.get_friendly_name();
char comment_buffer[ESPHOME_COMMENT_SIZE];
App.get_comment_string(comment_buffer, sizeof(comment_buffer));
App.get_comment_string(comment_buffer);
root[ESPHOME_F("comment")] = comment_buffer;
#if defined(USE_WEBSERVER_OTA_DISABLED) || !defined(USE_WEBSERVER_OTA)
root[ESPHOME_F("ota")] = false; // Note: USE_WEBSERVER_OTA_DISABLED only affects web_server, not captive_portal
+5 -5
View File
@@ -257,10 +257,10 @@ class Application {
}
/// Copy the comment string into the provided buffer
/// Buffer must be ESPHOME_COMMENT_SIZE bytes
void get_comment_string(char *buffer, size_t size) {
ESPHOME_strncpy_P(buffer, ESPHOME_COMMENT_STR, size);
buffer[size - 1] = '\0';
/// Buffer must be ESPHOME_COMMENT_SIZE bytes (compile-time enforced)
void get_comment_string(std::span<char, ESPHOME_COMMENT_SIZE> buffer) {
ESPHOME_strncpy_P(buffer.data(), ESPHOME_COMMENT_STR, buffer.size());
buffer[buffer.size() - 1] = '\0';
}
/// Get the comment of this Application (deprecated, use get_comment_string() instead)
@@ -268,7 +268,7 @@ class Application {
ESPDEPRECATED("Use get_comment_string() instead. Removed in 2026.7.0", "2026.1.0")
std::string get_comment() {
char buffer[ESPHOME_COMMENT_SIZE];
this->get_comment_string(buffer, sizeof(buffer));
this->get_comment_string(buffer);
return std::string(buffer);
}