1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Issue 19 solved

Revert the last Haptic changes (was unfinished, no more spare time during the week-end, sorry!)
Revert my last modification on main views (offset not displayed in Bar Graphs, I was wrong)
PPM Center now configurable for each servo
No mean on the Batt voltage when in the calibration menu to have a faster response when calibrating
SD card Backup / Restore Models feature started
Some french translations fixed
This commit is contained in:
bsongis 2012-04-14 11:32:40 +00:00
parent bedc673b98
commit 6bc2ddc3d4
26 changed files with 357 additions and 529 deletions

View file

@ -81,7 +81,7 @@ WS_HOW_HIGH = YES
# SDCARD Logs # SDCARD Logs
# Values = YES, NO # Values = YES, NO
LOGS = YES SDCARD = NO
# PXX (FrSky PCM) protocol # PXX (FrSky PCM) protocol
PXX = NO PXX = NO
@ -102,7 +102,7 @@ TRANSLATIONS = EN
# EEPROM_PROGRESS_BAR # EEPROM_PROGRESS_BAR
# Values = YES, NO # Values = YES, NO
EEPROM_PROGRESS_BAR = NO EEPROM_PROGRESS_BAR = NO
# Enable extra rotary encoders (V4 board only) # Enable extra rotary encoders (V4 board only)
# Values = YES, NO # Values = YES, NO
MOD_EXTRA_ROTARY_ENCODERS = NO MOD_EXTRA_ROTARY_ENCODERS = NO
@ -275,13 +275,11 @@ ifeq ($(PCB), ARM)
EXTRAINCDIRS += ersky9x EXTRAINCDIRS += ersky9x
BOARDSRC = board_ersky9x.cpp BOARDSRC = board_ersky9x.cpp
EXTRABOARDSRC = ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c EXTRABOARDSRC = ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c
# ersky9x/ff.c ersky9x/diskio_sam3s.c ersky9x/Media.c ersky9x/ccsbcs.c ersky9x/MEDSdcard.c # ersky9x/ff.c ersky9x/diskio_sam3s.c ersky9x/Media.c ersky9x/ccsbcs.c ersky9x/sdcard.c ersky9x/MEDSdcard.c
EEPROMSRC = eeprom_arm.cpp EEPROMSRC = eeprom_arm.cpp
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)
@ -293,20 +291,19 @@ 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
CPPSRC += gruvin9x/diskio.cpp CPPSRC += gruvin9x/diskio.cpp
ifeq ($(NAVIGATION), RE1) ifeq ($(NAVIGATION), RE1)
CPPDEFS += -DNAVIGATION_RE1 CPPDEFS += -DNAVIGATION_RE1
endif endif
ifeq ($(LOGS), YES) ifeq ($(SDCARD), YES)
CPPDEFS += -DSDCARD
CPPSRC += gruvin9x/logs.cpp CPPSRC += gruvin9x/logs.cpp
CPPDEFS += -DLOGS MODS:=${MODS}S
MODS:=${MODS}L
endif endif
ifeq ($(SOMO), YES) ifeq ($(SOMO), YES)
@ -335,12 +332,6 @@ 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 ###

View file

