This commit is contained in:
e2002
2022-08-03 14:30:19 +03:00
parent 2aa2fe3dda
commit 19fede3bdf
4 changed files with 18 additions and 6 deletions

View File

@@ -296,6 +296,10 @@ Work is in progress...
--- ---
## Version history ## Version history
#### v0.7.017
- fix initialization of some vs1053b green boards
- fix VU initialization on vs1053b boards
#### v0.7.010 #### v0.7.010
- fixed choppy of sound when volume adjustment - fixed choppy of sound when volume adjustment
- fixed initialisation of Nextion displays - fixed initialisation of Nextion displays

View File

@@ -1,7 +1,7 @@
#ifndef options_h #ifndef options_h
#define options_h #define options_h
#define VERSION "0.7.010" #define VERSION "0.7.017"
/******************************************************* /*******************************************************
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.

View File

@@ -314,7 +314,7 @@ void Audio::begin(){
mutex_pl = xSemaphoreCreateMutex(); mutex_pl = xSemaphoreCreateMutex();
DCS_HIGH(); DCS_HIGH();
CS_HIGH(); CS_HIGH();
delay(100); delay(200);
// Init SPI in slow mode (0.2 MHz) // Init SPI in slow mode (0.2 MHz)
VS1053_SPI = SPISettings(200000, MSBFIRST, SPI_MODE0); VS1053_SPI = SPISettings(200000, MSBFIRST, SPI_MODE0);
@@ -331,14 +331,14 @@ void Audio::begin(){
write_register(SCI_AUDATA, 44100 + 1); // 44.1kHz + stereo write_register(SCI_AUDATA, 44100 + 1); // 44.1kHz + stereo
// The next clocksetting allows SPI clocking at 5 MHz, 4 MHz is safe then. // The next clocksetting allows SPI clocking at 5 MHz, 4 MHz is safe then.
write_register(SCI_CLOCKF, 6 << 12); // Normal clock settings multiplyer 3.0=12.2 MHz write_register(SCI_CLOCKF, 6 << 12); // Normal clock settings multiplyer 3.0=12.2 MHz
//set vu meter
setVUmeter();
//SPI Clock to 4 MHz. Now you can set high speed SPI clock. //SPI Clock to 4 MHz. Now you can set high speed SPI clock.
VS1053_SPI=SPISettings(6700000, MSBFIRST, SPI_MODE0); // SPIDIV 12 -> 80/12=6.66 MHz VS1053_SPI=SPISettings(6700000, MSBFIRST, SPI_MODE0); // SPIDIV 12 -> 80/12=6.66 MHz
write_register(SCI_MODE, _BV (SM_SDINEW) | _BV(SM_LINE1)); write_register(SCI_MODE, _BV (SM_SDINEW) | _BV(SM_LINE1));
//testComm("Fast SPI, Testing VS1053 read/write registers again... \n"); //testComm("Fast SPI, Testing VS1053 read/write registers again... \n");
delay(10); delay(10);
await_data_request(); await_data_request();
//set vu meter
setVUmeter();
m_endFillByte=wram_read(0x1E06) & 0xFF; m_endFillByte=wram_read(0x1E06) & 0xFF;
// sprintf(chbuf, "endFillByte is %X", endFillByte); // sprintf(chbuf, "endFillByte is %X", endFillByte);
// if(audio_info) audio_info(chbuf); // if(audio_info) audio_info(chbuf);
@@ -467,7 +467,7 @@ void Audio::stopSong()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void Audio::softReset() void Audio::softReset()
{ {
if(VS1053_RST>0) return; // Hard resrt present // if(VS1053_RST>0) return; // Hard resrt present
write_register(SCI_MODE, _BV (SM_SDINEW) | _BV(SM_RESET)); write_register(SCI_MODE, _BV (SM_SDINEW) | _BV(SM_RESET));
delay(10); delay(10);
await_data_request(); await_data_request();
@@ -1571,6 +1571,12 @@ void Audio::setDefaults(){
void Audio::setVUmeter() { void Audio::setVUmeter() {
// if(!ENABLE_VU_METER) return; // if(!ENABLE_VU_METER) return;
uint16_t MP3Status = read_register(SCI_STATUS); uint16_t MP3Status = read_register(SCI_STATUS);
if(MP3Status==0) {
Serial.println("VS1053 Error: Unable to write SCI_STATUS");
_vuInitalized = false;
return;
}
_vuInitalized = true;
write_register(SCI_STATUS, MP3Status | _BV(9)); write_register(SCI_STATUS, MP3Status | _BV(9));
} }
@@ -1588,6 +1594,7 @@ void Audio::setVUmeter() {
*/ */
void Audio::getVUlevel() { void Audio::getVUlevel() {
// if(!ENABLE_VU_METER) return; // if(!ENABLE_VU_METER) return;
if(!_vuInitalized) return;
int16_t reg = read_register(SCI_AICTRL3); int16_t reg = read_register(SCI_AICTRL3);
uint8_t rl = map((uint8_t)reg, 85, 92, 0, 255); uint8_t rl = map((uint8_t)reg, 85, 92, 0, 255);
uint8_t rr = map((uint8_t)(reg >> 8), 85, 92, 0, 255); uint8_t rr = map((uint8_t)(reg >> 8), 85, 92, 0, 255);

View File

@@ -197,7 +197,8 @@ private:
bool m_f_stream_ready=false; // Set after connecttohost and first streamdata are available bool m_f_stream_ready=false; // Set after connecttohost and first streamdata are available
bool m_f_unsync = false; bool m_f_unsync = false;
bool m_f_exthdr = false; // ID3 extended header bool m_f_exthdr = false; // ID3 extended header
bool _vuInitalized;
const char volumetable[22]={ 0,50,60,65,70,75,80,82,84,86, const char volumetable[22]={ 0,50,60,65,70,75,80,82,84,86,
88,90,91,92,93,94,95,96,97,98,99,100}; //22 elements 88,90,91,92,93,94,95,96,97,98,99,100}; //22 elements
protected: protected: