1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-22 15:55:26 +03:00

Massive revert of the trunk to return to the last known stable version. I would like a new release soon.

This commit is contained in:
bsongis 2012-04-18 08:24:33 +00:00
parent 090b111b7a
commit 1d2de3d3e0
21 changed files with 191 additions and 674 deletions

View file

@ -83,10 +83,6 @@ DISPLAY_USER_DATA = NO
# Values = YES, NO
FRSKY_HUB = YES
# Enable Extended vario functions (V4 board only)
# Values = YES, NO
VARIO_EXTENDED = NO
# WS HowHigh
# Values = YES, NO
WS_HOW_HIGH = YES
@ -296,7 +292,7 @@ ifeq ($(PCB), ARM)
# ersky9x/ff.c ersky9x/diskio_sam3s.c ersky9x/Media.c ersky9x/ccsbcs.c ersky9x/sdcard.c ersky9x/MEDSdcard.c
EEPROMSRC = eeprom_arm.cpp
PULSESSRC = pulses_arm.cpp
CPPSRC += audio.cpp haptic.cpp
CPPSRC += audio.cpp
CPPSRC += ersky9x/sound.cpp
endif
@ -308,7 +304,7 @@ ifeq ($(PCB), V4)
BOARDSRC += board_gruvin9x.cpp
EEPROMSRC = eeprom_avr.cpp
PULSESSRC = pulses_avr.cpp
CPPSRC += audio.cpp haptic.cpp
CPPSRC += audio.cpp
CPPSRC += gruvin9x/gtime.cpp
CPPSRC += gruvin9x/rtc.cpp
CPPSRC += gruvin9x/ff.cpp
@ -358,7 +354,6 @@ ifeq ($(PCB), STD)
ifeq ($(HAPTIC), YES)
CPPDEFS += -DHAPTIC
CPPSRC += haptic.cpp
endif
endif

View file

