File tree Expand file tree Collapse file tree 9 files changed +38
-22
lines changed Expand file tree Collapse file tree 9 files changed +38
-22
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,11 @@ Work is in progress...
278278
279279---
280280## Version history
281+ #### v0.6.220
282+ - new option PLAYER_FORCE_MONO (with i2S DAC only)
283+ - change default scroll speed in DSP_NOKIA5110
284+ - improved reconnect to WiFi on connection loss
285+
281286#### v0.6.210
282287- fixed choppy playback on DSP_ST7735 displays used with VS1053
283288- new option PL_WITH_NUMBERS (show the number of station in the playlist)
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
103103//#define MUTE_PIN 255 /* MUTE Pin */
104104//#define MUTE_VAL HIGH /* Write this to MUTE_PIN when player is stopped */
105105//#define PL_WITH_NUMBERS /* show the number of station in the playlist */
106+ //#define PLAYER_FORCE_MONO false /* mono option on boot - false stereo, true mono */
106107
107108/******************************************/
108109
Original file line number Diff line number Diff line change @@ -533,27 +533,10 @@ void Display::ip() {
533533 dsp.ip (WiFi.localIP ().toString ().c_str ());
534534}
535535
536- void Display::checkConnection () {
537- if (WiFi.status () != WL_CONNECTED) {
538- bool playing = player.mode == PLAYING;
539- swichMode (LOST);
540- if (playing) player.mode = STOPPED;
541- WiFi.disconnect ();
542- ip ();
543- WiFi.reconnect ();
544- while (WiFi.status () != WL_CONNECTED) {
545- delay (500 );
546- }
547- swichMode (PLAYER);
548- if (playing) player.play (config.store .lastStation );
549- }
550- }
551-
552536void Display::time (bool redraw) {
553537 if (dsp_before_clock) if (!dsp_before_clock (&dsp, dt)) return ;
554538 char timeStringBuff[20 ] = { 0 };
555539 if (!dt) {
556- checkConnection ();
557540 heap ();
558541 rssi ();
559542 }
Original file line number Diff line number Diff line change @@ -129,7 +129,6 @@ class Display {
129129 void apScreen ();
130130 void drawPlayer ();
131131 void drawVolume ();
132- void checkConnection ();
133132 void swichMode (displayMode_e newmode);
134133 void drawPlaylist ();
135134 void volume ();
Original file line number Diff line number Diff line change 11#ifndef options_h
22#define options_h
33
4- #define VERSION "0.6.210 "
4+ #define VERSION "0.6.220 "
55
66/*******************************************************
77DO NOT EDIT THIS FILE.
@@ -203,7 +203,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
203203#ifndef MUTE_VAL
204204 #define MUTE_VAL HIGH // Write this to MUTE_PIN when player is stopped
205205#endif
206-
206+ #ifndef PLAYER_FORCE_MONO
207+ #define PLAYER_FORCE_MONO false // mono option - false stereo, true mono
208+ #endif
207209/*
208210*** ST7735 display submodel ***
209211INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html
Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ class Audio : private AudioBuffer{
272272 void setBalance (int8_t bal = 0 );
273273 void setTone (int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass);
274274 void setDefaults ();
275+ void forceMono (bool m) {} // TODO
275276 // implement several function with respect to the index of string
276277 bool startsWith (const char * base, const char * str) { return (strstr (base, str) - base) == 0 ;}
277278 bool endsWith (const char * base, const char * str) {
Original file line number Diff line number Diff line change 1414#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
1515// #define SCROLLDELTA 8
1616// #define SCROLLTIME 332
17- #define SCROLLDELTA 5
18- #define SCROLLTIME 200
17+ #define SCROLLDELTA 4
18+ #define SCROLLTIME 250
1919#endif
2020
2121#define META_SIZE 1
Original file line number Diff line number Diff line change 1414#include " controls.h"
1515#include " mqtt.h"
1616
17+ unsigned long checkMillis = 0 ;
18+ unsigned long checkInterval = 3000 ;
19+
1720void setup () {
1821 Serial.begin (115200 );
1922 pinMode (LED_BUILTIN, OUTPUT);
@@ -28,6 +31,9 @@ void setup() {
2831 }
2932 netserver.begin ();
3033 telnet.begin ();
34+ #if PLAYER_FORCE_MONO
35+ player.forceMono (true );
36+ #endif
3137 player.setVol (config.store .volume , true );
3238 initControls ();
3339 display.start ();
@@ -44,7 +50,26 @@ void loop() {
4450 telnet.loop ();
4551 player.loop ();
4652 loopControls ();
53+ checkConnection ();
4754 }
4855// display.loop();
4956 netserver.loop ();
5057}
58+
59+ void checkConnection (){
60+ if ((WiFi.status () != WL_CONNECTED) && (millis () - checkMillis >=checkInterval)) {
61+ bool playing = player.isRunning ();
62+ if (playing) player.mode = STOPPED;
63+ display.putRequest ({NEWMODE, LOST});
64+ Serial.println (" Lost connection, reconnecting..." );
65+ while (true ){
66+ if (WiFi.status () == WL_CONNECTED) break ;
67+ WiFi.disconnect ();
68+ WiFi.reconnect ();
69+ delay (3000 );
70+ }
71+ display.putRequest ({NEWMODE, PLAYER});
72+ if (playing) player.request .station = config.store .lastStation ;
73+ checkMillis = millis ();
74+ }
75+ }
You can’t perform that action at this time.
0 commit comments