@ -41,6 +41,10 @@ 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
@ -67,10 +71,26 @@ 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)) {
tonePause = 0; //time gets counted down tonePause = 0; //time gets counted down
@ -82,6 +102,8 @@ 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;
} }
@ -99,10 +121,22 @@ 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--;
} }
@ -111,7 +145,9 @@ 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;
} }
@ -133,30 +169,38 @@ 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, 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 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, tFreqIncr); playASAP(tFreq, tLen, tPause, tRepeat-1, tHaptic, 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, int8_t tFreqIncr) uint8_t tRepeat, uint8_t tHaptic, 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;
@ -166,6 +210,9 @@ 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) {
@ -176,25 +223,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, 1); playASAP(60, 20, 3, 2, 0, 1);
playASAP(80, 20, 3, 2, -1); playASAP(80, 20, 3, 2, 1, -1);
} }
break; break;
// error // error
case AU_ERROR: case AU_ERROR:
playNow(BEEP_DEFAULT_FREQ, 40, 1, 0); playNow(BEEP_DEFAULT_FREQ, 40, 1, 0, 1);
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); playNow(BEEP_KEY_UP_FREQ, 10, 1, 0, 1);
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); playNow(BEEP_KEY_DOWN_FREQ, 10, 1, 0, 1);
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); playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
break; break;
// trim move // trim move
case AU_TRIM_MOVE: case AU_TRIM_MOVE:
@ -202,23 +249,19 @@ 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); playNow(BEEP_DEFAULT_FREQ, 10, 2, 0, 1);
hapticDefevent(1);
break; break;
// warning one // warning one
case AU_WARNING1: case AU_WARNING1:
playNow(BEEP_DEFAULT_FREQ, 10, 1, 0); playNow(BEEP_DEFAULT_FREQ, 10, 1, 0, 1);
hapticDefevent(1);
break; break;
// warning two // warning two
case AU_WARNING2: case AU_WARNING2:
playNow(BEEP_DEFAULT_FREQ, 20, 1, 0); playNow(BEEP_DEFAULT_FREQ, 20, 1, 0, 1);
hapticDefevent(1);
break; break;
// warning three // warning three
case AU_WARNING3: case AU_WARNING3:
playNow(BEEP_DEFAULT_FREQ, 30, 1, 0); playNow(BEEP_DEFAULT_FREQ, 30, 1, 0, 1);
hapticDefevent(1);
break; break;
// startup tune // startup tune
case AU_TADA: case AU_TADA:
@ -228,63 +271,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); playNow(BEEP_DEFAULT_FREQ + 50, 10, 1, 0, 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); playNow(BEEP_DEFAULT_FREQ + 50, 6, 0, 0, 1);
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); playNow(BEEP_DEFAULT_FREQ + 52, 6, 0, 0, 1);
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); playNow(BEEP_DEFAULT_FREQ + 54, 6, 0, 0, 1);
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); playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 3, 1);
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); playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 2, 1);
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); playNow(BEEP_DEFAULT_FREQ + 50, 15, 3, 1, 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); playNow(BEEP_DEFAULT_FREQ, 20, 25, 1, 1);
break; break;
case AU_FRSKY_WARN1: case AU_FRSKY_WARN1:
playASAP(BEEP_DEFAULT_FREQ+20,15,5,2); playASAP(BEEP_DEFAULT_FREQ+20,15,5,2,1);
break; break;
case AU_FRSKY_WARN2: case AU_FRSKY_WARN2:
playASAP(BEEP_DEFAULT_FREQ+30,15,5,2); playASAP(BEEP_DEFAULT_FREQ+30,15,5,2,1);
break; break;
case AU_FRSKY_CHEEP: case AU_FRSKY_CHEEP:
playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,2); playASAP(BEEP_DEFAULT_FREQ+30,10,2,2,1,2);
break; break;
case AU_FRSKY_RING: case AU_FRSKY_RING:
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); playASAP(BEEP_DEFAULT_FREQ+25,5,10,1,1);
playASAP(BEEP_DEFAULT_FREQ+25,5,2,10); playASAP(BEEP_DEFAULT_FREQ+25,5,2,10,1);
break; break;
case AU_FRSKY_SCIFI: case AU_FRSKY_SCIFI:
playASAP(80,10,3,2,-1); playASAP(80,10,3,2,0,-1);
playASAP(60,10,3,2,1); playASAP(60,10,3,2,0,1);
playASAP(70,10,1,0); playASAP(70,10,1,0,2);
break; break;
case AU_FRSKY_ROBOT: case AU_FRSKY_ROBOT:
playASAP(70,5,1,1); playASAP(70,5,1,1,1);
playASAP(50,15,2,1); playASAP(50,15,2,1,1);
playASAP(80,15,2,1); playASAP(80,15,2,1,1);
break; break;
case AU_FRSKY_CHIRP: case AU_FRSKY_CHIRP:
playASAP(BEEP_DEFAULT_FREQ+40,5,1,2); playASAP(BEEP_DEFAULT_FREQ+40,5,1,2,1);
playASAP(BEEP_DEFAULT_FREQ+54,5,1,3); playASAP(BEEP_DEFAULT_FREQ+54,5,1,3,1);
break; break;
case AU_FRSKY_TADA: case AU_FRSKY_TADA:
playASAP(50,5,5); playASAP(50,5,5);
@ -292,25 +335,40 @@ 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); playASAP(80,5,10,3,1);
playASAP(80,5,20,1); playASAP(80,5,20,1,1);
playASAP(80,5,10,3); playASAP(80,5,10,3,1);
break; break;
case AU_FRSKY_SIREN: case AU_FRSKY_SIREN:
playASAP(10,20,5,2,1); playASAP(10,20,5,2,1,1);
break; break;
case AU_FRSKY_ALARMC: case AU_FRSKY_ALARMC:
playASAP(50,4,10,2); playASAP(50,4,10,2,1);
playASAP(70,8,20,1); playASAP(70,8,20,1,1);
playASAP(50,8,10,2); playASAP(50,8,10,2,1);
playASAP(70,4,20,1); playASAP(70,4,20,1,1);
break; break;
case AU_FRSKY_RATATA: case AU_FRSKY_RATATA:
playASAP(BEEP_DEFAULT_FREQ+50,5,10,10); playASAP(BEEP_DEFAULT_FREQ+50,5,10,10,1);
break; break;
case AU_FRSKY_TICK: case AU_FRSKY_TICK:
playASAP(BEEP_DEFAULT_FREQ+50,5,50,2); playASAP(BEEP_DEFAULT_FREQ+50,5,50,2,1);
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;
} }