@ -40,8 +40,20 @@ audioQueue::audioQueue()
t_queueRidx = 0;
t_queueWidx = 0;
#ifdef HAPTIC
hapticTick = 0;
hapticSpinUpTime = 0;
#endif
}
#if 0
bool audioQueue::freeslots(uint8_t slots)
{
return AUDIO_QUEUE_LENGTH - ((t_queueWidx + AUDIO_QUEUE_LENGTH - t_queueRidx) % AUDIO_QUEUE_LENGTH) >= slots;
}
#endif
// heartbeat is responsibile for issueing the audio tones and general square waves
// it is essentially the life of the class.
// it is called every 10ms
@ -58,8 +70,27 @@ void audioQueue::heartbeat()
toneFreqIncr * 61 / 2)) {
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 {
#if defined(HAPTIC)
if(hapticSpinUpTime > 0){
hapticSpinUpTime--;
} else {
hapticOff();
}
#endif
if (tonePause) {
if (queueTone(0, tonePause * 10, 0)) {
tonePause = 0; //time gets counted down
@ -71,6 +102,8 @@ void audioQueue::heartbeat()
toneTimeLeft = queueToneLength[t_queueRidx];
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
tonePause = queueTonePause[t_queueRidx];
toneHaptic = queueToneHaptic[t_queueRidx];
hapticTick = 0;
if (!queueToneRepeat[t_queueRidx]--) {
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
}
@ -87,11 +120,24 @@ void audioQueue::heartbeat()
#endif
toneTimeLeft--; //time gets counted down
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 {
SPEAKER_OFF;
HAPTIC_OFF;
if (tonePause > 0) {
SPEAKER_OFF;
tonePause--;
}
else if (t_queueRidx != t_queueWidx) {
@ -99,14 +145,12 @@ void audioQueue::heartbeat()
toneTimeLeft = queueToneLength[t_queueRidx];
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
tonePause = queueTonePause[t_queueRidx];
if((toneFreq==0) || (toneTimeLeft==0)){
SPEAKER_OFF;
}
#if defined(HAPTIC)
toneHaptic = queueToneHaptic[t_queueRidx];
#endif
if (!queueToneRepeat[t_queueRidx]--) {
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
}
} else {
SPEAKER_OFF;
}
}
#endif
@ -125,54 +169,50 @@ inline uint8_t audioQueue::getToneLength(uint8_t tLen)
}
bool s_beeper;
#if defined(HAPTIC)
bool s_haptic;
#endif
void audioQueue::playNow(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
uint8_t tRepeat, int8_t tFreqIncr)
uint8_t tRepeat, uint8_t tHaptic, int8_t tFreqIncr)
{
toneFreq = ((s_beeper && tFreq) ? tFreq + g_eeGeneral.speakerPitch + BEEP_OFFSET : 0); // add pitch compensator
toneTimeLeft = getToneLength(tLen);
tonePause = tPause;
#if defined(HAPTIC)
toneHaptic = s_haptic ? tHaptic : 0;
#endif
toneFreqIncr = tFreqIncr;
t_queueWidx = t_queueRidx;
if (tRepeat) {
playASAP(tFreq, tLen, tPause, tRepeat-1, tFreqIncr);
playASAP(tFreq, tLen, tPause, tRepeat-1, tHaptic, tFreqIncr);
}
}
void audioQueue::playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
uint8_t tRepeat, int8_t tFreqIncr)
uint8_t tRepeat, uint8_t tHaptic, int8_t tFreqIncr)
{
uint8_t next_queueWidx = (t_queueWidx + 1) % AUDIO_QUEUE_LENGTH;
if (next_queueWidx != t_queueRidx) {
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 -1;
#if defined(HAPTIC)
queueToneHaptic[t_queueWidx] = s_haptic ? tHaptic : 0;
#endif
queueToneRepeat[t_queueWidx] = tRepeat;
queueToneFreqIncr[t_queueWidx] = tFreqIncr;
t_queueWidx = next_queueWidx;
}
}
#if defined(VARIO_EXTENDED)
void audioQueue::playVario(uint8_t tFreq, uint8_t tLen)
{
uint8_t next_queueWidx = (t_queueWidx + 1) % AUDIO_QUEUE_LENGTH;
if (next_queueWidx != t_queueRidx) {
queueToneFreq[t_queueWidx] = tFreq;
queueToneLength[t_queueWidx] = tLen;
queueTonePause[t_queueWidx] = 0;
queueToneRepeat[t_queueWidx] = 0;
queueToneFreqIncr[t_queueWidx] = 0;
t_queueWidx = next_queueWidx;
}
}
#endif
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));
#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 (e < AU_FRSKY_FIRST || empty()) {
switch (e) {
@ -183,25 +223,25 @@ void audioQueue::event(uint8_t e, uint8_t f)
// low battery in tx
case AU_TX_BATTERY_LOW:
if (empty()) {
playASAP(60, 20, 3, 2, 1);
playASAP(80, 20, 3, 2, -1);
playASAP(60, 20, 3, 2, 0, 1);
playASAP(80, 20, 3, 2, 1, -1);
}
break;
// error
case AU_ERROR:
playNow(BEEP_DEFAULT_FREQ, 40, 1, 0);
playNow(BEEP_DEFAULT_FREQ, 40, 1, 0, 1);
break;
// keypad up (seems to be used when going left/right through system menu options. 0-100 scales etc)
case AU_KEYPAD_UP:
playNow(BEEP_KEY_UP_FREQ, 10, 1, 0);
playNow(BEEP_KEY_UP_FREQ, 10, 1, 0, 1);
break;
// keypad down (seems to be used when going left/right through system menu options. 0-100 scales etc)
case AU_KEYPAD_DOWN:
playNow(BEEP_KEY_DOWN_FREQ, 10, 1, 0);
playNow(BEEP_KEY_DOWN_FREQ, 10, 1, 0, 1);
break;
// menu display (also used by a few generic beeps)
case AU_MENUS:
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0);
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
break;
// trim move
case AU_TRIM_MOVE:
@ -209,19 +249,19 @@ void audioQueue::event(uint8_t e, uint8_t f)
break;
// trim center
case AU_TRIM_MIDDLE:
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0);
playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
break;
// warning one
case AU_WARNING1:
playNow(BEEP_DEFAULT_FREQ, 10, 1, 0);
playNow(BEEP_DEFAULT_FREQ, 10, 1, 0, 1);
break;
// warning two
case AU_WARNING2:
playNow(BEEP_DEFAULT_FREQ, 20, 1, 0);
playNow(BEEP_DEFAULT_FREQ, 20, 1, 0, 1);
break;
// warning three
case AU_WARNING3:
playNow(BEEP_DEFAULT_FREQ, 30, 1, 0);
playNow(BEEP_DEFAULT_FREQ, 30, 1, 0, 1);
break;
// startup tune
case AU_TADA:
@ -231,63 +271,63 @@ void audioQueue::event(uint8_t e, uint8_t f)
break;
// pot/stick center
case AU_POT_STICK_MIDDLE:
playNow(BEEP_DEFAULT_FREQ + 50, 10, 1, 0);
playNow(BEEP_DEFAULT_FREQ + 50, 10, 1, 0, 0);
break;
// mix warning 1
case AU_MIX_WARNING_1:
playNow(BEEP_DEFAULT_FREQ + 50, 6, 0, 0);
playNow(BEEP_DEFAULT_FREQ + 50, 6, 0, 0, 1);
break;
// mix warning 2
case AU_MIX_WARNING_2:
playNow(BEEP_DEFAULT_FREQ + 52, 6, 0, 0);
playNow(BEEP_DEFAULT_FREQ + 52, 6, 0, 0, 1);
break;
// mix warning 3
case AU_MIX_WARNING_3:
playNow(BEEP_DEFAULT_FREQ + 54, 6, 0, 0);
playNow(BEEP_DEFAULT_FREQ + 54, 6, 0, 0, 1);
break;
// time 30 seconds left
case AU_TIMER_30:
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 3);
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 3, 1);
break;
// time 20 seconds left
case AU_TIMER_20:
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 2);
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 2, 1);
break;
// time 10 seconds left
case AU_TIMER_10:
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 0);
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 1, 1);
break;
// time <3 seconds left
case AU_TIMER_LT3:
playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 0);
playNow(BEEP_DEFAULT_FREQ, 20, 25, 1, 1);
break;
case AU_FRSKY_WARN1:
playASAP(BEEP_DEFAULT_FREQ+20,15,5,2);
playASAP(BEEP_DEFAULT_FREQ+20,15,5,2,1);
break;
case AU_FRSKY_WARN2:
playASAP(BEEP_DEFAULT_FREQ+30,15,5,2);
playASAP(BEEP_DEFAULT_FREQ+30,15,5,2,1);
break;
case AU_FRSKY_CHEEP:
playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,2);
playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,1,2);
break;
case AU_FRSKY_RING:
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10);
playASAP(BEEP_DEFAULT_FREQ+25,5,10,1);
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10);
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10,1);
playASAP(BEEP_DEFAULT_FREQ+25,5,10,1,1);
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10,1);
break;
case AU_FRSKY_SCIFI:
playASAP(80,10,3,2,-1);
playASAP(60,10,3,2,1);
playASAP(70,10,1,0);
playASAP(80,10,3,2,0,-1);
playASAP(60,10,3,2,0,1);
playASAP(70,10,1,0,2);
break;
case AU_FRSKY_ROBOT:
playASAP(70,5,1,1);
playASAP(50,15,2,1);
playASAP(80,15,2,1);
playASAP(70,5,1,1,1);
playASAP(50,15,2,1,1);
playASAP(80,15,2,1,1);
break;
case AU_FRSKY_CHIRP:
playASAP(BEEP_DEFAULT_FREQ+40,5,1,2);
playASAP(BEEP_DEFAULT_FREQ+54,5,1,3);
playASAP(BEEP_DEFAULT_FREQ+40,5,1,2,1);
playASAP(BEEP_DEFAULT_FREQ+54,5,1,3,1);
break;
case AU_FRSKY_TADA:
playASAP(50,5,5);
@ -295,25 +335,40 @@ void audioQueue::event(uint8_t e, uint8_t f)
playASAP(110,3,4,2);
break;
case AU_FRSKY_CRICKET:
playASAP(80,5,10,3);
playASAP(80,5,20,1);
playASAP(80,5,10,3);
playASAP(80,5,10,3,1);
playASAP(80,5,20,1,1);
playASAP(80,5,10,3,1);
break;
case AU_FRSKY_SIREN:
playASAP(10,20,5,2,1);
playASAP(10,20,5,2,1,1);
break;
case AU_FRSKY_ALARMC:
playASAP(50,4,10,2);
playASAP(70,8,20,1);
playASAP(50,8,10,2);
playASAP(70,4,20,1);
playASAP(50,4,10,2,1);
playASAP(70,8,20,1,1);
playASAP(50,8,10,2,1);
playASAP(70,4,20,1,1);
break;
case AU_FRSKY_RATATA:
playASAP(BEEP_DEFAULT_FREQ+50,5,10,10);
playASAP(BEEP_DEFAULT_FREQ+50,5,10,10,1);
break;
case AU_FRSKY_TICK:
playASAP(BEEP_DEFAULT_FREQ+50,5,50,2);
playASAP(BEEP_DEFAULT_FREQ+50,5,50,2,1);
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:
break;
}
@ -322,8 +377,5 @@ void audioQueue::event(uint8_t e, uint8_t f)
void audioDefevent(uint8_t e)
{
#ifdef HAPTIC
hapticAudioEvent(e); //do this before audio to help sync timings
#endif
audio.event(e, BEEP_DEFAULT_FREQ);
}

