DFR Mini Player ('Fast' library): Removing 'Send Stack' messages edit

I’ve been using the DF Player Mini MP3 Player module with the official DFR library. But now I’m trying the DFPlayerMini_Fast library again. There are relatively few examples around (the github one is trivial), the author does not answer any of the Issues raised, and I’m stuck on what’s probably a very simple but frustrating point.

How can I avoid the hundreds of debugging messages that get printed with any program? To me they're superfluous as I'd have to take ages to decode their hex and work out what they mean. The actual lines I do want are correctly displayed, but finding them is hard work.

Here's an example of a sketch and the output it produced:

// Wednesday 21 September 2022; Testing basic volume, track & play commands

//Include libraries
#include <DFPlayerMini_Fast.h> //Library to control the DFPlayer module
#include <SoftwareSerial.h> //Software serial communications

//Boolean values, true or false
bool isPlaying = false; // Keep track of status

//Setup library objects
//Software Serial on pins 11 (RX) and 10 (TX);
SoftwareSerial mySerial(10, 11);

//instantiate the DFPlayer library
DFPlayerMini_Fast mp3;

void setup()
{
  Serial.begin(115200);
  delay(200); // Time for previous print to be cleared?
  Serial.println();
  Serial.println("Test_FAST_VolTrackPrinting-3");
  delay(1000);
  Serial.println();

  //Software serial communication
  mySerial.begin(9600);
  //initialise DFPlayer library using the software serial connection
  mp3.begin(mySerial, true);

  //Set DFPlayer volume, otherwise max (30)
  mp3.volume(15);
  delay(1000);

  int v = mp3.currentVolume(); // Get volume
  Serial.print("Volume v = ");
  Serial.println(v);

  //Check if already playing
  if (mp3.isPlaying())
  {
    Serial.println("MUSIC IS ALREADY PLAYING ON STARTUP");
    isPlaying = true;
    int n = mp3.currentSdTrack();
    Serial.println(mp3.currentSdTrack());
    Serial.println(n);
    delay(1000);
  }
  // Not already playing
  delay(1000);
  Serial.print(F("NOT ALREADY PLAYING"));
  Serial.print("Current track number = ");
  Serial.println(Serial.println(mp3.currentSdTrack()));
  // Play an arbitrary track; doesn't matter if flat or folder structure
  mp3.play(9);
  delay(1000);

  // Alternative printing code
  Serial.print("mp3.currentSdTrack = ");
  Serial.println(mp3.currentSdTrack());

  //  v = mp3.currentVolume();
  Serial.print("Volume = ");
  Serial.println(mp3.currentVolume());


} //End setup

void loop()
{
  //
  //  Serial.print("From loop Current track number = ");
  //  Serial.println(mp3.currentSdTrack());
  //  delay(3000);

}

MONITOR OUTPUT