View file

@ -34,6 +34,12 @@
#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"
@ -87,6 +93,11 @@ 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,
}; };
@ -98,9 +109,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, 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); 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); } inline bool busy() { return (toneTimeLeft > 0); }
@ -173,7 +184,12 @@ 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;
@ -185,6 +201,8 @@ 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)

View file

@ -652,7 +652,6 @@ void configure_pins( uint32_t pins, uint16_t config )
} }
} }
void board_init() void board_init()
{ {
// register uint32_t goto_usb ; // register uint32_t goto_usb ;

View file

@ -1,3 +1,39 @@
/*
* 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 board_ersky9x_h
#define board_ersky9x_h
#ifdef REVA #ifdef REVA
#include "ersky9x/AT91SAM3S2.h" #include "ersky9x/AT91SAM3S2.h"
#else #else
@ -30,3 +66,5 @@ uint16_t getCurrent();
extern uint16_t Temperature ; // Raw temp reading extern uint16_t Temperature ; // Raw temp reading
extern uint16_t maxTemperature ; // Raw temp reading extern uint16_t maxTemperature ; // Raw temp reading
#endif

View file

@ -1,61 +0,0 @@
/****************************************************************************
* Copyright (c) 2011 by Michael Blandford. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
****************************************************************************
* History:
*
****************************************************************************/
#include "../open9x.h"
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
}

View file

@ -1,40 +0,0 @@
/****************************************************************************
* Copyright (c) 2011 by Michael Blandford. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
****************************************************************************
* History:
*
****************************************************************************/
extern void hapticOff(void) ;
extern void hapticOn( uint32_t pwmPercent ) ;

View file

@ -423,3 +423,27 @@ extern "C" void TWI0_IRQHandler()
} }
} }
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
}

View file

@ -55,6 +55,8 @@ 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 ) ;

View file

@ -84,7 +84,6 @@ enum menuProcSetupItems {
#ifdef HAPTIC #ifdef HAPTIC
ITEM_SETUP_HAPTIC_MODE, ITEM_SETUP_HAPTIC_MODE,
ITEM_SETUP_HAPTIC_STRENGTH, ITEM_SETUP_HAPTIC_STRENGTH,
ITEM_SETUP_HAPTIC_LENGTH,
#endif #endif
#ifdef SPLASH #ifdef SPLASH
ITEM_SETUP_SPLASH, ITEM_SETUP_SPLASH,
@ -108,7 +107,7 @@ void menuProcSetup(uint8_t event)
#define AUDIO_ZEROS #define AUDIO_ZEROS
#endif #endif
#ifdef HAPTIC #ifdef HAPTIC
#define HAPTIC_ZEROS 0, 0, 0, #define HAPTIC_ZEROS 0, 0,
#else #else
#define HAPTIC_ZEROS #define HAPTIC_ZEROS
#endif #endif
@ -195,14 +194,6 @@ 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, STR_HAPTICLENGTH); //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

View file