View file

@ -86,6 +86,11 @@ enum AUDIO_SOUNDS {
AU_FRSKY_ALARMC,
AU_FRSKY_RATATA,
AU_FRSKY_TICK,
#ifdef HAPTIC
AU_FRSKY_HAPTIC1,
AU_FRSKY_HAPTIC2,
AU_FRSKY_HAPTIC3,
#endif
AU_FRSKY_LAST,
};
@ -97,13 +102,9 @@ class audioQueue
// only difference between these two functions is that one does the
// 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, int8_t tFreqIncr=0);
void playNow(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);
#if defined(VARIO_EXTENDED)
void playVario(uint8_t tFreq, uint8_t tLen);
#endif
void playASAP(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0, uint8_t tHaptic=0, int8_t tFreqIncr=0);
inline bool busy() { return (toneTimeLeft > 0); }
@ -176,6 +177,13 @@ class audioQueue
uint8_t queueTonePause[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)
uint8_t toneCounter;
#endif
@ -186,6 +194,8 @@ extern audioQueue audio;
void audioDefevent(uint8_t e);
#define HAPTIC_SPINUP (10);
#define AUDIO_KEYPAD_UP() audioDefevent(AU_KEYPAD_UP)
#define AUDIO_KEYPAD_DOWN() audioDefevent(AU_KEYPAD_DOWN)
#define AUDIO_MENUS() audioDefevent(AU_MENUS)

View file

@ -39,6 +39,9 @@ uint8_t beepAgainOrig = 0;
uint8_t beepOn = false;
bool warble = false;
bool warbleC;
#if defined(HAPTIC)
uint8_t hapticTick = 0;
#endif
// The various "beep" tone lengths
static const pm_uint8_t beepTab[] PROGMEM = {
@ -57,7 +60,4 @@ void beep(uint8_t val)
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));
}
#ifdef HAPTIC
hapticBeepEvent(val);
#endif
}

View file

@ -40,6 +40,9 @@ extern uint8_t beepAgainOrig;
extern uint8_t beepOn;
extern bool warble;
extern bool warbleC;
#if defined(HAPTIC)
extern uint8_t hapticTick;
#endif
#if defined(PCBARM)
#include "ersky9x/sound.h"
@ -107,9 +110,19 @@ FORCEINLINE void AUDIO_HEARTBEAT()
BUZZER_OFF;
else
BUZZER_ON;
#if defined(HAPTIC)
if (hapticTick-- > 0) {
HAPTIC_ON; // haptic output 'high'
}
else {
HAPTIC_OFF; // haptic output 'low'
hapticTick = g_eeGeneral.hapticStrength;
}
#endif
}
else {
BUZZER_OFF;
HAPTIC_OFF;
}
}
#endif

View file