17:52:24.096 -> Test_FAST_VolTrackPrinting-3
17:52:25.080 -> 
17:52:25.127 -> Sent Stack:
17:52:25.127 -> 7E FF 6 6 0 0 F FE E6 EF
17:52:25.127 -> 
17:52:26.112 -> Sent Stack:
17:52:26.112 -> 7E FF 6 43 0 0 0 FE B8 EF
17:52:26.158 -> 
17:52:26.158 -> Rec: 7E
17:52:26.158 -> State: find_start_byte
17:52:26.158 -> Rec: FF
17:52:26.158 -> State: find_ver_byte
17:52:26.158 -> Rec: 6
17:52:26.158 -> State: find_len_byte
17:52:26.158 -> Rec: 43
17:52:26.158 -> State: find_command_byte
17:52:26.158 -> Rec: 0
17:52:26.158 -> State: find_feedback_byte
17:52:26.158 -> Rec: 0
17:52:26.158 -> State: find_param_MSB
17:52:26.158 -> Rec: F
17:52:26.158 -> State: find_param_LSB
17:52:26.158 -> Rec: FE
17:52:26.158 -> State: find_checksum_MSB
17:52:26.158 -> Rec: A9
17:52:26.158 -> State: find_checksum_LSB
17:52:26.158 -> Rec: EF
17:52:26.158 -> State: find_end_byte
17:52:26.158 -> Volume v = 15
17:52:26.158 -> Sent Stack:
17:52:26.205 -> 7E FF 6 42 0 0 0 FE B9 EF
17:52:26.205 -> 
17:52:26.205 -> Rec: 7E
17:52:26.205 -> State: find_start_byte
17:52:26.205 -> Rec: FF
17:52:26.205 -> State: find_ver_byte
17:52:26.205 -> Rec: 6
17:52:26.205 -> State: find_len_byte
17:52:26.205 -> Rec: 42
17:52:26.205 -> State: find_command_byte
17:52:26.205 -> Rec: 0
17:52:26.205 -> State: find_feedback_byte
17:52:26.205 -> Rec: 2
17:52:26.205 -> State: find_param_MSB
17:52:26.205 -> Rec: 0
17:52:26.205 -> State: find_param_LSB
17:52:26.205 -> Rec: FE
17:52:26.205 -> State: find_checksum_MSB
17:52:26.205 -> Rec: B7
17:52:26.205 -> State: find_checksum_LSB
17:52:26.205 -> Rec: EF
17:52:26.205 -> State: find_end_byte
17:52:27.188 -> NOT ALREADY PLAYINGCurrent track number = Sent Stack:
17:52:27.235 -> 7E FF 6 4C 0 0 0 FE AF EF
17:52:27.235 -> 
17:52:27.235 -> Rec: 7E
17:52:27.235 -> State: find_start_byte
17:52:27.235 -> Rec: FF
17:52:27.235 -> State: find_ver_byte
17:52:27.235 -> Rec: 6
17:52:27.235 -> State: find_len_byte
17:52:27.235 -> Rec: 4C
17:52:27.235 -> State: find_command_byte
17:52:27.235 -> Rec: 0
17:52:27.235 -> State: find_feedback_byte
17:52:27.235 -> Rec: 0
17:52:27.235 -> State: find_param_MSB
17:52:27.235 -> Rec: 9
17:52:27.235 -> State: find_param_LSB
17:52:27.235 -> Rec: FE
17:52:27.235 -> State: find_checksum_MSB
17:52:27.235 -> Rec: A6
17:52:27.235 -> State: find_checksum_LSB
17:52:27.281 -> Rec: EF
17:52:27.281 -> State: find_end_byte
17:52:27.281 -> 9
17:52:27.281 -> 3
17:52:27.281 -> Sent Stack:
17:52:27.281 -> 7E FF 6 3 0 0 9 FE EF EF
17:52:27.281 -> 
17:52:28.265 -> mp3.currentSdTrack = Sent Stack:
17:52:28.311 -> 7E FF 6 4C 0 0 0 FE AF EF
17:52:28.311 -> 
17:52:28.311 -> Rec: 7E
17:52:28.311 -> State: find_start_byte
17:52:28.311 -> Rec: FF
17:52:28.311 -> State: find_ver_byte
17:52:28.311 -> Rec: 6
17:52:28.311 -> State: find_len_byte
17:52:28.311 -> Rec: 4C
17:52:28.311 -> State: find_command_byte
17:52:28.311 -> Rec: 0
17:52:28.311 -> State: find_feedback_byte
17:52:28.311 -> Rec: 0
17:52:28.311 -> State: find_param_MSB
17:52:28.311 -> Rec: 9
17:52:28.311 -> State: find_param_LSB
17:52:28.311 -> Rec: FE
17:52:28.311 -> State: find_checksum_MSB
17:52:28.311 -> Rec: A6
17:52:28.311 -> State: find_checksum_LSB
17:52:28.311 -> Rec: EF
17:52:28.311 -> State: find_end_byte
17:52:28.358 -> 9
17:52:28.358 -> Volume = Sent Stack:
17:52:28.358 -> 7E FF 6 43 0 0 0 FE B8 EF
17:52:28.358 -> 
17:52:28.358 -> Rec: 7E
17:52:28.358 -> State: find_start_byte
17:52:28.358 -> Rec: FF
17:52:28.358 -> State: find_ver_byte
17:52:28.358 -> Rec: 6
17:52:28.358 -> State: find_len_byte
17:52:28.358 -> Rec: 43
17:52:28.358 -> State: find_command_byte
17:52:28.358 -> Rec: 0
17:52:28.358 -> State: find_feedback_byte
17:52:28.358 -> Rec: 0
17:52:28.358 -> State: find_param_MSB
17:52:28.358 -> Rec: F
17:52:28.358 -> State: find_param_LSB
17:52:28.358 -> Rec: FE
17:52:28.358 -> State: find_checksum_MSB
17:52:28.358 -> Rec: A9
17:52:28.358 -> State: find_checksum_LSB
17:52:28.358 -> Rec: EF
17:52:28.358 -> State: find_end_byte
17:52:28.358 -> 15

Don't set debug true in your begin() call. The second argument is the debugging. It is false by default so you can just use

mp3.begin(mySerial);

1 Like

Great, thanks so much, will fix that first thing tomorrow.

What documentation re that parameter did I fail to find please?

All your libraries are on your PC in the documents\arduino\libraries folder. Just look at the header file (.h) and/or the source (.cpp) which is usually in the src folder.

Your

mp3.begin(mySerial);

made such a difference, thanks again!

I'll study those library files. An associated issue: when I get a bug that warrants examining the full error text, it often also contains mention of multiple libraries, like this:

Multiple libraries were found for "DFPlayerMini_Fast.h"

 Used: C:\Users\terry\Dropbox\Electronics\Arduino\SKETCHES\libraries\DFPlayerMini_Fast

 Not used: C:\Users\terry\Dropbox\Electronics\Arduino\SKETCHES\libraries\arduino_425580

Why does that arise? Should I delete any other than that directly under
\SKETCHES\libraries ?

You don't need to delete anything. It is just telling you there were multiple libraries available and which one it choose. If you every install a replacement of a built-in library, you will get this info as well. The compiler chooses libraries in your \libraries folder over libraries installed with the IDE. It (I think) also chooses libraries with a matching folder name over ones that don't match. That means if you have a built-in library callded SD and two different versions in libraries\SD... and libraries\SD-master... then it will chose the library in libraries\SD

As for your libraries\arduino_425580, I would look and see what is in the folder. If you have two copies of the IDE open (2 different sketches) and install a library, the IDE will use a name like that rather than the actual name of the library. If it is another copy of DFPlayerMini_Fast, then you can delete the folder. You can also just delete the folder and, in the future, if you have a sketch that suddenly stops compiling with an error about a library or file not being found, you can just re-install whatever library is missing.

1 Like

Thanks, understood (I think).

I did open a couple of those numbered subfolders and they appear to be duplicates of the meaningfully named ones. Not an exact match though: 160 numbered of 264 total entries in \libraries. That 264 Includes 8 loose files, so there are only 96 named subfolders.

Reckon I'll just leave them all alone!

EDIT: I suspect my copying between this PC in the house (Win 10) and my ancient shed workshop PC (XP) explains these numbered folders. The shed machine has no internet connection so that was via USB sticks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.