Skip to content

Commit 3cd53f2

Browse files
committed
v0.9.220
1 parent c31ed52 commit 3cd53f2

30 files changed

+298
-172
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ Work is in progress...
226226

227227
---
228228
## Version history
229+
#### v0.9.220
230+
- fixed SD prelist indexing error when switching Web>>SD
231+
- fixed a bug of switching to the next track when accidentally playing SD
232+
- fixed import of large playlists (tried). PS: import playlist size is limited by SPIFFS size (SPIFFS.totalBytes()/100*65-SPIFFS.usedBytes() = approximately 60kb )
233+
- new url parameter - http://YPRADIOIP/?clearspiffs - for clearing tails from SD playlist
234+
- optimization of the issuance of the WEB-interface
235+
- brought back the functionality of the track slider
236+
- fixing bugs in the application logic
237+
229238
#### v0.9.201
230239
- fixed a bug when importing a playlist
231240

yoRadio/data/www/script.js.gz

5 Bytes
Binary file not shown.

yoRadio/src/SSD1322/SSD1322.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121
#include "../core/options.h"
22-
#include "../core/player.h"
22+
#include "../core/spidog.h"
2323
#if DSP_MODEL==DSP_SSD1322
2424

2525

@@ -39,8 +39,8 @@
3939
#define SSD1322_MODE_DATA digitalWrite(dcPin, HIGH); ///< Data mode
4040

4141
#if defined(SPI_HAS_TRANSACTION)
42-
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
43-
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
42+
#define TAKE_MUTEX() sdog.takeMutex()
43+
#define GIVE_MUTEX() sdog.giveMutex()
4444
#define SPI_TRANSACTION_START TAKE_MUTEX(); spi->beginTransaction(spiSettings) ///< Pre-SPI
4545
#define SPI_TRANSACTION_END spi->endTransaction(); GIVE_MUTEX() ///< Post-SPI
4646
#else // SPI transactions likewise not present in older Arduino SPI lib

yoRadio/src/ST7920/ST7920.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "../core/options.h"
2-
#include "../core/player.h"
2+
#include "../core/spidog.h"
33
#if DSP_MODEL==DSP_ST7920
44

55
#include "Adafruit_GFX.h"
@@ -10,8 +10,8 @@
1010
//This display is split into two halfs. Pages are 16bit long and pages are arranged in that way that are lied horizontaly instead of verticaly, unlike SSD1306 OLED, Nokia 5110 LCD, etc.
1111
//After 8 horizonral page is written, it jumps to half of the screen (Y = 32) and continues until 16 lines of page have been written. After that, we have set cursor in new line.
1212

13-
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
14-
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
13+
#define TAKE_MUTEX() sdog.takeMutex()
14+
#define GIVE_MUTEX() sdog.giveMutex()
1515
#define st7920_swap(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
1616