@ -1,171 +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;
}
#if 0
bool hapticQueue::freeslots(uint8_t slots)
{
return HAPTIC_QUEUE_LENGTH - ((t_queueWidx + HAPTIC_QUEUE_LENGTH - t_queueRidx) % HAPTIC_QUEUE_LENGTH) >= slots;
}
#endif
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 (buzzHaptic){
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 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,115 +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
#if defined(PCBARM)
#include "ersky9x/haptic.h"
#endif
//haptic
#define HAPTIC_QUEUE_LENGTH (8) //8 seems to suit most alerts
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;
// queue arrays
uint8_t queueHapticLength[HAPTIC_QUEUE_LENGTH];
uint8_t queueHapticPause[HAPTIC_QUEUE_LENGTH];
uint8_t queueHapticRepeat[HAPTIC_QUEUE_LENGTH];
uint8_t buzzHaptic;
uint8_t hapticTick;
#if defined(PCBSTD)
uint8_t buzzCounter;
#endif
};
//wrapper function - dirty but results in a space saving!!!
extern hapticQueue haptic;
void hapticDefevent(uint8_t e);
#define HAPTIC_SPINUP (10);
#define IS_HAPTIC_BUSY() haptic.busy()
#define HAPTIC_HEARTBEAT() haptic.heartbeat()
#endif // haptic_h

View file

@ -239,8 +239,8 @@ void menuMainView(uint8_t event)
for(uint8_t i=0; i<8; i++) for(uint8_t i=0; i<8; i++)
{ {
uint8_t x0,y0; uint8_t x0,y0;
int16_t val = ex_chans[i]; int16_t val = g_chans512[i];
//val += g_model.limitData[i].revert ? g_model.limitData[i].offset : -g_model.limitData[i].offset;
switch(view_base) switch(view_base)
{ {
case e_outputValues: case e_outputValues:

View file

@ -527,6 +527,46 @@ void displayConfirmation(uint8_t event)
} }
} }
#if defined(SDCARD)
const pm_char * s_menu[MENU_MAX_LINES] = { 0, 0, 0, 0 };
uint8_t s_menu_item = 0;
uint8_t s_menu_count = 0;
const pm_char * displayMenu(uint8_t event)
{
const pm_char * result = NULL;
lcd_filled_rect(10, 16, 108, s_menu_count * (FH+1) + 2, SOLID, WHITE);
lcd_rect(10, 16, 108, s_menu_count * (FH+1) + 2);
for (uint8_t i=0; i<s_menu_count; i++) {
lcd_puts(16, i*(FH+1) + 2*FH + 2, s_menu[i]);
if (i == s_menu_item) lcd_filled_rect(11, i*(FH+1) + 2*FH + 1, 106, 9);
}
switch(event) {
case EVT_KEY_FIRST(KEY_UP):
if (s_menu_item > 0) s_menu_item--;
break;
case EVT_KEY_FIRST(KEY_DOWN):
if (s_menu_item < s_menu_count - 1) s_menu_item++;
break;
case EVT_KEY_FIRST(KEY_EXIT):
killEvents(event);
s_menu_item = 0;
s_menu_count = 0;
break;
case EVT_KEY_FIRST(KEY_MENU):
killEvents(event);
result = s_menu[s_menu_item];
s_menu_count = 0;
s_menu_item = 0;
break;
}
return result;
}
#endif
#ifdef NAVIGATION_RE1 #ifdef NAVIGATION_RE1
int8_t *s_inflight_value = NULL; int8_t *s_inflight_value = NULL;
int8_t s_inflight_min; int8_t s_inflight_min;

View file

@ -186,4 +186,11 @@ void displayPopup(const pm_char * pstr);
void displayWarning(uint8_t event); void displayWarning(uint8_t event);
void displayConfirmation(uint8_t event); void displayConfirmation(uint8_t event);
#if defined(SDCARD)
#define MENU_MAX_LINES 4
extern const pm_char * s_menu[];
extern uint8_t s_menu_count;
const pm_char * displayMenu(uint8_t event);
#endif
#endif #endif

View file

