This commit is contained in:
e2002
2022-04-05 12:18:25 +03:00
parent 864d8f9dcd
commit 40f194ab26
40 changed files with 530 additions and 367 deletions

View File

@@ -41,7 +41,7 @@ void Player::init() {
setVolume(0);
mode = STOPPED;
setOutputPins(false);
requesToStart = true;
requestToStart = true;
zeroRequest();
}
@@ -49,7 +49,7 @@ void Player::stopInfo() {
config.setSmartStart(0);
telnet.info();
netserver.requestOnChange(MODE, 0);
requesToStart = true;
requestToStart = true;
}
void Player::loop() {
@@ -60,7 +60,7 @@ void Player::loop() {
//digitalWrite(LED_BUILTIN, LOW);
setOutputPins(false);
//display.title("[stopped]");
config.setTitle("[stopped]");
config.setTitle(display.mode==LOST?"":"[stopped]");
netserver.requestOnChange(TITLE, 0);
stopSong();
stopInfo();
@@ -75,13 +75,11 @@ void Player::loop() {
}
if (request.volume >= 0) {
config.setVolume(request.volume, request.doSave);
//display.volume();
display.refreshVolume = true;
telnet.printf("##CLI.VOL#: %d\n", config.store.volume);
Audio::setVolume(volToI2S(request.volume));
zeroRequest();
display.volume();
}
yield();
}
void Player::zeroRequest() {
@@ -97,31 +95,26 @@ void Player::setOutputPins(bool isPlaying) {
void Player::play(uint16_t stationId) {
stopSong();
//digitalWrite(LED_BUILTIN, LOW);
setOutputPins(false);
//display.title("[connecting]");
config.setTitle("[connecting]");
//display.refreshTitle = true;
netserver.requestOnChange(TITLE, 0);
//telnet.printf("##CLI.META#: %s\n", config.station.title);
config.loadStation(stationId);
setVol(config.store.volume, true);
//display.station();
display.refreshStation = true;
display.station();
netserver.requestOnChange(STATION, 0);
telnet.printf("##CLI.NAMESET#: %d %s\n", config.store.lastStation, config.station.name);
display.loop();
if (connecttohost(config.station.url)) {
mode = PLAYING;
config.setSmartStart(1);
netserver.requestOnChange(MODE, 0);
//digitalWrite(LED_BUILTIN, HIGH);
setOutputPins(true);
requesToStart = true;
requestToStart = true;
}else{
Serial.println("Some Unknown Bug...");
Serial.println("some unknown bug...");
}
zeroRequest();
display.loop();
}
void Player::prev() {
@@ -172,15 +165,7 @@ void Player::setVol(byte volume, bool inside) {
if (inside) {
setVolume(volToI2S(volume));
} else {
#if CORE_FOR_LOOP_CONTROLS==255
request.volume = volume;
request.doSave = true;
#else
config.setVolume(volume, true);
//display.volume();
display.refreshVolume = true;
telnet.printf("##CLI.VOL#: %d\n", config.store.volume);
Audio::setVolume(volToI2S(volume));
#endif
}
}