Skip to content

DFPlayer not managing acks correctly - causing problems with read functions (e.g. readFileCountsInFolder) when enabled #68

@steveisme

Description

@steveisme

See: https://forum.arduino.cc/t/continued-problems-with-dfplayer-readfilecountsinfolder-method/1420745/5 for a more detailed discussion.

In summary, when a read request is made (e.g. readState(), readVolume(), readEQ, readFileCounts(), etc). and acknowledgements are enabled (the library default) the library is expecting the data message with the data requested by the read command to come in from the DFPlayer serial buffer before the acknowledgement message. But (at least on the latest DFRobot and clone players), the acknowledgement message is coming in first followed by the data message. So, the library tries to interpret the ack message as the data message. To the user this results in the first read call returning -1 and then subsequent read calls looking like they are returning data for previous requests. If the user gets a -1 return and then calls the read function again, then this just queues up more acks and data messages that are all then interpreted out of order. Disabling acks in the begin() function does address this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions