This commit is contained in:
e2002
2023-02-22 09:57:58 +03:00
parent fe95774f14
commit 6bef9ca9d7
4 changed files with 17 additions and 11 deletions

View File

@@ -109,15 +109,17 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
}
if (strcmp(buf, "turnoff") == 0) {
uint8_t sst = config.store.smartstart;
player.stop();
config.setDspOn(0);
player.mode = STOPPED;
telnet.info();
delay(100);
config.store.smartstart = sst;
config.save();
config.setDspOn(0);
return;
}
if (strcmp(buf, "turnon") == 0) {
config.setDspOn(1);
if (config.store.smartstart == 1) player.play(config.store.lastStation);
if (config.store.smartstart == 1) player.request.station = config.store.lastStation;
return;
}
int volume;

View File

@@ -35,7 +35,7 @@ Player player;
void Player::init() {
Serial.print("##[BOOT]#\tplayer.init\t");
#ifdef MQTT_ROOT_TOPIC
memset(burl, 0, 400);
memset(burl, 0, MQTT_BURL_SIZE);
#endif
if(MUTE_PIN!=255) pinMode(MUTE_PIN, OUTPUT);
#if I2S_DOUT!=255
@@ -197,7 +197,7 @@ void Player::browseUrl(){
}else{
telnet.printf("##ERROR#:\tError connecting to %s\n", burl);
}
memset(burl, 0, 400);
memset(burl, 0, MQTT_BURL_SIZE);
}
#endif

View File

@@ -8,6 +8,10 @@
#include "../audioVS1053/audioVS1053Ex.h"
#endif
#ifndef MQTT_BURL_SIZE
#define MQTT_BURL_SIZE 512
#endif
enum audioMode_e { PLAYING, STOPPED };
struct audiorequest_t
@@ -30,7 +34,7 @@ class Player: public Audio {
bool resumeAfterUrl = false;
uint32_t sd_min, sd_max;
#ifdef MQTT_ROOT_TOPIC
char burl[400]; /* buffer for browseUrl */
char burl[MQTT_BURL_SIZE]; /* buffer for browseUrl */
#endif
public:
Player();