Improved R1 Neo & muzi-base buzzer beeps for GPS on/off#8870
Conversation
Matched the resonant frequency of the hardware buzzer to maximize volume for the turn on beep. Further distinguished ON beep from OFF beep, making it easier for users to understand the state change.
There was a problem hiding this comment.
Pull request overview
This PR enhances the GPS on/off auditory feedback for R1_NEO and MUZI_BASE hardware by optimizing buzzer frequencies and creating more distinct sound patterns.
- Added hardware-specific buzzer melodies that match the resonant frequency of the hardware for maximum volume
- Introduced new note frequencies (F5, G6, E7) and durations (1/16 note) for richer sound patterns
- Differentiated GPS enable/disable beeps with unique ascending (enable) and descending (disable) melodies
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
|
|
||
| // Some common frequencies. | ||
| #define NOTE_SILENT 1 |
There was a problem hiding this comment.
The name NOTE_SILENT is misleading. The value 1 represents a 1 Hz frequency, not silence. A 1 Hz frequency is extremely low and effectively inaudible to humans, but it's not the same as silence (which would typically be represented by 0 Hz or a special value that stops tone generation). Consider renaming to NOTE_INAUDIBLE or using a value of 0 if the underlying tone generation supports it.
| #define NOTE_SILENT 1 | |
| #define NOTE_SILENT 0 |
There was a problem hiding this comment.
Was avoiding using 0Hz as I had a concern it may break the signal generation code but didn't look into it
| ToneDuration melody[] = {{NOTE_B4, DURATION_1_16}, {NOTE_B4, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | ||
| {NOTE_F3, DURATION_1_16}, {NOTE_F3, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | ||
| {NOTE_C3, DURATION_1_1}, {NOTE_SILENT, DURATION_1_1}}; |
There was a problem hiding this comment.
[nitpick] Inconsistent whitespace around braces in the melody array. The spacing between {NOTE_B4, DURATION_1_16} elements uses 2 spaces while {NOTE_SILENT, DURATION_1_8} elements use 3 spaces. Consider using consistent spacing for better readability, e.g., all 2-space separators.
| ToneDuration melody[] = {{NOTE_B4, DURATION_1_16}, {NOTE_B4, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | |
| {NOTE_F3, DURATION_1_16}, {NOTE_F3, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | |
| {NOTE_C3, DURATION_1_1}, {NOTE_SILENT, DURATION_1_1}}; | |
| ToneDuration melody[] = {{NOTE_B4, DURATION_1_16}, {NOTE_B4, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | |
| {NOTE_F3, DURATION_1_16}, {NOTE_F3, DURATION_1_16}, {NOTE_SILENT, DURATION_1_8}, | |
| {NOTE_C3, DURATION_1_1}, {NOTE_SILENT, DURATION_1_1}}; |
Xaositek
left a comment
There was a problem hiding this comment.
Tested on my R1 Neo - no issues found.
Matched the resonant frequency of the hardware buzzer to maximize volume for the turn on beep.
Further distinguished ON beep from OFF beep, making it easier for users to understand the state change.