mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
Compare commits
No commits in common. "10c67c908fb75145f2975e00eb027cc8f8473997" and "22268aea3faf1d77a770707a4d02db75293e17db" have entirely different histories.
10c67c908f
...
22268aea3f
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "devel-202401030135Z"
|
||||
#define GITHUB_SHA "devel-202312251647Z"
|
||||
|
|
|
@ -76,6 +76,7 @@ private:
|
|||
I2CAddress _I2CAddress;
|
||||
I2CRB _rb;
|
||||
uint8_t _UART_CH;
|
||||
uint8_t _audioMixer = 0x01; // Default to output amplifier 1
|
||||
// Communication parameters for the DFPlayer are fixed at 8 bit, No parity, 1 stopbit
|
||||
uint8_t WORD_LEN = 0x03; // Value LCR bit 0,1
|
||||
uint8_t STOP_BIT = 0x00; // Value LCR bit 2
|
||||
|
@ -99,8 +100,6 @@ private:
|
|||
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
|
||||
uint8_t _outbuffer [11]; // DFPlayer command is 10 bytes + 1 byte register address & UART channel
|
||||
uint8_t _inbuffer[10]; // expected DFPlayer return 10 bytes
|
||||
|
||||
|
@ -357,27 +356,6 @@ public:
|
|||
sendPacket(0x07,0x00,_currentEQvalue);
|
||||
}
|
||||
_eqCmd = false;
|
||||
} else if (_setamCmd == true){ // Set Audio mixer channel
|
||||
setGPIO(); // Set the audio mixer channel
|
||||
/*
|
||||
if (_audioMixer == 1){ // set to audio mixer 1
|
||||
if (_UART_CH == 0){
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 0 to high
|
||||
} else { // must be UART 1
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 1 to high
|
||||
}
|
||||
//_setamCmd = false;
|
||||
//UART_WriteRegister(REG_IOSTATE, TEMP_REG_VAL);
|
||||
} else { // set to audio mixer 2
|
||||
if (_UART_CH == 0){
|
||||
TEMP_REG_VAL &= (0x00 << _UART_CH); //Set GPIO pin 0 to Low
|
||||
} else { // must be UART 1
|
||||
TEMP_REG_VAL &= (0x00 << _UART_CH); //Set GPIO pin 1 to Low
|
||||
}
|
||||
//_setamCmd = false;
|
||||
//UART_WriteRegister(REG_IOSTATE, TEMP_REG_VAL);
|
||||
}*/
|
||||
_setamCmd = false;
|
||||
} else if ((int32_t)currentMicros - _commandSendTime > 1000000) {
|
||||
// Poll device every second that other commands aren't being sent,
|
||||
// to check if it's still connected and responding.
|
||||
|
@ -439,7 +417,7 @@ public:
|
|||
break;
|
||||
case FOLDER:
|
||||
_folderCmd = true;
|
||||
if (volume <= 0 || volume > 99){ // Range checking, valid values 1-99, else default to 1
|
||||
if (volume <= 0 && volume > 99){ // Range checking
|
||||
_requestedFolder = 0x01; // if outside range, default to folder 01
|
||||
} else {
|
||||
_requestedFolder = volume;
|
||||
|
@ -464,11 +442,11 @@ public:
|
|||
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
|
||||
if (volume <= NORMAL) { // to keep backward compatibility the volume parameter is used for values of the EQ cmd
|
||||
_requestedEQValue = NORMAL;
|
||||
} else { // Valid EQ parameter range
|
||||
} else if (volume <= 0x05) { // Validate EQ parameters
|
||||
_requestedEQValue = volume;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RESET:
|
||||
_resetCmd = true;
|
||||
|
@ -479,17 +457,6 @@ public:
|
|||
#endif
|
||||
_daconCmd = true;
|
||||
break;
|
||||
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);
|
||||
#endif
|
||||
if (volume <= 0 || volume > 2) { // If out of range, default to 1
|
||||
_audioMixer = 1;
|
||||
} else { // Valid SETAM parameter in range
|
||||
_audioMixer = volume; // _audioMixer valid values 1 or 2
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -613,15 +580,12 @@ private:
|
|||
UART_WriteRegister(REG_IODIR, TEMP_REG_VAL);
|
||||
UART_ReadRegister(REG_IOSTATE); // Read current state as not to overwrite the other GPIO pins
|
||||
TEMP_REG_VAL = _inbuffer[0];
|
||||
setGPIO(); // Set the audio mixer channel
|
||||
/*
|
||||
if (_UART_CH == 0){ // Set Audio mixer channel
|
||||
if (_UART_CH == 0){
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 0 to high
|
||||
} else { // must be UART 1
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 1 to high
|
||||
}
|
||||
UART_WriteRegister(REG_IOSTATE, TEMP_REG_VAL);
|
||||
*/
|
||||
TEMP_REG_VAL = 0x07; // Reset FIFO, clear RX & TX FIFO
|
||||
UART_WriteRegister(REG_FCR, TEMP_REG_VAL);
|
||||
TEMP_REG_VAL = 0x00; // Set MCR to all 0, includes Clock divisor
|
||||
|
@ -675,29 +639,6 @@ private:
|
|||
UART_WriteRegister(REG_FCR, TEMP_REG_VAL);
|
||||
}
|
||||
|
||||
// Set or reset GPIO pin 0 and 1 depending on the UART ch
|
||||
// This function may be modified in a future release to enable all 8 pins to be set or reset with EX-Rail
|
||||
// for various auxilary functions
|
||||
void setGPIO(){
|
||||
UART_ReadRegister(REG_IOSTATE); // Get the current GPIO pins state from the IOSTATE register
|
||||
TEMP_REG_VAL = _inbuffer[0];
|
||||
if (_audioMixer == 1){ // set to audio mixer 1
|
||||
if (_UART_CH == 0){
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 0 to high
|
||||
} else { // must be UART 1
|
||||
TEMP_REG_VAL |= (0x01 << _UART_CH); //Set GPIO pin 1 to high
|
||||
}
|
||||
} else { // set to audio mixer 2
|
||||
if (_UART_CH == 0){
|
||||
TEMP_REG_VAL &= ~(0x01 << _UART_CH); //Set GPIO pin 0 to Low
|
||||
} else { // must be UART 1
|
||||
TEMP_REG_VAL &= ~(0x01 << _UART_CH); //Set GPIO pin 1 to Low
|
||||
}
|
||||
}
|
||||
UART_WriteRegister(REG_IOSTATE, TEMP_REG_VAL);
|
||||
_setamCmd = false;
|
||||
}
|
||||
|
||||
|
||||
// Read the Tranmit FIFO Level register (TXLVL), return a single unsigned integer
|
||||
// of nr characters free in the TX FIFO, bit 6:0, 7 not used, set to zero
|
||||
|
@ -779,8 +720,7 @@ enum : uint8_t{
|
|||
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
|
||||
DACON = 0x1A, // Not a DFLayer command,need to sent 0x1A and 3rd byte to 0x01 in processOutgoing()
|
||||
NORMAL = 0x00, // Equalizer parameters
|
||||
POP = 0x01,
|
||||
ROCK = 0x02,
|
||||
|
|
|
@ -179,7 +179,7 @@ bool WifiESP::setup(const char *SSid,
|
|||
if (WiFi.status() == WL_CONNECTED) {
|
||||
// DIAG(F("Wifi STA IP %s"),WiFi.localIP().toString().c_str());
|
||||
DIAG(F("Wifi in STA mode"));
|
||||
LCD(7, F("IP: %s"), WiFi.localIP().toString().c_str());
|
||||
LCD(7, F("IP: %s"), WiFi.softAPIP().toString().c_str());
|
||||
wifiUp = true;
|
||||
} else {
|
||||
DIAG(F("Could not connect to Wifi SSID %s"),SSid);
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.2.18ethCdf"
|
||||
// 5.2.18 - Display network IP fix
|
||||
#define VERSION "5.2.17ethCdf"
|
||||
// 5.2.17 - ESP32 simplify network logic
|
||||
// 5.2.16 - Bugfix to allow for devices using the EX-IOExpander protocol to have no analogue or no digital pins
|
||||
// df - I2C DFPlayper capability
|
||||
|
|
Loading…
Reference in New Issue
Block a user