Implement authentic Casio watch beep (2048 Hz C7, 24ms) on every screen touch

This commit is contained in:
Sebastián Nieto 2026-09-09 23:04:46 -03:00
parent 644179f09c
commit c3b15d6c34
2 changed files with 15 additions and 26 deletions

View file

@ -9,26 +9,25 @@ Configuration menu for OBD2 Gauge
#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 = 24) {
ledcWriteTone(buzzerChannel, freq);
delay(duration_ms);
ledcWriteTone(buzzerChannel, 0);
}
void beepbeep() {
ledcWriteTone(buzzerChannel, 2000);
delay(50);
ledcWriteTone(buzzerChannel, 0);
delay(50);
ledcWriteTone(buzzerChannel, 2000);
delay(50);
ledcWriteTone(buzzerChannel, 0);
casioBeep(2048, 35);
delay(35);
casioBeep(2048, 35);
}
void beep() {
ledcWriteTone(buzzerChannel, 2000);
delay(500);
ledcWriteTone(buzzerChannel, 0);
casioBeep(2048, 200);
}
void clickSound() {
ledcWriteTone(buzzerChannel, 5000);
delay(5);
ledcWriteTone(buzzerChannel, 0);
casioBeep(2048, 24);
}
// Configuration menu list

View file

@ -368,13 +368,12 @@ void loop() {
lastTouchX = touchX;
lastTouchY = touchY;
longPressHandled = false;
casioBeep(2048, 24); // Instant Casio beep on every screen touch!
} else if (!longPressHandled && (millis() - touchStartTime > 1000)) {
// Long press (> 1s) or button hold: Open Config Menu!
longPressHandled = true;
clickCount = 0;
ledcWriteTone(buzzerChannel, 3500);
delay(40);
ledcWriteTone(buzzerChannel, 0);
casioBeep(4096, 35); // High confirmation beep
configMenu();
if (foundOBD2) initScreen();
isTouching = false;
@ -395,13 +394,7 @@ void loop() {
if ((millis() - firstClickTime < 400) && (quad == clickQuadrant || fullScreenCell != -1)) {
// DOUBLE CLICK DETECTED!
clickCount = 0;
ledcWriteTone(buzzerChannel, 5000);
delay(15);
ledcWriteTone(buzzerChannel, 0);
delay(40);
ledcWriteTone(buzzerChannel, 5000);
delay(15);
ledcWriteTone(buzzerChannel, 0);
casioBeep(4096, 20); // High confirmation beep on double tap
if (fullScreenCell == -1) {
fullScreenCell = quad;
@ -422,9 +415,6 @@ void loop() {
// Handle single click timeout (after 400ms without a second tap)
if (clickCount == 1 && (millis() - firstClickTime >= 400)) {
clickCount = 0;
ledcWriteTone(buzzerChannel, 4500);
delay(15);
ledcWriteTone(buzzerChannel, 0);
if (fullScreenCell != -1) {
// In full screen: single click toggles between arc and number mode without header flicker