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

This commit is contained in:
Dionysus 2024-06-05 15:21:36 -04:00
parent 86b4488d92
commit d4911ee2d3
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
3 changed files with 19 additions and 5 deletions

View File

@ -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 - [ ] Keyboard backlight timeout with screen timeout
- [ ] Trackball support - [ ] Trackball support
- [X] Speaker support - [X] Speaker support
- [X] Bootup sounds
- [X] IRC mention sounds
- [ ] GPS support - [ ] GPS support
- [ ] Lora support - [ ] Lora support
- [ ] BLE support - [ ] BLE support

View File

@ -149,3 +149,12 @@ void playRTTTL(const char* rtttl, int volume = 16383, int bpm = -1) {
if (*p == ',') p++; if (*p == ',') p++;
} }
} }
void playNotificationSound() {
playTone(1000, 200);
delay(100);
playTone(1500, 200);
delay(100);
playTone(2000, 200);
}

View File

@ -133,17 +133,17 @@ void setup() {
tft.invertDisplay(1); tft.invertDisplay(1);
Serial.println("TFT initialized"); 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 // Display the boot screen
displayXBM(); displayXBM();
// Initialize the preferences // Initialize the preferences
loadPreferences(); 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 // Setup the WiFi
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.setHostname("acid-drop"); // Turn into a preference WiFi.setHostname("acid-drop"); // Turn into a preference
@ -1158,6 +1158,9 @@ void parseAndDisplay(String line) {
String senderNick = line.substring(1, line.indexOf('!')); String senderNick = line.substring(1, line.indexOf('!'));
bool mention = message.indexOf(irc_nickname) != -1; 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")) { if (message.startsWith(String("\x01") + "ACTION ") && message.endsWith("\x01")) {
String actionMessage = message.substring(8, message.length() - 1); String actionMessage = message.substring(8, message.length() - 1);
addLine(senderNick, actionMessage, "action"); addLine(senderNick, actionMessage, "action");