[stock] Flash saving

[X9D] Navigation continued
[sky9x] Mulaw codec added as an option
This commit is contained in:
bsongis
2012-11-21 18:27:21 +00:00
parent efe8c2ec8c
commit 98992ce1b0
11 changed files with 80 additions and 87 deletions
+1 -1
View File
@@ -442,7 +442,7 @@ RUN_FROM_FLASH = 1
ifeq ($(PCB), X9D) ifeq ($(PCB), X9D)
# X9D, so ... # X9D, so ...
OPT = 2 OPT = 2
CPPDEFS += -DPCBX9D -DPCBSKY9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1 CPPDEFS += -DPCBX9D -DPCBSKY9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1 -DLCD212
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
BOARDSRC = board_sky9x.cpp BOARDSRC = board_sky9x.cpp
SRC += sky9x/core_cm3.c sky9x/board_lowlevel.c sky9x/crt.c sky9x/vectors_sam3s.c SRC += sky9x/core_cm3.c sky9x/board_lowlevel.c sky9x/crt.c sky9x/vectors_sam3s.c
-1
View File
@@ -526,7 +526,6 @@ void menuGeneralSdManager(uint8_t event)
if (m_posVert > 0) { if (m_posVert > 0) {
uint8_t index = m_posVert-1-s_pgOfs; uint8_t index = m_posVert-1-s_pgOfs;
if (!reusableBuffer.sd.lines[index][SD_SCREEN_FILE_LENGTH+1]) { if (!reusableBuffer.sd.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
killEvents(event);
f_chdir(reusableBuffer.sd.lines[index]); f_chdir(reusableBuffer.sd.lines[index]);
s_pgOfs = 0; s_pgOfs = 0;
m_posVert = 1; m_posVert = 1;
+5 -1
View File
@@ -34,14 +34,18 @@
#ifndef lcd_h #ifndef lcd_h
#define lcd_h #define lcd_h
#if defined(PCBX9D) #if defined(LCD212)
#define DISPLAY_W 212 #define DISPLAY_W 212
#define DISPLAY_H 64 #define DISPLAY_H 64
#define xcoord_t uint16_t #define xcoord_t uint16_t
#define CENTER "\016"
#define CENTER_OFS (7*FW)
#else #else
#define DISPLAY_W 128 #define DISPLAY_W 128
#define DISPLAY_H 64 #define DISPLAY_H 64
#define xcoord_t uint8_t #define xcoord_t uint8_t
#define CENTER
#define CENTER_OFS 0
#endif #endif
#define FW 6 #define FW 6
+2 -2
View File
@@ -204,7 +204,7 @@ void menuMainView(uint8_t event)
{ {
// Flight Phase Name // Flight Phase Name
uint8_t phase = s_perout_flight_phase; uint8_t phase = s_perout_flight_phase;
#if defined(PCBX9D) #if defined(LCD212)
uint8_t len = ZLEN(g_model.phaseData[phase].name); uint8_t len = ZLEN(g_model.phaseData[phase].name);
if (len > 0) { if (len > 0) {
uint8_t tmp = (DISPLAY_W - 6*FW - 2 - len*FW/2); uint8_t tmp = (DISPLAY_W - 6*FW - 2 - len*FW/2);
@@ -239,7 +239,7 @@ void menuMainView(uint8_t event)
lcd_putcAtt(20*FW-3, 0*FH, '!', INVERS); lcd_putcAtt(20*FW-3, 0*FH, '!', INVERS);
} }
#if defined(PCBX9D) #if defined(LCD212)
// Main timer // Main timer
if (g_model.timers[0].mode) { if (g_model.timers[0].mode) {
uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK|INVERS : 0); uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK|INVERS : 0);
+13 -17
View File
@@ -120,10 +120,9 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
AUDIO_KEYPAD_DOWN(); AUDIO_KEYPAD_DOWN();
} }
if (i_min==0 && i_max==1 && event==EVT_KEY_FIRST(KEY_MENU)) { if (i_min==0 && i_max==1 && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0; s_editMode = 0;
newval=!val; newval = !val;
killEvents(event);
} }
#if defined (ROTARY_ENCODERS) || defined(NAVIGATION_POT1) #if defined (ROTARY_ENCODERS) || defined(NAVIGATION_POT1)
@@ -165,7 +164,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
} }
if (newval != val) { if (newval != val) {
if ((~i_flags & NO_INCDEC_MARKS) && (newval==0 || newval==-100 || newval==+100)) { if ((~i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && (newval==0 || newval==-100 || newval==+100)) {
pauseEvents(event); // delay before auto-repeat continues pauseEvents(event); // delay before auto-repeat continues
if (newval>val) // without AUDIO it's optimized, because the 2 sounds are the same if (newval>val) // without AUDIO it's optimized, because the 2 sounds are the same
AUDIO_KEYPAD_UP(); AUDIO_KEYPAD_UP();
@@ -286,9 +285,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
if (!(s_warning || s_menu_count)) if (!(s_warning || s_menu_count))
CHECK_ROTARY_ENCODER(event); CHECK_ROTARY_ENCODER(event);
if (l_posVert < 0 && (event==EVT_KEY_FIRST(RE_NAV_ENTER) || event==EVT_KEY_FIRST(KEY_MENU))) { if (l_posVert < 0 && (event==EVT_KEY_BREAK(RE_NAV_ENTER) || event==EVT_KEY_BREAK(KEY_MENU))) {
popMenu(); popMenu();
killEvents(event);
return false; return false;
} }
if (RE_NAV_ENABLE && event==EVT_KEY_BREAK(RE_NAV_ENTER)) { if (RE_NAV_ENABLE && event==EVT_KEY_BREAK(RE_NAV_ENTER)) {
@@ -379,7 +377,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
s_noScroll = 0; s_noScroll = 0;
displayScreenIndex(curr, menuTabSize, attr); displayScreenIndex(curr, menuTabSize, attr);
#if defined(PCBX9D) #if defined(LCD212)
if (maxrow > 7) if (maxrow > 7)
displayScrollbar(DISPLAY_W-1, FH, DISPLAY_H-FH, s_pgOfs, maxrow, 7); displayScrollbar(DISPLAY_W-1, FH, DISPLAY_H-FH, s_pgOfs, maxrow, 7);
#endif #endif
@@ -632,19 +630,18 @@ void displayWarning(uint8_t event)
lcd_puts(16, 5*FH, s_warning_type == WARNING_TYPE_CONFIRM ? STR_POPUPS : STR_EXIT); lcd_puts(16, 5*FH, s_warning_type == WARNING_TYPE_CONFIRM ? STR_POPUPS : STR_EXIT);
switch(event) { switch(event) {
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
case EVT_KEY_FIRST(BTN_REa): case EVT_KEY_BREAK(BTN_REa):
case EVT_KEY_FIRST(BTN_REb): case EVT_KEY_BREAK(BTN_REb):
if (!navigationRotaryEncoder(event)) if (!navigationRotaryEncoder(event))
break; break;
// no break // no break
#endif #endif
case EVT_KEY_FIRST(KEY_ENTER): case EVT_KEY_BREAK(KEY_ENTER):
if (s_warning_type == WARNING_TYPE_ASTERISK) if (s_warning_type == WARNING_TYPE_ASTERISK)
break; break;
s_warning_result = true; s_warning_result = true;
// no break // no break
case EVT_KEY_FIRST(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
killEvents(event);
s_warning = 0; s_warning = 0;
s_warning_type = WARNING_TYPE_ASTERISK; s_warning_type = WARNING_TYPE_ASTERISK;
break; break;
@@ -734,7 +731,7 @@ const char * displayMenu(uint8_t event)
} }
switch(event) { switch(event) {
case EVT_KEY_FIRST(KEY_UP): case EVT_KEY_BREAK(KEY_UP):
if (s_menu_item > 0) if (s_menu_item > 0)
s_menu_item--; s_menu_item--;
else if (s_menu_offset > 0) { else if (s_menu_offset > 0) {
@@ -742,7 +739,7 @@ const char * displayMenu(uint8_t event)
result = STR_UPDATE_LIST; result = STR_UPDATE_LIST;
} }
break; break;
case EVT_KEY_FIRST(KEY_DOWN): case EVT_KEY_BREAK(KEY_DOWN):
if (s_menu_item < display_count - 1 && s_menu_offset + s_menu_item + 1 < s_menu_count) if (s_menu_item < display_count - 1 && s_menu_offset + s_menu_item + 1 < s_menu_count)
s_menu_item++; s_menu_item++;
else if (s_menu_count > s_menu_offset + display_count) { else if (s_menu_count > s_menu_offset + display_count) {
@@ -750,11 +747,10 @@ const char * displayMenu(uint8_t event)
result = STR_UPDATE_LIST; result = STR_UPDATE_LIST;
} }
break; break;
case EVT_KEY_FIRST(KEY_MENU): case EVT_KEY_BREAK(KEY_MENU):
result = s_menu[s_menu_item]; result = s_menu[s_menu_item];
// no break // no break
case EVT_KEY_FIRST(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
killEvents(event);
s_menu_count = 0; s_menu_count = 0;
s_menu_item = 0; s_menu_item = 0;
s_menu_flags = 0; s_menu_flags = 0;
+1 -1
View File
@@ -47,7 +47,7 @@ typedef void (*MenuFuncP)(uint8_t event);
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr); void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
#if defined(PCBX9D) #if defined(LCD212)
#define MENUS_SCROLLBAR_WIDTH 2 #define MENUS_SCROLLBAR_WIDTH 2
#else #else
#define MENUS_SCROLLBAR_WIDTH 0 #define MENUS_SCROLLBAR_WIDTH 0
+25 -31
View File
@@ -294,7 +294,6 @@ void menuModelSelect(uint8_t event)
if (s_copyMode) { if (s_copyMode) {
sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow; sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
s_copyMode = 0; s_copyMode = 0;
killEvents(event);
} }
break; break;
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
@@ -409,7 +408,6 @@ void menuModelSelect(uint8_t event)
sub = m_posVert; sub = m_posVert;
} }
s_copyTgtOfs = next_ofs; s_copyTgtOfs = next_ofs;
killEvents(event);
} }
break; break;
#endif #endif
@@ -611,7 +609,11 @@ enum menuModelSetupItems {
#define FIELD_TIMER_MAX 2 #define FIELD_TIMER_MAX 2
#endif #endif
#if defined(LCD212)
#define MODEL_SETUP_2ND_COLUMN (DISPLAY_W-15*FW-MENUS_SCROLLBAR_WIDTH)
#else
#define MODEL_SETUP_2ND_COLUMN (DISPLAY_W-11*FW-MENUS_SCROLLBAR_WIDTH) #define MODEL_SETUP_2ND_COLUMN (DISPLAY_W-11*FW-MENUS_SCROLLBAR_WIDTH)
#endif
void menuModelSetup(uint8_t event) void menuModelSetup(uint8_t event)
{ {
@@ -758,8 +760,7 @@ void menuModelSetup(uint8_t event)
for (uint8_t i=0;i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS;i++) for (uint8_t i=0;i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS;i++)
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : ((g_model.beepANACenter & ((BeepANACenter)1<<i)) ? INVERS : 0 ) ); lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : ((g_model.beepANACenter & ((BeepANACenter)1<<i)) ? INVERS : 0 ) );
if (attr) { if (attr) {
if((event==EVT_KEY_FIRST(KEY_MENU)) || p1valdiff) { if((event==EVT_KEY_BREAK(KEY_MENU)) || p1valdiff) {
killEvents(event);
s_editMode = 0; s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz); g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
STORE_MODELVARS; STORE_MODELVARS;
@@ -870,7 +871,7 @@ static uint8_t s_currIdx;
#define MIXES_2ND_COLUMN (11*FW) #define MIXES_2ND_COLUMN (11*FW)
#endif #endif
#if defined(PCBX9D) #if defined(LCD212)
#define EXPO_ONE_2ND_COLUMN (DISPLAY_W - 88) #define EXPO_ONE_2ND_COLUMN (DISPLAY_W - 88)
#define EXPO_ONE_FP_WIDTH (9*FW) #define EXPO_ONE_FP_WIDTH (9*FW)
#else #else
@@ -900,12 +901,12 @@ PhasesType editPhases(uint8_t x, uint8_t y, uint8_t event, PhasesType value, uin
uint8_t posHorz = m_posHorz; uint8_t posHorz = m_posHorz;
#if defined(PCBSKY9X) && !defined(PCBX9D) #if defined(PCBSKY9X) && !defined(LCD212)
bool expoMenu = (x==EXPO_ONE_2ND_COLUMN-2*FW); bool expoMenu = (x==EXPO_ONE_2ND_COLUMN-2*FW);
#endif #endif
for (uint8_t p=0; p<MAX_PHASES; p++) { for (uint8_t p=0; p<MAX_PHASES; p++) {
#if defined(PCBSKY9X) && !defined(PCBX9D) #if defined(PCBSKY9X) && !defined(LCD212)
if (expoMenu && ((attr && p < posHorz-4) || (x > EXPO_ONE_2ND_COLUMN+2*FW))) if (expoMenu && ((attr && p < posHorz-4) || (x > EXPO_ONE_2ND_COLUMN+2*FW)))
continue; continue;
#endif #endif
@@ -914,8 +915,7 @@ PhasesType editPhases(uint8_t x, uint8_t y, uint8_t event, PhasesType value, uin
} }
if (attr) { if (attr) {
if ((event==EVT_KEY_FIRST(KEY_MENU)) || p1valdiff) { if ((event==EVT_KEY_BREAK(KEY_MENU)) || p1valdiff) {
killEvents(event);
s_editMode = 0; s_editMode = 0;
value ^= (1<<posHorz); value ^= (1<<posHorz);
STORE_MODELVARS; STORE_MODELVARS;
@@ -1170,8 +1170,16 @@ void menuModelPhasesAll(uint8_t event)
} }
#endif #endif
} }
#if defined(LCD212)
if (p->fadeIn || p->fadeOut) {
lcd_outdezAtt(24*FW, y, 5*p->fadeIn, PREC1|LEFT);
lcd_putc(lcdLastPos, y, '/');
lcd_outdezAtt(lcdLastPos+FW, y, 5*p->fadeOut, PREC1|LEFT);
}
#else
if (p->fadeIn || p->fadeOut) if (p->fadeIn || p->fadeOut)
lcd_putc(DISPLAY_W-FW, y, (p->fadeIn && p->fadeOut) ? '*' : (p->fadeIn ? 'I' : 'O')); lcd_putc(DISPLAY_W-FW-MENUS_SCROLLBAR_WIDTH, y, (p->fadeIn && p->fadeOut) ? '*' : (p->fadeIn ? 'I' : 'O'));
#endif
} }
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
@@ -1353,7 +1361,6 @@ void menuModelCurveOne(uint8_t event)
} }
break; break;
case EVT_KEY_FIRST(KEY_EXIT): case EVT_KEY_FIRST(KEY_EXIT):
killEvents(event);
if (s_editMode > 0) { if (s_editMode > 0) {
if (--s_editMode == 0) if (--s_editMode == 0)
m_posHorz = 0; m_posHorz = 0;
@@ -1540,13 +1547,11 @@ void memswap(void *a, void *b, uint8_t size)
uint8_t *y = (uint8_t*)b; uint8_t *y = (uint8_t*)b;
uint8_t temp ; uint8_t temp ;
pauseMixerCalculations();
while (size--) { while (size--) {
temp = *x; temp = *x;
*x++ = *y; *x++ = *y;
*y++ = temp; *y++ = temp;
} }
resumeMixerCalculations();
} }
bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up) bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
@@ -1621,7 +1626,10 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
size = sizeof(MixData); size = sizeof(MixData);
} }
pauseMixerCalculations();
memswap(x, y, size); memswap(x, y, size);
resumeMixerCalculations();
idx = tgt_idx; idx = tgt_idx;
return true; return true;
} }
@@ -2067,7 +2075,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t _event)
putsSwitches(11*FW, y, ed->swtch, 0); putsSwitches(11*FW, y, ed->swtch, 0);
lcd_putsnAtt(DISPLAY_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); lcd_putsnAtt(DISPLAY_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
} }
#if !defined(PCBX9D) #if !defined(LCD212)
else else
#endif #endif
#endif #endif
@@ -2088,7 +2096,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t _event)
if (md->name[0]) { if (md->name[0]) {
lcd_putsnAtt(DISPLAY_W-sizeof(md->name)*FW-MENUS_SCROLLBAR_WIDTH, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0)); lcd_putsnAtt(DISPLAY_W-sizeof(md->name)*FW-MENUS_SCROLLBAR_WIDTH, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0));
} }
#if !defined(PCBX9D) #if !defined(LCD212)
else else
#endif #endif
#endif #endif
@@ -2248,9 +2256,7 @@ void menuModelLimits(uint8_t event)
if (event==EVT_KEY_LONG(KEY_MENU)) { if (event==EVT_KEY_LONG(KEY_MENU)) {
s_noHi = NO_HI_LEN; s_noHi = NO_HI_LEN;
killEvents(event); killEvents(event);
pauseMixerCalculations();
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
resumeMixerCalculations();
} }
} }
return; return;
@@ -2286,21 +2292,12 @@ void menuModelLimits(uint8_t event)
lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1); lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1);
#endif #endif
if (active) { if (active) {
int16_t new_offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS); ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS);
#if defined(PCBGRUVIN9X)
if (checkIncDec_Ret)
#endif
{
pauseMixerCalculations();
ld->offset = new_offset;
resumeMixerCalculations();
}
} }
else if (attr && event==EVT_KEY_LONG(KEY_MENU)) { else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
pauseMixerCalculations(); pauseMixerCalculations();
int32_t zero = (int32_t)g_chans512[k]; int32_t zero = (int32_t)g_chans512[k];
s_perout_mode = e_perout_mode_nosticks+e_perout_mode_notrainer; perOut(e_perout_mode_nosticks+e_perout_mode_notrainer, 0);
perOut(0);
int32_t chan = chans[k]; int32_t chan = chans[k];
int8_t lim = ld->max+100; int8_t lim = ld->max+100;
if (chan < 0) { if (chan < 0) {
@@ -2309,7 +2306,6 @@ void menuModelLimits(uint8_t event)
} }
zero = (zero*100000 - 10*chan*lim) / (102400 - chan); zero = (zero*100000 - 10*chan*lim) / (102400 - chan);
ld->offset = (ld->revert) ? -zero : zero; ld->offset = (ld->revert) ? -zero : zero;
s_perout_mode = e_perout_mode_normal;
resumeMixerCalculations(); resumeMixerCalculations();
s_editMode = 0; s_editMode = 0;
STORE_MODELVARS; STORE_MODELVARS;
@@ -2342,7 +2338,6 @@ void menuModelLimits(uint8_t event)
if (checkIncDec_Ret && thrOutput(k)) { if (checkIncDec_Ret && thrOutput(k)) {
s_warning = STR_INVERT_THR; s_warning = STR_INVERT_THR;
s_warning_type = WARNING_TYPE_CONFIRM; s_warning_type = WARNING_TYPE_CONFIRM;
killEvents(event);
} }
else else
ld->revert = revert_new; ld->revert = revert_new;
@@ -3275,7 +3270,6 @@ void menuModelTemplates(uint8_t event)
if (event==EVT_KEY_FIRST(KEY_ENTER)) { if (event==EVT_KEY_FIRST(KEY_ENTER)) {
s_warning = STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES); s_warning = STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES);
s_warning_type = WARNING_TYPE_CONFIRM; s_warning_type = WARNING_TYPE_CONFIRM;
killEvents(event);
s_editMode = 0; s_editMode = 0;
} }
} }
+20 -23
View File
@@ -1293,7 +1293,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
{ {
lcd_clear(); lcd_clear();
#if defined(PCBX9D) #if defined(LCD212)
lcd_img(DISPLAY_W-29, 0, asterisk_lbm, 0, 0); lcd_img(DISPLAY_W-29, 0, asterisk_lbm, 0, 0);
#endif #endif
#if !defined(M64) || defined(EXTSTD) #if !defined(M64) || defined(EXTSTD)
@@ -1735,9 +1735,7 @@ FORCEINLINE void evalTrims()
} }
} }
uint8_t s_perout_mode = e_perout_mode_normal; BeepANACenter evalSticks(uint8_t mode)
BeepANACenter evalSticks()
{ {
BeepANACenter anaCenter = 0; BeepANACenter anaCenter = 0;
@@ -1791,7 +1789,7 @@ BeepANACenter evalSticks()
} }
if (ch < NUM_STICKS) { //only do this for sticks if (ch < NUM_STICKS) { //only do this for sticks
if (s_perout_mode == e_perout_mode_normal && (isFunctionActive(FUNC_TRAINER) || isFunctionActive(FUNC_TRAINER_RUD+ch))) { if (mode == e_perout_mode_normal && (isFunctionActive(FUNC_TRAINER) || isFunctionActive(FUNC_TRAINER_RUD+ch))) {
// trainer mode // trainer mode
TrainerMix* td = &g_eeGeneral.trainer.mix[ch]; TrainerMix* td = &g_eeGeneral.trainer.mix[ch];
if (td->mode) { if (td->mode) {
@@ -2203,11 +2201,11 @@ void evalFunctions()
} }
uint8_t s_perout_flight_phase; uint8_t s_perout_flight_phase;
void perOut(uint8_t tick10ms) void perOut(uint8_t mode, uint8_t tick10ms)
{ {
BeepANACenter anaCenter = evalSticks(); BeepANACenter anaCenter = evalSticks(mode);
if (s_perout_mode == e_perout_mode_normal) { if (mode == e_perout_mode_normal) {
//===========BEEP CENTER================ //===========BEEP CENTER================
anaCenter &= g_model.beepANACenter; anaCenter &= g_model.beepANACenter;
if(((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_STICK_MIDDLE(); if(((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_STICK_MIDDLE();
@@ -2299,12 +2297,12 @@ void perOut(uint8_t tick10ms)
//Notice 0 = NC switch means not used -> always on line //Notice 0 = NC switch means not used -> always on line
uint8_t k = md->srcRaw-1; uint8_t k = md->srcRaw-1;
int16_t v = 0; int16_t v = 0;
if (s_perout_mode != e_perout_mode_normal) { if (mode != e_perout_mode_normal) {
if (!sw || k >= NUM_STICKS || (k == THR_STICK && g_model.thrTrim)) { if (!sw || k >= NUM_STICKS || (k == THR_STICK && g_model.thrTrim)) {
continue; continue;
} }
else { else {
if (!(s_perout_mode & e_perout_mode_nosticks)) if (!(mode & e_perout_mode_nosticks))
v = anas[k]; v = anas[k];
} }
} }
@@ -2328,7 +2326,7 @@ void perOut(uint8_t tick10ms)
bool apply_offset = true; bool apply_offset = true;
if (sw) { // switch on? (if no switch selected => on) if (sw) { // switch on? (if no switch selected => on)
swTog = !swOn[i]; swTog = !swOn[i];
if (s_perout_mode == e_perout_mode_normal) { if (mode == e_perout_mode_normal) {
swOn[i] = true; swOn[i] = true;
if (md->delayUp) { if (md->delayUp) {
if (swTog) { if (swTog) {
@@ -2392,7 +2390,7 @@ void perOut(uint8_t tick10ms)
} }
//========== TRIMS =============== //========== TRIMS ===============
if (!(s_perout_mode & e_perout_mode_notrims)) { if (!(mode & e_perout_mode_notrims)) {
int8_t mix_trim = md->carryTrim; int8_t mix_trim = md->carryTrim;
if (mix_trim < TRIM_ON) if (mix_trim < TRIM_ON)
mix_trim = -mix_trim-1; mix_trim = -mix_trim-1;
@@ -2407,7 +2405,7 @@ void perOut(uint8_t tick10ms)
int16_t weight = GET_GVAR(md->weight, -500, 500, s_perout_flight_phase); int16_t weight = GET_GVAR(md->weight, -500, 500, s_perout_flight_phase);
//========== SPEED =============== //========== SPEED ===============
if (s_perout_mode == e_perout_mode_normal && (md->speedUp || md->speedDown)) // there are delay values if (mode == e_perout_mode_normal && (md->speedUp || md->speedDown)) // there are delay values
{ {
#define DEL_MULT 256 #define DEL_MULT 256
@@ -2561,7 +2559,7 @@ inline void doMixerCalculations()
for (uint8_t p=0; p<MAX_PHASES; p++) { for (uint8_t p=0; p<MAX_PHASES; p++) {
if (s_fade_flight_phases & (1<<p)) { if (s_fade_flight_phases & (1<<p)) {
s_perout_flight_phase = p; s_perout_flight_phase = p;
perOut(tick10ms); perOut(e_perout_mode_normal, tick10ms);
for (uint8_t i=0; i<NUM_CHNOUT; i++) for (uint8_t i=0; i<NUM_CHNOUT; i++)
sum_chans512[i] += (chans[i] / 16) * fp_act[p]; sum_chans512[i] += (chans[i] / 16) * fp_act[p];
weight += fp_act[p]; weight += fp_act[p];
@@ -2572,7 +2570,7 @@ inline void doMixerCalculations()
} }
else { else {
s_perout_flight_phase = phase; s_perout_flight_phase = phase;
perOut(tick10ms); perOut(e_perout_mode_normal, tick10ms);
} }
//========== LIMITS =============== //========== LIMITS ===============
@@ -3163,9 +3161,7 @@ ISR(USART0_UDRE_vect)
void instantTrim() void instantTrim()
{ {
s_perout_mode = e_perout_mode_notrainer; evalSticks(e_perout_mode_notrainer);
evalSticks();
s_perout_mode = e_perout_mode_normal;
for (uint8_t i=0; i<NUM_STICKS; i++) { for (uint8_t i=0; i<NUM_STICKS; i++) {
if (i!=THR_STICK) { if (i!=THR_STICK) {
@@ -3184,15 +3180,14 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
{ {
int16_t zeros[NUM_CHNOUT]; int16_t zeros[NUM_CHNOUT];
s_perout_mode = e_perout_mode_noinput; pauseMixerCalculations();
perOut(0); // do output loop - zero input sticks and trims
perOut(e_perout_mode_noinput, 0); // do output loop - zero input sticks and trims
for (uint8_t i=0; i<NUM_CHNOUT; i++) { for (uint8_t i=0; i<NUM_CHNOUT; i++) {
zeros[i] = applyLimits(i, chans[i]); zeros[i] = applyLimits(i, chans[i]);
} }
s_perout_mode = e_perout_mode_nosticks+e_perout_mode_notrainer; perOut(e_perout_mode_nosticks+e_perout_mode_notrainer, 0); // do output loop - only trims
perOut(0); // do output loop - only trims
s_perout_mode = e_perout_mode_normal;
for (uint8_t i=0; i<NUM_CHNOUT; i++) { for (uint8_t i=0; i<NUM_CHNOUT; i++) {
int16_t output = applyLimits(i, chans[i]) - zeros[i]; int16_t output = applyLimits(i, chans[i]) - zeros[i];
@@ -3215,6 +3210,8 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
} }
} }
resumeMixerCalculations();
STORE_MODELVARS; STORE_MODELVARS;
AUDIO_WARNING2(); AUDIO_WARNING2();
} }
+3 -5
View File
@@ -482,7 +482,7 @@ class Key
public: public:
void input(bool val, EnumKeys enuk); void input(bool val, EnumKeys enuk);
bool state() { return m_vals > 0; } bool state() { return m_vals > 0; }
void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0;} void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; }
void killEvents() { m_state = KSTATE_KILLED; } void killEvents() { m_state = KSTATE_KILLED; }
}; };
@@ -687,8 +687,6 @@ enum PerOutMode {
e_perout_mode_noinput = e_perout_mode_notrainer+e_perout_mode_notrims+e_perout_mode_nosticks e_perout_mode_noinput = e_perout_mode_notrainer+e_perout_mode_notrims+e_perout_mode_nosticks
}; };
extern uint8_t s_perout_mode;
#ifndef FORCEINLINE #ifndef FORCEINLINE
#define FORCEINLINE inline __attribute__ ((always_inline)) #define FORCEINLINE inline __attribute__ ((always_inline))
#endif #endif
@@ -702,8 +700,8 @@ extern uint8_t s_perout_mode;
extern uint8_t s_perout_flight_phase; extern uint8_t s_perout_flight_phase;
void perOut(uint8_t tick10ms); void perOut(uint8_t mode, uint8_t tick10ms);
void perMain(); void perMain();
NOINLINE void per10ms(); NOINLINE void per10ms();
int16_t getValue(uint8_t i); int16_t getValue(uint8_t i);
+2 -2
View File
@@ -257,8 +257,8 @@
#define TR_FADEIN "Fade In" #define TR_FADEIN "Fade In"
#define TR_FADEOUT "Fade Out" #define TR_FADEOUT "Fade Out"
#define TR_DEFAULT "(default)" #define TR_DEFAULT "(default)"
#define TR_CHECKTRIMS "\006Check\012Trims" #define TR_CHECKTRIMS CENTER"\006Check\012Trims"
#define OFS_CHECKTRIMS (9*FW) #define OFS_CHECKTRIMS CENTER_OFS+(9*FW)
#define TR_SWASHTYPE "Swash Type" #define TR_SWASHTYPE "Swash Type"
#define TR_COLLECTIVE "Collective" #define TR_COLLECTIVE "Collective"
#define TR_SWASHRING "Swash Ring" #define TR_SWASHRING "Swash Ring"
+6 -1
View File
@@ -96,7 +96,7 @@ def generate(str, idx, alternate=0):
os.remove(temp) os.remove(temp)
else: else:
os.rename(result, temp) os.rename(result, temp)
subprocess.Popen(["ffmpeg", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() subprocess.Popen(["ffmpeg", "-y", "-i", temp, "-acodec", defaultcodec, "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.remove(temp) os.remove(temp)
elif board == 'gruvin9x': elif board == 'gruvin9x':
subprocess.Popen(["AD4CONVERTER", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() subprocess.Popen(["AD4CONVERTER", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
@@ -136,6 +136,11 @@ if __name__ == "__main__":
if "list" in sys.argv: if "list" in sys.argv:
print tts.GetVoiceNames() print tts.GetVoiceNames()
if "mulaw" in sys.argv:
defaultcodec = "pcm_mulaw"
else:
defaultcodec = "pcm_alaw"
if "en" in sys.argv: if "en" in sys.argv:
if "sapi" in sys.argv: if "sapi" in sys.argv:
if "scottish" in sys.argv: if "scottish" in sys.argv: