mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
comment changes
This commit is contained in:
@@ -192,6 +192,8 @@ class EMSdevice {
|
|||||||
Value & value,
|
Value & value,
|
||||||
const __FlashStringHelper * suffix,
|
const __FlashStringHelper * suffix,
|
||||||
const uint8_t format = 0) {
|
const uint8_t format = 0) {
|
||||||
|
|
||||||
|
// create the value as a string using the render_value function
|
||||||
char buffer[15];
|
char buffer[15];
|
||||||
if (Helpers::render_value(buffer, value, format) == nullptr) {
|
if (Helpers::render_value(buffer, value, format) == nullptr) {
|
||||||
return;
|
return;
|
||||||
@@ -199,8 +201,7 @@ class EMSdevice {
|
|||||||
|
|
||||||
JsonObject dataElement = json.createNestedObject();
|
JsonObject dataElement = json.createNestedObject();
|
||||||
|
|
||||||
// copy flash into std::strings to ensure arduinojson can reference them without a copy
|
// append suffix to end
|
||||||
|
|
||||||
if (suffix != nullptr) {
|
if (suffix != nullptr) {
|
||||||
std::string text(20, '\0');
|
std::string text(20, '\0');
|
||||||
snprintf_P(&text[0], text.capacity() + 1, PSTR("%s%s"), buffer, uuid::read_flash_string(suffix).c_str());
|
snprintf_P(&text[0], text.capacity() + 1, PSTR("%s%s"), buffer, uuid::read_flash_string(suffix).c_str());
|
||||||
@@ -209,6 +210,7 @@ class EMSdevice {
|
|||||||
dataElement["value"] = buffer;
|
dataElement["value"] = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add prefix to name
|
||||||
std::string text2(100, '\0');
|
std::string text2(100, '\0');
|
||||||
snprintf_P(&text2[0], text2.capacity() + 1, PSTR("%s%s"), prefix.c_str(), uuid::read_flash_string(name).c_str());
|
snprintf_P(&text2[0], text2.capacity() + 1, PSTR("%s%s"), prefix.c_str(), uuid::read_flash_string(name).c_str());
|
||||||
dataElement["name"] = text2;
|
dataElement["name"] = text2;
|
||||||
|
|||||||
Reference in New Issue
Block a user