Skip to content

Commit

Permalink
Added Different noises for GPS enable and GPS disable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Technologyman00 committed Oct 18, 2024
1 parent 026bb74 commit 4b872f1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/ButtonThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/buzz/buzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
Expand Down
2 changes: 2 additions & 0 deletions src/buzz/buzz.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
void playBeep();
void playStartMelody();
void playShutdownMelody();
void playGPSEnableBeep();
void playGPSDisableBeep();
3 changes: 3 additions & 0 deletions src/gps/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "RTC.h"
#include "Throttle.h"
#include "meshUtils.h"
#include "buzz.h"

#include "main.h" // pmu_found
#include "sleep.h"
Expand Down Expand Up @@ -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");
Expand All @@ -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();
}
}
Expand Down

0 comments on commit 4b872f1

Please sign in to comment.