diff --git a/solarpump/mp3.h b/solarpump/mp3.h index bcc64edae36da61ac1cf5416a33a53502561e8ca..038879b28bcc578f711f45f302d425186d62df47 100644 --- a/solarpump/mp3.h +++ b/solarpump/mp3.h @@ -2,7 +2,7 @@ #define MP3_H void mp3Setup(void); -void playFile(uint8_t fileNumber); +void playFile(uint8_t fileNumber, bool respectBusyPin); void mp3Loop(void); void playFileQueue(uint8_t fileNumber); diff --git a/solarpump/mp3.ino b/solarpump/mp3.ino index a58ec6d5d5aa882a11c4e5b28c7334247a2bc3b1..c54977d0f1a7769b93a5486fc57d94131498e92e 100644 --- a/solarpump/mp3.ino +++ b/solarpump/mp3.ino @@ -4,7 +4,7 @@ static SoftwareSerial mp3(MP3RX, MP3TX); // the queue for playing sounds -#define QUEUESIZE 16 +#define QUEUESIZE 64 static uint8_t fileQueue[QUEUESIZE]; // needs to be run once at the start @@ -14,8 +14,12 @@ void mp3Setup(void) { //mp3.sendCommand(CMD_SEL_DEV, 0, 2); //select sd-card } -// immediately play a file, ignoring any queue or BUSY pin -void playFile(uint8_t fileNumber) { +// immediately play a file +void playFile(uint8_t fileNumber, bool respectBusyPin) { + // do nothing if we want to wait for the BUSY pin + if (respectBusyPin && digitalRead(MP3BUSY)) { + return; + } mp3.write(fileNumber); } diff --git a/solarpump/solarpump.ino b/solarpump/solarpump.ino index 2fd691fd206cc2e62d396efc98370fa7f8cac2c6..e3e11a6f9eb2b461669fb18f0421e882a38d8e19 100644 --- a/solarpump/solarpump.ino +++ b/solarpump/solarpump.ino @@ -170,10 +170,17 @@ void setup(void) { pinMode(BUTTON, INPUT_PULLUP); } +<<<<<<< HEAD void sayInfos(float temp1up, float temp1down, float temp2up, float temp2down, uint8_t comma) +======= +// say out all the relevant infos via the loudspeaker +void sayInfos(float t1up_C, float t1down_C, float t2up_C, float t2down_C) +>>>>>>> 5798fb6b122134e1e016b6e47ca39eb79566fdc7 { + const uint8_t decimals = 0; playFileQueue(SOUND_EINS); playFileQueue(SOUND_OBEN); +<<<<<<< HEAD sayNumber(temp1up, nachKommaStellen); playFileQueue(SOUND_STILLE); @@ -191,6 +198,21 @@ void sayInfos(float temp1up, float temp1down, float temp2up, float temp2down, ui playFileQueue(SOUND_UNTEN); sayNumber(temp2down, nachKommaStellen); playFileQueue(SOUND_STILLE); +======= + sayNumber(t1up_C, decimals); + + playFileQueue(SOUND_EINS); + playFileQueue(SOUND_UNTEN); + sayNumber(t1down_C, decimals); + + playFileQueue(SOUND_ZWEI); + playFileQueue(SOUND_OBEN); + sayNumber(t2up_C, decimals); + + playFileQueue(SOUND_ZWEI); + playFileQueue(SOUND_UNTEN); + sayNumber(t2down_C, decimals); +>>>>>>> 5798fb6b122134e1e016b6e47ca39eb79566fdc7 if (digitalRead(PUMP1)) { @@ -235,13 +257,12 @@ void loop(void) { static float t1down_C = 0.0; static float t2up_C = 0.0; static float t2down_C = 0.0; - static int nachKommaStellen = 1; mp3Loop(); if (checkButton() == LOW) { displayLight(true); - sayInfos(t1up_C, t1down_C, t2up_C, t2down_C, nachKommaStellen); + sayInfos(t1up_C, t1down_C, t2up_C, t2down_C); } else { displayLight(false); }