diff --git a/README.md b/README.md index 4f65194..486541a 100644 --- a/README.md +++ b/README.md @@ -278,6 +278,11 @@ Work is in progress... --- ## Version history +#### v0.6.220 +- new option PLAYER_FORCE_MONO (with i2S DAC only) +- change default scroll speed in DSP_NOKIA5110 +- improved reconnect to WiFi on connection loss + #### v0.6.210 - fixed choppy playback on DSP_ST7735 displays used with VS1053 - new option PL_WITH_NUMBERS (show the number of station in the playlist) diff --git a/exsamples/myoptions.h b/exsamples/myoptions.h index a655de2..97e6c38 100644 --- a/exsamples/myoptions.h +++ b/exsamples/myoptions.h @@ -103,6 +103,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti //#define MUTE_PIN 255 /* MUTE Pin */ //#define MUTE_VAL HIGH /* Write this to MUTE_PIN when player is stopped */ //#define PL_WITH_NUMBERS /* show the number of station in the playlist */ +//#define PLAYER_FORCE_MONO false /* mono option on boot - false stereo, true mono */ /******************************************/ diff --git a/images/img0.jpg b/images/img0.jpg index b5482aa..f5756c0 100644 Binary files a/images/img0.jpg and b/images/img0.jpg differ diff --git a/yoRadio/display.cpp b/yoRadio/display.cpp index 4d6eb48..8a07b1d 100644 --- a/yoRadio/display.cpp +++ b/yoRadio/display.cpp @@ -533,27 +533,10 @@ void Display::ip() { dsp.ip(WiFi.localIP().toString().c_str()); } -void Display::checkConnection() { - if (WiFi.status() != WL_CONNECTED) { - bool playing = player.mode == PLAYING; - swichMode(LOST); - if (playing) player.mode = STOPPED; - WiFi.disconnect(); - ip(); - WiFi.reconnect(); - while (WiFi.status() != WL_CONNECTED) { - delay(500); - } - swichMode(PLAYER); - if (playing) player.play(config.store.lastStation); - } -} - void Display::time(bool redraw) { if (dsp_before_clock) if (!dsp_before_clock(&dsp, dt)) return; char timeStringBuff[20] = { 0 }; if (!dt) { - checkConnection(); heap(); rssi(); } diff --git a/yoRadio/display.h b/yoRadio/display.h index 26573bb..d66acef 100644 --- a/yoRadio/display.h +++ b/yoRadio/display.h @@ -129,7 +129,6 @@ class Display { void apScreen(); void drawPlayer(); void drawVolume(); - void checkConnection(); void swichMode(displayMode_e newmode); void drawPlaylist(); void volume(); diff --git a/yoRadio/options.h b/yoRadio/options.h index 052e0d7..db30ebf 100644 --- a/yoRadio/options.h +++ b/yoRadio/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define VERSION "0.6.210" +#define VERSION "0.6.220" /******************************************************* DO NOT EDIT THIS FILE. @@ -203,7 +203,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti #ifndef MUTE_VAL #define MUTE_VAL HIGH // Write this to MUTE_PIN when player is stopped #endif - +#ifndef PLAYER_FORCE_MONO + #define PLAYER_FORCE_MONO false // mono option - false stereo, true mono +#endif /* *** ST7735 display submodel *** INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html diff --git a/yoRadio/src/audioVS1053/audioVS1053Ex.h b/yoRadio/src/audioVS1053/audioVS1053Ex.h index ac9e3f5..c8a94c4 100644 --- a/yoRadio/src/audioVS1053/audioVS1053Ex.h +++ b/yoRadio/src/audioVS1053/audioVS1053Ex.h @@ -272,6 +272,7 @@ public: void setBalance(int8_t bal = 0); void setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass); void setDefaults(); + void forceMono(bool m) {} // TODO // implement several function with respect to the index of string bool startsWith (const char* base, const char* str) { return (strstr(base, str) - base) == 0;} bool endsWith (const char* base, const char* str) { diff --git a/yoRadio/src/displays/displayN5110.h b/yoRadio/src/displays/displayN5110.h index 18aae39..5cf20b1 100644 --- a/yoRadio/src/displays/displayN5110.h +++ b/yoRadio/src/displays/displayN5110.h @@ -14,8 +14,8 @@ #if !defined(SCROLLDELTA) || !defined(SCROLLTIME) //#define SCROLLDELTA 8 //#define SCROLLTIME 332 -#define SCROLLDELTA 5 -#define SCROLLTIME 200 +#define SCROLLDELTA 4 +#define SCROLLTIME 250 #endif #define META_SIZE 1 diff --git a/yoRadio/yoRadio.ino b/yoRadio/yoRadio.ino index ad3190d..42b424c 100644 --- a/yoRadio/yoRadio.ino +++ b/yoRadio/yoRadio.ino @@ -14,6 +14,9 @@ #include "controls.h" #include "mqtt.h" +unsigned long checkMillis = 0; +unsigned long checkInterval = 3000; + void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); @@ -28,6 +31,9 @@ void setup() { } netserver.begin(); telnet.begin(); +#if PLAYER_FORCE_MONO + player.forceMono(true); +#endif player.setVol(config.store.volume, true); initControls(); display.start(); @@ -44,7 +50,26 @@ void loop() { telnet.loop(); player.loop(); loopControls(); + checkConnection(); } // display.loop(); netserver.loop(); } + +void checkConnection(){ + if ((WiFi.status() != WL_CONNECTED) && (millis() - checkMillis >=checkInterval)) { + bool playing = player.isRunning(); + if (playing) player.mode = STOPPED; + display.putRequest({NEWMODE, LOST}); + Serial.println("Lost connection, reconnecting..."); + while(true){ + if (WiFi.status() == WL_CONNECTED) break; + WiFi.disconnect(); + WiFi.reconnect(); + delay(3000); + } + display.putRequest({NEWMODE, PLAYER}); + if (playing) player.request.station = config.store.lastStation; + checkMillis = millis(); + } +}