player_queue_099
This commit is contained in:
@@ -345,7 +345,7 @@ void Display::_layoutChange(bool played){
|
||||
}
|
||||
}
|
||||
#ifndef DSP_QUEUE_TICKS
|
||||
#define DSP_QUEUE_TICKS 8
|
||||
#define DSP_QUEUE_TICKS 0
|
||||
#endif
|
||||
void Display::loop() {
|
||||
if(_bootStep==0) {
|
||||
@@ -483,9 +483,12 @@ void Display::_title() {
|
||||
}
|
||||
|
||||
void Display::_time(bool redraw) {
|
||||
|
||||
#if LIGHT_SENSOR!=255
|
||||
config.store.brightness = AUTOBACKLIGHT(analogRead(LIGHT_SENSOR));
|
||||
config.setBrightness();
|
||||
if(config.store.dspon) {
|
||||
config.store.brightness = AUTOBACKLIGHT(analogRead(LIGHT_SENSOR));
|
||||
config.setBrightness();
|
||||
}
|
||||
#endif
|
||||
_clock.draw();
|
||||
/*#ifdef USE_NEXTION
|
||||
|
||||
@@ -187,7 +187,7 @@ void NetServer::chunkedHtmlPage(const String& contentType, AsyncWebServerRequest
|
||||
#endif
|
||||
|
||||
#ifndef NS_QUEUE_TICKS
|
||||
#define NS_QUEUE_TICKS 2
|
||||
#define NS_QUEUE_TICKS 0
|
||||
#endif
|
||||
|
||||
char wsbuf[BUFLEN * 2];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef options_h
|
||||
#define options_h
|
||||
|
||||
#define YOVERSION "0.9.090"
|
||||
#define YOVERSION "0.9.099"
|
||||
|
||||
/*******************************************************
|
||||
DO NOT EDIT THIS FILE.
|
||||
@@ -299,6 +299,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
||||
#ifndef CLOCKFONT_MONO
|
||||
#define CLOCKFONT_MONO true // monospace clock font
|
||||
#endif
|
||||
#ifndef MAX_AUDIO_SOCKET_TIMEOUT
|
||||
#define MAX_AUDIO_SOCKET_TIMEOUT false // max audio socket timeout?
|
||||
#endif
|
||||
/*
|
||||
*** ST7735 display submodel ***
|
||||
INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html
|
||||
|
||||
@@ -63,6 +63,7 @@ void Player::init() {
|
||||
forceMono(true);
|
||||
#endif
|
||||
_loadVol(config.store.volume);
|
||||
setConnectionTimeout(1700, 3700);
|
||||
Serial.println("done");
|
||||
}
|
||||
|
||||
@@ -78,7 +79,7 @@ void Player::stopInfo() {
|
||||
requestToStart = true;
|
||||
}
|
||||
|
||||
void Player::_stop(){
|
||||
void Player::_stop(bool alreadyStopped){
|
||||
if(config.store.play_mode==PM_SDCARD) config.sdResumePos = player.getFilePos();
|
||||
_status = STOPPED;
|
||||
setOutputPins(false);
|
||||
@@ -90,10 +91,8 @@ void Player::_stop(){
|
||||
netserver.requestOnChange(BITRATE, 0);
|
||||
display.putRequest(DBITRATE);
|
||||
display.putRequest(PSTOP);
|
||||
#ifdef CLEAR_BUFFERS
|
||||
setDefaults();
|
||||
#endif
|
||||
stopSong();
|
||||
setDefaults();
|
||||
if(!alreadyStopped) stopSong();
|
||||
stopInfo();
|
||||
if (player_on_stop_play) player_on_stop_play();
|
||||
}
|
||||
@@ -108,7 +107,7 @@ void Player::initHeaders(const char *file) {
|
||||
}
|
||||
|
||||
#ifndef PL_QUEUE_TICKS
|
||||
#define PL_QUEUE_TICKS 2
|
||||
#define PL_QUEUE_TICKS 0
|
||||
#endif
|
||||
|
||||
void Player::loop() {
|
||||
@@ -136,7 +135,7 @@ void Player::loop() {
|
||||
xSemaphoreTake(playmutex, portMAX_DELAY);
|
||||
Audio::loop();
|
||||
xSemaphoreGive(playmutex);
|
||||
|
||||
if(!isRunning() && _status==PLAYING) _stop(true);
|
||||
if(_volTimer){
|
||||
if((millis()-_volTicks)>3000){
|
||||
config.saveVolume();
|
||||
@@ -166,10 +165,12 @@ void Player::_play(uint16_t stationId) {
|
||||
_loadVol(config.store.volume);
|
||||
display.putRequest(NEWSTATION);
|
||||
netserver.requestOnChange(STATION, 0);
|
||||
netserver.loop();
|
||||
netserver.loop();
|
||||
if (config.store.play_mode==PM_WEB?connecttohost(config.station.url):connecttoFS(SD,config.station.url,config.sdResumePos==0?_resumeFilePos:config.sdResumePos-player.sd_min)) {
|
||||
_status = PLAYING;
|
||||
if(config.store.play_mode==PM_SDCARD) config.sdResumePos = 0;
|
||||
config.setTitle("");
|
||||
//config.setTitle("");
|
||||
config.setSmartStart(1);
|
||||
netserver.requestOnChange(MODE, 0);
|
||||
setOutputPins(true);
|
||||
@@ -178,6 +179,7 @@ void Player::_play(uint16_t stationId) {
|
||||
if (player_on_start_play) player_on_start_play();
|
||||
}else{
|
||||
telnet.printf("##ERROR#:\tError connecting to %s\n", config.station.url);
|
||||
_stop(true);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -200,6 +202,7 @@ void Player::browseUrl(){
|
||||
if (player_on_start_play) player_on_start_play();
|
||||
}else{
|
||||
telnet.printf("##ERROR#:\tError connecting to %s\n", burl);
|
||||
_stop(true);
|
||||
}
|
||||
memset(burl, 0, MQTT_BURL_SIZE);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Player: public Audio {
|
||||
uint32_t _resumeFilePos;
|
||||
plStatus_e _status;
|
||||
private:
|
||||
void _stop();
|
||||
void _stop(bool alreadyStopped = false);
|
||||
void _play(uint16_t stationId);
|
||||
void _loadVol(uint8_t volume);
|
||||
public:
|
||||
|
||||
@@ -124,7 +124,8 @@ void Telnet::printf(const char *format, ...) {
|
||||
clients[id].print(buf);
|
||||
}
|
||||
}
|
||||
if(strstr(buf,"> ")==NULL) Serial.print(buf);
|
||||
if (strcmp(buf, "> ") == 0) return;
|
||||
if(strstr(buf,"\n> ")==NULL) Serial.print(buf);
|
||||
}
|
||||
|
||||
void Telnet::printf(byte id, const char *format, ...) {
|
||||
|
||||
Reference in New Issue
Block a user