diff --git a/README.md b/README.md index 528d95c..af64052 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,10 @@ Work is in progress... --- ## Version history +#### v0.7.010 +- fixed choppy of sound when volume adjustment +- fixed initialisation of Nextion displays + #### v0.7.000 - added support for Nextion displays ([more info](nextion/README.md)) - fixed work of VU Meter @@ -312,10 +316,10 @@ Work is in progress... option ENABLE_VU_METER (see [myoptions.h](exsamples/myoptions.h#L113) for exsample) \ **!!! Important !!!** \ if you enable this feathure on the esp32 wroom, due to lack of memory, you must modify the file Arduino/libraries/AsyncTCP/src/AsyncTCP.cpp \ - replace the line 221 \ - xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE); \ - with \ - xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 / 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE); + **replace the line 221** \ + _xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);_ \ + **with** \ + _xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 / 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);_ #### v0.6.450 **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** diff --git a/yoRadio/config.cpp b/yoRadio/config.cpp index 4cdd2b7..4d0a6ec 100644 --- a/yoRadio/config.cpp +++ b/yoRadio/config.cpp @@ -98,13 +98,13 @@ void Config::saveIR(){ } #endif -byte Config::setVolume(byte val, bool dosave) { +void Config::saveVolume(){ + EEPROM.write(EEPROM_START + sizeof(store.config_set), store.volume); + EEPROM.commit(); +} + +byte Config::setVolume(byte val) { store.volume = val; - if (dosave) { - //save(); - EEPROM.write(EEPROM_START + sizeof(store.config_set), store.volume); - EEPROM.commit(); - } return store.volume; } diff --git a/yoRadio/config.h b/yoRadio/config.h index 900281a..57e3f0c 100644 --- a/yoRadio/config.h +++ b/yoRadio/config.h @@ -72,7 +72,8 @@ class Config { void saveIR(); #endif void init(); - byte setVolume(byte val, bool dosave); + byte setVolume(byte val); + void saveVolume(); void setTone(int8_t bass, int8_t middle, int8_t trebble); void setBalance(int8_t balance); byte setLastStation(byte val); diff --git a/yoRadio/options.h b/yoRadio/options.h index 8dc37b0..ea16756 100644 --- a/yoRadio/options.h +++ b/yoRadio/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define VERSION "0.7.000" +#define VERSION "0.7.010" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/player.cpp b/yoRadio/player.cpp index c6f4013..d9e9640 100644 --- a/yoRadio/player.cpp +++ b/yoRadio/player.cpp @@ -47,6 +47,7 @@ void Player::init() { mode = STOPPED; setOutputPins(false); requestToStart = true; + volTimer=false; zeroRequest(); } @@ -81,13 +82,19 @@ void Player::loop() { zeroRequest(); } if (request.volume >= 0) { - config.setVolume(request.volume, request.doSave); + config.setVolume(request.volume); telnet.printf("##CLI.VOL#: %d\n", config.store.volume); Audio::setVolume(volToI2S(request.volume)); zeroRequest(); display.putRequest({DRAWVOL, 0}); netserver.requestOnChange(VOLUME, 0); } + if(volTimer){ + if((millis()-volTicks)>3000){ + config.saveVolume(); + volTimer=false; + } + } } void Player::zeroRequest() { @@ -174,6 +181,8 @@ void Player::setVol(byte volume, bool inside) { if (inside) { setVolume(volToI2S(volume)); } else { + volTicks = millis(); + volTimer = true; request.volume = volume; request.doSave = true; } diff --git a/yoRadio/player.h b/yoRadio/player.h index 96ba08a..2ee8d42 100644 --- a/yoRadio/player.h +++ b/yoRadio/player.h @@ -16,6 +16,9 @@ struct audiorequest_t bool doSave; }; class Player: public Audio { + private: + uint32_t volTicks; /* delayed volume save */ + bool volTimer; /* delayed volume save */ public: audioMode_e mode; audiorequest_t request; diff --git a/yoRadio/src/displays/nextion.cpp b/yoRadio/src/displays/nextion.cpp index eb3d80b..f04de3b 100644 --- a/yoRadio/src/displays/nextion.cpp +++ b/yoRadio/src/displays/nextion.cpp @@ -74,8 +74,10 @@ void Nextion::begin(bool dummy) { rx_pos = 0; _volInside=false; snprintf(_espcoreversion, sizeof(_espcoreversion) - 1, "%d.%d.%d", ESP_ARDUINO_VERSION_MAJOR, ESP_ARDUINO_VERSION_MINOR, ESP_ARDUINO_VERSION_PATCH); + putcmd(""); putcmd("rest"); delay(200); + putcmd(""); putcmd("bkcmd=0"); // putcmd("page boot"); if(dummy) {