@ -144,7 +144,8 @@ ISR(USART2_RX_vect)
if((res & 0x100) == 0x100){
vpotToChange = res & 0xff;
vpot_mod_state = 1;
}else{
}
else {
if(vpot_mod_state & (vpotToChange>0) & (vpotToChange<=NUM_EXTRA_ROTARY_ENCODERS))
{
int8_t vpot_inc = res & 0xff;

View file

@ -241,48 +241,7 @@ void parseTelemHubByte(uint8_t byte)
if (frskyHubData.temperature2 > frskyHubData.maxTemperature2)
frskyHubData.maxTemperature2 = frskyHubData.temperature2;
break;
#if defined(VARIO_EXTENDED)
case offsetof(FrskyHubData, baroAltitude_bp):
case offsetof(FrskyHubData, baroAltitude_ap):
if((!g_model.frsky.use_baroAltitude_ap & (offsetof(FrskyHubData, baroAltitude_bp) == (uint8_t)structPos)) |
(g_model.frsky.use_baroAltitude_ap & (offsetof(FrskyHubData, baroAltitude_ap) == (uint8_t)structPos))){
//here is baro altitude suggested 0.01m accuracy, i.e. baroAltitude_ap in range [0:99]
if(g_model.frsky.use_baroAltitude_ap){
uint16_t alt_sign = frskyHubData.baroAltitude_bp/abs(frskyHubData.baroAltitude_bp);
frskyHubData.baroAltitude_full = frskyHubData.baroAltitude_bp*100 + frskyHubData.baroAltitude_ap*alt_sign;
}else{
frskyHubData.baroAltitude_full = frskyHubData.baroAltitude_bp;
}
if(++frskyHubData.queuePointer>=5)
frskyHubData.queuePointer = 0;
frskyHubData.baroAltitudeQueue_Acc[frskyHubData.queuePointer] =
frskyHubData.baroAltitude_full - frskyHubData.baroAltitude_full_prev;
frskyHubData.baroAltitude_full_prev = frskyHubData.baroAltitude_full;
frskyHubData.varioSpeed = 0;
for(uint8_t vi=0; vi<5; vi++){
frskyHubData.varioSpeed += frskyHubData.baroAltitudeQueue_Acc[vi];
}
// First received barometer altitude => Altitude offset
if (!frskyHubData.baroAltitudeOffset)
frskyHubData.baroAltitudeOffset = -frskyHubData.baroAltitude_bp;
frskyHubData.baroAltitude_bp += frskyHubData.baroAltitudeOffset;
if(g_model.frsky.use_baroAltitude_only){
frskyHubData.Altitude_show = frskyHubData.gpsAltitude_bp;
if (frskyHubData.baroAltitude_bp > frskyHubData.maxAltitude)
frskyHubData.maxAltitude = frskyHubData.baroAltitude_bp;
if (frskyHubData.baroAltitude_bp < frskyHubData.minAltitude)
frskyHubData.minAltitude = frskyHubData.baroAltitude_bp;
}
}
break;
#else
case offsetof(FrskyHubData, baroAltitude_bp):
// First received barometer altitude => Altitude offset
if (!frskyHubData.baroAltitudeOffset)
@ -309,35 +268,7 @@ void parseTelemHubByte(uint8_t byte)
frskyHubData.lastBaroAltitude_bp = frskyHubData.baroAltitude_bp;
}
break;
#endif
#if defined(VARIO_EXTENDED)
case offsetof(FrskyHubData, gpsAltitude_ap):
if(g_model.frsky.use_baroAltitude_ap){
frskyHubData.gpsAltitude_full = frskyHubData.gpsAltitude_bp*100;
} else {
frskyHubData.gpsAltitude_full = frskyHubData.gpsAltitude_bp;
}
if (!frskyHubData.gpsAltitudeOffset)
frskyHubData.gpsAltitudeOffset = -frskyHubData.gpsAltitude_bp;
frskyHubData.gpsAltitude_bp += frskyHubData.gpsAltitudeOffset;
if(!g_model.frsky.use_baroAltitude_only){
frskyHubData.Altitude_show = frskyHubData.gpsAltitude_bp;
if (frskyHubData.gpsAltitude_bp > frskyHubData.maxAltitude)
frskyHubData.maxAltitude = frskyHubData.gpsAltitude_bp;
if (frskyHubData.gpsAltitude_bp < frskyHubData.minAltitude)
frskyHubData.minAltitude = frskyHubData.gpsAltitude_bp;
}
if (!frskyHubData.pilotLatitude && !frskyHubData.pilotLongitude) {
// First received GPS position => Pilot GPS position
getGpsPilotPosition();
}
else if (frskyHubData.gpsDistNeeded || g_menuStack[0] == menuProcFrsky) {
getGpsDistance();
}
break;
#else
case offsetof(FrskyHubData, gpsAltitude_ap):
if (!frskyHubData.gpsAltitudeOffset)
frskyHubData.gpsAltitudeOffset = -frskyHubData.gpsAltitude_bp;
@ -355,7 +286,7 @@ void parseTelemHubByte(uint8_t byte)
getGpsDistance();
}
break;
#endif
case offsetof(FrskyHubData, gpsSpeed_bp):
// Speed => Max speed
if (frskyHubData.gpsSpeed_bp < frskyHubData.maxGpsSpeed)
@ -694,37 +625,8 @@ void check_frsky()
if (isFunctionActive(FUNC_VARIO)) {
#if defined(AUDIO)
#if defined(VARIO_EXTENDED)
#define VARIO_SPEED_LIMIT 10 //m/s
int16_t verticalSpeed = 0;
//vertical speed in 0.01m/s now
if(g_model.frsky.use_baroAltitude_ap)//means if additional data enabled then _ap unit is 0.01
verticalSpeed = limit((int16_t)(-VARIO_SPEED_LIMIT*100), (int16_t)frskyHubData.varioSpeed, (int16_t)(+VARIO_SPEED_LIMIT*100));
else
verticalSpeed = limit((int16_t)-VARIO_SPEED_LIMIT, (int16_t)(frskyHubData.varioSpeed), (int16_t)+VARIO_SPEED_LIMIT)*100;
uint8_t SoundAltBeepNextFreq = (0);
uint8_t SoundAltBeepNextTime = (0);
if(verticalSpeed < g_model.varioSpeedUpMin*VARIO_LIM_MUL && verticalSpeed > g_model.varioSpeedDownMin*(-VARIO_LIM_MUL)) //check thresholds here in cm/s
{
SoundAltBeepNextFreq = (0);
SoundAltBeepNextTime = (0);
}else{
SoundAltBeepNextFreq = (((((int32_t)verticalSpeed * 84) + 125000)/10)/10)/20;//;150000)/10)/10)/20;
SoundAltBeepNextTime = ((1600 - verticalSpeed) / 100);
if(verticalSpeed > 0){
if ((int16_t)(g_tmr10ms - s_varioTmr) > (int16_t)(SoundAltBeepNextTime*2)) {
s_varioTmr = g_tmr10ms;
audio.playVario(SoundAltBeepNextFreq, SoundAltBeepNextTime);
}
} else {//negative vertical speed gives sound without pauses
audio.playVario(SoundAltBeepNextFreq, 1);
}
}
#else //VARIO_EXTENDED
uint8_t warble = 0;
#endif
int8_t verticalSpeed = limit((int16_t)-100, (int16_t)(frskyHubData.varioSpeed/10), (int16_t)+100);
uint16_t interval;
@ -745,11 +647,8 @@ void check_frsky()
else
AUDIO_VARIO_UP();
}
#endif //VARIO_EXTENDED
#endif //AUDIO
#endif //FRSKY_HUB || WS_HOW_HIGH
}
#endif
}
bool FRSKY_alarmRaised(uint8_t idx)
@ -896,9 +795,7 @@ void resetTelemetry()
frskyHubData.cellsCount = 6;
frskyHubData.gpsAltitude_bp = 50;
frskyHubData.gpsAltitude_full = 5000;
frskyHubData.baroAltitude_bp = 50;
frskyHubData.baroAltitude_full = 5000;
frskyHubData.minAltitude = 10;
frskyHubData.maxAltitude = 500;
@ -1177,15 +1074,7 @@ void menuProcFrsky(uint8_t event)
putsTime(x, 1+FH+2*FH*i, value, att, att);
}
else {
#if defined(VARIO_EXTENDED)
if(g_model.frsky.use_baroAltitude_ap & (field == TELEM_VSPD)){
putsTelemetryChannel(j ? 128 : 63, i==3 ? 1+7*FH : 1+2*FH+2*FH*i, field-1, value, att|PREC2);
}
else
#endif
{
putsTelemetryChannel(j ? 128 : 63, i==3 ? 1+7*FH : 1+2*FH+2*FH*i, field-1, value, att);
}
lcd_putsiAtt(j*65, 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0);
}
}

