1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 18:16: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
enum : uint8_t{
DF_PLAY = 0x0F,
DF_VOL = 0x06,
DF_FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is
DF_REPEATPLAY = 0x08,
DF_STOPPLAY = 0x16,
DF_EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS
DF_RESET = 0x0C,
DF_DACON = 0x1A,
DF_SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer
DF_NORMAL = 0x00, // Equalizer parameters
DF_POP = 0x01,
DF_ROCK = 0x02,
DF_JAZZ = 0x03,
DF_CLASSIC = 0x04,
DF_BASS = 0x05,
PLAY = 0x0F,
VOL = 0x06,
FOLDER = 0x2B, // Not a DFPlayer command, used to set folder nr where audio file is
REPEATPLAY = 0x08,
STOPPLAY = 0x16,
EQ = 0x07, // Set equaliser, require parameter NORMAL, POP, ROCK, JAZZ, CLASSIC or BASS
RESET = 0x0C,
DACON = 0x1A,
SETAM = 0x2A, // Set audio mixer 1 or 2 for this DFPLayer (future use)
NORMAL = 0x00, // Equalizer parameters
POP = 0x01,
ROCK = 0x02,
JAZZ = 0x03,
CLASSIC = 0x04,
BASS = 0x05,
};
#endif

View File

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