@ -131,7 +131,11 @@ void menuProcModelSelect(uint8_t event)
s_copyMode = 0; s_copyMode = 0;
} }
uint8_t _event = (s_warning ? 0 : event); #if defined(SDCARD)
uint8_t _event = (s_warning || s_menu_count) ? 0 : event;
#else
uint8_t _event = s_warning ? 0 : event;
#endif
uint8_t _event_ = (IS_RE1_EVT(_event) ? 0 : _event); uint8_t _event_ = (IS_RE1_EVT(_event) ? 0 : _event);
if (s_copyMode || !eeModelExists(g_eeGeneral.currModel)) { if (s_copyMode || !eeModelExists(g_eeGeneral.currModel)) {
@ -223,16 +227,27 @@ void menuProcModelSelect(uint8_t event)
#ifdef NAVIGATION_RE1 #ifdef NAVIGATION_RE1
s_editMode = -1; s_editMode = -1;
#endif #endif
displayPopup(STR_LOADINGMODEL);
eeCheck(true); // force writing of current model data before this is changed
if (g_eeGeneral.currModel != sub) {
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
eeLoadModel(sub);
}
s_copyMode = 0; s_copyMode = 0;
killEvents(event); killEvents(event);
return; if (g_eeGeneral.currModel != sub) {
#if defined(SDCARD)
s_menu[s_menu_count++] = STR_LOAD_MODEL;
if (eeModelExists(sub)) {
s_menu[s_menu_count++] = STR_ARCHIVE_MODEL;
s_menu[s_menu_count++] = STR_DELETE_MODEL;;
}
else {
s_menu[s_menu_count++] = STR_RESTORE_MODEL;;
}
#else
displayPopup(STR_LOADINGMODEL);
eeCheck(true); // force writing of current model data before this is changed
eeLoadModel(sub);
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
return;
#endif
}
} }
else if (eeModelExists(sub)) { else if (eeModelExists(sub)) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE); s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
@ -333,6 +348,32 @@ void menuProcModelSelect(uint8_t event)
s_warning_info_len = sizeof(g_model.name); s_warning_info_len = sizeof(g_model.name);
displayConfirmation(event); displayConfirmation(event);
} }
#if defined(SDCARD)
if (s_menu_count) {
const pm_char * result = displayMenu(event);
if (result) {
if (result == STR_LOAD_MODEL) {
displayPopup(STR_LOADINGMODEL);
eeCheck(true); // force writing of current model data before this is changed
if (g_eeGeneral.currModel != sub) {
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
eeLoadModel(sub);
}
}
else if (result == STR_ARCHIVE_MODEL) {
// TODO
}
else if (result == STR_RESTORE_MODEL) {
// TODO
}
else if (result == STR_DELETE_MODEL) {
s_warning = STR_DELETEMODEL;
}
}
}
#endif
} }
void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, bool active, uint8_t & cur) void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, bool active, uint8_t & cur)
@ -1301,7 +1342,8 @@ inline void displayMixerLine(uint8_t row, uint8_t mix, uint8_t ch, uint8_t idx,
cs = (cs =='S' ? '*' : 'D'); cs = (cs =='S' ? '*' : 'D');
lcd_putcAtt(18*FW+7, y, cs, 0); lcd_putcAtt(18*FW+7, y, cs, 0);
putsFlightPhase(20*FW+2, y, md->phase, CONDENSED); if (md->phase)
putsFlightPhase(20*FW+2, y, md->phase, CONDENSED);
if (s_copyMode) { if (s_copyMode) {
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && mix == (s_copySrcIdx + (s_copyTgtOfs<0))) { if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && mix == (s_copySrcIdx + (s_copyTgtOfs<0))) {
@ -1554,7 +1596,7 @@ void menuProcMixAll(uint8_t event)
void menuProcLimits(uint8_t event) void menuProcLimits(uint8_t event)
{ {
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0}); MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0});
int8_t sub = m_posVert - 1; int8_t sub = m_posVert - 1;
@ -1575,17 +1617,11 @@ void menuProcLimits(uint8_t event)
} }
LimitData *ld = limitaddress(k) ; LimitData *ld = limitaddress(k) ;
int16_t v = (ld->revert) ? -ld->offset : ld->offset;
char swVal = '-'; // '-', '<', '>'
if((g_chans512[k] - v) > 50) swVal = (ld->revert ? 127 : 126); // Switch to raw inputs? - remove trim!
if((g_chans512[k] - v) < -50) swVal = (ld->revert ? 126 : 127);
putsChn(0, y, k+1, 0);
lcd_putcAtt(12*FW+5, y, swVal, 0);
int8_t limit = (g_model.extendedLimits ? 125 : 100); int8_t limit = (g_model.extendedLimits ? 125 : 100);
for (uint8_t j=0; j<4; j++) { putsChn(0, y, k+1, 0);
for (uint8_t j=0; j<5; j++) {
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ; uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;
switch(j) switch(j)
@ -1593,7 +1629,7 @@ void menuProcLimits(uint8_t event)
case 0: case 0:
lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1); lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1);
if (active) { if (active) {
ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL); ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS);
} }
else if (attr && event==EVT_KEY_LONG(KEY_MENU)) { else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
int16_t zero = g_chans512[k]; int16_t zero = g_chans512[k];
@ -1603,23 +1639,29 @@ void menuProcLimits(uint8_t event)
} }
break; break;
case 1: case 1:
lcd_outdezAtt(12*FW, y, (int8_t)(ld->min-100), attr | INFLIGHT(ld->min)); lcd_outdezAtt(12*FW+1, y, (int8_t)(ld->min-100), attr | INFLIGHT(ld->min));
if (active) { if (active) {
CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->min, -limit, limit, +100, STR_MINLIMIT); CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->min, -limit, limit, +100, STR_MINLIMIT);
} }
break; break;
case 2: case 2:
lcd_outdezAtt(17*FW, y, (int8_t)(ld->max+100), attr | INFLIGHT(ld->max)); lcd_outdezAtt(16*FW, y, (int8_t)(ld->max+100), attr | INFLIGHT(ld->max));
if (active) { if (active) {
CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->max, -limit, limit, -100, STR_MAXLIMIT); CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->max, -limit, limit, -100, STR_MAXLIMIT);
} }
break; break;
case 3: case 3:
lcd_putsiAtt(18*FW, y, STR_MMMINV, ld->revert, attr); lcd_putcAtt(17*FW-2, y, ld->revert ? 127 : 126, attr);
if (active) { if (active) {
CHECK_INCDEC_MODELVAR(event, ld->revert, 0, 1); CHECK_INCDEC_MODELVAR(event, ld->revert, 0, 1);
} }
break; break;
case 4:
lcd_outdezAtt(21*FW+2, y, 1500+g_model.servoCenter[k], attr);
if (active) {
CHECK_INCDEC_MODELVAR(event, g_model.servoCenter[k], -125, +125);
}
break;
} }
} }
} }

