mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-10 17:59:53 +03:00
fix info command #2274, fix standanlone
This commit is contained in:
@@ -537,14 +537,14 @@ bool Command::list(const uint8_t device_type, JsonObject output) {
|
|||||||
output[F_(entities)] = Helpers::translated_word(FL_(entities_cmd));
|
output[F_(entities)] = Helpers::translated_word(FL_(entities_cmd));
|
||||||
|
|
||||||
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
||||||
output["settings/showertimer"] = Helpers::translated_word(FL_(system_cmd));
|
output["settings/showertimer"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["settings/showeralert"] = Helpers::translated_word(FL_(system_cmd));
|
output["settings/showeralert"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["settings/hideled"] = Helpers::translated_word(FL_(system_cmd));
|
output["settings/hideled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["settings/analogenabled"] = Helpers::translated_word(FL_(system_cmd));
|
output["settings/analogenabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["mqtt/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
output["mqtt/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["ntp/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
output["ntp/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["ap/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
output["ap/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
output["syslog/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
output["syslog/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||||
}
|
}
|
||||||
// create a list of commands we have registered, and sort them
|
// create a list of commands we have registered, and sort them
|
||||||
std::list<std::string> sorted_cmds;
|
std::list<std::string> sorted_cmds;
|
||||||
@@ -670,11 +670,7 @@ 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_) {
|
return true;
|
||||||
if (cf.device_type_ == device_type) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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