acid-drop

- Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.acid.vegas/-c.git
Log | Files | Refs | Archive | README | LICENSE

commit d4911ee2d34b376192270960c5d22bea215aa7a7
parent 86b4488d92e1e031de73ea8bff4e933224e3be26
Author: acidvegas <acid.vegas@acid.vegas>
Date: Wed, 5 Jun 2024 15:21:36 -0400

Added IRC mention sounds, moved boot sound to AFTER the XBM display

Diffstat:
MREADME.md | 2++
Msrc/Speaker.h | 10++++++++++
Msrc/main.ino | 13++++++++-----

3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
@@ -52,6 +52,8 @@ The device will scan for WiFi networks on boot. Once the list is displayed, you 
   - [ ] Keyboard backlight timeout with screen timeout
 - [ ] Trackball support
 - [X] Speaker support
+  - [X] Bootup sounds
+  - [X] IRC mention sounds
 - [ ] GPS support
 - [ ] Lora support
 - [ ] BLE support
diff --git a/src/Speaker.h b/src/Speaker.h
@@ -149,3 +149,12 @@ void playRTTTL(const char* rtttl, int volume = 16383, int bpm = -1) {
         if (*p == ',') p++;
     }
 }
+
+
+void playNotificationSound() {
+    playTone(1000, 200);
+    delay(100);
+    playTone(1500, 200);
+    delay(100);
+    playTone(2000, 200);
+}
+\ No newline at end of file
diff --git a/src/main.ino b/src/main.ino
@@ -133,17 +133,17 @@ void setup() {
     tft.invertDisplay(1);
     Serial.println("TFT initialized");
 
-    // Initialize the speaker
-    setupI2S(); // Do we want to keep this open or uninstall after each use to keep resources free?
-    const char* rtttl_boot = "ff6_victory:d=4,o=5,b=100:32d6,32p,32d6,32p,32d6,32p,d6,a#,c6,16d6,8p,16c6,2d6"; // This will go in preferences soon
-    playRTTTL(rtttl_boot);
-
     // Display the boot screen
     displayXBM();
 
     // Initialize the preferences
     loadPreferences();
 
+    // Initialize the speaker
+    setupI2S(); // Do we want to keep this open or uninstall after each use to keep resources free?
+    const char* rtttl_boot = "ff6_victory:d=4,o=5,b=100:32d6,32p,32d6,32p,32d6,32p,d6,a#,c6,16d6,8p,16c6,2d6"; // This will go in preferences soon
+    playRTTTL(rtttl_boot);
+
     // Setup the WiFi
     WiFi.mode(WIFI_STA);
     WiFi.setHostname("acid-drop"); // Turn into a preference
@@ -1158,6 +1158,9 @@ void parseAndDisplay(String line) {
                 String senderNick = line.substring(1, line.indexOf('!'));
                 bool mention = message.indexOf(irc_nickname) != -1;
 
+                if (mention)
+                    playNotificationSound(); // Will need a check here in the future when we have the ability to turn on/off notification sounds...
+
                 if (message.startsWith(String("\x01") + "ACTION ") && message.endsWith("\x01")) {
                     String actionMessage = message.substring(8, message.length() - 1);
                     addLine(senderNick, actionMessage, "action");