Меняем формат штампа времени в логах

This commit is contained in:
2022-04-30 09:28:49 +03:00
parent 790c289183
commit 83c5d74d7a
2 changed files with 11 additions and 4 deletions

View File

@@ -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

View File

@@ -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()) {