From 6fbaca79300677b355e15215f78e35cb5f724857 Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Fri, 31 Mar 2023 16:50:18 +0100 Subject: [PATCH] Update IO_DFPlayer.h Ensure device goes off-line when not responding. --- IO_DFPlayer.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IO_DFPlayer.h b/IO_DFPlayer.h index c12ae0b..4c2b2f1 100644 --- a/IO_DFPlayer.h +++ b/IO_DFPlayer.h @@ -231,8 +231,10 @@ protected: // Poll device every second that other commands aren't being sent, // to check if it's still connected and responding. sendPacket(0x42); - _timeoutTime = currentMicros + 5000000UL; // Timeout if no response within 5 seconds - _awaitingResponse = true; + if (!_awaitingResponse) { + _timeoutTime = currentMicros + 5000000UL; // Timeout if no response within 5 seconds + _awaitingResponse = true; + } } } }