Skip to content

Commit

Permalink
mathieucarbou/MycilaSystem @ 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Sep 3, 2024
1 parent 683f0d2 commit 12bfeea
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/MycilaAppInfo/MycilaAppInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__),
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/Website.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/init/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/init/REST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#include <map>

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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/tasks/MQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/Reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
2 changes: 1 addition & 1 deletion src/tasks/Restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
2 changes: 1 addition & 1 deletion src/tasks/SafeBoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

0 comments on commit 12bfeea

Please sign in to comment.