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");
| | |