diff --git a/DFRobotDFPlayerMini.cpp b/DFRobotDFPlayerMini.cpp index 337d14c..2468573 100644 --- a/DFRobotDFPlayerMini.cpp +++ b/DFRobotDFPlayerMini.cpp @@ -88,7 +88,7 @@ bool DFRobotDFPlayerMini::waitAvailable(){ return _handleType != TimeOut; } -bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK){ +bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK, bool doReset){ if (isACK) { enableACK(); } @@ -97,11 +97,18 @@ bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK){ } _serial = &stream; - _timeOutDuration += 3000; - reset(); - waitAvailable(); - _timeOutDuration -= 3000; - delay(200); + + if (doReset) { + _timeOutDuration += 3000; + reset(); + waitAvailable(); + _timeOutDuration -= 3000; + delay(200); + } else { + // assume same state as with reset(): online + _handleType = DFPlayerCardOnline; + } + return (readType() == DFPlayerCardOnline) || !isACK; } diff --git a/DFRobotDFPlayerMini.h b/DFRobotDFPlayerMini.h index 825e8dd..ec72f19 100644 --- a/DFRobotDFPlayerMini.h +++ b/DFRobotDFPlayerMini.h @@ -105,7 +105,7 @@ class DFRobotDFPlayerMini { uint8_t readCommand(); - bool begin(Stream& stream, bool isACK = true); + bool begin(Stream& stream, bool isACK = true, bool doReset = true); bool waitAvailable();