Major patch to split haptic and audio queues into separate systems.
Patch is testing and working on the sky9xboard and the stock board. I dont have a gruvin board to test on. Currently only events that trigger haptic alerts are WARNING1-3 and TRIM MIDDLE. Next step is for bertrand to use the hooks to enable a per alert option to choose enable haptic. Also... translations are added but the menu file does not use the translation yet - as I have not got my head round how this works!
This commit is contained in:
+17
-8
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
# PCB version
|
# PCB version
|
||||||
# Values: STD, V4, ARM
|
# Values: STD, V4, ARM
|
||||||
PCB = STD
|
PCB = ARM
|
||||||
|
|
||||||
# PCB revision
|
# PCB revision
|
||||||
# Values: REVA, REVB
|
# Values: REVA, REVB
|
||||||
@@ -29,7 +29,7 @@ PCBREV = REVB
|
|||||||
# For this option you need to modify your hardware!
|
# For this option you need to modify your hardware!
|
||||||
# More information at [insertURLhere]
|
# More information at [insertURLhere]
|
||||||
# Values = STD, FRSKY, JETI, NMEA, ARDUPILOT, MAVLINK
|
# Values = STD, FRSKY, JETI, NMEA, ARDUPILOT, MAVLINK
|
||||||
EXT = STD
|
EXT = FRSKY
|
||||||
|
|
||||||
# Enable heli menu
|
# Enable heli menu
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
@@ -37,7 +37,7 @@ HELI = NO
|
|||||||
|
|
||||||
# Enable templates menu
|
# Enable templates menu
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
TEMPLATES = YES
|
TEMPLATES = NO
|
||||||
|
|
||||||
# Enable navigation with Pots / Rotary encoders
|
# Enable navigation with Pots / Rotary encoders
|
||||||
# Values = NO
|
# Values = NO
|
||||||
@@ -54,11 +54,11 @@ endif
|
|||||||
|
|
||||||
# AUDIO Mods
|
# AUDIO Mods
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
AUDIO = NO
|
AUDIO = YES
|
||||||
|
|
||||||
# HAPTIC Mods
|
# HAPTIC Mods
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
HAPTIC = NO
|
HAPTIC = YES
|
||||||
|
|
||||||
# SPLASH on START
|
# SPLASH on START
|
||||||
SPLASH = YES
|
SPLASH = YES
|
||||||
@@ -84,13 +84,13 @@ WS_HOW_HIGH = YES
|
|||||||
LOGS = YES
|
LOGS = YES
|
||||||
|
|
||||||
# PXX (FrSky PCM) protocol
|
# PXX (FrSky PCM) protocol
|
||||||
PXX = NO
|
PXX = YES
|
||||||
|
|
||||||
# PPM16
|
# PPM16
|
||||||
PPM16 = NO
|
PPM16 = NO
|
||||||
|
|
||||||
# DSM2 (Spektrum) protocol
|
# DSM2 (Spektrum) protocol
|
||||||
DSM2 = NO
|
DSM2 = YES
|
||||||
|
|
||||||
# SOMO-14D module (V4 board only)
|
# SOMO-14D module (V4 board only)
|
||||||
SOMO = NO
|
SOMO = NO
|
||||||
@@ -101,7 +101,7 @@ TRANSLATIONS = EN
|
|||||||
|
|
||||||
# EEPROM_PROGRESS_BAR
|
# EEPROM_PROGRESS_BAR
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
EEPROM_PROGRESS_BAR = NO
|
EEPROM_PROGRESS_BAR = YES
|
||||||
|
|
||||||
# Enable extra rotary encoders (V4 board only)
|
# Enable extra rotary encoders (V4 board only)
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
@@ -280,6 +280,8 @@ ifeq ($(PCB), ARM)
|
|||||||
PULSESSRC = pulses_arm.cpp
|
PULSESSRC = pulses_arm.cpp
|
||||||
CPPSRC += audio.cpp
|
CPPSRC += audio.cpp
|
||||||
CPPSRC += ersky9x/sound.cpp
|
CPPSRC += ersky9x/sound.cpp
|
||||||
|
CPPSRC += haptic.cpp
|
||||||
|
CPPSRC += ersky9x/haptic.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PCB), V4)
|
ifeq ($(PCB), V4)
|
||||||
@@ -291,6 +293,7 @@ ifeq ($(PCB), V4)
|
|||||||
EEPROMSRC = eeprom_avr.cpp
|
EEPROMSRC = eeprom_avr.cpp
|
||||||
PULSESSRC = pulses_avr.cpp
|
PULSESSRC = pulses_avr.cpp
|
||||||
CPPSRC += audio.cpp
|
CPPSRC += audio.cpp
|
||||||
|
CPPSRC += haptic.cpp
|
||||||
CPPSRC += gruvin9x/gtime.cpp
|
CPPSRC += gruvin9x/gtime.cpp
|
||||||
CPPSRC += gruvin9x/rtc.cpp
|
CPPSRC += gruvin9x/rtc.cpp
|
||||||
CPPSRC += gruvin9x/ff.cpp
|
CPPSRC += gruvin9x/ff.cpp
|
||||||
@@ -332,6 +335,12 @@ ifeq ($(PCB), STD)
|
|||||||
else
|
else
|
||||||
CPPSRC += beeper.cpp
|
CPPSRC += beeper.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAPTIC), YES)
|
||||||
|
CPPDEFS += -DHAPTIC
|
||||||
|
CPPSRC += haptic.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### Global Build-Option Directives ###
|
### Global Build-Option Directives ###
|
||||||
|
|||||||
+51
-109
@@ -41,10 +41,6 @@ audioQueue::audioQueue()
|
|||||||
t_queueRidx = 0;
|
t_queueRidx = 0;
|
||||||
t_queueWidx = 0;
|
t_queueWidx = 0;
|
||||||
|
|
||||||
#ifdef HAPTIC
|
|
||||||
hapticTick = 0;
|
|
||||||
hapticSpinUpTime = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -71,25 +67,9 @@ void audioQueue::heartbeat()
|
|||||||
toneTimeLeft = 0; //time gets counted down
|
toneTimeLeft = 0; //time gets counted down
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAPTIC)
|
|
||||||
|
|
||||||
if (toneHaptic) {
|
|
||||||
hapticOn((g_eeGeneral.hapticStrength * 2) * 10);
|
|
||||||
hapticSpinUpTime = HAPTIC_SPINUP; //min time haptic runs for. Might be worth a config option in system prefs to allow user to set to suit motor?
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
#if defined(HAPTIC)
|
|
||||||
if(hapticSpinUpTime > 0){
|
|
||||||
hapticSpinUpTime--;
|
|
||||||
} else {
|
|
||||||
hapticOff();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tonePause) {
|
if (tonePause) {
|
||||||
if (queueTone(0, tonePause * 10, 0)) {
|
if (queueTone(0, tonePause * 10, 0)) {
|
||||||
@@ -102,8 +82,6 @@ void audioQueue::heartbeat()
|
|||||||
toneTimeLeft = queueToneLength[t_queueRidx];
|
toneTimeLeft = queueToneLength[t_queueRidx];
|
||||||
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
||||||
tonePause = queueTonePause[t_queueRidx];
|
tonePause = queueTonePause[t_queueRidx];
|
||||||
toneHaptic = queueToneHaptic[t_queueRidx];
|
|
||||||
hapticTick = 0;
|
|
||||||
if (!queueToneRepeat[t_queueRidx]--) {
|
if (!queueToneRepeat[t_queueRidx]--) {
|
||||||
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
|
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
|
||||||
}
|
}
|
||||||
@@ -121,21 +99,9 @@ void audioQueue::heartbeat()
|
|||||||
toneTimeLeft--; //time gets counted down
|
toneTimeLeft--; //time gets counted down
|
||||||
toneFreq += toneFreqIncr;
|
toneFreq += toneFreqIncr;
|
||||||
|
|
||||||
#if defined(HAPTIC)
|
|
||||||
if (toneHaptic){
|
|
||||||
if (hapticTick-- > 0) {
|
|
||||||
HAPTIC_ON; // haptic output 'high'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
HAPTIC_OFF; // haptic output 'low'
|
|
||||||
hapticTick = g_eeGeneral.hapticStrength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SPEAKER_OFF;
|
SPEAKER_OFF;
|
||||||
HAPTIC_OFF;
|
|
||||||
|
|
||||||
if (tonePause > 0) {
|
if (tonePause > 0) {
|
||||||
tonePause--;
|
tonePause--;
|
||||||
@@ -145,9 +111,7 @@ void audioQueue::heartbeat()
|
|||||||
toneTimeLeft = queueToneLength[t_queueRidx];
|
toneTimeLeft = queueToneLength[t_queueRidx];
|
||||||
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
||||||
tonePause = queueTonePause[t_queueRidx];
|
tonePause = queueTonePause[t_queueRidx];
|
||||||
#if defined(HAPTIC)
|
|
||||||
toneHaptic = queueToneHaptic[t_queueRidx];
|
|
||||||
#endif
|
|
||||||
if (!queueToneRepeat[t_queueRidx]--) {
|
if (!queueToneRepeat[t_queueRidx]--) {
|
||||||
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
|
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
|
||||||
}
|
}
|
||||||
@@ -169,38 +133,30 @@ inline uint8_t audioQueue::getToneLength(uint8_t tLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool s_beeper;
|
bool s_beeper;
|
||||||
#if defined(HAPTIC)
|
|
||||||
bool s_haptic;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void audioQueue::playNow(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
void audioQueue::playNow(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
||||||
uint8_t tRepeat, uint8_t tHaptic, int8_t tFreqIncr)
|
uint8_t tRepeat, int8_t tFreqIncr)
|
||||||
{
|
{
|
||||||
toneFreq = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator
|
toneFreq = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator
|
||||||
toneTimeLeft = getToneLength(tLen);
|
toneTimeLeft = getToneLength(tLen);
|
||||||
tonePause = tPause;
|
tonePause = tPause;
|
||||||
#if defined(HAPTIC)
|
|
||||||
toneHaptic = s_haptic ? tHaptic : 0;
|
|
||||||
#endif
|
|
||||||
toneFreqIncr = tFreqIncr;
|
toneFreqIncr = tFreqIncr;
|
||||||
t_queueWidx = t_queueRidx;
|
t_queueWidx = t_queueRidx;
|
||||||
|
|
||||||
if (tRepeat) {
|
if (tRepeat) {
|
||||||
playASAP(tFreq, tLen, tPause, tRepeat-1, tHaptic, tFreqIncr);
|
playASAP(tFreq, tLen, tPause, tRepeat-1, tFreqIncr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audioQueue::playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
void audioQueue::playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
||||||
uint8_t tRepeat, uint8_t tHaptic, int8_t tFreqIncr)
|
uint8_t tRepeat, int8_t tFreqIncr)
|
||||||
{
|
{
|
||||||
uint8_t next_queueWidx = (t_queueWidx + 1) % AUDIO_QUEUE_LENGTH;
|
uint8_t next_queueWidx = (t_queueWidx + 1) % AUDIO_QUEUE_LENGTH;
|
||||||
if (next_queueWidx != t_queueRidx) {
|
if (next_queueWidx != t_queueRidx) {
|
||||||
queueToneFreq[t_queueWidx] = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator
|
queueToneFreq[t_queueWidx] = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator
|
||||||
queueToneLength[t_queueWidx] = getToneLength(tLen);
|
queueToneLength[t_queueWidx] = getToneLength(tLen);
|
||||||
queueTonePause[t_queueWidx] = tPause;
|
queueTonePause[t_queueWidx] = tPause;
|
||||||
#if defined(HAPTIC)
|
|
||||||
queueToneHaptic[t_queueWidx] = s_haptic ? tHaptic : 0;
|
|
||||||
#endif
|
|
||||||
queueToneRepeat[t_queueWidx] = tRepeat;
|
queueToneRepeat[t_queueWidx] = tRepeat;
|
||||||
queueToneFreqIncr[t_queueWidx] = tFreqIncr;
|
queueToneFreqIncr[t_queueWidx] = tFreqIncr;
|
||||||
t_queueWidx = next_queueWidx;
|
t_queueWidx = next_queueWidx;
|
||||||
@@ -210,9 +166,6 @@ void audioQueue::playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
|||||||
void audioQueue::event(uint8_t e, uint8_t f)
|
void audioQueue::event(uint8_t e, uint8_t f)
|
||||||
{
|
{
|
||||||
s_beeper = (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_WARNING1) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR));
|
s_beeper = (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_WARNING1) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR));
|
||||||
#if defined(HAPTIC)
|
|
||||||
s_haptic = (g_eeGeneral.hapticMode>0 || (g_eeGeneral.hapticMode==0 && e>=AU_WARNING1) || (g_eeGeneral.hapticMode>=-1 && e<=AU_ERROR));
|
|
||||||
#endif
|
|
||||||
if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) g_LightOffCounter = FLASH_DURATION; // we got an event do we need to flash the display ?
|
if (g_eeGeneral.flashBeep && (e <= AU_ERROR || e >= AU_WARNING1)) g_LightOffCounter = FLASH_DURATION; // we got an event do we need to flash the display ?
|
||||||
if (e < AU_FRSKY_FIRST || empty()) {
|
if (e < AU_FRSKY_FIRST || empty()) {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
@@ -223,25 +176,25 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
|||||||
// low battery in tx
|
// low battery in tx
|
||||||
case AU_TX_BATTERY_LOW:
|
case AU_TX_BATTERY_LOW:
|
||||||
if (empty()) {
|
if (empty()) {
|
||||||
playASAP(60, 20, 3, 2, 0, 1);
|
playASAP(60, 20, 3, 2, 1);
|
||||||
playASAP(80, 20, 3, 2, 1, -1);
|
playASAP(80, 20, 3, 2, -1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// error
|
// error
|
||||||
case AU_ERROR:
|
case AU_ERROR:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 40, 1, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 40, 1, 0);
|
||||||
break;
|
break;
|
||||||
// keypad up (seems to be used when going left/right through system menu options. 0-100 scales etc)
|
// keypad up (seems to be used when going left/right through system menu options. 0-100 scales etc)
|
||||||
case AU_KEYPAD_UP:
|
case AU_KEYPAD_UP:
|
||||||
playNow(BEEP_KEY_UP_FREQ, 10, 1, 0, 1);
|
playNow(BEEP_KEY_UP_FREQ, 10, 1, 0);
|
||||||
break;
|
break;
|
||||||
// keypad down (seems to be used when going left/right through system menu options. 0-100 scales etc)
|
// keypad down (seems to be used when going left/right through system menu options. 0-100 scales etc)
|
||||||
case AU_KEYPAD_DOWN:
|
case AU_KEYPAD_DOWN:
|
||||||
playNow(BEEP_KEY_DOWN_FREQ, 10, 1, 0, 1);
|
playNow(BEEP_KEY_DOWN_FREQ, 10, 1, 0);
|
||||||
break;
|
break;
|
||||||
// menu display (also used by a few generic beeps)
|
// menu display (also used by a few generic beeps)
|
||||||
case AU_MENUS:
|
case AU_MENUS:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0);
|
||||||
break;
|
break;
|
||||||
// trim move
|
// trim move
|
||||||
case AU_TRIM_MOVE:
|
case AU_TRIM_MOVE:
|
||||||
@@ -249,19 +202,23 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
|||||||
break;
|
break;
|
||||||
// trim center
|
// trim center
|
||||||
case AU_TRIM_MIDDLE:
|
case AU_TRIM_MIDDLE:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0);
|
||||||
|
hapticDefevent(1);
|
||||||
break;
|
break;
|
||||||
// warning one
|
// warning one
|
||||||
case AU_WARNING1:
|
case AU_WARNING1:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 10, 1, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 10, 1, 0);
|
||||||
|
hapticDefevent(1);
|
||||||
break;
|
break;
|
||||||
// warning two
|
// warning two
|
||||||
case AU_WARNING2:
|
case AU_WARNING2:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 20, 1, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 20, 1, 0);
|
||||||
|
hapticDefevent(1);
|
||||||
break;
|
break;
|
||||||
// warning three
|
// warning three
|
||||||
case AU_WARNING3:
|
case AU_WARNING3:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 30, 1, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ, 30, 1, 0);
|
||||||
|
hapticDefevent(1);
|
||||||
break;
|
break;
|
||||||
// startup tune
|
// startup tune
|
||||||
case AU_TADA:
|
case AU_TADA:
|
||||||
@@ -271,63 +228,63 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
|||||||
break;
|
break;
|
||||||
// pot/stick center
|
// pot/stick center
|
||||||
case AU_POT_STICK_MIDDLE:
|
case AU_POT_STICK_MIDDLE:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 50, 10, 1, 0, 0);
|
playNow(BEEP_DEFAULT_FREQ + 50, 10, 1, 0);
|
||||||
break;
|
break;
|
||||||
// mix warning 1
|
// mix warning 1
|
||||||
case AU_MIX_WARNING_1:
|
case AU_MIX_WARNING_1:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 50, 6, 0, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ + 50, 6, 0, 0);
|
||||||
break;
|
break;
|
||||||
// mix warning 2
|
// mix warning 2
|
||||||
case AU_MIX_WARNING_2:
|
case AU_MIX_WARNING_2:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 52, 6, 0, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ + 52, 6, 0, 0);
|
||||||
break;
|
break;
|
||||||
// mix warning 3
|
// mix warning 3
|
||||||
case AU_MIX_WARNING_3:
|
case AU_MIX_WARNING_3:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 54, 6, 0, 0, 1);
|
playNow(BEEP_DEFAULT_FREQ + 54, 6, 0, 0);
|
||||||
break;
|
break;
|
||||||
// time 30 seconds left
|
// time 30 seconds left
|
||||||
case AU_TIMER_30:
|
case AU_TIMER_30:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 3, 1);
|
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 3);
|
||||||
break;
|
break;
|
||||||
// time 20 seconds left
|
// time 20 seconds left
|
||||||
case AU_TIMER_20:
|
case AU_TIMER_20:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 2, 1);
|
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 2);
|
||||||
break;
|
break;
|
||||||
// time 10 seconds left
|
// time 10 seconds left
|
||||||
case AU_TIMER_10:
|
case AU_TIMER_10:
|
||||||
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 1, 1);
|
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 1);
|
||||||
break;
|
break;
|
||||||
// time <3 seconds left
|
// time <3 seconds left
|
||||||
case AU_TIMER_LT3:
|
case AU_TIMER_LT3:
|
||||||
playNow(BEEP_DEFAULT_FREQ, 20, 25, 1, 1);
|
playNow(BEEP_DEFAULT_FREQ, 20, 25, 1);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_WARN1:
|
case AU_FRSKY_WARN1:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+20,15,5,2,1);
|
playASAP(BEEP_DEFAULT_FREQ+20,15,5,2);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_WARN2:
|
case AU_FRSKY_WARN2:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+30,15,5,2,1);
|
playASAP(BEEP_DEFAULT_FREQ+30,15,5,2);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_CHEEP:
|
case AU_FRSKY_CHEEP:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,1,2);
|
playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,2);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_RING:
|
case AU_FRSKY_RING:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10,1);
|
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10);
|
||||||
playASAP(BEEP_DEFAULT_FREQ+25,5,10,1,1);
|
playASAP(BEEP_DEFAULT_FREQ+25,5,10,1);
|
||||||
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10,1);
|
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_SCIFI:
|
case AU_FRSKY_SCIFI:
|
||||||
playASAP(80,10,3,2,0,-1);
|
playASAP(80,10,3,2,-1);
|
||||||
playASAP(60,10,3,2,0,1);
|
playASAP(60,10,3,2,1);
|
||||||
playASAP(70,10,1,0,2);
|
playASAP(70,10,1,0);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_ROBOT:
|
case AU_FRSKY_ROBOT:
|
||||||
playASAP(70,5,1,1,1);
|
playASAP(70,5,1,1);
|
||||||
playASAP(50,15,2,1,1);
|
playASAP(50,15,2,1);
|
||||||
playASAP(80,15,2,1,1);
|
playASAP(80,15,2,1);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_CHIRP:
|
case AU_FRSKY_CHIRP:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+40,5,1,2,1);
|
playASAP(BEEP_DEFAULT_FREQ+40,5,1,2);
|
||||||
playASAP(BEEP_DEFAULT_FREQ+54,5,1,3,1);
|
playASAP(BEEP_DEFAULT_FREQ+54,5,1,3);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_TADA:
|
case AU_FRSKY_TADA:
|
||||||
playASAP(50,5,5);
|
playASAP(50,5,5);
|
||||||
@@ -335,40 +292,25 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
|||||||
playASAP(110,3,4,2);
|
playASAP(110,3,4,2);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_CRICKET:
|
case AU_FRSKY_CRICKET:
|
||||||
playASAP(80,5,10,3,1);
|
playASAP(80,5,10,3);
|
||||||
playASAP(80,5,20,1,1);
|
playASAP(80,5,20,1);
|
||||||
playASAP(80,5,10,3,1);
|
playASAP(80,5,10,3);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_SIREN:
|
case AU_FRSKY_SIREN:
|
||||||
playASAP(10,20,5,2,1,1);
|
playASAP(10,20,5,2,1);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_ALARMC:
|
case AU_FRSKY_ALARMC:
|
||||||
playASAP(50,4,10,2,1);
|
playASAP(50,4,10,2);
|
||||||
playASAP(70,8,20,1,1);
|
playASAP(70,8,20,1);
|
||||||
playASAP(50,8,10,2,1);
|
playASAP(50,8,10,2);
|
||||||
playASAP(70,4,20,1,1);
|
playASAP(70,4,20,1);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_RATATA:
|
case AU_FRSKY_RATATA:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+50,5,10,10,1);
|
playASAP(BEEP_DEFAULT_FREQ+50,5,10,10);
|
||||||
break;
|
break;
|
||||||
case AU_FRSKY_TICK:
|
case AU_FRSKY_TICK:
|
||||||
playASAP(BEEP_DEFAULT_FREQ+50,5,50,2,1);
|
playASAP(BEEP_DEFAULT_FREQ+50,5,50,2);
|
||||||
break;
|
break;
|
||||||
#ifdef HAPTIC
|
|
||||||
case AU_FRSKY_HAPTIC1:
|
|
||||||
playASAP(0,30,10,0,1);
|
|
||||||
playASAP(0,10,50,0,1);
|
|
||||||
break;
|
|
||||||
case AU_FRSKY_HAPTIC2:
|
|
||||||
playASAP(0,30,10,0,1);
|
|
||||||
playASAP(0,10,10,0,1);
|
|
||||||
playASAP(0,10,30,0,1);
|
|
||||||
break;
|
|
||||||
case AU_FRSKY_HAPTIC3:
|
|
||||||
playASAP(0,30,10,0,1);
|
|
||||||
playASAP(0,10,10,2,1);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-21
@@ -34,12 +34,6 @@
|
|||||||
#ifndef audio_h
|
#ifndef audio_h
|
||||||
#define audio_h
|
#define audio_h
|
||||||
|
|
||||||
//#define ISER9X //enable this define for er9x. comment out for open9x
|
|
||||||
|
|
||||||
#if defined(ISER9X)
|
|
||||||
#define HAPTIC
|
|
||||||
#define PCBSTD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PCBARM)
|
#if defined(PCBARM)
|
||||||
#include "ersky9x/sound.h"
|
#include "ersky9x/sound.h"
|
||||||
@@ -93,11 +87,6 @@ enum AUDIO_SOUNDS {
|
|||||||
AU_FRSKY_ALARMC,
|
AU_FRSKY_ALARMC,
|
||||||
AU_FRSKY_RATATA,
|
AU_FRSKY_RATATA,
|
||||||
AU_FRSKY_TICK,
|
AU_FRSKY_TICK,
|
||||||
#ifdef HAPTIC
|
|
||||||
AU_FRSKY_HAPTIC1,
|
|
||||||
AU_FRSKY_HAPTIC2,
|
|
||||||
AU_FRSKY_HAPTIC3,
|
|
||||||
#endif
|
|
||||||
AU_FRSKY_LAST,
|
AU_FRSKY_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -109,9 +98,9 @@ class audioQueue
|
|||||||
|
|
||||||
// only difference between these two functions is that one does the
|
// only difference between these two functions is that one does the
|
||||||
// interupt queue (Now) and the other queues for playing ASAP.
|
// interupt queue (Now) and the other queues for playing ASAP.
|
||||||
void playNow(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0, uint8_t tHaptic=0, int8_t tFreqIncr=0);
|
void playNow(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0, int8_t tFreqIncr=0);
|
||||||
|
|
||||||
void playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0, uint8_t tHaptic=0, int8_t tFreqIncr=0);
|
void playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0, int8_t tFreqIncr=0);
|
||||||
|
|
||||||
inline bool busy() { return (toneTimeLeft > 0); }
|
inline bool busy() { return (toneTimeLeft > 0); }
|
||||||
|
|
||||||
@@ -184,12 +173,7 @@ class audioQueue
|
|||||||
uint8_t queueTonePause[AUDIO_QUEUE_LENGTH];
|
uint8_t queueTonePause[AUDIO_QUEUE_LENGTH];
|
||||||
uint8_t queueToneRepeat[AUDIO_QUEUE_LENGTH];
|
uint8_t queueToneRepeat[AUDIO_QUEUE_LENGTH];
|
||||||
|
|
||||||
#ifdef HAPTIC
|
|
||||||
uint8_t toneHaptic;
|
|
||||||
uint8_t hapticTick;
|
|
||||||
uint8_t queueToneHaptic[AUDIO_QUEUE_LENGTH];
|
|
||||||
uint8_t hapticSpinUpTime;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
#if defined(PCBSTD)
|
||||||
uint8_t toneCounter;
|
uint8_t toneCounter;
|
||||||
@@ -201,8 +185,6 @@ extern audioQueue audio;
|
|||||||
|
|
||||||
void audioDefevent(uint8_t e);
|
void audioDefevent(uint8_t e);
|
||||||
|
|
||||||
#define HAPTIC_SPINUP (10);
|
|
||||||
|
|
||||||
#define AUDIO_KEYPAD_UP() audioDefevent(AU_KEYPAD_UP)
|
#define AUDIO_KEYPAD_UP() audioDefevent(AU_KEYPAD_UP)
|
||||||
#define AUDIO_KEYPAD_DOWN() audioDefevent(AU_KEYPAD_DOWN)
|
#define AUDIO_KEYPAD_DOWN() audioDefevent(AU_KEYPAD_DOWN)
|
||||||
#define AUDIO_MENUS() audioDefevent(AU_MENUS)
|
#define AUDIO_MENUS() audioDefevent(AU_MENUS)
|
||||||
|
|||||||
@@ -423,42 +423,3 @@ extern "C" void TWI0_IRQHandler()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//void audioDefevent(uint8_t e)
|
|
||||||
//{
|
|
||||||
// if ( g_eeGeneral.speakerMode == 0 )
|
|
||||||
// {
|
|
||||||
// buzzer_sound( 4 ) ;
|
|
||||||
// }
|
|
||||||
// else if ( g_eeGeneral.speakerMode == 1 )
|
|
||||||
// {
|
|
||||||
//// tone_start( 50 ) ;
|
|
||||||
// playTone( 2000, 60 ) ; // 2KHz, 60mS
|
|
||||||
// }
|
|
||||||
//// audio.event(e,BEEP_DEFAULT_FREQ);
|
|
||||||
//}
|
|
||||||
|
|
||||||
void hapticOff()
|
|
||||||
{
|
|
||||||
PWM->PWM_DIS = PWM_DIS_CHID2 ; // Disable channel 2
|
|
||||||
PWM->PWM_OOV &= ~0x00040000 ; // Force low
|
|
||||||
PWM->PWM_OSS |= 0x00040000 ; // Force low
|
|
||||||
}
|
|
||||||
|
|
||||||
// pwmPercent 0-100
|
|
||||||
void hapticOn( uint32_t pwmPercent )
|
|
||||||
{
|
|
||||||
register Pwm *pwmptr ;
|
|
||||||
|
|
||||||
pwmptr = PWM ;
|
|
||||||
|
|
||||||
if ( pwmPercent > 100 )
|
|
||||||
{
|
|
||||||
pwmPercent = 100 ;
|
|
||||||
}
|
|
||||||
pwmptr->PWM_CH_NUM[2].PWM_CDTYUPD = pwmPercent ; // Duty
|
|
||||||
pwmptr->PWM_ENA = PWM_ENA_CHID2 ; // Enable channel 2
|
|
||||||
pwmptr->PWM_OSC = 0x00040000 ; // Enable output
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ extern void init_twi( void ) ;
|
|||||||
extern void set_volume( register uint8_t volume ) ;
|
extern void set_volume( register uint8_t volume ) ;
|
||||||
extern "C" void TWI0_IRQHandler (void) ;
|
extern "C" void TWI0_IRQHandler (void) ;
|
||||||
extern void audioDefevent( uint8_t e ) ;
|
extern void audioDefevent( uint8_t e ) ;
|
||||||
extern void hapticOff(void) ;
|
|
||||||
extern void hapticOn( uint32_t pwmPercent ) ;
|
|
||||||
extern void sound_5ms( void ) ;
|
extern void sound_5ms( void ) ;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -194,6 +194,14 @@ void menuProcSetup(uint8_t event)
|
|||||||
}
|
}
|
||||||
if((y+=FH)>7*FH) return;
|
if((y+=FH)>7*FH) return;
|
||||||
}subN++;
|
}subN++;
|
||||||
|
|
||||||
|
if(s_pgOfs<subN) {
|
||||||
|
lcd_putsLeft( y, PSTR("Haptic Length")); //to do translations
|
||||||
|
lcd_putsiAtt(PARAM_OFS - 2*FW, y, STR_VBEEPLEN, 2+g_eeGeneral.hapticLength, (sub==subN ? INVERS:0));
|
||||||
|
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.hapticLength, -2, 2);
|
||||||
|
if((y+=FH)>7*FH) return;
|
||||||
|
}subN++;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO port onoffMenuItem here to save flash
|
// TODO port onoffMenuItem here to save flash
|
||||||
|
|||||||
+2
-1
@@ -133,7 +133,8 @@ PACK(typedef struct t_EEGeneral {
|
|||||||
uint8_t lightAutoOff;
|
uint8_t lightAutoOff;
|
||||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||||
int8_t PPM_Multiplier;
|
int8_t PPM_Multiplier;
|
||||||
uint8_t spare3[2];
|
uint8_t hapticLength;
|
||||||
|
uint8_t spare3;
|
||||||
int8_t beeperLength:3;
|
int8_t beeperLength:3;
|
||||||
uint8_t hapticStrength:3;
|
uint8_t hapticStrength:3;
|
||||||
uint8_t gpsFormat:1;
|
uint8_t gpsFormat:1;
|
||||||
|
|||||||
+15
-1
@@ -64,6 +64,11 @@ uint16_t g_time_per10;
|
|||||||
audioQueue audio;
|
audioQueue audio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAPTIC
|
||||||
|
//new audio object
|
||||||
|
hapticQueue haptic;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t heartbeat;
|
uint8_t heartbeat;
|
||||||
|
|
||||||
uint8_t stickMode;
|
uint8_t stickMode;
|
||||||
@@ -876,6 +881,8 @@ uint8_t checkTrim(uint8_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((before<after && after>TRIM_MAX) || (before>after && after<TRIM_MIN)) {
|
if ((before<after && after>TRIM_MAX) || (before>after && after<TRIM_MIN)) {
|
||||||
if (!g_model.extendedTrims) after = before;
|
if (!g_model.extendedTrims) after = before;
|
||||||
beepTrim = true; // no repetition, it could be dangerous
|
beepTrim = true; // no repetition, it could be dangerous
|
||||||
@@ -903,7 +910,8 @@ uint8_t checkTrim(uint8_t event)
|
|||||||
|
|
||||||
if (beepTrim) {
|
if (beepTrim) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
AUDIO_WARNING2();
|
//AUDIO_WARNING2();
|
||||||
|
audio.event(AU_TRIM_MIDDLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if defined (AUDIO)
|
#if defined (AUDIO)
|
||||||
@@ -2037,8 +2045,11 @@ void perMain()
|
|||||||
|
|
||||||
#if defined(PCBARM)
|
#if defined(PCBARM)
|
||||||
AUDIO_HEARTBEAT(); // the queue processing
|
AUDIO_HEARTBEAT(); // the queue processing
|
||||||
|
HAPTIC_HEARTBEAT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
int16_t g_ppmIns[8];
|
int16_t g_ppmIns[8];
|
||||||
uint8_t ppmInState = 0; //0=unsync 1..8= wait for value i-1
|
uint8_t ppmInState = 0; //0=unsync 1..8= wait for value i-1
|
||||||
@@ -2097,6 +2108,8 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
|||||||
|
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined (PCBSTD) && defined (AUDIO)
|
#if defined (PCBSTD) && defined (AUDIO)
|
||||||
AUDIO_DRIVER();
|
AUDIO_DRIVER();
|
||||||
static uint8_t cnt10ms = 77; // execute 10ms code once every 78 ISRs
|
static uint8_t cnt10ms = 77; // execute 10ms code once every 78 ISRs
|
||||||
@@ -2106,6 +2119,7 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
AUDIO_HEARTBEAT();
|
AUDIO_HEARTBEAT();
|
||||||
|
HAPTIC_HEARTBEAT();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Record start time from TCNT1 to record excution time
|
// Record start time from TCNT1 to record excution time
|
||||||
|
|||||||
@@ -812,6 +812,11 @@ extern uint16_t jeti_keys;
|
|||||||
#include "beeper.h"
|
#include "beeper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAPTIC)
|
||||||
|
#include "haptic.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOGS
|
#ifdef LOGS
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define TR_HAPTICMODE "Haptic Mode"
|
#define TR_HAPTICMODE "Haptic Mode"
|
||||||
#define TR_HAPTICSTRENGTH "Haptic Strength"
|
#define TR_HAPTICSTRENGTH "Haptic Strength"
|
||||||
|
#define TR_HAPTICLENGTH "Haptic Length"
|
||||||
#define TR_CONTRAST "Contrast"
|
#define TR_CONTRAST "Contrast"
|
||||||
#define TR_BATTERYWARNING "Battery Warning"
|
#define TR_BATTERYWARNING "Battery Warning"
|
||||||
#define TR_INACTIVITYALARM "Inactivity alarm"
|
#define TR_INACTIVITYALARM "Inactivity alarm"
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define TR_HAPTICMODE "Mode Vibreur"
|
#define TR_HAPTICMODE "Mode Vibreur"
|
||||||
#define TR_HAPTICSTRENGTH "Force Vibreur"
|
#define TR_HAPTICSTRENGTH "Force Vibreur"
|
||||||
|
#define TR_HAPTICLENGTH "Length Vibreur"
|
||||||
#define TR_CONTRAST "Contraste"
|
#define TR_CONTRAST "Contraste"
|
||||||
#define TR_BATTERYWARNING "Alarme Batterie"
|
#define TR_BATTERYWARNING "Alarme Batterie"
|
||||||
#define TR_INACTIVITYALARM "Alarme Inactivite"
|
#define TR_INACTIVITYALARM "Alarme Inactivite"
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define TR_HAPTICMODE "Vibrator l\201ge"
|
#define TR_HAPTICMODE "Vibrator l\201ge"
|
||||||
#define TR_HAPTICSTRENGTH "Vibrator Niv\200"
|
#define TR_HAPTICSTRENGTH "Vibrator Niv\200"
|
||||||
|
#define TR_HAPTICLENGTH "Vibrator tid"
|
||||||
#define TR_CONTRAST "Kontrast"
|
#define TR_CONTRAST "Kontrast"
|
||||||
#define TR_BATTERYWARNING "Batterivarning"
|
#define TR_BATTERYWARNING "Batterivarning"
|
||||||
#define TR_INACTIVITYALARM "Inaktivitetslarm"
|
#define TR_INACTIVITYALARM "Inaktivitetslarm"
|
||||||
|
|||||||
Reference in New Issue
Block a user