1717
void ST7920::drawPixel(int16_t x, int16_t y, uint16_t color) {

yoRadio/src/audioI2S/Audio.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "../core/options.h"
2+
#include "../core/spidog.h"
23
#if VS1053_CS==255
34
/*
45
* Audio.cpp
@@ -170,7 +171,6 @@ Audio::Audio(bool internalDAC /* = false */, uint8_t channelEnabled /* = I2S_DAC
170171
#ifdef AUDIO_LOG
171172
m_f_Log = true;
172173
#endif
173-
mutex_pl = xSemaphoreCreateMutex();
174174
clientsecure.setInsecure(); // if that can't be resolved update to ESP32 Arduino version 1.0.5-rc05 or higher
175175
m_f_channelEnabled = channelEnabled;
176176
m_f_internalDAC = internalDAC;
@@ -315,7 +315,7 @@ void Audio::setDefaults() {
315315
vector_clear_and_shrink(m_playlistURL);
316316
vector_clear_and_shrink(m_playlistContent);
317317
m_hashQueue.clear(); m_hashQueue.shrink_to_fit(); // uint32_t vector
318-
if(config.store.play_mode!=PM_SDCARD){
318+
if(config.getMode()!=PM_SDCARD){
319319
client.stop();
320320
client.flush(); // release memory
321321
clientsecure.stop();
@@ -711,14 +711,14 @@ bool Audio::connecttoFS(fs::FS &fs, const char* path, uint32_t resumeFilePos) {
711711
m_file_size = audiofile.size();//TEST loop
712712
cardLock(false);
713713
char* afn = NULL; // audioFileName
714-
//cardLock(true);
714+
cardLock(true);
715715
#ifdef SDFATFS_USED
716716
audiofile.getName(chbuf, sizeof(chbuf));
717717
afn = strdup(chbuf);
718718
#else
719719
afn = strdup(audiofile.name());
720720
#endif
721-
//cardLock(false);
721+
cardLock(false);
722722
uint8_t dotPos = lastIndexOf(afn, ".");
723723
for(uint8_t i = dotPos + 1; i < strlen(afn); i++){
724724
afn[i] = toLowerCase(afn[i]);
@@ -2458,9 +2458,9 @@ bool Audio::playChunk() {
24582458
void Audio::cardLock(bool lock){
24592459
#if (TFT_CS!=255) || (SDC_CS!=255)
24602460
if(lock){
2461-
xSemaphoreTake(mutex_pl, portMAX_DELAY);
2461+
sdog.takeMutex();
24622462
}else{
2463-
xSemaphoreGive(mutex_pl);
2463+
sdog.giveMutex();
24642464
}
24652465
#endif
24662466
}
@@ -3035,14 +3035,14 @@ void Audio::processLocalFile() {
30353035
} //TEST loop
30363036
f_stream = false;
30373037
m_streamType = ST_NONE;
3038-
//cardLock(true);
3038+
cardLock(true);
30393039
#ifdef SDFATFS_USED
30403040
audiofile.getName(chbuf, sizeof(chbuf));
30413041
char *afn =strdup(chbuf);
30423042
#else
30433043
char *afn =strdup(audiofile.name()); // store temporary the name
30443044
#endif
3045-
//cardLock(false);
3045+
cardLock(false);
30463046
stopSong();
30473047
if(m_codec == CODEC_MP3) MP3Decoder_FreeBuffers();
30483048
if(m_codec == CODEC_AAC) AACDecoder_FreeBuffers();
@@ -4400,9 +4400,9 @@ bool Audio::setPinout(uint8_t BCLK, uint8_t LRC, uint8_t DOUT, int8_t DIN, int8_
44004400
//---------------------------------------------------------------------------------------------------------------------
44014401
uint32_t Audio::getFileSize() {
44024402
if(!audiofile) return 0;
4403-
//cardLock(true);
4403+
cardLock(true);
44044404
uint32_t s = audiofile.size();
4405-
//cardLock(false);
4405+
cardLock(false);
44064406
return s;
44074407
}
44084408
//---------------------------------------------------------------------------------------------------------------------

yoRadio/src/audioI2S/AudioEx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ class Audio : private AudioBuffer{
210210
void setVUmeter() {};
211211
void getVUlevel() {};
212212
uint8_t vuLeft, vuRight;
213-
SemaphoreHandle_t mutex_pl=NULL;
214213
bool eofHeader;
215214
esp_err_t i2s_mclk_pin_select(const uint8_t pin);
216215
uint32_t inBufferFilled(); // returns the number of stored bytes in the inputbuffer

yoRadio/src/audioVS1053/audioVS1053Ex.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "../core/options.h"
2+
#include "../core/spidog.h"
23
#if I2S_DOUT==255
34
/*
45
* vs1053_ext.cpp
@@ -152,7 +153,6 @@ Audio::Audio(uint8_t _cs_pin, uint8_t _dcs_pin, uint8_t _dreq_pin, uint8_t spi,
152153
m_endFillByte=0;
153154
curvol=50;
154155
m_LFcount=0;
155-
mutex_pl = xSemaphoreCreateMutex();
156156
}
157157
Audio::~Audio(){
158158
// destructor
@@ -180,18 +180,18 @@ void Audio::control_mode_off()
180180
{
181181
CS_HIGH(); // End control mode
182182
spi_VS1053->endTransaction(); // Allow other SPI users
183-
xSemaphoreGive(mutex_pl);
183+
sdog.giveMutex();
184184
}
185185
void Audio::control_mode_on()
186186
{
187-
xSemaphoreTake(mutex_pl, portMAX_DELAY);
187+
sdog.takeMutex();
188188
spi_VS1053->beginTransaction(VS1053_SPI_CTL); // Prevent other SPI users
189189
DCS_HIGH(); // Bring slave in control mode
190190
CS_LOW();
191191
}
192192
void Audio::data_mode_on()
193193
{
194-
xSemaphoreTake(mutex_pl, portMAX_DELAY);
194+
sdog.takeMutex();
195195
spi_VS1053->beginTransaction(VS1053_SPI_DATA); // Prevent other SPI users
196196
CS_HIGH(); // Bring slave in data mode
197197
DCS_LOW();
@@ -201,7 +201,7 @@ void Audio::data_mode_off()
201201
//digitalWrite(dcs_pin, HIGH); // End data mode
202202
DCS_HIGH();
203203
spi_VS1053->endTransaction(); // Allow other SPI users
204-
xSemaphoreGive(mutex_pl);
204+
sdog.giveMutex();
205205
}
206206
//---------------------------------------------------------------------------------------------------------------------
207207
uint16_t Audio::read_register(uint8_t _reg)
@@ -303,7 +303,6 @@ void Audio::begin(){
303303
pinMode(dreq_pin, INPUT); // DREQ is an input
304304
pinMode(cs_pin, OUTPUT); // The SCI and SDI signals
305305
pinMode(dcs_pin, OUTPUT);
306-
//mutex_pl = xSemaphoreCreateMutex();
307306
DCS_HIGH();
308307
CS_HIGH();
309308
delay(170);
@@ -573,10 +572,9 @@ void Audio::showstreamtitle(const char* ml) {
573572
void Audio::cardLock(bool lock){
574573
#if (SDC_CS!=255)
575574
if(lock){
576-
xSemaphoreTake(mutex_pl, portMAX_DELAY);
575+
sdog.takeMutex();
577576
}else{
578-
// digitalWrite(SDC_CS, HIGH);
579-
xSemaphoreGive(mutex_pl);
577+
sdog.giveMutex();
580578
}
581579
#endif
582580
}
@@ -744,9 +742,9 @@ void Audio::processLocalFile() {
744742

745743
f_stream = false;
746744
m_f_localfile = false;
747-
//cardLock(true);
745+
cardLock(true);
748746
char *afn =strdup(audiofile.name()); // store temporary the name
749-
//cardLock(false);
747+
cardLock(false);
750748
stopSong();
751749
sprintf(chbuf, "End of file \"%s\"", afn);
752750
if(audio_info) audio_info(chbuf);
@@ -1612,7 +1610,7 @@ void Audio::setDefaults(){
16121610
InBuff.resetBuffer();
16131611
vector_clear_and_shrink(m_playlistURL);
16141612
vector_clear_and_shrink(m_playlistContent);
1615-
if(config.store.play_mode!=PM_SDCARD){
1613+
if(config.getMode()!=PM_SDCARD){
16161614
client.stop();
16171615
client.flush(); // release memory
16181616
clientsecure.stop();
@@ -2484,9 +2482,9 @@ void Audio::showID3Tag(const char* tag, const char* value){
24842482
//---------------------------------------------------------------------------------------------------------------------
24852483
uint32_t Audio::getFileSize(){
24862484
if (!audiofile) return 0;
2487-
//cardLock(true);
2485+
cardLock(true);
24882486
uint32_t s = audiofile.size();
2489-
//cardLock(false);
2487+
cardLock(false);
24902488
return s;
24912489
}
24922490
//---------------------------------------------------------------------------------------------------------------------

yoRadio/src/audioVS1053/audioVS1053Ex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ class Audio : private AudioBuffer{
310310
bool setFilePos(uint32_t pos);
311311
uint32_t getAudioFileDuration();
312312
uint32_t getAudioCurrentTime();
313-
SemaphoreHandle_t mutex_pl=NULL;
314313
size_t bufferFilled();
315314
size_t bufferFree();
316315
size_t inBufferFilled(){ return bufferFilled(); }

yoRadio/src/core/audiohandlers.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,13 @@ void audio_id3data(const char *info){ //id3 metadata
112112

113113
void audio_eof_mp3(const char *info){ //end of file
114114
config.sdResumePos = 0;
115-
if(config.sdSnuffle){
116-
player.sendCommand({PR_PLAY, random(1, config.store.countStation)});
117-
}else{
118-
player.next();
119-
}
115+
player.next();
120116
}
121117

122118
void audio_eof_stream(const char *info){
123119
player.sendCommand({PR_STOP, 0});
124120
if(!player.resumeAfterUrl) return;
125-
if (config.store.play_mode==PM_WEB){
121+
if (config.getMode()==PM_WEB){
126122
player.sendCommand({PR_PLAY, config.store.lastStation});
127123
}else{
128124
player.setResumeFilePos( config.sdResumePos==0?0:config.sdResumePos-player.sd_min);

0 commit comments

Comments
 (0)