From eb30c016bd48a89f0002338941c4c5d0bc895d38 Mon Sep 17 00:00:00 2001 From: Henry Zhang Date: Mon, 12 Nov 2018 18:49:56 +0800 Subject: [PATCH] fix failure to initialize issue --- DFRobotDFPlayerMini.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/DFRobotDFPlayerMini.cpp b/DFRobotDFPlayerMini.cpp index bd60a66..07626a0 100644 --- a/DFRobotDFPlayerMini.cpp +++ b/DFRobotDFPlayerMini.cpp @@ -34,7 +34,7 @@ void DFRobotDFPlayerMini::sendStack(){ if (_sending[Stack_ACK]) { //if the ack mode is on wait until the last transmition while (_isSending) { delay(0); - available(); + waitAvailable(); } } @@ -88,7 +88,7 @@ bool DFRobotDFPlayerMini::waitAvailable(unsigned long duration){ } while (!available()){ if (millis() - timer > duration) { - return false; + return handleError(TimeOut); } delay(0); } @@ -281,9 +281,6 @@ bool DFRobotDFPlayerMini::available(){ } } - if (_isSending && (millis()-_timeOutTimer>=_timeOutDuration)) { - return handleError(TimeOut); - } return _isAvailable; }