mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
rename boot time, free mem, free app, add web buffer to info command output
This commit is contained in:
@@ -547,7 +547,7 @@ void System::send_info_mqtt(const char * event_str, bool send_ntp) {
|
|||||||
char time_string[25];
|
char time_string[25];
|
||||||
time_t now = time(nullptr) - uuid::get_uptime_sec();
|
time_t now = time(nullptr) - uuid::get_uptime_sec();
|
||||||
strftime(time_string, 25, "%FT%T%z", localtime(&now));
|
strftime(time_string, 25, "%FT%T%z", localtime(&now));
|
||||||
doc["boot_time"] = time_string;
|
doc["boot time"] = time_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
@@ -1073,7 +1073,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
node["free mem"] = ESP.getFreeHeap() / 1024; // kilobytes
|
node["free mem"] = ESP.getFreeHeap() / 1024; // kilobytes
|
||||||
node["maxalloc"] = ESP.getMaxAllocHeap() / 1024; // kilobytes
|
node["maxalloc"] = ESP.getMaxAllocHeap() / 1024; // kilobytes
|
||||||
node["free_app"] = EMSESP::system_.appFree(); // kilobytes
|
node["free app"] = EMSESP::system_.appFree(); // kilobytes
|
||||||
#endif
|
#endif
|
||||||
node["reset reason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
|
node["reset reason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
|
||||||
|
|
||||||
@@ -1264,6 +1264,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
node["enum format"] = settings.enum_format;
|
node["enum format"] = settings.enum_format;
|
||||||
node["analog enabled"] = settings.analog_enabled;
|
node["analog enabled"] = settings.analog_enabled;
|
||||||
node["telnet enabled"] = settings.telnet_enabled;
|
node["telnet enabled"] = settings.telnet_enabled;
|
||||||
|
node["web log buffer"] = settings.weblog_buffer;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Devices - show EMS devices if we have any
|
// Devices - show EMS devices if we have any
|
||||||
@@ -1415,8 +1416,8 @@ std::string System::reset_reason(uint8_t cpu) const {
|
|||||||
void System::ntp_connected(bool b) {
|
void System::ntp_connected(bool b) {
|
||||||
if (b != ntp_connected_) {
|
if (b != ntp_connected_) {
|
||||||
LOG_INFO(b ? "NTP connected" : "NTP disconnected"); // if changed report it
|
LOG_INFO(b ? "NTP connected" : "NTP disconnected"); // if changed report it
|
||||||
emsesp::EMSESP::system_.send_info_mqtt("connected", true); // send info topic, but only once
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ntp_connected_ = b;
|
ntp_connected_ = b;
|
||||||
ntp_last_check_ = b ? uuid::get_uptime_sec() : 0;
|
ntp_last_check_ = b ? uuid::get_uptime_sec() : 0;
|
||||||
}
|
}
|
||||||
@@ -1427,6 +1428,7 @@ bool System::ntp_connected() {
|
|||||||
if ((uuid::get_uptime_sec() - ntp_last_check_ > 7201) && ntp_connected_) {
|
if ((uuid::get_uptime_sec() - ntp_last_check_ > 7201) && ntp_connected_) {
|
||||||
ntp_connected(false);
|
ntp_connected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ntp_connected_;
|
return ntp_connected_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user