diff --git a/src/Main.cpp b/src/Main.cpp index cdb8be18..01b5d131 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -36,7 +36,7 @@ void setup() { String ntpServer = jsonReadStr(settingsFlashJson, F("ntp")); int timezone = jsonReadInt(settingsFlashJson, F("timezone")); configTime(3600*timezone, 0, ntpServer.c_str(), "ru.pool.ntp.org", "pool.ntp.org"); - Serial.print("Start syncing NTP time"); + Serial.println("Start syncing NTP time"); time(&iotTimeNow); // int i = 0; // while (isNetworkActive() && iotTimeNow < 1510592825 && i < 200) @@ -52,8 +52,8 @@ void setup() { watch = new IoTRTC(0); // создаем объект главного хранилища времени, но с заглушкой (0) для получения системного времени watch->period(60); // время в минутах для синхронизации с часами реального времени или системным watch->begin(); - Serial.print(F("Time from Local: ")); - Serial.println(watch->gettime("d-m-Y, H:i:s, M")); + //Serial.print(F("Time from Local: ")); + //Serial.println(watch->gettime("d-m-Y, H:i:s, M")); //инициализация асинхронного веб сервера и веб сокетов #ifdef ASYNC_WEB_SERVER diff --git a/src/utils/SerialPrint.cpp b/src/utils/SerialPrint.cpp index 7a2e9b40..ed4c7cbc 100644 --- a/src/utils/SerialPrint.cpp +++ b/src/utils/SerialPrint.cpp @@ -1,8 +1,15 @@ #include "utils/SerialPrint.h" +#include "classes/IoTRTC.h" + +extern IoTRTC *watch; void SerialPrint(String errorLevel, String module, String msg) { - String tosend = prettyMillis(millis()) + " [" + errorLevel + "] [" + module + "] " + msg; + String tosend; + if (watch) tosend = watch->gettime("d.m.y H:i:s"); + else tosend = prettyMillis(millis()); + + tosend = tosend + " [" + errorLevel + "] [" + module + "] " + msg; Serial.println(tosend); if (isNetworkActive()) {