View file

@ -109,18 +109,10 @@ PACK(struct FrskyHubData {
uint8_t cellsCount:4; // 4bits out of 16bits spare reused
uint8_t minCellVolts; // 8bits out of 16bits spare reused
uint16_t current; // 0x28 Current
#if defined(VARIO_EXTENDED)
int8_t spare2[10];
#else
int8_t varioQueue[10]; // circular-buffer
#endif
uint8_t queuePointer; // circular-buffer pointer
int8_t spare3;
#if defined(VARIO_EXTENDED)
int16_t spare4;
#else
int8_t spare2;
int16_t lastBaroAltitude_bp;
#endif
int16_t varioSpeed;
/* next fields must keep this order! */
int16_t minAltitude;
@ -131,25 +123,15 @@ PACK(struct FrskyHubData {
uint16_t maxGpsSpeed;
uint16_t maxGpsDistance;
/* end */
#if defined(VARIO_EXTENDED)
int16_t Altitude_show;
int16_t spare5;
#else
int16_t varioAcc1;
int16_t varioAcc2;
#endif
uint16_t volts_bp; // 0x3A
uint16_t volts_ap; // 0x3B
// end of FrSky Hub data
uint16_t gpsDistance;
int16_t gpsAltitudeOffset;
uint8_t minCellMinVolts;
#if defined(VARIO_EXTENDED)
int32_t baroAltitude_full;
int32_t gpsAltitude_full;
int32_t baroAltitude_full_prev;
int16_t baroAltitudeQueue_Acc[5];
#endif
});
#elif defined(WS_HOW_HIGH)

View file

@ -98,7 +98,6 @@ enum menuProcSetupItems {
#ifdef HAPTIC
ITEM_SETUP_HAPTIC_MODE,
ITEM_SETUP_HAPTIC_STRENGTH,
ITEM_SETUP_HAPTIC_LENGTH,
#endif
#ifdef SPLASH
ITEM_SETUP_SPLASH,
@ -119,7 +118,7 @@ void menuProcSetup(uint8_t event)
#define AUDIO_ZEROS
#endif
#ifdef HAPTIC
#define HAPTIC_ZEROS 0, 0, 0,
#define HAPTIC_ZEROS 0, 0,
#else
#define HAPTIC_ZEROS
#endif
@ -198,14 +197,6 @@ void menuProcSetup(uint8_t event)
}
if((y+=FH)>7*FH) return;
}subN++;
if(s_pgOfs<subN) {
lcd_putsLeft( y, STR_HAPTICLENGTH);
lcd_putsiAtt(GENERAL_PARAM_OFS, 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
#if defined(PCBARM)

View file

@ -1,150 +0,0 @@
/*
* Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "open9x.h"
hapticQueue::hapticQueue()
{
buzzTimeLeft = 0;
buzzPause = 0;
t_queueRidx = 0;
t_queueWidx = 0;
hapticTick = 0;
}
void hapticQueue::heartbeat()
{
#if defined(SIMU)
return;
#endif
#if defined(PCBARM)
if (buzzTimeLeft > 0) {
buzzTimeLeft--; //time gets counted down
hapticOn((g_eeGeneral.hapticStrength * 2) * 10);
}
else {
hapticOff();
if (buzzPause > 0) {
buzzPause--;
}
else if (t_queueRidx != t_queueWidx) {
buzzTimeLeft = queueHapticLength[t_queueRidx];
buzzPause = queueHapticPause[t_queueRidx];
if (!queueHapticRepeat[t_queueRidx]--) {
t_queueRidx = (t_queueRidx + 1) % HAPTIC_QUEUE_LENGTH;
}
}
}
#else
if (buzzTimeLeft > 0) {
buzzTimeLeft--; // time gets counted down
if (hapticTick-- > 0) {
HAPTIC_ON; // haptic output 'high'
}
else {
HAPTIC_OFF; // haptic output 'high'
hapticTick = g_eeGeneral.hapticStrength;
}
}
else {
HAPTIC_OFF; // haptic output 'high'
if (buzzPause > 0) {
buzzPause--;
}
else if (t_queueRidx != t_queueWidx) {
buzzTimeLeft = queueHapticLength[t_queueRidx];
buzzPause = queueHapticPause[t_queueRidx];
if (!queueHapticRepeat[t_queueRidx]--) {
t_queueRidx = (t_queueRidx + 1) % HAPTIC_QUEUE_LENGTH;
}
}
}
#endif
}
inline uint8_t hapticQueue::getHapticLength(uint8_t tLen)
{
return ((g_eeGeneral.hapticLength * 2) + tLen) * 2;
}
void hapticQueue::playNow(uint8_t tLen, uint8_t tPause, uint8_t tRepeat)
{
buzzTimeLeft = getHapticLength(tLen);
buzzPause = tPause;
t_queueWidx = t_queueRidx;
if (tRepeat) {
playASAP(tLen, tPause, tRepeat-1);
}
}
void hapticQueue::playASAP(uint8_t tLen, uint8_t tPause, uint8_t tRepeat)
{
uint8_t next_queueWidx = (t_queueWidx + 1) % HAPTIC_QUEUE_LENGTH;
if (next_queueWidx != t_queueRidx) {
queueHapticLength[t_queueWidx] = getHapticLength(tLen);
queueHapticPause[t_queueWidx] = tPause;
queueHapticRepeat[t_queueWidx] = tRepeat-1;
t_queueWidx = next_queueWidx;
}
}
void hapticQueue::event(uint8_t e)
{
switch (e) {
case 0: // very little buzz for keys / trims
playNow(5, 0, 0);
break;
case 1: // one buzz
playASAP(10,2,1);
break;
case 2: // two buzz
playASAP(10,2,2);
break;
case 3: // three buzz
playASAP(10,2,3);
break;
default:
break;
}
}
void hapticDefevent(uint8_t e)
{
haptic.event(e);
}

View file

@ -1,126 +0,0 @@
/*
* Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef haptic_h
#define haptic_h
#define HAPTIC_QUEUE_LENGTH 3
class hapticQueue
{
public:
hapticQueue();
// only difference between these two functions is that one does the
// interupt queue (Now) and the other queues for playing ASAP.
void playNow(uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0);
void playASAP(uint8_t tLen, uint8_t tPause, uint8_t tRepeat=0);
inline bool busy() { return (buzzTimeLeft > 0); }
void event(uint8_t e);
// heartbeat is responsibile for issueing the haptic buzzs and general square waves
// it is essentially the life of the class.
void heartbeat();
// bool freeslots(uint8_t slots);
inline bool empty() {
return (t_queueRidx == t_queueWidx);
}
protected:
inline uint8_t getHapticLength(uint8_t tLen);
private:
uint8_t t_queueRidx;
uint8_t t_queueWidx;
uint8_t buzzTimeLeft;
uint8_t buzzPause;
uint8_t hapticTick;
// queue arrays
uint8_t queueHapticLength[HAPTIC_QUEUE_LENGTH];
uint8_t queueHapticPause[HAPTIC_QUEUE_LENGTH];
uint8_t queueHapticRepeat[HAPTIC_QUEUE_LENGTH];
};
//wrapper function - dirty but results in a space saving!!!
extern hapticQueue haptic;
void hapticDefevent(uint8_t e);
#define IS_HAPTIC_BUSY() haptic.busy()
#define HAPTIC_HEARTBEAT() haptic.heartbeat()
#ifdef AUDIO
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);
else if (g_eeGeneral.hapticMode>0)
hapticDefevent(0);
}
#else
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)
hapticDefevent(0);
}
#endif
#endif // haptic_h

View file

@ -1967,12 +1967,6 @@ void menuProcFunctionSwitches(uint8_t event)
break;
#endif
}
#if defined(HAPTIC)
else if (sd->func == FUNC_HAPTIC) {
val_max = 3;
lcd_outdezAtt(21*FW, y, val_displayed, attr);
}
#endif
#if defined(SOMO)
else if (sd->func == FUNC_PLAY_SOMO) {
lcd_outdezAtt(21*FW, y, val_displayed, attr);
@ -2009,12 +2003,8 @@ void menuProcFunctionSwitches(uint8_t event)
#define TELEM_COL2 (9*FW+2)
void menuProcTelemetry(uint8_t event)
{
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)// v v v v 4 new menu items for baro alt/vario
#if defined(VARIO_EXTENDED)
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 32, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, (uint8_t)-1, 0, 0, (uint8_t)-1, 0, 0, 0, 0, (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2});
#else
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 27, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, (uint8_t)-1, 0, 0, (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2});
#endif
#else
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 24, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2});
#endif
@ -2162,49 +2152,6 @@ void menuProcTelemetry(uint8_t event)
CHECK_INCDEC_MODELVAR(event, g_model.frsky.blades, 0, 2);
}
subN++;
#if defined(VARIO_EXTENDED)
if(s_pgOfs<subN) {
y = (subN-s_pgOfs)*FH;
lcd_putsLeft(y, STR_BARO_VARIO);
}
subN++;
if(s_pgOfs<subN) {//setup baro altimeter after point data to be used
y = (subN-s_pgOfs)*FH;
lcd_puts(4, y, STR_BARO_PR);
menu_lcd_onoff( TELEM_COL2, y, g_model.frsky.use_baroAltitude_ap, sub==subN ) ;
if (sub==subN)
CHECK_INCDEC_MODELVAR(event, g_model.frsky.use_baroAltitude_ap, 0, 1);
}
subN++;
if(s_pgOfs<subN) {//use barometer altitude only if ON and use GPS altitude if OFF
y = (subN-s_pgOfs)*FH;
lcd_puts(4, y, STR_BARO_ONLY);
menu_lcd_onoff( TELEM_COL2, y, g_model.frsky.use_baroAltitude_only, sub==subN ) ;
if (sub==subN)
CHECK_INCDEC_MODELVAR(event, g_model.frsky.use_baroAltitude_only, 0, 1);
}
subN++;
if(s_pgOfs<subN) {
y = (subN-s_pgOfs)*FH;
lcd_puts(4, y, STR_BARO_UP_LIM);
lcd_outdezAtt(TELEM_COL2+FWNUM+2*FW, y, VARIO_LIM_MUL*g_model.varioSpeedUpMin, (sub==subN ? INVERS : 0)|PREC2);//TODO: EDIT DECIMALS HERE
if (sub==subN)
CHECK_INCDEC_MODELVAR(event, g_model.varioSpeedUpMin, 0, 15);
}
subN++;
if(s_pgOfs<subN) {
y = (subN-s_pgOfs)*FH;
lcd_puts(4, y, STR_BARO_DWN_LIM);
lcd_outdezAtt(TELEM_COL2+FWNUM+2*FW, y, VARIO_LIM_MUL*g_model.varioSpeedDownMin, (sub==subN ? INVERS : 0)|PREC2);//TODO: EDIT DECIMALS HERE
if (sub==subN)
CHECK_INCDEC_MODELVAR(event, g_model.varioSpeedDownMin, 0, 15);
}
subN++;
#endif //VARIO_EXTENDED
#endif
// Display

View file

@ -251,18 +251,15 @@ enum Functions {
FUNC_TRAINER_THR,
FUNC_TRAINER_AIL,
FUNC_INSTANT_TRIM,
FUNC_RESET,
FUNC_PLAY_SOUND,
#ifdef HAPTIC
FUNC_HAPTIC,
#endif
#ifdef SOMO
FUNC_PLAY_SOMO,
#endif
FUNC_RESET,
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
FUNC_VARIO,
#endif
#ifdef SDCARD
#ifdef LOGS
FUNC_LOGS,
#endif
#ifdef DEBUG
@ -347,25 +344,18 @@ PACK(typedef struct t_FrSkyBarData {
uint16_t barMax:6; // ditto for max display (would usually = ratio)
}) FrSkyBarData;
enum FrskyUsrProtocols {//probably to add x3mfly protocol here
enum FrskyUsrProtocols {
PROTO_NONE,
PROTO_FRSKY_HUB,
PROTO_WS_HOW_HIGH
};
#define VARIO_LIM_MUL 20 //to get 0.2m steps
PACK(typedef struct t_FrSkyData {
FrSkyChannelData channels[2];
uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t imperial:1;
uint8_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades
#if defined(VARIO_EXTENDED)
uint8_t use_baroAltitude_ap:1;//used 2 spare bits here
uint8_t use_baroAltitude_only:1;
#else
uint8_t spare:2;
#endif
FrSkyBarData bars[4];
FrSkyRSSIAlarm rssiAlarms[2];
}) FrSkyData;
@ -515,11 +505,6 @@ PACK(typedef struct t_ModelData {
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[NUM_CHNOUT];
#if defined(VARIO_EXTENDED)
//TODO:temporary place, need to move to frskydata
uint8_t varioSpeedUpMin:4; //if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin:4; //too small but enough in most cases
#endif //VARIO_EXTENDED
}) ModelData;
extern EEGeneral g_eeGeneral;

View file

@ -148,13 +148,6 @@ const pm_char STR_BAR[] PROGMEM = TR_BAR;
const pm_char STR_ALARM[] PROGMEM = TR_ALARM;
const pm_char STR_USRDATA[] PROGMEM = TR_USRDATA;
const pm_char STR_BLADES[] PROGMEM = TR_BLADES; // TODO check that it is optimized away when no FRSKY
#ifdef VARIO_EXTENDED
const pm_char STR_BARO_VARIO[] PROGMEM = TR_BARO_VARIO;
const pm_char STR_BARO_PR[] PROGMEM = TR_BARO_PR;
const pm_char STR_BARO_ONLY[] PROGMEM = TR_BARO_ONLY;
const pm_char STR_BARO_UP_LIM[] PROGMEM = TR_BARO_UP_LIM;
const pm_char STR_BARO_DWN_LIM[] PROGMEM = TR_BARO_DWN_LIM;
#endif //VARIO_EXTENDED
const pm_char STR_BARS[] PROGMEM = TR_BARS;
const pm_char STR_DISPLAY[] PROGMEM = TR_DISPLAY;
const pm_char STR_BEEPERMODE[] PROGMEM = TR_BEEPERMODE;

View file

@ -235,11 +235,6 @@ extern const pm_char STR_BAR[];
extern const pm_char STR_ALARM[];
extern const pm_char STR_USRDATA[];
extern const pm_char STR_BLADES[];
extern const pm_char STR_BARO_VARIO[];
extern const pm_char STR_BARO_PR[];
extern const pm_char STR_BARO_ONLY[];
extern const pm_char STR_BARO_UP_LIM[];
extern const pm_char STR_BARO_DWN_LIM[];
extern const pm_char STR_BARS[];
extern const pm_char STR_DISPLAY[];
extern const pm_char STR_BEEPERMODE[];

View file

@ -63,10 +63,6 @@ uint16_t g_time_per10;
audioQueue audio;
#endif
#ifdef HAPTIC
hapticQueue haptic;
#endif
uint8_t heartbeat;
uint8_t stickMode;
@ -423,12 +419,8 @@ int16_t getValue(uint8_t i)
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_RSSI_TX) return frskyRSSI[1].value;
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_RSSI_RX) return frskyRSSI[0].value;
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
#if defined(VARIO_EXTENDED)
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_ALT) return frskyHubData.Altitude_show;
#else //VARIO_EXTENDED
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_ALT) return frskyHubData.baroAltitude_bp;
#endif //VARIO_EXTENDED
#endif //FRSKY_HUB || WS_HOW_HIGH
#endif
#if defined(FRSKY_HUB)
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_RPM) return frskyHubData.rpm;
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_FUEL) return frskyHubData.fuelLevel;
@ -445,7 +437,7 @@ int16_t getValue(uint8_t i)
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_MIN_A1) return frskyTelemetry[0].min;
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_MIN_A2) return frskyTelemetry[1].min;
else if(i<CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_MAX_DIST) return *(((int16_t*)(&frskyHubData.minAltitude))+i-(CSW_CHOUT_BASE+NUM_CHNOUT+TELEM_MIN_ALT-1));
#endif //FRSKY_HUB
#endif
#endif
else return 0;
}
@ -1389,13 +1381,6 @@ void evalFunctions()
beep(3);
#endif
}
#if defined(HAPTIC)
if (sd->func == FUNC_HAPTIC) {
hapticDefevent(sd->param);
}
#endif
active_functions |= mask;
}
else {
@ -2053,7 +2038,6 @@ void perMain()
#if defined(PCBARM)
AUDIO_HEARTBEAT(); // the queue processing
HAPTIC_HEARTBEAT();
#endif
}
@ -2124,10 +2108,6 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
AUDIO_HEARTBEAT();
#ifdef HAPTIC
HAPTIC_HEARTBEAT();
#endif
#ifdef DEBUG
// Record start time from TCNT1 to record excution time
cli();

View file

@ -818,10 +818,6 @@ extern uint16_t jeti_keys;
#include "beeper.h"
#endif
#if defined(HAPTIC)
#include "haptic.h"
#endif
#if defined(SDCARD)
#include "logs.h"
#endif

View file

@ -210,7 +210,7 @@ FORCEINLINE void setupPulsesPPM()
uint16_t rest = 22500u*2-q; //Minimum Framelen=22.5 ms
rest += (int16_t(g_model.ppmFrameLength))*1000;
for (uint8_t i=0; i<p; i++) {
#ifdef PPM_LIMITS_UNIT_US
#ifdef PPM_CENTER_ADJUSTABLE
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);
#else
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*PPM_CENTER;
@ -821,7 +821,7 @@ void setupPulsesPPM16()
uint16_t rest=22500u*2-q; //Minimum Framelen=22.5 ms
rest += (int16_t(g_model.ppmFrameLength))*1000;
for (uint8_t i=p-8; i<p; i++) { //NUM_CHNOUT
#ifdef PPM_LIMITS_UNIT_US
#ifdef PPM_CENTER_ADJUSTABLE
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);
#else
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*PPM_CENTER;

View file

@ -101,18 +101,13 @@
#else
#define TR_TEST
#endif
#ifdef HAPTIC
#define TR_HAPTIC "Haptic\0 "
#else
#define TR_HAPTIC
#endif
#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim " "Reset\0 " TR_SOUND TR_HAPTIC TR_SOMO TR_VARIO TR_SDCLOGGS TR_TEST
#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO "Reset\0 " TR_VARIO TR_SDCLOGGS TR_TEST
#define LEN_VFSWRESET "\006"
#define TR_VFSWRESET "Timer1""Timer2""All ""Telem."
#define LEN_FUNCSOUNDS "\006"
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick "
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3"
#define LEN_VTELEMCHNS "\004"
#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""Cell""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Acc\0""Time"
@ -236,13 +231,6 @@
#define TR_ALARM "Alarm"
#define TR_USRDATA "UsrData"
#define TR_BLADES "Blades"
#ifdef VARIO_EXTENDED
#define TR_BARO_VARIO "Baro Vario"
#define TR_BARO_PR "Use AP"
#define TR_BARO_ONLY "BaroOnly"
#define TR_BARO_UP_LIM "Up Lim"
#define TR_BARO_DWN_LIM "Down Lim"
#endif //VARIO_EXTENDED
#define TR_BARS "Bars"
#define TR_DISPLAY "Display"
#ifdef AUDIO

View file

@ -101,18 +101,13 @@
#else
#define TR_TEST
#endif
#ifdef HAPTIC
#define TR_HAPTIC "Haptic\0 "
#else
#define TR_HAPTIC
#endif
#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant " "Reset\0 " TR_SOUND TR_HAPTIC TR_SOMO TR_VARIO TR_SDCLOGGS TR_TEST
#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant " TR_SOUND TR_SOMO "Reset\0 " TR_VARIO TR_SDCLOGGS TR_TEST
#define LEN_VFSWRESET "\006"
#define TR_VFSWRESET "Timer1""Timer2""All ""Telem."
#define LEN_FUNCSOUNDS "\006"
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick "
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3"
#define LEN_VTELEMCHNS "\004"
#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""Cell""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Acc\0""Time"
@ -236,13 +231,6 @@
#define TR_ALARM "Alarme"
#define TR_USRDATA "UsrData"
#define TR_BLADES "Blades"
#ifdef VARIO_EXTENDED
#define TR_BARO_VARIO "Baro Vario"
#define TR_BARO_PR "Use AP"
#define TR_BARO_ONLY "BaroOnly"
#define TR_BARO_UP_LIM "Up Lim"
#define TR_BARO_DWN_LIM "Down Lim"
#endif //VARIO_EXTENDED
#define TR_BARS "Gauges"
#define TR_DISPLAY "Display"
#ifdef AUDIO

View file

@ -96,23 +96,18 @@
#else
#define TR_SOUND "Pip \0 "
#endif
#ifdef HAPTIC
#define TR_HAPTIC "Haptic\0 "
#else
#define TR_HAPTIC
#endif
#ifdef DEBUG
#define TR_TEST "Test\0 "
#else
#define TR_TEST
#endif
#define TR_VFSWFUNC "S\201kerhet \0 ""Trainer \0 ""Instant Trim " "Reset\0 " TR_SOUND TR_HAPTIC TR_SOMO TR_VARIO TR_SDCLOGGS TR_TEST
#define TR_VFSWFUNC "S\201kerhet \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO "Reset\0 " TR_VARIO TR_SDCLOGGS TR_TEST
#define LEN_VFSWRESET "\006"
#define TR_VFSWRESET "Timer1""Timer2""All ""Telem."
#define LEN_FUNCSOUNDS "\006"
#define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F\200r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick "
#define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F\200r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick ""Vibr1 ""Vibr2 ""Vibr3 "
#define LEN_VTELEMCHNS "\004"
#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Tank""T1\0 ""T2\0 ""Spd\0""Dist""Cell""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Acc\0""Tid\0"
@ -236,13 +231,6 @@
#define TR_ALARM "Alarm"
#define TR_USRDATA "Anv\201ndardata"
#define TR_BLADES "Blad"
#ifdef VARIO_EXTENDED
#define TR_BARO_VARIO "Baro Vario"
#define TR_BARO_PR "Use AP"
#define TR_BARO_ONLY "BaroOnly"
#define TR_BARO_UP_LIM "Up Lim"
#define TR_BARO_DWN_LIM "Down Lim"
#endif //VARIO_EXTENDED
#define TR_BARS "Staplar som visas"
#define TR_DISPLAY "Display"
#ifdef AUDIO