1
0
mirror of https://github.com/xfjx/TonUINO.git synced 2025-08-30 09:50:16 +02:00
This commit is contained in:
Thorsten Voß
2019-05-01 11:25:32 +02:00
parent 74dda59e6c
commit e29590ec00

View File

@@ -246,6 +246,9 @@ class Modifier {
virtual uint8_t getActive() { virtual uint8_t getActive() {
return 0; return 0;
} }
Modifier() {
}
}; };
Modifier *activeModifier = NULL; Modifier *activeModifier = NULL;
@@ -259,6 +262,7 @@ class SleepTimer: public Modifier {
if (this->sleepAtMillis != 0 && millis() > this->sleepAtMillis) { if (this->sleepAtMillis != 0 && millis() > this->sleepAtMillis) {
Serial.println(F("=== SleepTimer::loop() -> SLEEP!")); Serial.println(F("=== SleepTimer::loop() -> SLEEP!"));
mp3.pause(); mp3.pause();
setstandbyTimer();
activeModifier = NULL; activeModifier = NULL;
delete this; delete this;
} }
@@ -268,9 +272,9 @@ class SleepTimer: public Modifier {
Serial.println(F("=== SleepTimer()")); Serial.println(F("=== SleepTimer()"));
Serial.println(minutes); Serial.println(minutes);
this->sleepAtMillis = millis() + minutes * 60000; this->sleepAtMillis = millis() + minutes * 60000;
if (isPlaying()) // if (isPlaying())
mp3.playAdvertisement(302); // mp3.playAdvertisement(302);
delay(500); // delay(500);
} }
uint8_t getActive() { uint8_t getActive() {
Serial.println(F("== SleepTimer::getActive()")); Serial.println(F("== SleepTimer::getActive()"));
@@ -305,6 +309,7 @@ class FreezeDance: public Modifier {
FreezeDance(void) { FreezeDance(void) {
Serial.println(F("=== FreezeDance()")); Serial.println(F("=== FreezeDance()"));
if (isPlaying()) { if (isPlaying()) {
delay(1000);
mp3.playAdvertisement(300); mp3.playAdvertisement(300);
delay(500); delay(500);
} }
@@ -344,8 +349,8 @@ class Locked: public Modifier {
} }
Locked(void) { Locked(void) {
Serial.println(F("=== Locked()")); Serial.println(F("=== Locked()"));
if (isPlaying()) // if (isPlaying())
mp3.playAdvertisement(303); // mp3.playAdvertisement(303);
} }
uint8_t getActive() { uint8_t getActive() {
return 3; return 3;
@@ -376,8 +381,8 @@ class ToddlerMode: public Modifier {
} }
ToddlerMode(void) { ToddlerMode(void) {
Serial.println(F("=== ToddlerMode()")); Serial.println(F("=== ToddlerMode()"));
if (isPlaying()) // if (isPlaying())
mp3.playAdvertisement(304); // mp3.playAdvertisement(304);
} }
uint8_t getActive() { uint8_t getActive() {
Serial.println(F("== ToddlerMode::getActive()")); Serial.println(F("== ToddlerMode::getActive()"));
@@ -407,10 +412,10 @@ class KindergardenMode: public Modifier {
} }
return false; return false;
} }
virtual bool handlePause() { // virtual bool handlePause() {
Serial.println(F("== KindergardenMode::handlePause() -> LOCKED!")); // Serial.println(F("== KindergardenMode::handlePause() -> LOCKED!"));
return true; // return true;
} // }
virtual bool handleNextButton() { virtual bool handleNextButton() {
Serial.println(F("== KindergardenMode::handleNextButton() -> LOCKED!")); Serial.println(F("== KindergardenMode::handleNextButton() -> LOCKED!"));
return true; return true;
@@ -430,9 +435,9 @@ class KindergardenMode: public Modifier {
} }
KindergardenMode() { KindergardenMode() {
Serial.println(F("=== KindergardenMode()")); Serial.println(F("=== KindergardenMode()"));
if (isPlaying()) // if (isPlaying())
mp3.playAdvertisement(305); // mp3.playAdvertisement(305);
delay(500); // delay(500);
} }
uint8_t getActive() { uint8_t getActive() {
Serial.println(F("== KindergardenMode::getActive()")); Serial.println(F("== KindergardenMode::getActive()"));
@@ -1158,7 +1163,7 @@ void adminMenu(bool fromCard = false) {
} }
else if (subMenu == 4) { else if (subMenu == 4) {
// Initial Volume // Initial Volume
mySettings.initVolume = voiceMenu(mySettings.maxVolume - mySettings.minVolume + 1, 932, mySettings.minVolume - 1, false, false, mySettings.initVolume - mySettings.minVolume) + mySettings.minVolume - 1; mySettings.initVolume = voiceMenu(mySettings.maxVolume - mySettings.minVolume + 1, 932, mySettings.minVolume - 1, false, false, mySettings.initVolume - mySettings.minVolume + 1) + mySettings.minVolume - 1;
} }
else if (subMenu == 5) { else if (subMenu == 5) {
// EQ // EQ
@@ -1609,11 +1614,30 @@ bool readCard(nfcTagObject * nfcTag) {
if (activeModifier->getActive() == tempCard.nfcFolderSettings.mode) { if (activeModifier->getActive() == tempCard.nfcFolderSettings.mode) {
activeModifier = NULL; activeModifier = NULL;
Serial.println(F("modifier removed")); Serial.println(F("modifier removed"));
if (isPlaying()) {
mp3.playAdvertisement(261);
}
else {
mp3.start();
delay(100);
mp3.playAdvertisement(261);
delay(100);
mp3.pause();
}
delay(2000); delay(2000);
return false; return false;
} }
} }
if (isPlaying()) {
mp3.playAdvertisement(260);
}
else {
mp3.start();
delay(100);
mp3.playAdvertisement(260);
delay(100);
mp3.pause();
}
switch (tempCard.nfcFolderSettings.mode ) { switch (tempCard.nfcFolderSettings.mode ) {
case 0: mfrc522.PICC_HaltA(); mfrc522.PCD_StopCrypto1(); adminMenu(true); break; case 0: mfrc522.PICC_HaltA(); mfrc522.PCD_StopCrypto1(); adminMenu(true); break;
case 1: activeModifier = new SleepTimer(tempCard.nfcFolderSettings.special); break; case 1: activeModifier = new SleepTimer(tempCard.nfcFolderSettings.special); break;