View file

@ -497,6 +497,7 @@ PACK(typedef struct t_ModelData {
uint8_t modelId; uint8_t modelId;
uint8_t frskyLines[4]; uint8_t frskyLines[4];
uint16_t frskyLinesXtra; uint16_t frskyLinesXtra;
int8_t servoCenter[NUM_CHNOUT];
}) ModelData; }) ModelData;
extern EEGeneral g_eeGeneral; extern EEGeneral g_eeGeneral;

View file

@ -300,6 +300,13 @@ const pm_char STR_CURRENT_CALIB[] PROGMEM = TR_CURRENT_CALIB;
const pm_char STR_CURRENT[] PROGMEM = TR_CURRENT; const pm_char STR_CURRENT[] PROGMEM = TR_CURRENT;
#endif #endif
#if defined(SDCARD)
const pm_char STR_LOAD_MODEL[] PROGMEM = TR_LOAD_MODEL;
const pm_char STR_ARCHIVE_MODEL[] PROGMEM = TR_ARCHIVE_MODEL;
const pm_char STR_DELETE_MODEL[] PROGMEM = TR_DELETE_MODEL;
const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL;
#endif
const pm_uchar font[] PROGMEM = { const pm_uchar font[] PROGMEM = {
#include "font.lbm" #include "font.lbm"
#ifdef TRANSLATIONS_SE #ifdef TRANSLATIONS_SE

View file

@ -361,5 +361,13 @@ extern const pm_char STR_CURRENT_CALIB[];
extern const pm_char STR_CURRENT[]; extern const pm_char STR_CURRENT[];
#endif #endif
#if defined(SDCARD)
extern const pm_char STR_LOAD_MODEL[];
extern const pm_char STR_ARCHIVE_MODEL[];
extern const pm_char STR_DELETE_MODEL[];
extern const pm_char STR_RESTORE_MODEL[];
#endif
extern const pm_uchar font[]; extern const pm_uchar font[];
extern const pm_uchar font_dblsize[]; extern const pm_uchar font_dblsize[];

View file

@ -64,11 +64,6 @@ 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;
@ -880,8 +875,6 @@ uint8_t checkTrim(uint8_t event)
beepTrim = true; beepTrim = true;
} }
} }
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;
@ -910,13 +903,7 @@ uint8_t checkTrim(uint8_t event)
if (beepTrim) { if (beepTrim) {
killEvents(event); killEvents(event);
AUDIO_WARNING2();
#if defined (AUDIO)
audio.event(AU_TRIM_MIDDLE);
# else
AUDIO_WARNING2();
#endif
} }
else { else {
#if defined (AUDIO) #if defined (AUDIO)
@ -1341,7 +1328,7 @@ void evalFunctions()
if (sd->swtch) { if (sd->swtch) {
uint16_t mask = (sd->func >= FUNC_TRAINER ? (1 << (sd->func-FUNC_TRAINER)) : 0); uint16_t mask = (sd->func >= FUNC_TRAINER ? (1 << (sd->func-FUNC_TRAINER)) : 0);
if (getSwitch(sd->swtch, 0)) { if (getSwitch(sd->swtch, 0)) {
if (sd->func < FUNC_TRAINER && (g_menuStack[0] != menuProcFunctionSwitches || m_posVert != i+1 || m_posHorz > 1)) { if (sd->func < FUNC_TRAINER && (g_menuStack[g_menuStackPtr] != menuProcFunctionSwitches || m_posVert != (i+1) || m_posHorz > 1)) {
safetyCh[sd->func] = (int8_t)sd->param; safetyCh[sd->func] = (int8_t)sd->param;
} }
@ -2036,7 +2023,7 @@ void perMain()
#else #else
instant_vbat = (instant_vbat*16 + instant_vbat*g_eeGeneral.vBatCalib/8) / BandGap; instant_vbat = (instant_vbat*16 + instant_vbat*g_eeGeneral.vBatCalib/8) / BandGap;
#endif #endif
if (g_vbat100mV == 0 || g_menuStack[0] != menuMainView) g_vbat100mV = instant_vbat; if (g_vbat100mV == 0 || g_menuStack[g_menuStackPtr] != menuMainView) g_vbat100mV = instant_vbat;
g_vbat100mV = (instant_vbat + g_vbat100mV*7) / 8; g_vbat100mV = (instant_vbat + g_vbat100mV*7) / 8;
static uint8_t s_batCheck; static uint8_t s_batCheck;
@ -2050,11 +2037,8 @@ 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
@ -2112,8 +2096,6 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
#endif #endif
sei(); sei();
#if defined (PCBSTD) && defined (AUDIO) #if defined (PCBSTD) && defined (AUDIO)
AUDIO_DRIVER(); AUDIO_DRIVER();
@ -2124,7 +2106,6 @@ 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

View file

@ -812,11 +812,6 @@ 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

View file

@ -193,9 +193,10 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation
#endif #endif
#define PPM_CENTER 1500
FORCEINLINE void setupPulsesPPM() FORCEINLINE void setupPulsesPPM()
{ {
#define PPM_CENTER 1500*2
int16_t PPM_range = g_model.extendedLimits ? 640*2 : 512*2; //range of 0.7..1.7msec int16_t PPM_range = g_model.extendedLimits ? 640*2 : 512*2; //range of 0.7..1.7msec
//Total frame length = 22.5msec //Total frame length = 22.5msec
@ -211,7 +212,7 @@ FORCEINLINE void setupPulsesPPM()
uint16_t rest = 22500u*2-q; //Minimum Framelen=22.5 ms uint16_t rest = 22500u*2-q; //Minimum Framelen=22.5 ms
rest += (int16_t(g_model.ppmFrameLength))*1000; rest += (int16_t(g_model.ppmFrameLength))*1000;
for (uint8_t i=0; i<p; i++) { for (uint8_t i=0; i<p; i++) {
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + PPM_CENTER; int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);
rest -= v; rest -= v;
*ptr++ = v - q; /* as Pat MacKenzie suggests, reviewed and modified by Cam */ *ptr++ = v - q; /* as Pat MacKenzie suggests, reviewed and modified by Cam */
*ptr++ = q; *ptr++ = q;
@ -818,7 +819,7 @@ void setupPulsesPPM16()
uint16_t rest=22500u*2-q; //Minimum Framelen=22.5 ms uint16_t rest=22500u*2-q; //Minimum Framelen=22.5 ms
rest += (int16_t(g_model.ppmFrameLength))*1000; rest += (int16_t(g_model.ppmFrameLength))*1000;
for (uint8_t i=p-8; i<p; i++) { //NUM_CHNOUT for (uint8_t i=p-8; i<p; i++) { //NUM_CHNOUT
int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + PPM_CENTER; int16_t v = limit((int16_t)-PPM_range, g_chans512[i], (int16_t)PPM_range) + 2*(PPM_CENTER+g_model.servoCenter[i]);
rest -= v; rest -= v;
*ptr++ = q; *ptr++ = q;
*ptr++ = v - q; /* as Pat MacKenzie suggests, reviewed and modified by Cam */ *ptr++ = v - q; /* as Pat MacKenzie suggests, reviewed and modified by Cam */

View file

@ -336,3 +336,7 @@
#define TR_BATT_CALIB "Battery Calib" #define TR_BATT_CALIB "Battery Calib"
#define TR_CURRENT_CALIB "Current Calib" #define TR_CURRENT_CALIB "Current Calib"
#define TR_CURRENT "Current" #define TR_CURRENT "Current"
#define TR_LOAD_MODEL "Load Model"
#define TR_ARCHIVE_MODEL "Archive Model"
#define TR_DELETE_MODEL "Delete Model" // TODO merged into DELETEMODEL?
#define TR_RESTORE_MODEL "Restore Model"

View file

@ -215,8 +215,8 @@
#define TR_MULTPX "Multpx" #define TR_MULTPX "Multpx"
#define TR_DELAYDOWN "Retard Bas" #define TR_DELAYDOWN "Retard Bas"
#define TR_DELAYUP "Retard Haut" #define TR_DELAYUP "Retard Haut"
#define TR_SLOWDOWN "Ralentir Haut" #define TR_SLOWDOWN "Ralenti Haut"
#define TR_SLOWUP "Ralentir Bas" #define TR_SLOWUP "Ralenti Bas"
#define TR_MIXER "MIXEUR" #define TR_MIXER "MIXEUR"
#define TR_CV "CV" #define TR_CV "CV"
#define TR_SW "SW" #define TR_SW "SW"
@ -337,3 +337,7 @@
#define TR_BATT_CALIB "Battery Calib" #define TR_BATT_CALIB "Battery Calib"
#define TR_CURRENT_CALIB "Current Calib" #define TR_CURRENT_CALIB "Current Calib"
#define TR_CURRENT "Courant" #define TR_CURRENT "Courant"
#define TR_LOAD_MODEL "Charger Modele"
#define TR_ARCHIVE_MODEL "Archiver Modele"
#define TR_DELETE_MODEL "Supprimer Modele"
#define TR_RESTORE_MODEL "Restorer Modele"

View file

@ -336,3 +336,7 @@
#define TR_BATT_CALIB "Battery Calib" #define TR_BATT_CALIB "Battery Calib"
#define TR_CURRENT_CALIB "Current Calib" #define TR_CURRENT_CALIB "Current Calib"
#define TR_CURRENT "Sp\201nning" #define TR_CURRENT "Sp\201nning"
#define TR_LOAD_MODEL "Load Model"
#define TR_ARCHIVE_MODEL "Archive Model"
#define TR_DELETE_MODEL "Delete Model"
#define TR_RESTORE_MODEL "Restore Model"

View file

@ -16,7 +16,7 @@ options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"),
options_v4 = [[("", "EXT=FRSKY")], options_v4 = [[("", "EXT=FRSKY")],
[("", "HELI=NO"), ("heli", "HELI=YES")], [("", "HELI=NO"), ("heli", "HELI=YES")],
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")], [("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
[("", "LOGS=NO"), ("logs", "LOGS=YES")], [("", "SDCARD=NO"), ("sdcard", "SDCARD=YES")],
[("", "SOMO=NO"), ("SOMO", "SOMO=YES")], [("", "SOMO=NO"), ("SOMO", "SOMO=YES")],
] ]