esp32_ethernet_milight_hub/lib/Settings/AboutHelper.cpp

28 lines
No EOL
729 B
C++

#include <AboutHelper.h>
#include <ArduinoJson.h>
#include <Settings.h>
#include <ETH.h>
String AboutHelper::generateAboutString(bool abbreviated) {
DynamicJsonDocument buffer(1024);
generateAboutObject(buffer, abbreviated);
String body;
serializeJson(buffer, body);
return body;
}
void AboutHelper::generateAboutObject(JsonDocument& obj, bool abbreviated) {
obj["firmware"] = QUOTE(FIRMWARE_NAME);
obj["version"] = QUOTE(MILIGHT_HUB_VERSION);
obj["ip_address"] = ETH.localIP().toString();
//obj["reset_reason"] = ESP.getResetReason();
if (! abbreviated) {
obj["variant"] = QUOTE(FIRMWARE_VARIANT);
obj["free_heap"] = ESP.getFreeHeap();
//obj["arduino_version"] = ESP.getCoreVersion();
}
}