From 9a3bb03f82f1eec8fe240f30799ada5b790f5fc8 Mon Sep 17 00:00:00 2001 From: e2002 Date: Mon, 15 Sep 2025 17:01:48 +0300 Subject: [PATCH] v0.9.720 --- README.md | 10 ++++++++++ yoRadio/src/audioI2S/Audio.cpp | 2 +- yoRadio/src/core/mqtt.cpp | 17 ++--------------- yoRadio/src/core/network.cpp | 24 +++++++++++------------- yoRadio/src/core/options.h | 2 +- yoRadio/src/displays/displayGC9106.cpp | 6 +----- yoRadio/src/displays/displayGC9A01A.cpp | 5 ----- yoRadio/src/displays/displayILI9488.cpp | 5 ----- yoRadio/src/displays/displaySSD1305.cpp | 8 ++------ yoRadio/src/displays/displaySSD1322.cpp | 7 ++----- yoRadio/src/displays/displayST7735.cpp | 5 ----- yoRadio/src/displays/displayST7789.cpp | 5 ----- yoRadio/src/displays/displayST7796.cpp | 5 ----- yoRadio/src/displays/displayST7920.cpp | 8 ++------ yoRadio/src/main.cpp | 5 +---- 15 files changed, 33 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 0cd03cc..090dc12 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,16 @@ Work is in progress... --- ## Version history +#### v0.9.720 +- PR #211 https://github.com/e2002/yoradio/pull/211 +- fix packets lost in HLS-TS +- fix stuttering if datatransfer is chunked +- split processWebStream/processWebFile +- fixed the error of connecting to the next access points from the list if the first one is unavailable +- fixed playback control errors from Home Assistant +- the DEF_SPI_FREQ parameter, intended for setting the user speed SPI of displays, has been removed from the settings (they work fine anyway) +- fixed an error connecting to the MQTT server during initial boot in SDCARD mode + #### v0.9.711 - fixed compilation error for LCD displays #210 diff --git a/yoRadio/src/audioI2S/Audio.cpp b/yoRadio/src/audioI2S/Audio.cpp index 222d11b..099722e 100644 --- a/yoRadio/src/audioI2S/Audio.cpp +++ b/yoRadio/src/audioI2S/Audio.cpp @@ -3147,7 +3147,7 @@ void Audio::processWebStream() { if(InBuff.bufferFilled() > maxFrameSize) {f_tmr_1s = false; cnt_slow = 0; loopCnt = 0;} if(f_tmr_1s){ cnt_slow ++; - if(cnt_slow > 50){cnt_slow = 0; AUDIO_INFO("slow stream, dropouts are possible");} + if(cnt_slow > 50){cnt_slow = 0; f_tmr_1s = false; AUDIO_INFO("slow stream, dropouts are possible");} } // if the buffer can't filled for several seconds try a new connection - - - - - - - - - - - - - - - - - - - - - - - if(f_stream && !availableBytes){ diff --git a/yoRadio/src/core/mqtt.cpp b/yoRadio/src/core/mqtt.cpp index 276c3fe..3a94d0c 100644 --- a/yoRadio/src/core/mqtt.cpp +++ b/yoRadio/src/core/mqtt.cpp @@ -5,13 +5,13 @@ #include "mqtt.h" #include "WiFi.h" #include "player.h" +#include "commandhandler.h" AsyncMqttClient mqttClient; TimerHandle_t mqttReconnectTimer; char topic[100], status[BUFLEN*2]; void connectToMqtt() { - //config.waitConnection(); mqttClient.connect(); } @@ -82,20 +82,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties char buf[len+1]; strncpy(buf, payload, len); buf[len]='\0'; - if (strcmp(buf, "prev") == 0) { player.sendCommand({PR_PREV, 0}); return; } - if (strcmp(buf, "next") == 0) { player.sendCommand({PR_NEXT, 0}); return; } - if (strcmp(buf, "toggle") == 0) { player.sendCommand({PR_TOGGLE, 0}); return; } - if (strcmp(buf, "stop") == 0) { player.sendCommand({PR_STOP, 0}); return; } - if (strcmp(buf, "start") == 0 || strcmp(buf, "play") == 0) { player.sendCommand({PR_PLAY, config.lastStation()}); return; } - if (strcmp(buf, "boot") == 0 || strcmp(buf, "reboot") == 0) { ESP.restart(); return; } - if (strcmp(buf, "volm") == 0) { - player.stepVol(false); - return; - } - if (strcmp(buf, "volp") == 0) { - player.stepVol(true); - return; - } + if(cmd.exec(buf, "")) return; if (strcmp(buf, "turnoff") == 0) { uint8_t sst = config.store.smartstart; config.setDspOn(0); diff --git a/yoRadio/src/core/network.cpp b/yoRadio/src/core/network.cpp index 4bd7ba1..1a61a30 100644 --- a/yoRadio/src/core/network.cpp +++ b/yoRadio/src/core/network.cpp @@ -58,25 +58,16 @@ bool MyNetwork::wifiBegin(bool silent){ uint8_t ls = (config.store.lastSSID == 0 || config.store.lastSSID > config.ssidsCount) ? 0 : config.store.lastSSID - 1; uint8_t startedls = ls; uint8_t errcnt = 0; - WiFi.mode(WIFI_STA); - /* - char buf[MDNS_LENGTH]; - WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); - if(strlen(config.store.mdnsname)>0){ - WiFi.setHostname(config.store.mdnsname); - }else{ - snprintf(buf, MDNS_LENGTH, "yoradio-%x", config.getChipId()); - WiFi.setHostname(buf); - } - */ + //WiFi.mode(WIFI_STA); while (true) { if(!silent){ Serial.printf("##[BOOT]#\tAttempt to connect to %s\n", config.ssids[ls].ssid); Serial.print("##[BOOT]#\t"); display.putRequest(BOOTSTRING, ls); } - WiFi.disconnect(true, true); //disconnect & erase internal credentials https://github.com/e2002/yoradio/pull/164/commits/89d8b4450dde99cd7930b84bb14d81dab920b879 - delay(100); + //WiFi.disconnect(true, true); //disconnect & erase internal credentials https://github.com/e2002/yoradio/pull/164/commits/89d8b4450dde99cd7930b84bb14d81dab920b879 + //delay(100); + WiFi.mode(WIFI_STA); WiFi.begin(config.ssids[ls].ssid, config.ssids[ls].password); while (WiFi.status() != WL_CONNECTED) { if(!silent) Serial.print("."); @@ -88,6 +79,7 @@ bool MyNetwork::wifiBegin(bool silent){ ls++; if (ls > config.ssidsCount - 1) ls = 0; if(!silent) Serial.println(); + WiFi.mode(WIFI_OFF); break; } } @@ -112,6 +104,9 @@ void searchWiFi(void * pvParameters){ telnet.begin(true); network.setWifiParams(); display.putRequest(NEWIP, 0); + #ifdef MQTT_ROOT_TOPIC + mqttInit(); + #endif } vTaskDelete( NULL ); } @@ -134,6 +129,9 @@ void MyNetwork::begin() { Serial.println("."); status = CONNECTED; setWifiParams(); + #ifdef MQTT_ROOT_TOPIC + mqttInit(); + #endif }else{ status = SDREADY; xTaskCreatePinnedToCore(searchWiFi, "searchWiFi", 1024 * 4, NULL, 0, NULL, SEARCH_WIFI_CORE_ID); diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index ea02ed7..d5b3601 100644 --- a/yoRadio/src/core/options.h +++ b/yoRadio/src/core/options.h @@ -2,7 +2,7 @@ #define options_h #pragma once -#define YOVERSION "0.9.711" +#define YOVERSION "0.9.720" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/displays/displayGC9106.cpp b/yoRadio/src/displays/displayGC9106.cpp index 6e9f3e4..05a42d2 100644 --- a/yoRadio/src/displays/displayGC9106.cpp +++ b/yoRadio/src/displays/displayGC9106.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 24000000 /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): Adafruit_GC9106Ex(&SPI2, TFT_DC, TFT_CS, TFT_RST) {} #else @@ -14,7 +10,7 @@ DspCore::DspCore(): Adafruit_GC9106Ex(TFT_CS, TFT_DC, TFT_RST) {} #endif void DspCore::initDisplay() { - begin(DEF_SPI_FREQ); + begin(); cp437(true); invert(); flip(); diff --git a/yoRadio/src/displays/displayGC9A01A.cpp b/yoRadio/src/displays/displayGC9A01A.cpp index 81ef6b8..ee96bf7 100644 --- a/yoRadio/src/displays/displayGC9A01A.cpp +++ b/yoRadio/src/displays/displayGC9A01A.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): Adafruit_GC9A01A(&SPI2, TFT_CS, TFT_DC, TFT_RST) {} #else @@ -15,7 +11,6 @@ DspCore::DspCore(): Adafruit_GC9A01A(TFT_CS, TFT_DC, TFT_RST) {} void DspCore::initDisplay() { begin(); - if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); invert(); cp437(true); flip(); diff --git a/yoRadio/src/displays/displayILI9488.cpp b/yoRadio/src/displays/displayILI9488.cpp index a425088..3af057e 100644 --- a/yoRadio/src/displays/displayILI9488.cpp +++ b/yoRadio/src/displays/displayILI9488.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): ILI9486_SPI(&SPI2, TFT_CS, TFT_DC, TFT_RST) {} #else @@ -16,7 +12,6 @@ void DspCore::initDisplay() { setSpiKludge(false); init(); - //if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); cp437(true); setTextWrap(false); setTextSize(1); diff --git a/yoRadio/src/displays/displaySSD1305.cpp b/yoRadio/src/displays/displaySSD1305.cpp index 12c4ef6..2fbe965 100644 --- a/yoRadio/src/displays/displaySSD1305.cpp +++ b/yoRadio/src/displays/displaySSD1305.cpp @@ -7,15 +7,11 @@ #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda #endif -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 8000000UL /* set it to 0 for system default */ -#endif - #if DSP_MODEL==DSP_SSD1305 #if DSP_HSPI - DspCore::DspCore(): Adafruit_SSD1305(128, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): Adafruit_SSD1305(128, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS) {} #else - DspCore::DspCore(): Adafruit_SSD1305(128, 64, &SPI, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): Adafruit_SSD1305(128, 64, &SPI, TFT_DC, TFT_RST, TFT_CS) {} #endif #else #include diff --git a/yoRadio/src/displays/displaySSD1322.cpp b/yoRadio/src/displays/displaySSD1322.cpp index f96362a..4e9a994 100644 --- a/yoRadio/src/displays/displaySSD1322.cpp +++ b/yoRadio/src/displays/displaySSD1322.cpp @@ -3,17 +3,14 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 16000000UL /* set it to 0 for system default */ -#endif #ifndef SSD1322_GRAYSCALE #define SSD1322_GRAYSCALE false #endif #if DSP_HSPI - DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS) {} #else - DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI, TFT_DC, TFT_RST, TFT_CS) {} #endif void DspCore::initDisplay() { diff --git a/yoRadio/src/displays/displayST7735.cpp b/yoRadio/src/displays/displayST7735.cpp index 364a72b..24258a6 100644 --- a/yoRadio/src/displays/displayST7735.cpp +++ b/yoRadio/src/displays/displayST7735.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ -#define DEF_SPI_FREQ 0 //26000000UL /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): Adafruit_ST7735(&SPI2, TFT_CS, TFT_DC, TFT_RST) {} #else @@ -15,7 +11,6 @@ DspCore::DspCore(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {} void DspCore::initDisplay() { initR(DTYPE); - if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); cp437(true); invert(); flip(); diff --git a/yoRadio/src/displays/displayST7789.cpp b/yoRadio/src/displays/displayST7789.cpp index 620b401..504d402 100644 --- a/yoRadio/src/displays/displayST7789.cpp +++ b/yoRadio/src/displays/displayST7789.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): Adafruit_ST7789(&SPI2, TFT_CS, TFT_DC, TFT_RST) {} #else @@ -21,7 +17,6 @@ void DspCore::initDisplay() { }else{ init(240,(DSP_MODEL==DSP_ST7789)?320:240); } - if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); invert(); cp437(true); flip(); diff --git a/yoRadio/src/displays/displayST7796.cpp b/yoRadio/src/displays/displayST7796.cpp index 1903e20..6b856a1 100644 --- a/yoRadio/src/displays/displayST7796.cpp +++ b/yoRadio/src/displays/displayST7796.cpp @@ -3,10 +3,6 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */ -#endif - #if DSP_HSPI DspCore::DspCore(): Adafruit_ST7796S_kbv(&SPI2, TFT_DC, TFT_CS, TFT_RST) {} #else @@ -15,7 +11,6 @@ DspCore::DspCore(): Adafruit_ST7796S_kbv(TFT_CS, TFT_DC, TFT_RST) {} void DspCore::initDisplay() { begin(); - if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); invert(); cp437(true); flip(); diff --git a/yoRadio/src/displays/displayST7920.cpp b/yoRadio/src/displays/displayST7920.cpp index 68a2965..0798553 100644 --- a/yoRadio/src/displays/displayST7920.cpp +++ b/yoRadio/src/displays/displayST7920.cpp @@ -3,14 +3,10 @@ #include "dspcore.h" #include "../core/config.h" -#ifndef DEF_SPI_FREQ - #define DEF_SPI_FREQ 8000000UL -#endif - #if DSP_HSPI - DspCore::DspCore(): ST7920(&SPI2, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): ST7920(&SPI2, TFT_CS) {} #else - DspCore::DspCore(): ST7920(&SPI, TFT_CS, DEF_SPI_FREQ) {} + DspCore::DspCore(): ST7920(&SPI, TFT_CS) {} #endif void DspCore::initDisplay() { diff --git a/yoRadio/src/main.cpp b/yoRadio/src/main.cpp index 73f09e3..c8bdafa 100644 --- a/yoRadio/src/main.cpp +++ b/yoRadio/src/main.cpp @@ -8,7 +8,7 @@ #include "core/network.h" #include "core/netserver.h" #include "core/controls.h" -#include "core/mqtt.h" +//#include "core/mqtt.h" #include "core/optionschecker.h" #include "core/timekeeper.h" #ifdef USE_NEXTION @@ -94,9 +94,6 @@ void setup() { initControls(); display.putRequest(DSP_START); while(!display.ready()) delay(10); - #ifdef MQTT_ROOT_TOPIC - mqttInit(); - #endif #if USE_OTA setupOTA(); #endif