arduino socket

This commit is contained in:
ackimixs
2024-05-02 11:55:07 +02:00
parent 6199bbe58c
commit 83a3ee2678
2 changed files with 5 additions and 5 deletions

View File

@@ -702,20 +702,19 @@ void TCPServer::goToAruco(const ArucoTag &arucoTag, const int pince) {
}
void TCPServer::askArduinoPos() {
ClientTCP arduino;
for (const auto & client : clients) {
if (client.name == "arduino") {
arduino = client;
this->arduinoSocket = client.socket;
break;
}
}
if (arduino.socket == -1) {
if (this->arduinoSocket == -1) {
return;
}
while (!this->_shouldStop) {
this->sendToClient("strat;arduino;get pos;1\n", arduino.socket);
this->sendToClient("strat;arduino;get pos;1\n", this->arduinoSocket);
usleep(200'000);
}
}
@@ -727,7 +726,7 @@ void TCPServer::awaitRobotIdle() {
// ReSharper disable once CppDFAEndlessLoop
while (isRobotIdle < 2) {
usleep(100'000);
this->broadcastMessage("strat;arduino;get state;1\n");
this->sendToClient("strat;arduino;get state;1\n", this->arduinoSocket);
timeout++;
/*if (timeout > 30) {
this->broadcastMessage("strat;arduino;clear;1");

View File

@@ -134,6 +134,7 @@ private:
std::thread gameThread;
int lidarSocket = -1;
int arduinoSocket = -1;
int firstTimeDropWhiteFlower = 0;