From 7e9db611036a08ec70e91213227d82b66a4bba44 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Fri, 30 May 2014 15:14:42 +0100 Subject: [PATCH] Fix buzzer durations and make it so that all buzzer durations are linked so they never become out of alignment with each other. --- src/buzzer.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/buzzer.c b/src/buzzer.c index dfba21ed0..3956a447f 100644 --- a/src/buzzer.c +++ b/src/buzzer.c @@ -11,8 +11,12 @@ #include "buzzer.h" -#define LONG_PAUSE_DURATION_MILLIS 50 -#define SHORT_CONFIRMATION_BEEP_DURATION_MILLIS 50 +#define DOUBLE_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS * 2) +#define LONG_PAUSE_DURATION_MILLIS 400 +#define SHORT_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS / 4) +#define MEDIUM_PAUSE_DURATION_MILLIS (LONG_PAUSE_DURATION_MILLIS / 2) + +#define SHORT_CONFIRMATION_BEEP_DURATION_MILLIS (SHORT_PAUSE_DURATION_MILLIS / 2) static uint8_t buzzerIsOn = 0, beepDone = 0; static uint32_t buzzerLastToggleTime; @@ -113,18 +117,19 @@ void beep_code(char first, char second, char third, char pause) patternChar[2] = third; patternChar[3] = pause; switch (patternChar[icnt]) { - case 'M': - Duration = 100; + case 'N': + Duration = 0; break; - case 'L': - Duration = 200; + case 'S': + Duration = LONG_PAUSE_DURATION_MILLIS / 4; break; - case 'D': - Duration = 2000; + case 'M': + Duration = LONG_PAUSE_DURATION_MILLIS / 2; break; - case 'N': - Duration = 0; + case 'D': + Duration = LONG_PAUSE_DURATION_MILLIS * 2; break; + case 'L': default: Duration = LONG_PAUSE_DURATION_MILLIS; break;