From bcfc573312ab64ec747e2d7c46bcb9eadd4468a0 Mon Sep 17 00:00:00 2001 From: "rob@marotori.com" Date: Tue, 17 Apr 2012 10:33:56 +0000 Subject: [PATCH] Bug fix in audio - playASAP sending 1 to many events. So a request for 3 beeps would play 4 etc.. Fix in haptic to do correct number of vibrations on time count down. --- src/audio.cpp | 2 +- src/haptic.h | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/audio.cpp b/src/audio.cpp index 5dd7dc49a..278d55ff7 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -145,7 +145,7 @@ void audioQueue::playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause, queueToneFreq[t_queueWidx] = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator queueToneLength[t_queueWidx] = getToneLength(tLen); queueTonePause[t_queueWidx] = tPause; - queueToneRepeat[t_queueWidx] = tRepeat; + queueToneRepeat[t_queueWidx] = tRepeat -1; queueToneFreqIncr[t_queueWidx] = tFreqIncr; t_queueWidx = next_queueWidx; } diff --git a/src/haptic.h b/src/haptic.h index 6be7fed3a..1148d1953 100644 --- a/src/haptic.h +++ b/src/haptic.h @@ -94,8 +94,14 @@ inline void hapticAudioEvent(uint8_t e) { if (g_eeGeneral.hapticMode>=-1 && e<=AU_ERROR) hapticDefevent(1); + else if (e == AU_TIMER_30) + hapticDefevent(3); + else if (e == AU_TIMER_20) + hapticDefevent(2); + else if (e == AU_TIMER_10) + hapticDefevent(1); else if (g_eeGeneral.hapticMode==0 && e>=AU_WARNING1) - hapticDefevent(1); + hapticDefevent(1); else if (g_eeGeneral.hapticMode>0) hapticDefevent(0); } @@ -104,6 +110,12 @@ inline void hapticBeepEvent(uint8_t e) { if (g_eeGeneral.hapticMode>=-1 && e>=3) hapticDefevent(1); + else if (e == AU_TIMER_30) + hapticDefevent(3); + else if (e == AU_TIMER_20) + hapticDefevent(2); + else if (e == AU_TIMER_10) + hapticDefevent(1); else if (g_eeGeneral.hapticMode==0 && e>0) hapticDefevent(1); else if (g_eeGeneral.hapticMode>0)