mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-11 18:29:52 +03:00
fix info command #2274, fix standanlone
This commit is contained in:
@@ -670,13 +670,9 @@ bool Command::device_has_commands(const uint8_t device_type) {
|
|||||||
|
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
for (const auto & cf : cmdfunctions_) {
|
|
||||||
if (cf.device_type_ == device_type) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,11 +256,17 @@ char * Helpers::render_value(char * result, const double value, const int8_t for
|
|||||||
double v = value < 0 ? value - 1.0 / (2 * p[format]) : value + 1.0 / (2 * p[format]);
|
double v = value < 0 ? value - 1.0 / (2 * p[format]) : value + 1.0 / (2 * p[format]);
|
||||||
auto whole = (long long)v;
|
auto whole = (long long)v;
|
||||||
|
|
||||||
if (whole == 0 && v < 0) {
|
if (whole <= 0 && v < 0) {
|
||||||
result[0] = '-';
|
result[0] = '-';
|
||||||
result++;
|
result++;
|
||||||
|
whole = -whole;
|
||||||
|
v = -v;
|
||||||
}
|
}
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
lltoa(whole, result, 10);
|
lltoa(whole, result, 10);
|
||||||
|
#else
|
||||||
|
ultostr(result, whole, 10);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (*result != '\0') {
|
while (*result != '\0') {
|
||||||
result++;
|
result++;
|
||||||
|
|||||||
Reference in New Issue
Block a user