From 4900c36e0b6a3261c38cd2f0ec66d4b6fa193184 Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Fri, 8 Sep 2023 13:25:57 +0200 Subject: [PATCH] More fixes for logging --- firmware/src/LoggingAPI.h | 4 ++-- firmware/src/firmware_main.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/src/LoggingAPI.h b/firmware/src/LoggingAPI.h index 268f368..fde2524 100644 --- a/firmware/src/LoggingAPI.h +++ b/firmware/src/LoggingAPI.h @@ -40,7 +40,7 @@ class LoggingAPI const auto endIt = logger->end(); StaticJsonDocument<512> data; - for(auto it = beginIt; it != endIt; ++beginIt) { + for(auto it = beginIt; it != endIt; ++it) { data["time"] = it.time_millis(); data["msg"] = it.message(); server.template sendToAll<512>(MessageCode::LOG_UPDATE, data); @@ -51,7 +51,7 @@ class LoggingAPI private: bool running_ = false; - Logger::iterator lastEnd_; + Logger::iterator lastEnd_ = Logger::iterator(nullptr); bool firstCall_ = false; }; diff --git a/firmware/src/firmware_main.cpp b/firmware/src/firmware_main.cpp index 793576c..00d39ab 100644 --- a/firmware/src/firmware_main.cpp +++ b/firmware/src/firmware_main.cpp @@ -25,6 +25,7 @@ #include "WebsocketServer.h" #include "SessionAPI.h" #include "WifiAPI.h" +#include "LoggingAPI.h" using Session_T = SimpleMeasurementSession; SessionManager sessionManager; @@ -35,7 +36,7 @@ EspHttp espHttpServer; WifiManager wifiManager; -auto apiTuple = std::make_tuple(SessionAPI(sessionManager), WifiAPI(wifiManager)); +auto apiTuple = std::make_tuple(SessionAPI(sessionManager), WifiAPI(wifiManager), LoggingAPI()); WebsocketServer websocketServer(81, apiTuple); //WebsocketServer webSocketServer(sessionManager, userStorage, 81);