From da1fe6070e743cfa010b35a0f6ad230b3807a359 Mon Sep 17 00:00:00 2001 From: arkadiusz Date: Wed, 28 Aug 2024 16:29:35 +0200 Subject: [PATCH] Remove ID and x-coordinate from the JSON output, adjust WebSocket thread timing - The inclusion of 'Id' and 'x' in the JSON output within 'captureDataToJson' has been commented out and replaced by the timestamp field for debugging purposes. - Restored the 5ms sleep delay in the 'WebSocketHandler' main loop to manage thread timing. This update temporarily removes the 'id' and 'x' values from the JSON output for debugging purposes and focuses on the timestamp data. It also reintroduces a controlled delay in the WebSocket handling loop to effectively manage processing intervals. --- src/jsonhandler.cpp | 8 ++++++-- src/websockethandler.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/jsonhandler.cpp b/src/jsonhandler.cpp index b52d2091..2dcb3b63 100644 --- a/src/jsonhandler.cpp +++ b/src/jsonhandler.cpp @@ -13,8 +13,12 @@ nlohmann::json captureDataToJson(const std::map(tuple).time_since_epoch().count(); nlohmann::json dataPoint = { - {"Id", id.serial}, - {"x", std::get<0>(tuple)}, + + // DEBUG ID + // {"Id", id.serial}, + // Replaced by a timestamp + // {"x", std::get<0>(tuple)}, + {"y", std::get<1>(tuple)}, {"timestamp", timestamp} }; diff --git a/src/websockethandler.cpp b/src/websockethandler.cpp index 1626d699..f0e7ec75 100644 --- a/src/websockethandler.cpp +++ b/src/websockethandler.cpp @@ -64,7 +64,7 @@ void WebSocketHandler::startWebSocketThread(const std::set& selecte send(captureData, selected_serials); } - // std::this_thread::sleep_for(std::chrono::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } }); webSocketThread.detach();