From 571b877a8d4c083a7c58fc0427e9ee9f90b03244 Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 29 May 2012 18:55:55 +0000 Subject: [PATCH] If lightOffCounter running and a beep occurs, the counter is erased with the flash duration --- src/beeper.cpp | 2 +- src/ersky9x/audio.cpp | 6 ++++-- src/stock/audio.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/beeper.cpp b/src/beeper.cpp index 1048c5440..cb50396c1 100644 --- a/src/beeper.cpp +++ b/src/beeper.cpp @@ -56,7 +56,7 @@ void beep(uint8_t val) haptic.event(val==0 ? 0 : AU_TIMER_10+beepAgain); #endif - if(g_eeGeneral.flashBeep && val > 1) g_LightOffCounter = FLASH_DURATION; + if(g_eeGeneral.flashBeep && val > 1 && g_LightOffCounter < FLASH_DURATION) g_LightOffCounter = FLASH_DURATION; if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && val!=0) || (g_eeGeneral.beeperMode==-1 && val>=3)) { _beep(pgm_read_byte(beepTab+5*(2+g_eeGeneral.beeperLength)+val)); diff --git a/src/ersky9x/audio.cpp b/src/ersky9x/audio.cpp index 5e9d50d6b..fe078e757 100644 --- a/src/ersky9x/audio.cpp +++ b/src/ersky9x/audio.cpp @@ -179,8 +179,10 @@ void audioQueue::event(uint8_t e, uint8_t f) haptic.event(e); //do this before audio to help sync timings #endif - if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) - g_LightOffCounter = FLASH_DURATION; + if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) { + if (g_LightOffCounter < FLASH_DURATION) + g_LightOffCounter = FLASH_DURATION; + } if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) { if (e < AU_FRSKY_FIRST || empty()) { diff --git a/src/stock/audio.cpp b/src/stock/audio.cpp index 6177e203f..aecf264e2 100644 --- a/src/stock/audio.cpp +++ b/src/stock/audio.cpp @@ -166,8 +166,10 @@ void audioQueue::event(uint8_t e, uint8_t f) haptic.event(e); //do this before audio to help sync timings #endif - if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) - g_LightOffCounter = FLASH_DURATION; + if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) { + if (g_LightOffCounter < FLASH_DURATION) + g_LightOffCounter = FLASH_DURATION; + } if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) { if (e < AU_FRSKY_FIRST || empty()) {