From 4b872f1891affa589e72eaa56d1019a813b245ac Mon Sep 17 00:00:00 2001 From: Technologyman00 Date: Thu, 17 Oct 2024 21:34:24 -0500 Subject: [PATCH] Added Different noises for GPS enable and GPS disable One beep for GPS enable and the same beep for disable made it impossible to know which is which so now it has distinct different sounds. --- src/ButtonThread.cpp | 4 +--- src/buzz/buzz.cpp | 12 ++++++++++++ src/buzz/buzz.h | 2 ++ src/gps/GPS.cpp | 3 +++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 1185d1a76d..ca4d40e158 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -169,10 +169,8 @@ int32_t ButtonThread::runOnce() case 3: if (!config.device.disable_triple_click && (gps != nullptr)) { gps->toggleGpsMode(); - if (screen) { + if (screen) screen->forceDisplay(true); // Force a new UI frame, then force an EInk update - } - playBeep(); } break; #endif diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index e42a9c203f..221c14d751 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -55,6 +55,18 @@ void playBeep() playTones(melody, sizeof(melody) / sizeof(ToneDuration)); } +void playGPSEnableBeep() +{ + ToneDuration melody[] = {{NOTE_CS4, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_C3, DURATION_1_4}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + +void playGPSDisableBeep() +{ + ToneDuration melody[] = {{NOTE_C3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_CS4, DURATION_1_4}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + void playStartMelody() { ToneDuration melody[] = {{NOTE_FS3, DURATION_1_8}, {NOTE_AS3, DURATION_1_8}, {NOTE_CS4, DURATION_1_4}}; diff --git a/src/buzz/buzz.h b/src/buzz/buzz.h index 3883bd057c..c52c3020cd 100644 --- a/src/buzz/buzz.h +++ b/src/buzz/buzz.h @@ -3,3 +3,5 @@ void playBeep(); void playStartMelody(); void playShutdownMelody(); +void playGPSEnableBeep(); +void playGPSDisableBeep(); \ No newline at end of file diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 18feb6daa1..11a43e5a71 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -8,6 +8,7 @@ #include "RTC.h" #include "Throttle.h" #include "meshUtils.h" +#include "buzz.h" #include "main.h" // pmu_found #include "sleep.h" @@ -1680,6 +1681,7 @@ void GPS::toggleGpsMode() if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) { config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED; LOG_INFO("User toggled GpsMode. Now DISABLED."); + playGPSDisableBeep(); #ifdef GNSS_AIROHA if (powerState == GPS_ACTIVE) { LOG_DEBUG("User power Off GPS"); @@ -1690,6 +1692,7 @@ void GPS::toggleGpsMode() } else if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) { config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED; LOG_INFO("User toggled GpsMode. Now ENABLED"); + playGPSEnableBeep(); enable(); } }