From 6636bf90c8589f9b7d80095c4685ab283a62fa87 Mon Sep 17 00:00:00 2001 From: "rob@marotori.com" Date: Mon, 2 Jul 2012 16:55:06 +0000 Subject: [PATCH] Update to enable different sound event for trim centres, and trim end points. --- src/beeper.h | 1 + src/ersky9x/audio.cpp | 5 +++++ src/ersky9x/audio.h | 1 + src/open9x.cpp | 13 +++++++++---- src/open9x.h | 1 + src/stock/audio.cpp | 7 +++++-- src/stock/audio.h | 1 + 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/beeper.h b/src/beeper.h index b609a70a6..bb204c920 100644 --- a/src/beeper.h +++ b/src/beeper.h @@ -78,6 +78,7 @@ extern void beep(uint8_t val); #define AUDIO_VARIO_DOWN() _beep(1) #define AUDIO_TRIM(event, f) { if (event & _MSK_KEY_REPT) warble = true; beep(1); } #define AUDIO_TRIM_MIDDLE(f) beep(2) +#define AUDIO_TRIM_END(f) beep(2) #define AUDIO_PLAY(p) beep(3) #define IS_AUDIO_BUSY() (g_beepCnt || beepAgain || beepOn) diff --git a/src/ersky9x/audio.cpp b/src/ersky9x/audio.cpp index 6a5dda856..19aaff323 100644 --- a/src/ersky9x/audio.cpp +++ b/src/ersky9x/audio.cpp @@ -45,6 +45,7 @@ const char * audioFilenames[] = { "warning2", "warning3", "midtrim", + "endtrim", "tada", "midpot", "mixwarn1", @@ -380,6 +381,10 @@ void audioEvent(uint8_t e, uint8_t f) case AU_TRIM_MIDDLE: play(f, 20, 4, PLAY_NOW); break; + // trim center + case AU_TRIM_END: + play(f, 20, 4, PLAY_NOW); + break; // warning one case AU_WARNING1: play(BEEP_DEFAULT_FREQ, 20, 2, PLAY_NOW); diff --git a/src/ersky9x/audio.h b/src/ersky9x/audio.h index 8f4b9406c..646c06e35 100644 --- a/src/ersky9x/audio.h +++ b/src/ersky9x/audio.h @@ -98,6 +98,7 @@ void audioEvent(uint8_t e, uint8_t f=BEEP_DEFAULT_FREQ); #define AUDIO_VARIO_UP() audioEvent(AU_KEYPAD_UP) #define AUDIO_VARIO_DOWN() audioEvent(AU_KEYPAD_DOWN) #define AUDIO_TRIM_MIDDLE(f) audioEvent(AU_TRIM_MIDDLE, f) +#define AUDIO_TRIM_END(f) audioEvent(AU_TRIM_END, f) #define AUDIO_TRIM(event, f) audioEvent(AU_TRIM_MOVE, f) #define AUDIO_PLAY(p) audioEvent(p) #define AUDIO_VARIO(f, t) play(f, t, 0, PLAY_SOUND_VARIO) diff --git a/src/open9x.cpp b/src/open9x.cpp index 708cb692a..61b19b254 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1083,17 +1083,18 @@ void checkTrims() if (thro) v = 4; // if throttle trim and trim trottle then step=4 int16_t after = (k&1) ? before + v : before - v; // positive = k&1 - bool beepTrim = false; + bool beepTrimEnd = false; + bool beepTrimMid = false; for (int16_t mark=TRIM_MIN; mark<=TRIM_MAX; mark+=TRIM_MAX) { if ((mark!=0 || !thro) && ((mark!=TRIM_MIN && after>=mark && beforemark))) { after = mark; - beepTrim = true; + beepTrimMid = true; } } if ((beforeTRIM_MAX) || (before>after && after