Device: Wait longer to receive message in heart beat thread

pull/61/head
Emily Brooks 2023-08-07 18:32:28 -04:00
parent 53e66b8772
commit 188a087c51
1 changed files with 5 additions and 2 deletions

View File

@ -280,8 +280,11 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
// No heartbeat received, request a status // No heartbeat received, request a status
com->sendCommand(Command::RequestStatusUpdate); com->sendCommand(Command::RequestStatusUpdate);
// The response should come back quickly if the com is quiet
std::this_thread::sleep_for(std::chrono::milliseconds(50)); // Wait until we either received the message or reach max wait time
for (uint32_t sleepTime = 0; sleepTime < 3500 && !receivedMessage; sleepTime += 50)
std::this_thread::sleep_for(std::chrono::milliseconds(50));
// Check if we got a message, and if not, if settings are being applied // Check if we got a message, and if not, if settings are being applied
if(receivedMessage) { if(receivedMessage) {
receivedMessage = false; receivedMessage = false;