From 0acd7853d767e23ec44bf27315b583df55130c44 Mon Sep 17 00:00:00 2001 From: ackimixs Date: Mon, 6 May 2024 10:31:00 +0200 Subject: [PATCH] add sleep statement --- TCPServer.cpp | 11 ++++++++++- TCPServer.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index f86882a..e9edc7e 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -271,7 +271,7 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) this->gameThread = std::thread([this]() { this->startGameTest(); }); break; case LIDAR: - this->stratPatterns = { GET_LIDAR_POS }; + this->stratPatterns = { SLEEP_5S, GET_LIDAR_POS }; this->gameThread = std::thread([this]() { this->startGame(); }); } @@ -520,6 +520,15 @@ void TCPServer::startGame() { case DROP_FLOWER_BASE_2: dropBaseFlowers(DROP_FLOWER_BASE_2); break; + case SLEEP_1S: + usleep(1'000'000); + break; + case SLEEP_5S: + usleep(5'000'000); + break; + case SLEEP_10S: + usleep(10'000'000); + break; } whereAmI++; } diff --git a/TCPServer.h b/TCPServer.h index 0e4de91..16a22e0 100644 --- a/TCPServer.h +++ b/TCPServer.h @@ -60,6 +60,9 @@ enum StratPattern { REMOVE_POT_J2, DROP_FLOWER_BASE_1, DROP_FLOWER_BASE_2, + SLEEP_1S, + SLEEP_5S, + SLEEP_10S, }; class TCPServer; // Forward declaration