Browse Source

Fix of: can't enable BT while PLAY_LAST_RFID_AFTER_REBOOT is active

master
Torsten Stauder 4 years ago
parent
commit
4e900c48cc
  1. 23
      src/main.cpp

23
src/main.cpp

@ -476,6 +476,10 @@ void IRAM_ATTR onTimer() {
// Get last RFID-tag applied from NVS // Get last RFID-tag applied from NVS
void recoverLastRfidPlayed(void) { void recoverLastRfidPlayed(void) {
if (recoverLastRfid) { if (recoverLastRfid) {
if (operationMode == OPMODE_BLUETOOTH) { // Don't recover if BT-mode is desired
recoverLastRfid = false;
return;
}
recoverLastRfid = false; recoverLastRfid = false;
String lastRfidPlayed = prefsSettings.getString("lastRfid", "-1"); String lastRfidPlayed = prefsSettings.getString("lastRfid", "-1");
if (!lastRfidPlayed.compareTo("-1")) { if (!lastRfidPlayed.compareTo("-1")) {
@ -2318,11 +2322,11 @@ void showLed(void *parameter) {
switch (playProperties.playMode) { switch (playProperties.playMode) {
case NO_PLAYLIST: // If no playlist is active (idle) case NO_PLAYLIST: // If no playlist is active (idle)
#ifdef BLUETOOTH_ENABLE #ifdef BLUETOOTH_ENABLE
if(operationMode == OPMODE_BLUETOOTH ) {
if (operationMode == OPMODE_BLUETOOTH) {
idleColor = CRGB::Blue; idleColor = CRGB::Blue;
} else { } else {
#endif #endif
if(wifiManager() == WL_CONNECTED) {
if (wifiManager() == WL_CONNECTED) {
idleColor = CRGB::White; idleColor = CRGB::White;
} else { } else {
idleColor = CRGB::Green; idleColor = CRGB::Green;
@ -2800,14 +2804,6 @@ void trackQueueDispatcher(const char *_itemToPlay, const uint32_t _lastPlayPos,
// Modification-cards can change some settings (e.g. introducing track-looping or sleep after track/playlist). // Modification-cards can change some settings (e.g. introducing track-looping or sleep after track/playlist).
// This function handles them. // This function handles them.
void doRfidCardModifications(const uint32_t mod) { void doRfidCardModifications(const uint32_t mod) {
#ifdef PLAY_LAST_RFID_AFTER_REBOOT
if (recoverLastRfid) {
recoverLastRfid = false;
// We don't want to remember modification-cards
return;
}
#endif
doCmdAction(mod); doCmdAction(mod);
} }
@ -3339,7 +3335,7 @@ void rfidPreferenceLookupHandler (void) {
#ifdef BLUETOOTH_ENABLE #ifdef BLUETOOTH_ENABLE
// if music rfid was read, go back to normal mode // if music rfid was read, go back to normal mode
if(operationMode == OPMODE_BLUETOOTH) {
if (operationMode == OPMODE_BLUETOOTH) {
setOperationMode(OPMODE_NORMAL); setOperationMode(OPMODE_NORMAL);
} }
#endif #endif
@ -3404,6 +3400,7 @@ void accessPointStart(const char *SSID, IPAddress ip, IPAddress netmask) {
accessPointStarted = true; accessPointStarted = true;
} }
// Reads stored WiFi-status from NVS // Reads stored WiFi-status from NVS
bool getWifiEnableStatusFromNVS(void) { bool getWifiEnableStatusFromNVS(void) {
uint32_t wifiStatus = prefsSettings.getUInt("enableWifi", 99); uint32_t wifiStatus = prefsSettings.getUInt("enableWifi", 99);
@ -3443,10 +3440,14 @@ bool writeWifiStatusToNVS(bool wifiStatus) {
return true; return true;
} }
// Reads from NVS, if bluetooth or "normal" mode is desired
uint8_t readOperationModeFromNVS(void) { uint8_t readOperationModeFromNVS(void) {
return prefsSettings.getUChar("operationMode", OPMODE_NORMAL); return prefsSettings.getUChar("operationMode", OPMODE_NORMAL);
} }
// Writes to NVS, if bluetooth or "normal" mode is desired
bool setOperationMode(uint8_t newOperationMode) { bool setOperationMode(uint8_t newOperationMode) {
uint8_t currentOperationMode = prefsSettings.getUChar("operationMode", OPMODE_NORMAL); uint8_t currentOperationMode = prefsSettings.getUChar("operationMode", OPMODE_NORMAL);
if(currentOperationMode != newOperationMode) { if(currentOperationMode != newOperationMode) {

Loading…
Cancel
Save