mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
fix render long numbers, #2267
This commit is contained in:
@@ -214,7 +214,7 @@ bool WebCustomEntityService::command_setvalue(const char * value, const int8_t i
|
||||
// output of a single value
|
||||
// if add_uom is true it will add the UOM string to the value
|
||||
void WebCustomEntityService::render_value(JsonObject output, CustomEntityItem & entity, const bool useVal, const bool web, const bool add_uom) {
|
||||
char payload[12];
|
||||
char payload[20];
|
||||
std::string name = useVal ? "value" : entity.name;
|
||||
switch (entity.value_type) {
|
||||
case DeviceValueType::BOOL:
|
||||
@@ -496,7 +496,7 @@ void WebCustomEntityService::generate_value_web(JsonObject output, const bool is
|
||||
obj["c"] = entity.name;
|
||||
include = true;
|
||||
if (entity.value_type != DeviceValueType::BOOL && entity.value_type != DeviceValueType::STRING) {
|
||||
char s[10];
|
||||
char s[20];
|
||||
obj["s"] = Helpers::render_value(s, entity.factor, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,10 +267,10 @@ void WebDataService::write_device_value(AsyncWebServerRequest * request, JsonVar
|
||||
if (data.is<const char *>()) {
|
||||
return_code = Command::call(device_type, cmd, data.as<const char *>(), true, id, output);
|
||||
} else if (data.is<int>()) {
|
||||
char s[10];
|
||||
char s[20];
|
||||
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<int32_t>(), 0), true, id, output);
|
||||
} else if (data.is<float>()) {
|
||||
char s[10];
|
||||
char s[20];
|
||||
return_code = Command::call(device_type, cmd, Helpers::render_value(s, data.as<float>(), 1), true, id, output);
|
||||
} else if (data.is<bool>()) {
|
||||
return_code = Command::call(device_type, cmd, data.as<bool>() ? "true" : "false", true, id, output);
|
||||
|
||||
Reference in New Issue
Block a user