last_station
This commit is contained in:
@@ -23,6 +23,8 @@ void Config::init() {
|
|||||||
#endif
|
#endif
|
||||||
eepromRead(EEPROM_START, store);
|
eepromRead(EEPROM_START, store);
|
||||||
if (store.config_set != 4262) setDefaults();
|
if (store.config_set != 4262) setDefaults();
|
||||||
|
backupLastStation = store.lastStation;
|
||||||
|
Serial.print("Config::init, backupLastStation=\t"); Serial.println(backupLastStation);
|
||||||
if(store.play_mode==80) store.play_mode=PM_WEB;
|
if(store.play_mode==80) store.play_mode=PM_WEB;
|
||||||
|
|
||||||
//if (!SPIFFS.begin(false, "/spiffs", 30)) {
|
//if (!SPIFFS.begin(false, "/spiffs", 30)) {
|
||||||
@@ -188,7 +190,11 @@ uint16_t Config::getTimezoneOffset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Config::save() {
|
void Config::save() {
|
||||||
|
uint16_t ls = store.lastStation;
|
||||||
|
if(store.play_mode==PM_SDCARD) store.lastStation = backupLastStation;
|
||||||
|
if(store.play_mode==PM_WEB) backupLastStation = store.lastStation;
|
||||||
eepromWrite(EEPROM_START, store);
|
eepromWrite(EEPROM_START, store);
|
||||||
|
store.lastStation = ls;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IR_PIN!=255
|
#if IR_PIN!=255
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ class Config {
|
|||||||
byte ssidsCount;
|
byte ssidsCount;
|
||||||
uint16_t sleepfor;
|
uint16_t sleepfor;
|
||||||
uint32_t sdResumePos;
|
uint32_t sdResumePos;
|
||||||
|
uint16_t backupLastStation;
|
||||||
public:
|
public:
|
||||||
Config() {};
|
Config() {};
|
||||||
void save();
|
void save();
|
||||||
|
|||||||
@@ -500,10 +500,12 @@ void onBtnClick(int id) {
|
|||||||
}
|
}
|
||||||
case EVT_BTNMODE: {
|
case EVT_BTNMODE: {
|
||||||
if(SDC_CS==255) break;
|
if(SDC_CS==255) break;
|
||||||
|
if(config.store.play_mode==PM_SDCARD) config.store.lastStation = config.backupLastStation;
|
||||||
config.store.play_mode++;
|
config.store.play_mode++;
|
||||||
if(config.store.play_mode > MAX_PLAY_MODE){
|
if(config.store.play_mode > MAX_PLAY_MODE){
|
||||||
config.store.play_mode=0;
|
config.store.play_mode=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user