Update to enable different sound event for trim centres, and trim end points.

This commit is contained in:
rob@marotori.com
2012-07-02 16:55:06 +00:00
parent 190aafa1ef
commit 6636bf90c8
7 changed files with 23 additions and 6 deletions
+1
View File
@@ -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)
+5
View File
@@ -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);
+1
View File
@@ -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)
+9 -4
View File
@@ -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 && before<mark) || (mark!=TRIM_MAX && after<=mark && before>mark))) {
after = mark;
beepTrim = true;
beepTrimMid = true;
}
}
if ((before<after && after>TRIM_MAX) || (before>after && after<TRIM_MIN)) {
if (!g_model.extendedTrims) after = before;
beepTrim = true; // no repetition, it could be dangerous
beepTrimEnd = true; // no repetition, it could be dangerous
}
if (after < TRIM_EXTENDED_MIN) {
@@ -1116,10 +1117,14 @@ void checkTrims()
after += 60;
#endif
if (beepTrim) {
if (beepTrimMid) {
killEvents(event);
AUDIO_TRIM_MIDDLE(after);
}
else if (beepTrimEnd) {
killEvents(event);
AUDIO_TRIM_END(after);
}
else {
AUDIO_TRIM(event, after);
}
+1
View File
@@ -873,6 +873,7 @@ enum AUDIO_SOUNDS {
AU_WARNING2,
AU_WARNING3,
AU_TRIM_MIDDLE,
AU_TRIM_END,
AU_TADA,
AU_POT_STICK_MIDDLE,
AU_MIX_WARNING_1,
+5 -2
View File
@@ -117,8 +117,8 @@ inline uint8_t audioQueue::getToneLength(uint8_t tLen)
}
void audioQueue::pause(uint8_t tLen)
{
play(0, tLen, 5); // a pause
{
play(0, tLen, 5); // a pause
}
void audioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
@@ -209,6 +209,9 @@ void audioQueue::event(uint8_t e, uint8_t f)
case AU_TRIM_MIDDLE:
play(f, 10, 2, PLAY_NOW);
break;
case AU_TRIM_END:
play(f, 10, 2, PLAY_NOW);
break;
// warning one
case AU_WARNING1:
play(BEEP_DEFAULT_FREQ, 10, 1, PLAY_NOW);
+1
View File
@@ -131,6 +131,7 @@ void audioDefevent(uint8_t e);
#define AUDIO_VARIO_UP() audioDefevent(AU_KEYPAD_UP)
#define AUDIO_VARIO_DOWN() audioDefevent(AU_KEYPAD_DOWN)
#define AUDIO_TRIM_MIDDLE(f) audio.event(AU_TRIM_MIDDLE, f)
#define AUDIO_TRIM_END) audio.event(AU_TRIM_END, f)
#define AUDIO_TRIM(event, f) audio.event(AU_TRIM_MOVE, f)
#define AUDIO_PLAY(p) audio.event(p)
#define AUDIO_VARIO(f, t) audio.play(f, t, 0, PLAY_SOUND_VARIO)