@@ -55,7 +56,17 @@
-
+
+
volume: 0
bitrate: 0kBit
diff --git a/yoRadio/data/www/script.js.gz b/yoRadio/data/www/script.js.gz
index aa35f08..275eb6d 100644
Binary files a/yoRadio/data/www/script.js.gz and b/yoRadio/data/www/script.js.gz differ
diff --git a/yoRadio/data/www/style.css.gz b/yoRadio/data/www/style.css.gz
index 2d9fc53..a88366a 100644
Binary files a/yoRadio/data/www/style.css.gz and b/yoRadio/data/www/style.css.gz differ
diff --git a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp
index cac7715..1985db5 100644
--- a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp
+++ b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp
@@ -2464,7 +2464,7 @@ uint32_t Audio::getFilePos(){
bool Audio::setFilePos(uint32_t pos){
if (!audiofile) return false;
cardLock(true);
- uint32_t s = audiofile.seek(pos);
+ bool s = audiofile.seek(pos);
cardLock(false);
return s;
}
diff --git a/yoRadio/src/core/netserver.cpp b/yoRadio/src/core/netserver.cpp
index 4c00775..09f1191 100644
--- a/yoRadio/src/core/netserver.cpp
+++ b/yoRadio/src/core/netserver.cpp
@@ -413,6 +413,13 @@ void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len, uint8_t client
byte v = atoi(val);
player.setVol(v, false);
}
+ if (strcmp(cmd, "sdpos") == 0) {
+ if (config.store.play_mode==PM_SDCARD){
+ //byte v = atoi(val);
+ player.play(config.store.lastStation, atoi(val));
+ //Serial.printf("player.setFilePos(%d)\t******************************************\n", v);
+ }
+ }
if (strcmp(cmd, "balance") == 0) {
int8_t valb = atoi(val);
player.setBalance(valb);
@@ -587,6 +594,7 @@ void NetServer::requestOnChange(requestType_e request, uint8_t clientId) {
case TITLE: sprintf (buf, "{\"meta\": \"%s\"}", config.station.title); if (player.requestToStart) { telnet.info(); player.requestToStart = false; } else { telnet.printf("##CLI.META#: %s\n> ", config.station.title); } break;
case VOLUME: sprintf (buf, "{\"vol\": %d}", config.store.volume); break;
case NRSSI: sprintf (buf, "{\"rssi\": %d}", rssi); rssi = 255; break;
+ case SDPOS: sprintf (buf, "{\"sdpos\": %d,\"sdend\": %d,\"sdtpos\": %d,\"sdtend\": %d}", player.getFilePos(), player.getFileSize(), 0, 0); break;
case BITRATE: sprintf (buf, "{\"bitrate\": %d}", config.station.bitrate); break;
case MODE: sprintf (buf, "{\"mode\": \"%s\"}", player.mode == PLAYING ? "playing" : "stopped"); break;
case EQUALIZER: sprintf (buf, "{\"bass\": %d, \"middle\": %d, \"trebble\": %d}", config.store.bass, config.store.middle, config.store.trebble); break;
@@ -603,6 +611,13 @@ void NetServer::requestOnChange(requestType_e request, uint8_t clientId) {
String processor(const String& var) { // %Templates%
if (var == "VERSION") return YOVERSION;
+ if (var == "MODE") {
+ if(config.store.play_mode==PM_SDCARD) {
+ return "modescard";
+ }else{
+ return "modeweb";
+ }
+ }
return String();
}
diff --git a/yoRadio/src/core/netserver.h b/yoRadio/src/core/netserver.h
index 171c212..940fae3 100644
--- a/yoRadio/src/core/netserver.h
+++ b/yoRadio/src/core/netserver.h
@@ -5,7 +5,7 @@
#include "ESPAsyncWebServer.h"
#include "AsyncUDP.h"
-enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, ITEM=3, TITLE=4, VOLUME=5, NRSSI=6, BITRATE=7, MODE=8, EQUALIZER=9, BALANCE=10, PLAYLISTSAVED=11, GETMODE=12, GETINDEX=13, GETACTIVE=14, GETSYSTEM=15, GETSCREEN=16, GETTIMEZONE=17, GETWEATHER=18, GETCONTROLS=19, DSPON=20 };
+enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, ITEM=3, TITLE=4, VOLUME=5, NRSSI=6, BITRATE=7, MODE=8, EQUALIZER=9, BALANCE=10, PLAYLISTSAVED=11, GETMODE=12, GETINDEX=13, GETACTIVE=14, GETSYSTEM=15, GETSCREEN=16, GETTIMEZONE=17, GETWEATHER=18, GETCONTROLS=19, DSPON=20, SDPOS=21 };
enum import_e : uint8_t { IMDONE=0, IMPL=1, IMWIFI=2 };
class NetServer {
diff --git a/yoRadio/src/core/network.cpp b/yoRadio/src/core/network.cpp
index 59c7e07..c5cb115 100644
--- a/yoRadio/src/core/network.cpp
+++ b/yoRadio/src/core/network.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "telnet.h"
#include "netserver.h"
+#include "player.h"
Network network;
@@ -39,7 +40,7 @@ void ticks() {
mktime(&network.timeinfo);
display.putRequest(CLOCK);
}
-
+ if(player.isRunning() && config.store.play_mode==PM_SDCARD) netserver.requestOnChange(SDPOS, 0);
if(divrssi) {
int rs = WiFi.RSSI();
netserver.setRSSI(rs);
diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h
index 088b09e..5b103b0 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.8.813"
+#define YOVERSION "0.8.816"
/*******************************************************
DO NOT EDIT THIS FILE.
diff --git a/yoRadio/src/core/player.cpp b/yoRadio/src/core/player.cpp
index 54cde3d..6587655 100644
--- a/yoRadio/src/core/player.cpp
+++ b/yoRadio/src/core/player.cpp
@@ -124,7 +124,7 @@ void Player::setOutputPins(bool isPlaying) {
if(MUTE_PIN!=255) digitalWrite(MUTE_PIN, isPlaying?!MUTE_VAL:MUTE_VAL);
}
-void Player::play(uint16_t stationId) {
+void Player::play(uint16_t stationId, uint32_t filePos) {
display.putRequest(PSTOP);
setDefaults();
setOutputPins(false);
@@ -136,7 +136,7 @@ void Player::play(uint16_t stationId) {
display.putRequest(NEWSTATION);
netserver.requestOnChange(STATION, 0);
telnet.printf("##CLI.NAMESET#: %d %s\n", config.store.lastStation, config.station.name);
- if (config.store.play_mode==PM_WEB?connecttohost(config.station.url):connecttoFS(SD,config.station.url)) {
+ if (config.store.play_mode==PM_WEB?connecttohost(config.station.url):connecttoFS(SD,config.station.url,filePos)) {
mode = PLAYING;
config.setTitle("");
netserver.requestOnChange(TITLE, 0);
diff --git a/yoRadio/src/core/player.h b/yoRadio/src/core/player.h
index 9df7dd0..d82e9c2 100644
--- a/yoRadio/src/core/player.h
+++ b/yoRadio/src/core/player.h
@@ -30,7 +30,7 @@ class Player: public Audio {
Player();
void init();
void loop();
- void play(uint16_t stationId);
+ void play(uint16_t stationId, uint32_t filePos=0);
void stop(const char *nttl = NULL);
void prev();
void next();