feat: standardize all touch and UI beeps to crisp 4096 Hz chirp

This commit is contained in:
Sebastián Nieto 2026-09-09 23:31:26 -03:00
parent 1367d59aff
commit cc33986acc
2 changed files with 9 additions and 9 deletions

View file

@ -9,9 +9,9 @@ Configuration menu for OBD2 Gauge with volume and per-instrument alarm controls
#define FORMAT_SPIFFS_IF_FAILED true
/*------------ SOUND EFFECTS ----------*/
// Classic Casio Watch Beep (F-91W / G-Shock Module 593: 32768 / 16 = 2048 Hz, exact C7 note)
inline void casioBeep(uint16_t freq = 2048, uint8_t duration_ms = 20) {
uint16_t duty = VOL_DUTY_TABLE[buzzerVolumeLevel > 5 ? 2 : buzzerVolumeLevel];
// Crisp High-Pitch Casio Chirp (4096 Hz, 25ms)
inline void casioBeep(uint16_t freq = 4096, uint8_t duration_ms = 25) {
uint16_t duty = VOL_DUTY_TABLE[buzzerVolumeLevel > 5 ? 3 : buzzerVolumeLevel];
if (duty == 0) return; // Mute mode
ledcSetup(buzzerChannel, freq, 10);
ledcWrite(buzzerChannel, duty);
@ -20,17 +20,17 @@ inline void casioBeep(uint16_t freq = 2048, uint8_t duration_ms = 20) {
}
void beepbeep() {
casioBeep(2048, 30);
casioBeep(4096, 25);
delay(30);
casioBeep(2048, 30);
casioBeep(4096, 25);
}
void beep() {
casioBeep(2048, 150);
casioBeep(4096, 40);
}
void clickSound() {
casioBeep(2048, 20);
casioBeep(4096, 25);
}
// Configuration menu list (3 options)
@ -258,7 +258,7 @@ void volumeMenu() {
if (touchedLvl >= 0 && touchedLvl <= 5) {
buzzerVolumeLevel = touchedLvl;
drawVolUI();
casioBeep(2048, 20); // Immediate acoustic feedback at selected volume
casioBeep(4096, 25); // Immediate acoustic feedback at selected volume
}
while (isScreenPressed()) { delay(10); yield(); }
delay(50);

View file

@ -378,7 +378,7 @@ void loop() {
lastTouchX = touchX;
lastTouchY = touchY;
longPressHandled = false;
casioBeep(2048, 20); // Soft, instant Casio beep ONLY on touch screen press!
casioBeep(4096, 25); // Crisp, bright Casio chirp on touch screen press!
} else if (!longPressHandled && (millis() - touchStartTime > 1000)) {
// Long press (> 1s): Open Config Menu!
longPressHandled = true;