1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00

Compare commits

..

No commits in common. "53fec9bc3a26a9acded83858b5ab9710b26b2dfe" and "5f6e18e1e78620ea77a9b3bfe9e1d9dc740a5b8d" have entirely different histories.

2 changed files with 42 additions and 44 deletions

View File

@ -260,21 +260,21 @@ private:
// IO_I2CDFPlayer commands and values // IO_I2CDFPlayer commands and values
enum : uint8_t{ enum : uint8_t{
DF_PLAY = 0x0F, PLAY = 0x0F,
DF_VOL = 0x06, VOL = 0x06,
DF_FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is
DF_REPEATPLAY = 0x08, REPEATPLAY = 0x08,
DF_STOPPLAY = 0x16, STOPPLAY = 0x16,
DF_EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS
DF_RESET = 0x0C, RESET = 0x0C,
DF_DACON = 0x1A, DACON = 0x1A,
DF_SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer (future use)
DF_NORMAL = 0x00, // Equalizer parameters NORMAL = 0x00, // Equalizer parameters
DF_POP = 0x01, POP = 0x01,
DF_ROCK = 0x02, ROCK = 0x02,
DF_JAZZ = 0x03, JAZZ = 0x03,
DF_CLASSIC = 0x04, CLASSIC = 0x04,
DF_BASS = 0x05, BASS = 0x05,
}; };
#endif #endif

View File

@ -101,8 +101,8 @@ private:
bool _stopplayCmd = false; bool _stopplayCmd = false;
bool _resetCmd = false; bool _resetCmd = false;
bool _eqCmd = false; bool _eqCmd = false;
uint8_t _requestedEQValue = DF_NORMAL; uint8_t _requestedEQValue = NORMAL;
uint8_t _currentEQvalue = DF_NORMAL; // start equalizer value uint8_t _currentEQvalue = NORMAL; // start equalizer value
bool _daconCmd = false; bool _daconCmd = false;
uint8_t _audioMixer = 0x01; // Default to output amplifier 1 uint8_t _audioMixer = 0x01; // Default to output amplifier 1
bool _setamCmd = false; // Set the Audio mixer channel bool _setamCmd = false; // Set the Audio mixer channel
@ -434,18 +434,18 @@ public:
//case NONE: //case NONE:
// DFPlayerCmd = cmd; // DFPlayerCmd = cmd;
// break; // break;
case DF_PLAY: case PLAY:
_playCmd = true; _playCmd = true;
_volCmd = true; _volCmd = true;
_requestedSong = value; _requestedSong = value;
_requestedVolumeLevel = volume; _requestedVolumeLevel = volume;
_playing = true; _playing = true;
break; break;
case DF_VOL: case VOL:
_volCmd = true; _volCmd = true;
_requestedVolumeLevel = volume; _requestedVolumeLevel = volume;
break; break;
case DF_FOLDER: case FOLDER:
_folderCmd = true; _folderCmd = true;
if (volume <= 0 || volume > 99){ // Range checking, valid values 1-99, else default to 1 if (volume <= 0 || volume > 99){ // Range checking, valid values 1-99, else default to 1
_requestedFolder = 0x01; // if outside range, default to folder 01 _requestedFolder = 0x01; // if outside range, default to folder 01
@ -453,7 +453,7 @@ public:
_requestedFolder = volume; _requestedFolder = volume;
} }
break; break;
case DF_REPEATPLAY: // Need to check if _repeat == true, if so do nothing case REPEATPLAY: // Need to check if _repeat == true, if so do nothing
if (_repeat == false) { if (_repeat == false) {
#ifdef DIAG_I2CDFplayer_playing #ifdef DIAG_I2CDFplayer_playing
DIAG(F("I2CDFPlayer: WriteAnalog Repeat: _repeat: 0x0%x, value: %d _repeatCmd: 0x%x"), _repeat, value, _repeatCmd); DIAG(F("I2CDFPlayer: WriteAnalog Repeat: _repeat: 0x0%x, value: %d _repeatCmd: 0x%x"), _repeat, value, _repeatCmd);
@ -464,30 +464,30 @@ public:
_playing = true; _playing = true;
} }
break; break;
case DF_STOPPLAY: case STOPPLAY:
_stopplayCmd = true; _stopplayCmd = true;
break; break;
case DF_EQ: case EQ:
#ifdef DIAG_I2CDFplayer_playing #ifdef DIAG_I2CDFplayer_playing
DIAG(F("I2CDFPlayer: WriteAnalog EQ: cmd: 0x%x, EQ value: 0x%x"), cmd, volume); DIAG(F("I2CDFPlayer: WriteAnalog EQ: cmd: 0x%x, EQ value: 0x%x"), cmd, volume);
#endif #endif
_eqCmd = true; _eqCmd = true;
if (volume <= 0 || volume > 5) { // If out of range, default to NORMAL if (volume <= 0 || volume > 5) { // If out of range, default to NORMAL
_requestedEQValue = DF_NORMAL; _requestedEQValue = NORMAL;
} else { // Valid EQ parameter range } else { // Valid EQ parameter range
_requestedEQValue = volume; _requestedEQValue = volume;
} }
break; break;
case DF_RESET: case RESET:
_resetCmd = true; _resetCmd = true;
break; break;
case DF_DACON: // Works, but without the DACOFF command limited value, except when not relying on DFPlayer default to turn the DAC on case DACON: // Works, but without the DACOFF command limited value, except when not relying on DFPlayer default to turn the DAC on
#ifdef DIAG_I2CDFplayer_playing #ifdef DIAG_I2CDFplayer_playing
DIAG(F("I2CDFPlayer: WrtieAnalog DACON: cmd: 0x%x"), cmd); DIAG(F("I2CDFPlayer: WrtieAnalog DACON: cmd: 0x%x"), cmd);
#endif #endif
_daconCmd = true; _daconCmd = true;
break; break;
case DF_SETAM: // Set the audio mixer channel to 1 or 2 case SETAM: // Set the audio mixer channel to 1 or 2
_setamCmd = true; _setamCmd = true;
#ifdef DIAG_I2CDFplayer_playing #ifdef DIAG_I2CDFplayer_playing
DIAG(F("I2CDFPlayer: WrtieAnalog SETAM: cmd: 0x%x"), cmd); DIAG(F("I2CDFPlayer: WrtieAnalog SETAM: cmd: 0x%x"), cmd);
@ -779,25 +779,23 @@ enum : uint8_t{
REG_XOFF2 = 0x07, // R/W REG_XOFF2 = 0x07, // R/W
}; };
// DFPlayer commands and values // DFPlayer commands and values
// Declared in this scope
enum : uint8_t{ enum : uint8_t{
DF_PLAY = 0x0F, PLAY = 0x0F,
DF_VOL = 0x06, VOL = 0x06,
DF_FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is
DF_REPEATPLAY = 0x08, REPEATPLAY = 0x08,
DF_STOPPLAY = 0x16, STOPPLAY = 0x16,
DF_EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS
DF_RESET = 0x0C, RESET = 0x0C,
DF_DACON = 0x1A, DACON = 0x1A,
DF_SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer
DF_NORMAL = 0x00, // Equalizer parameters NORMAL = 0x00, // Equalizer parameters
DF_POP = 0x01, POP = 0x01,
DF_ROCK = 0x02, ROCK = 0x02,
DF_JAZZ = 0x03, JAZZ = 0x03,
DF_CLASSIC = 0x04, CLASSIC = 0x04,
DF_BASS = 0x05, BASS = 0x05,
}; };
}; };