diff --git a/lib/MycilaAppInfo/MycilaAppInfo.cpp b/lib/MycilaAppInfo/MycilaAppInfo.cpp index 92ff3bb..1ba9c28 100644 --- a/lib/MycilaAppInfo/MycilaAppInfo.cpp +++ b/lib/MycilaAppInfo/MycilaAppInfo.cpp @@ -33,7 +33,7 @@ extern const char* __COMPILED_BUILD_HASH__; extern const char* __COMPILED_BUILD_NAME__; extern const char* __COMPILED_BUILD_TIMESTAMP__; -Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System.getEspID()), +Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()), name(APP_NAME), model(APP_MODEL), version(__COMPILED_APP_VERSION__), diff --git a/platformio.ini b/platformio.ini index fca9aa4..26df165 100644 --- a/platformio.ini +++ b/platformio.ini @@ -72,7 +72,7 @@ lib_deps = mathieucarbou/MycilaPulseAnalyzer @ 1.0.2 mathieucarbou/MycilaPZEM004Tv3 @ 4.0.7 mathieucarbou/MycilaRelay @ 4.0.1 - mathieucarbou/MycilaSystem @ 2.0.8 + mathieucarbou/MycilaSystem @ 3.0.1 mathieucarbou/MycilaTaskManager @ 3.1.2 mathieucarbou/MycilaTaskMonitor @ 3.0.1 mathieucarbou/MycilaTrafficLight @ 1.0.0 diff --git a/src/Website.cpp b/src/Website.cpp index f01902c..17d34a5 100644 --- a/src/Website.cpp +++ b/src/Website.cpp @@ -454,7 +454,7 @@ void YaSolR::WebsiteClass::initCards() { _appModel.set((Mycila::AppInfo.model.c_str())); _appName.set((Mycila::AppInfo.name.c_str())); _appVersion.set(Mycila::AppInfo.version.c_str()); - _deviceBootCount.set(String(Mycila::System.getBootCount()).c_str()); + _deviceBootCount.set(String(Mycila::System::getBootCount()).c_str()); _deviceCores.set(String(ESP.getChipCores()).c_str()); _deviceModel.set(ESP.getChipModel()); _deviceRev.set(String(ESP.getChipRevision()).c_str()); @@ -778,7 +778,8 @@ void YaSolR::WebsiteClass::updateCards() { } // stats - Mycila::SystemMemory memory = Mycila::System.getMemory(); + Mycila::System::Memory memory; + Mycila::System::getMemory(memory); Mycila::ESPConnect::Mode mode = espConnect.getMode(); _output1RelaySwitchCount.set(String(bypassRelayO1.getSwitchCount()).c_str()); _output2RelaySwitchCount.set(String(bypassRelayO2.getSwitchCount()).c_str()); @@ -800,7 +801,7 @@ void YaSolR::WebsiteClass::updateCards() { _zcdPulsePeriod.set((String(pulseAnalyzer.getPeriod()) + " us").c_str()); _zcdPulseLength.set((String(pulseAnalyzer.getLength()) + " us").c_str()); _time.set(Mycila::Time::getLocalStr().c_str()); - _uptime.set(Mycila::Time::toDHHMMSS(Mycila::System.getUptime()).c_str()); + _uptime.set(Mycila::Time::toDHHMMSS(Mycila::System::getUptime()).c_str()); #ifdef APP_MODEL_TRIAL _trialRemainingTime.set(Mycila::Time::toDHHMMSS(Mycila::Trial.getRemaining()).c_str()); #endif diff --git a/src/init/Boot.cpp b/src/init/Boot.cpp index 287707b..41d3ac7 100644 --- a/src/init/Boot.cpp +++ b/src/init/Boot.cpp @@ -19,7 +19,7 @@ Mycila::Task bootTask("Boot", [](void* params) { logger.warn(TAG, "Booting %s", Mycila::AppInfo.nameModelVersion.c_str()); // system - Mycila::System.begin(true, "fs"); + Mycila::System::init(true, "fs"); // trial #ifdef APP_MODEL_TRIAL diff --git a/src/init/REST.cpp b/src/init/REST.cpp index 6196aac..3dad9bc 100644 --- a/src/init/REST.cpp +++ b/src/init/REST.cpp @@ -10,14 +10,15 @@ #include static void systemInfoToJson(JsonObject& root) { - Mycila::SystemMemory memory = Mycila::System.getMemory(); + Mycila::System::Memory memory; + Mycila::System::getMemory(memory); root["app"]["manufacturer"] = Mycila::AppInfo.manufacturer; root["app"]["model"] = Mycila::AppInfo.model; root["app"]["name"] = Mycila::AppInfo.name; root["app"]["version"] = Mycila::AppInfo.version; - root["device"]["boots"] = Mycila::System.getBootCount(); + root["device"]["boots"] = Mycila::System::getBootCount(); root["device"]["cores"] = ESP.getChipCores(); root["device"]["cpu_freq"] = ESP.getCpuFreqMHz(); root["device"]["heap"]["total"] = memory.total; @@ -26,7 +27,7 @@ static void systemInfoToJson(JsonObject& root) { root["device"]["id"] = Mycila::AppInfo.id; root["device"]["model"] = ESP.getChipModel(); root["device"]["revision"] = ESP.getChipRevision(); - root["device"]["uptime"] = Mycila::System.getUptime(); + root["device"]["uptime"] = Mycila::System::getUptime(); root["firmware"]["build"]["branch"] = Mycila::AppInfo.buildBranch; root["firmware"]["build"]["hash"] = Mycila::AppInfo.buildHash; diff --git a/src/tasks/Display.cpp b/src/tasks/Display.cpp index 689cfc7..314f70a 100644 --- a/src/tasks/Display.cpp +++ b/src/tasks/Display.cpp @@ -151,8 +151,8 @@ Mycila::Task displayTask("Display", [](void* params) { default: { struct tm timeInfo; - display.home.printf("Restarts: %11" PRIu32 "\n", Mycila::System.getBootCount()); - display.home.printf("Uptime: %13.13s\n", Mycila::Time::toDHHMMSS(Mycila::System.getUptime()).c_str()); + display.home.printf("Restarts: %11" PRIu32 "\n", Mycila::System::getBootCount()); + display.home.printf("Uptime: %13.13s\n", Mycila::Time::toDHHMMSS(Mycila::System::getUptime()).c_str()); if (Mycila::NTP.isSynced() && getLocalTime(&timeInfo, 5)) display.home.printf("NTP Time: %02u:%02u\n", timeInfo.tm_hour, timeInfo.tm_min); else diff --git a/src/tasks/MQTT.cpp b/src/tasks/MQTT.cpp index 70001c5..bdae745 100644 --- a/src/tasks/MQTT.cpp +++ b/src/tasks/MQTT.cpp @@ -55,7 +55,7 @@ Mycila::Task mqttPublishStaticTask("MQTT Static", Mycila::TaskType::ONCE, [](voi mqtt.publish(baseTopic + "/system/app/version", Mycila::AppInfo.version, true); yield(); - mqtt.publish(baseTopic + "/system/device/boots", String(Mycila::System.getBootCount()), true); + mqtt.publish(baseTopic + "/system/device/boots", String(Mycila::System::getBootCount()), true); mqtt.publish(baseTopic + "/system/device/cores", String(ESP.getChipCores()), true); mqtt.publish(baseTopic + "/system/device/cpu_freq", String(ESP.getCpuFreqMHz()), true); mqtt.publish(baseTopic + "/system/device/heap/total", String(ESP.getHeapSize()), true); @@ -91,10 +91,12 @@ Mycila::Task mqttPublishConfigTask("MQTT Config", Mycila::TaskType::ONCE, [](voi Mycila::Task mqttPublishTask("MQTT", [](void* params) { const String baseTopic = config.get(KEY_MQTT_TOPIC); - Mycila::SystemMemory memory = Mycila::System.getMemory(); + Mycila::System::Memory memory; + Mycila::System::getMemory(memory); + mqtt.publish(baseTopic + "/system/device/heap/usage", String(memory.usage)); mqtt.publish(baseTopic + "/system/device/heap/used", String(memory.used)); - mqtt.publish(baseTopic + "/system/device/uptime", String(Mycila::System.getUptime())); + mqtt.publish(baseTopic + "/system/device/uptime", String(Mycila::System::getUptime())); yield(); mqtt.publish(baseTopic + "/system/network/eth/ip_address", espConnect.getIPAddress(Mycila::ESPConnect::Mode::ETH).toString()); diff --git a/src/tasks/Reset.cpp b/src/tasks/Reset.cpp index 89a30ce..97b483c 100644 --- a/src/tasks/Reset.cpp +++ b/src/tasks/Reset.cpp @@ -7,5 +7,5 @@ Mycila::Task resetTask("Reset", Mycila::TaskType::ONCE, [](void* params) { logger.warn("YaSolR", "Resetting %s", Mycila::AppInfo.nameModelVersion.c_str()); config.clear(); - Mycila::System.restart(500); + Mycila::System::restart(500); }); diff --git a/src/tasks/Restart.cpp b/src/tasks/Restart.cpp index b966e1f..c1536f6 100644 --- a/src/tasks/Restart.cpp +++ b/src/tasks/Restart.cpp @@ -6,5 +6,5 @@ Mycila::Task restartTask("Restart", Mycila::TaskType::ONCE, [](void* params) { logger.warn("YaSolR", "Restarting %s", Mycila::AppInfo.nameModelVersion.c_str()); - Mycila::System.restart(500); + Mycila::System::restart(500); }); diff --git a/src/tasks/SafeBoot.cpp b/src/tasks/SafeBoot.cpp index dfe4f32..3365b1d 100644 --- a/src/tasks/SafeBoot.cpp +++ b/src/tasks/SafeBoot.cpp @@ -20,5 +20,5 @@ Mycila::Task safeBootTask("SafeBoot", Mycila::TaskType::ONCE, [](void* params) { #ifdef APP_MODEL_TRIAL Mycila::Trial.end(); #endif - Mycila::System.restartFactory("safeboot"); + Mycila::System::restartFactory("safeboot"); });