|
LCC Fusion Project 1.0
LCC Automation
|
Controls a DFPlayer Mini via SoftwareSerial, with save/restore functionality. More...
#include <SoundCardPlayer.h>
Public Member Functions | |
| SoundCardPlayer () | |
| Construct a new SoundCardPlayer instance. More... | |
| bool | isPlaying () |
| Check if the DFPlayer is currently playing audio. More... | |
| void | play (uint8_t fileNum, uint8_t volume) |
| Play a single file once at the given volume. More... | |
| void | loop (uint8_t fileNum, uint8_t volume) |
| Loop playback of a file indefinitely at the given volume. More... | |
| void | pause () |
| Pause current playback. | |
| void | reset () |
| Reset the DFPlayer and clear saved state file. | |
| void | save () |
| Persist current playback state (request, file, volume, playing flag) to SPIFFS. | |
| void | restore () |
| Restore playback state from SPIFFS and resume if it was playing. | |
| void | testPlayer (uint8_t volumePct=25) |
| Perform ready checks and play the first track if present. More... | |
Private Member Functions | |
| void | openSaveFile_ () |
| Open or create the SPIFFS save file for this player. More... | |
| bool | _isSdCardFound () |
| Heuristic check for SD card presence using a lightweight play probe. More... | |
| bool | _isTrackFound (uint16_t track=1) |
| Check whether a specific track exists and can be played. More... | |
Private Attributes | |
| SoftwareSerial | swSerial_ |
| UART to DFPlayer. | |
| uint8_t | playerNum_ |
| Unique player instance number. | |
| uint8_t | currentFileNum_ |
| Last requested file index. | |
| uint8_t | currentVolume_ |
| Last requested volume. | |
| requestTypes | currentRequest_ |
| Last requested command type. | |
| ESPFlash< uint8_t > | saveFile_ |
| Persistent storage for state. | |
| DFPlayerMini_Fast | DF_Player_ |
| Underlying DFPlayer handle. | |
| bool | isConnected |
| True if DFPlayer init succeeded. | |
Controls a DFPlayer Mini via SoftwareSerial, with save/restore functionality.
Definition at line 75 of file SoundCardPlayer.h.
|
inline |
Construct a new SoundCardPlayer instance.
Configures SoftwareSerial pins for this player, initializes DFPlayer, and sets default EQ and source.
Definition at line 82 of file SoundCardPlayer.h.

|
inlineprivate |
Heuristic check for SD card presence using a lightweight play probe.
DFPlayerMini_Fast does not expose a direct "card present" flag universally, so we attempt a quick play of track 1 and observe whether the device reports "playing". If it starts, we immediately pause and report true.
Definition at line 267 of file SoundCardPlayer.h.

|
inlineprivate |
Check whether a specific track exists and can be played.
| track | 1-based file number to probe. |
Definition at line 285 of file SoundCardPlayer.h.

|
inline |
Check if the DFPlayer is currently playing audio.
Must call swSerial_.listen() before status query.
Definition at line 122 of file SoundCardPlayer.h.
|
inline |
Loop playback of a file indefinitely at the given volume.
| fileNum | File index to loop |
| volume | Volume level (0..30) |
Definition at line 152 of file SoundCardPlayer.h.
|
inlineprivate |
Open or create the SPIFFS save file for this player.
File name is SAVE_FILE_NAME + binary representation of playerNum_.
Definition at line 251 of file SoundCardPlayer.h.

|
inline |
Play a single file once at the given volume.
| fileNum | File index to play (1-based) |
| volume | Volume level (0..30) |
Definition at line 133 of file SoundCardPlayer.h.

|
inline |
Perform ready checks and play the first track if present.
| volumePct | Volume in percent (0..100). Mapped to DF volume 0..30. |
Definition at line 217 of file SoundCardPlayer.h.
