This commit is contained in:
e2002
2022-08-29 10:23:53 +03:00
parent de9753058d
commit b574b4ab8d
15 changed files with 435 additions and 680 deletions

View File

@@ -317,6 +317,24 @@ Work is in progress...
---
## Version history
#### v0.7.490
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** \
**Please backup playlist.csv and wifi.csv before updating.**
- fixed playlist break down when saving it
- fixed bug with cropped song titles on single line displays (GC9106, ST7735mini, N5110 etc.)
- netserver - optimization and refactoring
- web interface optimization
- the AUDIOBUFFER_MULTIPLIER parameter is deprecated. New parameter AUDIOBUFFER_MULTIPLIER2. If everything works fine, then it is better not to touch it.
- new setting VS_PATCH_ENABLE (see PS)
- fixing other bugs
_**PS:** A bug was found with the lack of sound on some (not all) green VS1053 boards.
If there is no sound, you need to assign in myoptions_
```
#define VS_PATCH_ENABLE false
```
_On red boards and normally working green boards, nothing else needs to be done._
#### v0.7.414
- fixed non latin long titles of songs error

View File

@@ -15,7 +15,7 @@ void audio_info(const char *info) {
player.mode = STOPPED;
player.stopInfo();
}
if (strstr(info, "not supported") != NULL){
if (strstr(info, "not supported") != NULL || strstr(info, "Account already in use") != NULL){
config.setTitle(info);
netserver.requestOnChange(TITLE, 0);
player.setOutputPins(false);
@@ -47,20 +47,32 @@ bool printable(const char *info) {
}
void audio_showstation(const char *info) {
DBGVB("[%s] info = %s", __func__, info);
if (strlen(info) > 0) {
bool p = printable(info);
config.setTitle(p?info:"*****");
config.setTitle(p?info:config.station.name);
netserver.requestOnChange(TITLE, 0);
}
}
void audio_showstreamtitle(const char *info) {
DBGVB("[%s] info = %s", __func__, info);
if (strstr(info, "Account already in use") != NULL){
config.setTitle(info);
netserver.requestOnChange(TITLE, 0);
player.setOutputPins(false);
player.setDefaults();
if (player_on_stop_play) player_on_stop_play();
player.mode = STOPPED;
player.stopInfo();
return;
}
if (strlen(info) > 0) {
bool p = printable(info);
#ifdef DEBUG_TITLES
config.setTitle(DEBUG_TITLES);
#else
config.setTitle(p?info:"*****");
config.setTitle(p?info:config.station.name);
#endif
netserver.requestOnChange(TITLE, 0);
}

View File

@@ -443,7 +443,7 @@ bool Config::parseSsid(const char* line, char* ssid, char* pass) {
return true;
}
bool Config::saveWifi(const char* post) {
bool Config::saveWifiFromNextion(const char* post){
File file = SPIFFS.open(SSIDS_PATH, "w");
if (!file) {
return false;
@@ -455,6 +455,14 @@ bool Config::saveWifi(const char* post) {
}
}
bool Config::saveWifi() {
if (!SPIFFS.exists(TMP_PATH)) return false;
SPIFFS.remove(SSIDS_PATH);
SPIFFS.rename(TMP_PATH, SSIDS_PATH);
ESP.restart();
return true;
}
bool Config::initNetwork() {
File file = SPIFFS.open(SSIDS_PATH, "r");
if (!file || file.isDirectory()) {

View File

@@ -147,7 +147,8 @@ class Config {
bool parseSsid(const char* line, char* ssid, char* pass);
void loadStation(uint16_t station);
bool initNetwork();
bool saveWifi(const char* post);
bool saveWifi();
bool saveWifiFromNextion(const char* post);
void setSmartStart(byte ss);
void initPlaylist();
void indexPlaylist();

Binary file not shown.

View File

@@ -177,6 +177,7 @@
</div>
</div>
<div class="flex-row last">
<input id="file-upload" type="file" accept=".txt, .csv" hidden/>
<div class="button group group_system hidden" data-name="wifiexport">Export</div>
<div class="button hlbutton" data-name="wifiupload">Save &amp; Reboot</div>
</div>

View File

@@ -580,7 +580,7 @@ char *split(char *str, const char *delim) {
}
void Display::title() {
DBGVB("call of %s(), config.station.title=%s", __func__, config.station.title);
DBGVB("[%s] config.station.title = %s", __func__, config.station.title);
if (strlen(config.station.title) > 0) {
char tmpbuf[strlen(config.station.title)+1];
strlcpy(tmpbuf, config.station.title, strlen(config.station.title)+1);
@@ -589,7 +589,7 @@ void Display::title() {
title1.setText(dsp.utf8Rus(tmpbuf, true));
title2.setText(dsp.utf8Rus(stitle, true));
}else{
title1.setText(dsp.utf8Rus(tmpbuf, true));
title1.setText(dsp.utf8Rus(config.station.title, true));
title2.setText(dsp.utf8Rus("", true));
}
#ifdef USE_NEXTION

File diff suppressed because it is too large Load Diff

View File

@@ -6,38 +6,38 @@
#include "AsyncUDP.h"
enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, ITEM=3, TITLE=4, VOLUME=5, NRSSI=6, BITRATE=7, MODE=8, EQUALIZER=9, BALANCE=10, PLAYLISTSAVED=11, GETMODE=12, GETINDEX=13, GETACTIVE=14, GETSYSTEM=15, GETSCREEN=16, GETTIMEZONE=17, GETWEATHER=18, GETCONTROLS=19, DSPON=20 };
enum htmlPath_e : uint8_t { PINDEX=1, PSETTINGS=2, PUPDATE=3, PIR=4, PPLAYLIST=5, PSSIDS=6 };
enum import_e : uint8_t { IMDONE=0, IMPL=1, IMWIFI=2 };
#define PLOW() //player.setBufsize(1600*2, -1); vTaskDelay(150)
#define PHIG() //vTaskDelay(150); player.setBufsize(1600*AUDIOBUFFER_MULTIPLIER2, -1)
class NetServer {
public:
uint8_t playlistrequest; // ClientId want the playlist
bool importRequest;
//uint8_t playlistrequest; // ClientId want the playlist/* Cleanup this */
import_e importRequest;
bool resumePlay;
htmlPath_e htmlPath;
char chunkedPathBuffer[40];
public:
NetServer() {};
bool begin();
void loop();
void requestOnChange(requestType_e request, uint8_t clientId);
void setRSSI(int val);
void setRSSI(int val) { rssi = val; };
void chunkedHtmlPage(const String& contentType, AsyncWebServerRequest *request, const char * path, bool gzip = false);
void onWsMessage(void *arg, uint8_t *data, size_t len, uint8_t clientId);
bool savePlaylist(const char* post);
void takeMallocDog();
void giveMallocDog();
uint32_t max, htmlpos;
bool theend;
#if IR_PIN!=255
bool irRecordEnable;
void irToWs(const char* protocol, uint64_t irvalue);
void irValsToWs();
void chunkedHtmlPage(const String& contentType, AsyncWebServerRequest *request);
#endif
private:
requestType_e request;
int rssi;
void getPlaylist(uint8_t clientId);
bool importPlaylist();
static size_t chunkedHtmlPageCallback(uint8_t* buffer, size_t maxLen, size_t index);
static void beginUpload(AsyncWebServerRequest *request);
static void beginUpdate(AsyncWebServerRequest *request);
};
extern NetServer netserver;

View File

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

View File

@@ -61,7 +61,10 @@ void Player::stopInfo() {
void Player::loop() {
if (mode == PLAYING) {
xSemaphoreTake(playmutex, portMAX_DELAY);
Audio::loop();
xSemaphoreGive(playmutex);
vTaskDelay(2);
} else {
if (isRunning()) {
//digitalWrite(LED_BUILTIN, LOW);
@@ -71,7 +74,6 @@ void Player::loop() {
//stopSong();
setDefaults();
stopInfo();
xSemaphoreGive(playmutex);
if (player_on_stop_play) player_on_stop_play();
}
}
@@ -112,8 +114,6 @@ void Player::setOutputPins(bool isPlaying) {
void Player::play(uint16_t stationId) {
//stopSong();
xSemaphoreGive(playmutex);
xSemaphoreTake(playmutex, portMAX_DELAY);
setDefaults();
setOutputPins(false);
config.setTitle("[connecting]");

View File

@@ -32,8 +32,8 @@
#include <FFat.h>
#endif // SDFATFS_USED
#ifndef AUDIOBUFFER_MULTIPLIER
#define AUDIOBUFFER_MULTIPLIER 12
#ifndef AUDIOBUFFER_MULTIPLIER2
#define AUDIOBUFFER_MULTIPLIER2 8
#endif
#ifdef SDFATFS_USED
@@ -140,7 +140,7 @@ public:
protected:
size_t m_buffSizePSRAM = 300000; // most webstreams limit the advance to 100...300Kbytes
//size_t m_buffSizeRAM = 1600 * 5;
size_t m_buffSizeRAM = 1600 * AUDIOBUFFER_MULTIPLIER;
size_t m_buffSizeRAM = 1600 * AUDIOBUFFER_MULTIPLIER2;
size_t m_buffSize = 0;
size_t m_freeSpace = 0;
size_t m_writeSpace = 0;

View File

@@ -7,7 +7,9 @@
* Updated on: Aug 15.2022
* Author: Wolle
*/
#ifndef VS_PATCH_ENABLE
#define VS_PATCH_ENABLE true
#endif
#include "audioVS1053Ex.h"
//---------------------------------------------------------------------------------------------------------------------
@@ -325,7 +327,7 @@ void Audio::begin(){
setVUmeter();
m_endFillByte = wram_read(0x1E06) & 0xFF;
// printDetails("After last clocksetting \n");
loadUserCode(); // load in VS1053B if you want to play flac
if(VS_PATCH_ENABLE) loadUserCode(); // load in VS1053B if you want to play flac
startSong();
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1613,6 +1615,7 @@ void Audio::setDefaults(){
* \n The VU meter takes about 0.2MHz of processing power with 48 kHz samplerate.
*/
void Audio::setVUmeter() {
if(!VS_PATCH_ENABLE) return;
uint16_t MP3Status = read_register(SCI_STATUS);
if(MP3Status==0) {
Serial.println("VS1053 Error: Unable to write SCI_STATUS");
@@ -1636,6 +1639,7 @@ void Audio::setVUmeter() {
* \warning This feature is only available with patches that support VU meter.
*/
void Audio::getVUlevel() {
if(!VS_PATCH_ENABLE) return;
if(!_vuInitalized) return;
int16_t reg = read_register(SCI_AICTRL3);
uint8_t rl = map((uint8_t)reg, 85, 92, 0, 255);

View File

@@ -9,8 +9,8 @@
#ifndef _vs1053_ext
#define _vs1053_ext
#ifndef AUDIOBUFFER_MULTIPLIER
#define AUDIOBUFFER_MULTIPLIER 12
#ifndef AUDIOBUFFER_MULTIPLIER2
#define AUDIOBUFFER_MULTIPLIER2 10
#endif
#define VS1053VOLM 128 // 128 or 96 only
@@ -97,7 +97,7 @@ public:
protected:
const size_t m_buffSizePSRAM = 300000; // most webstreams limit the advance to 100...300Kbytes
//const size_t m_buffSizeRAM = 1600 * 10;
const size_t m_buffSizeRAM = 1600 * AUDIOBUFFER_MULTIPLIER;
const size_t m_buffSizeRAM = 1600 * AUDIOBUFFER_MULTIPLIER2;
size_t m_buffSize = 0;
size_t m_freeSpace = 0;
size_t m_writeSpace = 0;

View File

@@ -353,7 +353,7 @@ void Nextion::loop() {
wifisettings+=(String(scanBuf)+"\n");
}
if (sscanf(rxbuf, "wifidone=%d", &scanDigit) == 1){
config.saveWifi(wifisettings.c_str());
config.saveWifiFromNextion(wifisettings.c_str());
}
}
}