diff --git a/src/Makefile b/src/Makefile index bee01d58a..63258b1c1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -442,7 +442,7 @@ RUN_FROM_FLASH = 1 ifeq ($(PCB), X9D) # X9D, so ... 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 BOARDSRC = board_sky9x.cpp SRC += sky9x/core_cm3.c sky9x/board_lowlevel.c sky9x/crt.c sky9x/vectors_sam3s.c diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 45091d0ae..425be8d26 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -526,7 +526,6 @@ void menuGeneralSdManager(uint8_t event) if (m_posVert > 0) { uint8_t index = m_posVert-1-s_pgOfs; if (!reusableBuffer.sd.lines[index][SD_SCREEN_FILE_LENGTH+1]) { - killEvents(event); f_chdir(reusableBuffer.sd.lines[index]); s_pgOfs = 0; m_posVert = 1; diff --git a/src/lcd.h b/src/lcd.h index 632ba1f0e..874c375a3 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -34,14 +34,18 @@ #ifndef lcd_h #define lcd_h -#if defined(PCBX9D) +#if defined(LCD212) #define DISPLAY_W 212 #define DISPLAY_H 64 #define xcoord_t uint16_t +#define CENTER "\016" +#define CENTER_OFS (7*FW) #else #define DISPLAY_W 128 #define DISPLAY_H 64 #define xcoord_t uint8_t +#define CENTER +#define CENTER_OFS 0 #endif #define FW 6 diff --git a/src/main_views.cpp b/src/main_views.cpp index ae6975f27..16df2541a 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -204,7 +204,7 @@ void menuMainView(uint8_t event) { // Flight Phase Name uint8_t phase = s_perout_flight_phase; -#if defined(PCBX9D) +#if defined(LCD212) uint8_t len = ZLEN(g_model.phaseData[phase].name); if (len > 0) { 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); } -#if defined(PCBX9D) +#if defined(LCD212) // Main timer if (g_model.timers[0].mode) { uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK|INVERS : 0); diff --git a/src/menus.cpp b/src/menus.cpp index a6e382811..23971b96f 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -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(); } - 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; - newval=!val; - killEvents(event); + newval = !val; } #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 ((~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 if (newval>val) // without AUDIO it's optimized, because the 2 sounds are the same 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 (!(s_warning || s_menu_count)) 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(); - killEvents(event); return false; } 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; displayScreenIndex(curr, menuTabSize, attr); -#if defined(PCBX9D) +#if defined(LCD212) if (maxrow > 7) displayScrollbar(DISPLAY_W-1, FH, DISPLAY_H-FH, s_pgOfs, maxrow, 7); #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); switch(event) { #if defined(ROTARY_ENCODERS) - case EVT_KEY_FIRST(BTN_REa): - case EVT_KEY_FIRST(BTN_REb): + case EVT_KEY_BREAK(BTN_REa): + case EVT_KEY_BREAK(BTN_REb): if (!navigationRotaryEncoder(event)) break; // no break #endif - case EVT_KEY_FIRST(KEY_ENTER): + case EVT_KEY_BREAK(KEY_ENTER): if (s_warning_type == WARNING_TYPE_ASTERISK) break; s_warning_result = true; // no break - case EVT_KEY_FIRST(KEY_EXIT): - killEvents(event); + case EVT_KEY_BREAK(KEY_EXIT): s_warning = 0; s_warning_type = WARNING_TYPE_ASTERISK; break; @@ -734,7 +731,7 @@ const char * displayMenu(uint8_t event) } switch(event) { - case EVT_KEY_FIRST(KEY_UP): + case EVT_KEY_BREAK(KEY_UP): if (s_menu_item > 0) s_menu_item--; else if (s_menu_offset > 0) { @@ -742,7 +739,7 @@ const char * displayMenu(uint8_t event) result = STR_UPDATE_LIST; } 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) s_menu_item++; else if (s_menu_count > s_menu_offset + display_count) { @@ -750,11 +747,10 @@ const char * displayMenu(uint8_t event) result = STR_UPDATE_LIST; } break; - case EVT_KEY_FIRST(KEY_MENU): + case EVT_KEY_BREAK(KEY_MENU): result = s_menu[s_menu_item]; // no break - case EVT_KEY_FIRST(KEY_EXIT): - killEvents(event); + case EVT_KEY_BREAK(KEY_EXIT): s_menu_count = 0; s_menu_item = 0; s_menu_flags = 0; diff --git a/src/menus.h b/src/menus.h index c8b101cbc..e2e9c1444 100644 --- a/src/menus.h +++ b/src/menus.h @@ -47,7 +47,7 @@ typedef void (*MenuFuncP)(uint8_t event); void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr); -#if defined(PCBX9D) +#if defined(LCD212) #define MENUS_SCROLLBAR_WIDTH 2 #else #define MENUS_SCROLLBAR_WIDTH 0 diff --git a/src/model_menus.cpp b/src/model_menus.cpp index f74b9da2f..88cd07e42 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -294,7 +294,6 @@ void menuModelSelect(uint8_t event) if (s_copyMode) { sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow; s_copyMode = 0; - killEvents(event); } break; #if defined(ROTARY_ENCODERS) @@ -409,7 +408,6 @@ void menuModelSelect(uint8_t event) sub = m_posVert; } s_copyTgtOfs = next_ofs; - killEvents(event); } break; #endif @@ -611,7 +609,11 @@ enum menuModelSetupItems { #define FIELD_TIMER_MAX 2 #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) +#endif void menuModelSetup(uint8_t event) { @@ -758,8 +760,7 @@ void menuModelSetup(uint8_t event) for (uint8_t i=0;i EXPO_ONE_2ND_COLUMN+2*FW))) continue; #endif @@ -914,8 +915,7 @@ PhasesType editPhases(uint8_t x, uint8_t y, uint8_t event, PhasesType value, uin } if (attr) { - if ((event==EVT_KEY_FIRST(KEY_MENU)) || p1valdiff) { - killEvents(event); + if ((event==EVT_KEY_BREAK(KEY_MENU)) || p1valdiff) { s_editMode = 0; value ^= (1<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) - 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) @@ -1353,7 +1361,6 @@ void menuModelCurveOne(uint8_t event) } break; case EVT_KEY_FIRST(KEY_EXIT): - killEvents(event); if (s_editMode > 0) { if (--s_editMode == 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 temp ; - pauseMixerCalculations(); while (size--) { temp = *x; *x++ = *y; *y++ = temp; } - resumeMixerCalculations(); } 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); } + pauseMixerCalculations(); memswap(x, y, size); + resumeMixerCalculations(); + idx = tgt_idx; return true; } @@ -2067,7 +2075,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t _event) 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)); } -#if !defined(PCBX9D) +#if !defined(LCD212) else #endif #endif @@ -2088,7 +2096,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t _event) 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)); } -#if !defined(PCBX9D) +#if !defined(LCD212) else #endif #endif @@ -2248,9 +2256,7 @@ void menuModelLimits(uint8_t event) if (event==EVT_KEY_LONG(KEY_MENU)) { s_noHi = NO_HI_LEN; killEvents(event); - pauseMixerCalculations(); moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets - resumeMixerCalculations(); } } return; @@ -2286,21 +2292,12 @@ void menuModelLimits(uint8_t event) lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1); #endif if (active) { - int16_t new_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(); - } + ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS); } else if (attr && event==EVT_KEY_LONG(KEY_MENU)) { pauseMixerCalculations(); int32_t zero = (int32_t)g_chans512[k]; - s_perout_mode = e_perout_mode_nosticks+e_perout_mode_notrainer; - perOut(0); + perOut(e_perout_mode_nosticks+e_perout_mode_notrainer, 0); int32_t chan = chans[k]; int8_t lim = ld->max+100; if (chan < 0) { @@ -2309,7 +2306,6 @@ void menuModelLimits(uint8_t event) } zero = (zero*100000 - 10*chan*lim) / (102400 - chan); ld->offset = (ld->revert) ? -zero : zero; - s_perout_mode = e_perout_mode_normal; resumeMixerCalculations(); s_editMode = 0; STORE_MODELVARS; @@ -2342,7 +2338,6 @@ void menuModelLimits(uint8_t event) if (checkIncDec_Ret && thrOutput(k)) { s_warning = STR_INVERT_THR; s_warning_type = WARNING_TYPE_CONFIRM; - killEvents(event); } else ld->revert = revert_new; @@ -3275,7 +3270,6 @@ void menuModelTemplates(uint8_t event) if (event==EVT_KEY_FIRST(KEY_ENTER)) { s_warning = STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES); s_warning_type = WARNING_TYPE_CONFIRM; - killEvents(event); s_editMode = 0; } } diff --git a/src/open9x.cpp b/src/open9x.cpp index 01aaccf9c..561aa523d 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1293,7 +1293,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO { lcd_clear(); -#if defined(PCBX9D) +#if defined(LCD212) lcd_img(DISPLAY_W-29, 0, asterisk_lbm, 0, 0); #endif #if !defined(M64) || defined(EXTSTD) @@ -1735,9 +1735,7 @@ FORCEINLINE void evalTrims() } } -uint8_t s_perout_mode = e_perout_mode_normal; - -BeepANACenter evalSticks() +BeepANACenter evalSticks(uint8_t mode) { BeepANACenter anaCenter = 0; @@ -1791,7 +1789,7 @@ BeepANACenter evalSticks() } 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 TrainerMix* td = &g_eeGeneral.trainer.mix[ch]; if (td->mode) { @@ -2203,11 +2201,11 @@ void evalFunctions() } 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================ anaCenter &= g_model.beepANACenter; 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 uint8_t k = md->srcRaw-1; 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)) { continue; } else { - if (!(s_perout_mode & e_perout_mode_nosticks)) + if (!(mode & e_perout_mode_nosticks)) v = anas[k]; } } @@ -2328,7 +2326,7 @@ void perOut(uint8_t tick10ms) bool apply_offset = true; if (sw) { // switch on? (if no switch selected => on) swTog = !swOn[i]; - if (s_perout_mode == e_perout_mode_normal) { + if (mode == e_perout_mode_normal) { swOn[i] = true; if (md->delayUp) { if (swTog) { @@ -2392,7 +2390,7 @@ void perOut(uint8_t tick10ms) } //========== TRIMS =============== - if (!(s_perout_mode & e_perout_mode_notrims)) { + if (!(mode & e_perout_mode_notrims)) { int8_t mix_trim = md->carryTrim; if (mix_trim < TRIM_ON) 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); //========== 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 @@ -2561,7 +2559,7 @@ inline void doMixerCalculations() for (uint8_t p=0; p 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; } }; @@ -687,8 +687,6 @@ enum PerOutMode { e_perout_mode_noinput = e_perout_mode_notrainer+e_perout_mode_notrims+e_perout_mode_nosticks }; -extern uint8_t s_perout_mode; - #ifndef FORCEINLINE #define FORCEINLINE inline __attribute__ ((always_inline)) #endif @@ -702,8 +700,8 @@ extern uint8_t s_perout_mode; extern uint8_t s_perout_flight_phase; -void perOut(uint8_t tick10ms); -void perMain(); +void perOut(uint8_t mode, uint8_t tick10ms); +void perMain(); NOINLINE void per10ms(); int16_t getValue(uint8_t i); diff --git a/src/translations/en.h b/src/translations/en.h index 33846c4d4..14bd3f973 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -257,8 +257,8 @@ #define TR_FADEIN "Fade In" #define TR_FADEOUT "Fade Out" #define TR_DEFAULT "(default)" -#define TR_CHECKTRIMS "\006Check\012Trims" -#define OFS_CHECKTRIMS (9*FW) +#define TR_CHECKTRIMS CENTER"\006Check\012Trims" +#define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Swash Type" #define TR_COLLECTIVE "Collective" #define TR_SWASHRING "Swash Ring" diff --git a/util/tts.py b/util/tts.py index ebc5a5b9b..edea0cd82 100644 --- a/util/tts.py +++ b/util/tts.py @@ -96,7 +96,7 @@ def generate(str, idx, alternate=0): os.remove(temp) else: 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) elif board == 'gruvin9x': subprocess.Popen(["AD4CONVERTER", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() @@ -135,7 +135,12 @@ if __name__ == "__main__": # tts.SetRate(1) if "list" in sys.argv: print tts.GetVoiceNames() - + + if "mulaw" in sys.argv: + defaultcodec = "pcm_mulaw" + else: + defaultcodec = "pcm_alaw" + if "en" in sys.argv: if "sapi" in sys.argv: if "scottish" in sys.argv: @@ -147,7 +152,7 @@ if __name__ == "__main__": elif "australian" in sys.argv: tts.SetVoiceByName("ScanSoftKaren_Full_22kHz") voice = "english-australian" - elif "irish" in sys.argv: + elif "irish" in sys.argv: tts.SetVoiceByName("ScanSoftMoira_Full_22kHz") voice = "english-irish" else: