From d2193350f84adc0a06f154c86a6ce8e404c2c207 Mon Sep 17 00:00:00 2001 From: e2002 Date: Sun, 26 Mar 2023 21:28:22 +0300 Subject: [PATCH] n5110_crash_fix_127 --- yoRadio/src/AsyncWebServer/AsyncTCP.cpp | 2 +- yoRadio/src/AsyncWebServer/AsyncTCP.h | 4 +++- yoRadio/src/core/options.h | 5 ++++- yoRadio/src/core/player.cpp | 8 +++++--- yoRadio/src/displays/conf/displayLCD2004conf.h | 4 ++-- yoRadio/src/displays/displayN5110.cpp | 3 ++- yoRadio/src/displays/widgets/widgets.cpp | 3 +++ yoRadio/src/displays/widgets/widgets.h | 1 + 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/yoRadio/src/AsyncWebServer/AsyncTCP.cpp b/yoRadio/src/AsyncWebServer/AsyncTCP.cpp index d0c5344..0af17fd 100644 --- a/yoRadio/src/AsyncWebServer/AsyncTCP.cpp +++ b/yoRadio/src/AsyncWebServer/AsyncTCP.cpp @@ -104,7 +104,7 @@ static inline bool _init_async_event_queue(){ } static inline bool _send_async_event(lwip_event_packet_t ** e){ - return _async_queue && xQueueSend(_async_queue, e, portMAX_DELAY) == pdPASS; + return _async_queue && xQueueSend(_async_queue, e, SEND_ASYNC_EVENT_DELAY) == pdPASS; } static inline bool _prepend_async_event(lwip_event_packet_t ** e){ diff --git a/yoRadio/src/AsyncWebServer/AsyncTCP.h b/yoRadio/src/AsyncWebServer/AsyncTCP.h index 4af403d..31a3df2 100644 --- a/yoRadio/src/AsyncWebServer/AsyncTCP.h +++ b/yoRadio/src/AsyncWebServer/AsyncTCP.h @@ -46,7 +46,9 @@ extern "C" { #ifndef XQUEUE_SIZE #define XQUEUE_SIZE 128 // (32) #endif - +#ifndef SEND_ASYNC_EVENT_DELAY + #define SEND_ASYNC_EVENT_DELAY portMAX_DELAY +#endif class AsyncClient; #define ASYNC_MAX_ACK_TIME 5000 diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index b9d1573..9872cff 100644 --- a/yoRadio/src/core/options.h +++ b/yoRadio/src/core/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define YOVERSION "0.9.122" +#define YOVERSION "0.9.127" /******************************************************* DO NOT EDIT THIS FILE. @@ -257,6 +257,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 MUTE_LOCK + #define MUTE_LOCK false // for vs1053 Shield rev2 - lock MUTE_PIN to !MUTE_VAL +#endif #ifndef BRIGHTNESS_PIN #define BRIGHTNESS_PIN 255 // BRIGHTNESS Pin #endif diff --git a/yoRadio/src/core/player.cpp b/yoRadio/src/core/player.cpp index c03100b..f774139 100644 --- a/yoRadio/src/core/player.cpp +++ b/yoRadio/src/core/player.cpp @@ -37,7 +37,8 @@ void Player::init() { Serial.print("##[BOOT]#\tplayer.init\t"); playerQueue=NULL; playerQueue = xQueueCreate( 5, sizeof( playerRequestParams_t ) ); - + setOutputPins(false); + delay(50); memset(_plError, 0, PLERR_LN); #ifdef MQTT_ROOT_TOPIC memset(burl, 0, MQTT_BURL_SIZE); @@ -56,7 +57,7 @@ void Player::init() { setTone(config.store.bass, config.store.middle, config.store.trebble); setVolume(0); _status = STOPPED; - setOutputPins(false); + //setOutputPins(false); _volTimer=false; playmutex = xSemaphoreCreateMutex(); randomSeed(analogRead(0)); @@ -159,7 +160,8 @@ void Player::loop() { void Player::setOutputPins(bool isPlaying) { if(LED_BUILTIN!=255) digitalWrite(LED_BUILTIN, LED_INVERT?!isPlaying:isPlaying); - if(MUTE_PIN!=255) digitalWrite(MUTE_PIN, isPlaying?!MUTE_VAL:MUTE_VAL); + bool _ml = MUTE_LOCK?!MUTE_VAL:(isPlaying?!MUTE_VAL:MUTE_VAL); + if(MUTE_PIN!=255) digitalWrite(MUTE_PIN, _ml); } void Player::_play(uint16_t stationId) { diff --git a/yoRadio/src/displays/conf/displayLCD2004conf.h b/yoRadio/src/displays/conf/displayLCD2004conf.h index 3174cc6..e71b592 100644 --- a/yoRadio/src/displays/conf/displayLCD2004conf.h +++ b/yoRadio/src/displays/conf/displayLCD2004conf.h @@ -5,8 +5,8 @@ More info on https://github.com/e2002/yoradio/wiki/Widgets#widgets-description *************************************************************************************/ -#ifndef displayLCD1602conf_h -#define displayLCD1602conf_h +#ifndef displayLCD2004conf_h +#define displayLCD2004conf_h #define DSP_WIDTH 20 #define TFT_FRAMEWDT 0 diff --git a/yoRadio/src/displays/displayN5110.cpp b/yoRadio/src/displays/displayN5110.cpp index d76a964..c66eb05 100644 --- a/yoRadio/src/displays/displayN5110.cpp +++ b/yoRadio/src/displays/displayN5110.cpp @@ -180,8 +180,9 @@ void DspCore::clearClock(){ void DspCore::loop(bool force) { + if(digitalRead(TFT_CS)==LOW) return; display(); - delay(5); + delay(10); } void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){ diff --git a/yoRadio/src/displays/widgets/widgets.cpp b/yoRadio/src/displays/widgets/widgets.cpp index ba2e432..305fec1 100644 --- a/yoRadio/src/displays/widgets/widgets.cpp +++ b/yoRadio/src/displays/widgets/widgets.cpp @@ -265,6 +265,9 @@ void SliderWidget::_clear() { // _oldvalwidth = 0; dsp.fillRect(_config.left, _config.top, _width, _height, _bgcolor); } +void SliderWidget::_reset() { + _oldvalwidth = 0; +} /************************ VU WIDGET ************************/ diff --git a/yoRadio/src/displays/widgets/widgets.h b/yoRadio/src/displays/widgets/widgets.h index 89f0f6c..1f801a6 100644 --- a/yoRadio/src/displays/widgets/widgets.h +++ b/yoRadio/src/displays/widgets/widgets.h @@ -191,6 +191,7 @@ class SliderWidget: public Widget { void _draw(); void _drawslider(); void _clear(); + void _reset(); }; class VuWidget: public Widget {