DFPlayerMini_Fast icon indicating copy to clipboard operation
DFPlayerMini_Fast copied to clipboard

No Way To Tell If Command Is Finished

Open 4-codedev opened this issue 2 years ago • 1 comments

Hi, a really useful feature would be a way to tell when a Query/Command is finished, since it throws and error when a command is not finished and another is requested.

4-codedev avatar Jul 03 '23 21:07 4-codedev

Hi, a query is finnished when the function returns so you receive an result. Some modules support waiting until the command has been finished.

I wrote a little function which will wait until the player is in idle mode (value 0) or while it is playing (value 2).

void waitForDFPlayer()
{
  int16_t playerStatus = -1;
  while( ( playerStatus != 0 ) && ( playerStatus != 2 ) )
  {
    playerStatus = myMP3.query( dfplayer::GET_STATUS_ );
    delay( 100 );
  }
} // void waitForDFPlayer()

derniwi avatar Jul 21 '23 18:07 derniwi