From e2df5ef0eddf08b15e1e2f5d75857562cf3ce8cc Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Tue, 2 Apr 2013 17:23:39 +0000 Subject: [PATCH] [all] New german translations [all except '64] Trainer short and Trainer long in Custom Functions [Taranis] No Haptic function [Taranis] Overflow problem in playValue [Taranis] EEPROM flushed and loaded again before / after USB connection --- src/gruvin9x/board_gruvin9x.h | 1 + src/lcd.cpp | 47 +++-- src/menu_general.cpp | 123 +++++++------ src/menu_model.cpp | 314 +++++++++++++++------------------- src/menus.cpp | 1 + src/menus.h | 1 + src/myeeprom.h | 17 +- src/opentx.cpp | 94 ++++++---- src/opentx.h | 41 ++--- src/sky9x/board_sky9x.h | 2 +- src/sky9x/keys_driver.cpp | 2 +- src/taranis/usbd_usr.cpp | 4 + src/translations/de.h | 40 +++-- src/translations/en.h | 12 +- src/view_main.cpp | 4 +- src/view_telemetry.cpp | 10 +- 16 files changed, 351 insertions(+), 362 deletions(-) diff --git a/src/gruvin9x/board_gruvin9x.h b/src/gruvin9x/board_gruvin9x.h index ecd1a384e..09c87cdc9 100644 --- a/src/gruvin9x/board_gruvin9x.h +++ b/src/gruvin9x/board_gruvin9x.h @@ -178,6 +178,7 @@ void sdPoll10ms(); // Power driver uint8_t pwrCheck(); +void pwrOff(); #define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown) #define EEPROM_MASSSTORAGE() (0) diff --git a/src/lcd.cpp b/src/lcd.cpp index 7d0a97cb1..c9a72df91 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -851,37 +851,34 @@ void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att) } #if ROTARY_ENCODERS > 0 - if (idx >= SWSRC_FIRST_ROTENC_SWITCH) { - if (idx <= SWSRC_LAST_ROTENC_SWITCH) { - idx -= SWSRC_FIRST_ROTENC_SWITCH; - char suffix; - if (idx < ROTARY_ENCODERS) { - suffix = 's'; - } - else { - idx -= ROTARY_ENCODERS; - suffix = 'l'; - } - lcd_putcAtt(x+3*FW, y, suffix, att); - return lcd_putsiAtt(x, y, STR_VRENCODERS, idx, att); + else if (idx >= SWSRC_FIRST_ROTENC_SWITCH) { + idx -= SWSRC_FIRST_ROTENC_SWITCH; + char suffix = (idx & 1) ? 'l' : 's'; + lcd_putcAtt(x+3*FW, y, suffix, att); + return lcd_putsiAtt(x, y, STR_VRENCODERS, idx/2, att); + } +#endif + +#if !defined(CPUM64) + else if (idx >= SWSRC_TRAINER_SHORT) { + idx -= SWSRC_TRAINER_SHORT; + lcd_putcAtt(x+3*FW, y, (idx & 1) ? 'l' : 's', att); +#if ROTARY_ENCODERS > 0 + if (idx >= 2) { + idx -= 2; + return lcd_putsiAtt(x, y, STR_VRENCODERS, idx/2, att); + } + else +#endif + { + return lcd_putsiAtt(x, y, STR_VSWITCHES, SWSRC_TRAINER-1, att); } - idx -= 2*ROTARY_ENCODERS; } #endif if (idx > SWSRC_ON) { idx -= SWSRC_ON; char suffix = 'm'; -#if defined(CPUARM) - if (idx > SWSRC_ON) { - suffix = 's'; - idx -= SWSRC_ON; - if (idx > MAX_PSWITCH) { - suffix = 'l'; - idx -= MAX_PSWITCH; - } - } -#endif if (~att & SWCONDENSED) lcd_putcAtt(x+3*FW, y, suffix, att); } lcd_putsiAtt(x, y, STR_VSWITCHES, idx-1, att); @@ -942,7 +939,7 @@ void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags at } } -#if defined(ROTARY_ENCODERS) +#if ROTARY_ENCODERS > 0 void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att) { #if ROTARY_ENCODERS > 2 diff --git a/src/menu_general.cpp b/src/menu_general.cpp index 3bad00a62..5423eaab4 100644 --- a/src/menu_general.cpp +++ b/src/menu_general.cpp @@ -531,6 +531,58 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line) return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcmp(fn, line) < 0); } +void onSdManagerMenu(const char *result) +{ + char lfn[SD_SCREEN_FILE_LENGTH]; + + uint8_t index = m_posVert-1-s_pgOfs; + if (result == STR_SD_INFO) { + pushMenu(menuGeneralSdManagerInfo); + } + else if (result == STR_SD_FORMAT) { + displayPopup(STR_FORMATTING); + closeLogs(); +#if defined(PCBSKY9X) + Card_state = SD_ST_DATA; +#endif +#if defined(CPUARM) + audioQueue.stopSD(); +#endif + if (f_mkfs(0, 1, 0) == FR_OK) { + f_chdir("/"); + reusableBuffer.sd.offset = -1; + } + else { + s_warning = STR_SDCARD_ERROR; + } + } + else if (result == STR_DELETE_FILE) { + f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); + strcat_P(lfn, PSTR("/")); + strcat(lfn, reusableBuffer.sd.lines[index]); + f_unlink(lfn); + strncpy(statusLineMsg, reusableBuffer.sd.lines[index], 13); + strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED); + showStatusLine(); + if ((uint16_t)m_posVert == reusableBuffer.sd.count) m_posVert--; + reusableBuffer.sd.offset = s_pgOfs-1; + } +#if defined(CPUARM) + /* TODO else if (result == STR_LOAD_FILE) { + f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); + strcat(lfn, "/"); + strcat(lfn, reusableBuffer.sd.lines[index]); + s_warning = eeLoadModelSD(lfn); + } */ + else if (result == STR_PLAY_FILE) { + f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); + strcat(lfn, "/"); + strcat(lfn, reusableBuffer.sd.lines[index]); + audioQueue.playFile(lfn, PLAY_NOW); + } +#endif +} + void menuGeneralSdManager(uint8_t event) { FILINFO fno; @@ -544,11 +596,6 @@ void menuGeneralSdManager(uint8_t event) char lfn[SD_SCREEN_FILE_LENGTH]; #endif - uint8_t _event = event; - if (s_menu_count) { - event = 0; - } - SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabDiag, e_Sd, 1+reusableBuffer.sd.count); if (s_editMode > 0) @@ -585,10 +632,9 @@ void menuGeneralSdManager(uint8_t event) case EVT_KEY_LONG(KEY_ENTER): killEvents(event); - _event = 0; if (m_posVert == 0) { - s_menu[s_menu_count++] = STR_SD_INFO; - s_menu[s_menu_count++] = STR_SD_FORMAT; + MENU_ADD_ITEM(STR_SD_INFO); + MENU_ADD_ITEM(STR_SD_FORMAT); } else { #if defined(CPUARM) @@ -599,13 +645,14 @@ void menuGeneralSdManager(uint8_t event) s_menu[s_menu_count++] = STR_LOAD_FILE; } else */ if (!strcmp(ext, SOUNDS_EXT)) { - s_menu[s_menu_count++] = STR_PLAY_FILE; + MENU_ADD_ITEM(STR_PLAY_FILE); } #endif - s_menu[s_menu_count++] = STR_DELETE_FILE; - s_menu[s_menu_count++] = STR_RENAME_FILE; - s_menu[s_menu_count++] = STR_COPY_FILE; + MENU_ADD_ITEM(STR_DELETE_FILE); + MENU_ADD_ITEM(STR_RENAME_FILE); + MENU_ADD_ITEM(STR_COPY_FILE); } + menuHandler = onSdManagerMenu; break; } @@ -701,58 +748,6 @@ void menuGeneralSdManager(uint8_t event) if (!reusableBuffer.sd.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdLastPos, y, ']', attr); } } } - - if (s_menu_count) { - const char * result = displayMenu(_event); - if (result) { - uint8_t index = m_posVert-1-s_pgOfs; - if (result == STR_SD_INFO) { - pushMenu(menuGeneralSdManagerInfo); - } - else if (result == STR_SD_FORMAT) { - displayPopup(STR_FORMATTING); - closeLogs(); -#if defined(PCBSKY9X) - Card_state = SD_ST_DATA; -#endif -#if defined(CPUARM) - audioQueue.stopSD(); -#endif - if (f_mkfs(0, 1, 0) == FR_OK) { - f_chdir("/"); - reusableBuffer.sd.offset = -1; - } - else { - s_warning = STR_SDCARD_ERROR; - } - } - else if (result == STR_DELETE_FILE) { - f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); - strcat_P(lfn, PSTR("/")); - strcat(lfn, reusableBuffer.sd.lines[index]); - f_unlink(lfn); - strncpy(statusLineMsg, reusableBuffer.sd.lines[index], 13); - strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED); - showStatusLine(); - if ((uint16_t)m_posVert == reusableBuffer.sd.count) m_posVert--; - reusableBuffer.sd.offset = s_pgOfs-1; - } -#if defined(CPUARM) - /* TODO else if (result == STR_LOAD_FILE) { - f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); - strcat(lfn, "/"); - strcat(lfn, reusableBuffer.sd.lines[index]); - s_warning = eeLoadModelSD(lfn); - } - else */ if (result == STR_PLAY_FILE) { - f_getcwd(lfn, SD_SCREEN_FILE_LENGTH); - strcat(lfn, "/"); - strcat(lfn, reusableBuffer.sd.lines[index]); - audioQueue.playFile(lfn, PLAY_NOW); - } -#endif - } - } } #endif diff --git a/src/menu_model.cpp b/src/menu_model.cpp index ac8b9aa66..bed4d9439 100644 --- a/src/menu_model.cpp +++ b/src/menu_model.cpp @@ -181,6 +181,7 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, char *line = reusableBuffer.models.menu_bss[0]; memset(line, 0, MENU_LINE_LENGTH); strcpy(line, "---"); + s_menu[0] = line; } } @@ -242,18 +243,70 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, } #endif -void menuModelSelect(uint8_t event) +#if defined(NAVIGATION_MENUS) +void onModelSelectMenu(const char *result) { -#if defined(PCBSKY9X) - #define REFRESH(x) -#elif defined(PCBGRUVIN9X) && defined(SDCARD) - static bool refresh = true; - #define REFRESH(x) refresh = (x) + int8_t sub = m_posVert; + + if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) { + displayPopup(STR_LOADINGMODEL); + saveTimers(); + 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); + } + } +#if defined(ROTARY_ENCODER_NAVIGATION) + else if (result == STR_COPY_MODEL) { + s_copyMode = COPY_MODE; + s_copyTgtOfs = 0; + s_copySrcRow = -1; + } + else if (result == STR_MOVE_MODEL) { + s_copyMode = MOVE_MODE; + s_copyTgtOfs = 0; + s_copySrcRow = -1; + } +#endif +#if defined(SDCARD) + else if (result == STR_BACKUP_MODEL) { + eeCheck(true); // force writing of current model data before this is changed + s_warning = eeBackupModel(sub); + } + else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) { + if (!listSdFiles(MODELS_PATH, MODELS_EXT, sizeof(g_model.name), NULL)) { + s_warning = STR_NO_MODELS_ON_SD; + s_menu_flags = 0; + } + } +#endif + else if (result == STR_DELETE_MODEL) { + s_warning = STR_DELETEMODEL; + s_warning_type = WARNING_TYPE_CONFIRM; +#if defined(CPUARM) + s_warning_info = modelNames[sub]; #else - #define refresh event - #define REFRESH(x) + char * name = reusableBuffer.models.mainname; + eeLoadModelName(sub, name); + s_warning_info = name; +#endif + s_warning_info_len = sizeof(g_model.name); + } +#if defined(SDCARD) + else { + // The user choosed a file on SD to restore + s_warning = eeRestoreModel(sub, (char *)result); + if (!s_warning && g_eeGeneral.currModel == sub) + eeLoadModel(sub); + } +#endif +} #endif +void menuModelSelect(uint8_t event) +{ if (s_warning_result) { eeDeleteModel(m_posVert); // delete file s_warning_result = 0; @@ -261,13 +314,6 @@ void menuModelSelect(uint8_t event) event = EVT_ENTRY_UP; } -#if defined(NAVIGATION_MENUS) - uint8_t _event = event; - if (s_menu_count) { - event = 0; - } -#endif - uint8_t _event_ = (IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event) ? 0 : event); #if defined(PCBTARANIS) @@ -287,9 +333,6 @@ void menuModelSelect(uint8_t event) #if !defined(CPUARM) if (event) { eeFlush(); // flush eeprom write -#if defined(SDCARD) - REFRESH(true); -#endif } #endif @@ -400,7 +443,6 @@ void menuModelSelect(uint8_t event) s_copyMode = 0; killEvents(event); #if defined(NAVIGATION_MENUS) - _event = 0; if (g_eeGeneral.currModel != sub) { if (eeModelExists(sub)) { MENU_ADD_ITEM(STR_SELECT_MODEL); @@ -431,6 +473,7 @@ void menuModelSelect(uint8_t event) MENU_ADD_NAVIGATION_ITEM(STR_COPY_MODEL); MENU_ADD_NAVIGATION_ITEM(STR_MOVE_MODEL); } + menuHandler = onModelSelectMenu; #else if (g_eeGeneral.currModel != sub) { displayPopup(STR_LOADINGMODEL); @@ -507,12 +550,12 @@ void menuModelSelect(uint8_t event) #if defined(PCBTARANIS) lcd_puts(27*FW-(LEN_FREE-4)*FW, 0, STR_FREE); - if (refresh) reusableBuffer.models.eepromfree = EeFsGetFree(); + if (event) reusableBuffer.models.eepromfree = EeFsGetFree(); lcd_outdezAtt(20*FW, 0, reusableBuffer.models.eepromfree, 0); lcd_puts(21*FW, 0, "bytes"); // TODO translations #elif !defined(PCBSKY9X) lcd_puts(9*FW-(LEN_FREE-4)*FW, 0, STR_FREE); - if (refresh) reusableBuffer.models.eepromfree = EeFsGetFree(); + if (event) reusableBuffer.models.eepromfree = EeFsGetFree(); lcd_outdezAtt(17*FW, 0, reusableBuffer.models.eepromfree, 0); #endif @@ -558,7 +601,7 @@ void menuModelSelect(uint8_t event) lcd_outdezAtt(20*FW, y, eeModelSize(k), 0); #else char * name = reusableBuffer.models.listnames[i]; - if (refresh) eeLoadModelName(k, name); + if (event) eeLoadModelName(k, name); putsModelName(4*FW, y, name, k, 0); lcd_outdezAtt(20*FW, y, eeModelSize(k), 0); #endif @@ -570,71 +613,6 @@ void menuModelSelect(uint8_t event) lcd_rect(8, y-1, LCD_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED); } } - -#if defined(NAVIGATION_MENUS) - REFRESH(false); - - if (s_menu_count) { - const char * result = displayMenu(_event); - if (result) { - REFRESH(true); - if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) { - displayPopup(STR_LOADINGMODEL); - saveTimers(); - 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); - } - } -#if defined(ROTARY_ENCODER_NAVIGATION) - else if (result == STR_COPY_MODEL) { - s_copyMode = COPY_MODE; - s_copyTgtOfs = 0; - s_copySrcRow = -1; - } - else if (result == STR_MOVE_MODEL) { - s_copyMode = MOVE_MODE; - s_copyTgtOfs = 0; - s_copySrcRow = -1; - } -#endif -#if defined(SDCARD) - else if (result == STR_BACKUP_MODEL) { - eeCheck(true); // force writing of current model data before this is changed - s_warning = eeBackupModel(sub); - } - else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) { - if (!listSdFiles(MODELS_PATH, MODELS_EXT, sizeof(g_model.name), NULL)) { - s_warning = STR_NO_MODELS_ON_SD; - s_menu_flags = 0; - } - } -#endif - else if (result == STR_DELETE_MODEL) { - s_warning = STR_DELETEMODEL; - s_warning_type = WARNING_TYPE_CONFIRM; -#if defined(CPUARM) - s_warning_info = modelNames[sub]; -#else - char * name = reusableBuffer.models.mainname; - eeLoadModelName(sub, name); - s_warning_info = name; -#endif - s_warning_info_len = sizeof(g_model.name); - } -#if defined(SDCARD) - else { - // The user choosed a file on SD to restore - s_warning = eeRestoreModel(sub, (char *)result); - if (!s_warning && g_eeGeneral.currModel == sub) - eeLoadModel(sub); - } -#endif - } - } -#endif } void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uint8_t active) @@ -774,15 +752,26 @@ enum menuModelSetupItems { #define MODEL_SETUP_2ND_COLUMN (LCD_W-11*FW-MENUS_SCROLLBAR_WIDTH) #endif -void menuModelSetup(uint8_t event) -{ #if defined(PCBTARANIS) && defined(SDCARD) - uint8_t _event = event; - if (s_menu_count) { - event = 0; +void onModelSetupMenu(const char *result) +{ + if (result == STR_UPDATE_LIST) { + if (!listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.bitmap), NULL)) { + s_warning = STR_NO_BITMAPS_ON_SD; + s_menu_flags = 0; + } } + else { + // The user choosed a bmp file in the list + memcpy(g_model.bitmap, result, sizeof(g_model.bitmap)); + LOAD_MODEL_BITMAP(); + eeDirty(EE_MODEL); + } +} #endif +void menuModelSetup(uint8_t event) +{ // TODO this is quick & dirty, should be done in place of the return which is hidden inside MENU(...) #if defined(DSM2) if (event == EVT_KEY_LONG(KEY_EXIT)) { @@ -831,13 +820,14 @@ void menuModelSetup(uint8_t event) lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr); if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) { s_editMode = 0; - _event = 0; - if (!listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.bitmap), g_model.bitmap, LIST_NONE_SD_FILE)) { + if (listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.bitmap), g_model.bitmap, LIST_NONE_SD_FILE)) { + menuHandler = onModelSetupMenu; + } + else { s_warning = STR_NO_BITMAPS_ON_SD; s_menu_flags = 0; } } - break; #endif @@ -1223,26 +1213,6 @@ void menuModelSetup(uint8_t event) #endif // defined(PCBTARANIS) } } - -#if defined(PCBTARANIS) && defined(SDCARD) - if (s_menu_count) { - const char * result = displayMenu(_event); - if (result) { - if (result == STR_UPDATE_LIST) { - if (!listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.bitmap), NULL)) { - s_warning = STR_NO_BITMAPS_ON_SD; - s_menu_flags = 0; - } - } - else { - // The user choosed a bmp file in the list - memcpy(g_model.bitmap, result, sizeof(g_model.bitmap)); - LOAD_MODEL_BITMAP(); - eeDirty(EE_MODEL); - } - } - } -#endif } static uint8_t s_currIdx; @@ -2497,6 +2467,35 @@ static uint8_t s_copySrcCh; #define EXPO_LINE_SELECT_POS 18 #endif +#if defined(NAVIGATION_MENUS) +void onExpoMixMenu(const char *result) +{ + bool expo = (g_menuStack[g_menuStackPtr] == menuModelExposAll); + uint8_t chn = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1); + + if (result == STR_EDIT) { + pushMenu(expo ? menuModelExpoOne : menuModelMixOne); + } + else if (result == STR_INSERT_BEFORE || result == STR_INSERT_AFTER) { + if (!reachExpoMixCountLimit(expo)) { + s_currCh = chn; + if (result == STR_INSERT_AFTER) { s_currIdx++; m_posVert++; } + insertExpoMix(expo, s_currIdx); + pushMenu(expo ? menuModelExpoOne : menuModelMixOne); + } + } + else if (result == STR_COPY || result == STR_MOVE) { + s_copyMode = (result == STR_COPY ? COPY_MODE : MOVE_MODE); + s_copySrcIdx = s_currIdx; + s_copySrcCh = chn; + s_copySrcRow = m_posVert; + } + else if (result == STR_DELETE) { + deleteExpoMix(expo, s_currIdx); + } +} +#endif + void menuModelExpoMix(uint8_t expo, uint8_t event) { uint8_t sub = m_posVert; @@ -2506,13 +2505,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) uint8_t chn = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1); -#if defined(NAVIGATION_MENUS) - uint8_t _event = event; - if (s_menu_count) { - event = 0; - } -#endif - switch (event) { case EVT_ENTRY: @@ -2582,7 +2574,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) return; } else { - _event = event = 0; + event = 0; s_copyMode = 0; MENU_ADD_ITEM(STR_EDIT); MENU_ADD_ITEM(STR_INSERT_BEFORE); @@ -2590,6 +2582,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) MENU_ADD_ITEM(STR_COPY); MENU_ADD_ITEM(STR_MOVE); MENU_ADD_ITEM(STR_DELETE); + menuHandler = onExpoMixMenu; } #else if (s_currCh) { @@ -2795,34 +2788,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) } s_maxLines = cur; if (sub >= s_maxLines-1) m_posVert = s_maxLines-1; - -#if defined(NAVIGATION_MENUS) - if (s_menu_count) { - const char * result = displayMenu(_event); - if (result) { - if (result == STR_EDIT) { - pushMenu(expo ? menuModelExpoOne : menuModelMixOne); - } - else if (result == STR_INSERT_BEFORE || result == STR_INSERT_AFTER) { - if (!reachExpoMixCountLimit(expo)) { - s_currCh = chn; - if (result == STR_INSERT_AFTER) { s_currIdx++; m_posVert++; } - insertExpoMix(expo, s_currIdx); - pushMenu(expo ? menuModelExpoOne : menuModelMixOne); - } - } - else if (result == STR_COPY || result == STR_MOVE) { - s_copyMode = (result == STR_COPY ? COPY_MODE : MOVE_MODE); - s_copySrcIdx = s_currIdx; - s_copySrcCh = chn; - s_copySrcRow = sub; - } - else if (result == STR_DELETE) { - deleteExpoMix(expo, s_currIdx); - } - } - } -#endif } void menuModelExposAll(uint8_t event) @@ -3546,15 +3511,27 @@ void menuModelCustomSwitches(uint8_t event) #define MODEL_CUSTOM_FUNC_4TH_COLUMN (18*FW+2) #endif -void menuModelCustomFunctions(uint8_t event) -{ #if defined(CPUARM) && defined(SDCARD) - uint8_t _event = event; - if (s_menu_count) { - event = 0; +void onCustomFunctionsMenu(const char *result) +{ + int8_t sub = m_posVert - 1; + + if (result == STR_UPDATE_LIST) { + if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT, sizeof(g_model.funcSw[sub].param), NULL)) { + s_warning = STR_NO_SOUNDS_ON_SD; + s_menu_flags = 0; + } } + else { + // The user choosed a wav file in the list + memcpy(g_model.funcSw[sub].param.name, result, sizeof(g_model.funcSw[sub].param.name)); + eeDirty(EE_MODEL); + } +} #endif +void menuModelCustomFunctions(uint8_t event) +{ MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|3/*repeated*/}); uint8_t y; @@ -3664,8 +3641,10 @@ void menuModelCustomFunctions(uint8_t event) lcd_putsiAtt(x, y, STR_VCSWFUNC, 0, attr); if (active && event==EVT_KEY_BREAK(KEY_ENTER)) { s_editMode = 0; - _event = 0; - if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT, sizeof(sd->param.name), sd->param.name)) { + if (listSdFiles(SOUNDS_PATH, SOUNDS_EXT, sizeof(sd->param.name), sd->param.name)) { + menuHandler = onCustomFunctionsMenu; + } + else { s_warning = STR_NO_SOUNDS_ON_SD; s_menu_flags = 0; } @@ -3817,25 +3796,6 @@ void menuModelCustomFunctions(uint8_t event) } } } - -#if defined(CPUARM) && defined(SDCARD) - if (s_menu_count) { - const char * result = displayMenu(_event); - if (result) { - if (result == STR_UPDATE_LIST) { - if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT, sizeof(g_model.funcSw[sub].param), NULL)) { - s_warning = STR_NO_SOUNDS_ON_SD; - s_menu_flags = 0; - } - } - else { - // The user choosed a wav file in the list - memcpy(g_model.funcSw[sub].param.name, result, sizeof(g_model.funcSw[sub].param.name)); - eeDirty(EE_MODEL); - } - } - } -#endif } enum menuModelTelemetryItems { diff --git a/src/menus.cpp b/src/menus.cpp index 44d566725..50ff6f7fc 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -846,6 +846,7 @@ uint8_t s_menu_item = 0; uint16_t s_menu_count = 0; uint8_t s_menu_flags = 0; uint16_t s_menu_offset = 0; +void (*menuHandler)(const char *result); const char * displayMenu(uint8_t event) { const char * result = NULL; diff --git a/src/menus.h b/src/menus.h index b487963ec..e59cf16dc 100644 --- a/src/menus.h +++ b/src/menus.h @@ -278,6 +278,7 @@ void displayWarning(uint8_t event); extern uint8_t s_menu_flags; extern uint16_t s_menu_offset; const char * displayMenu(uint8_t event); + extern void (*menuHandler)(const char *result); #else #define s_menu_count 0 #endif diff --git a/src/myeeprom.h b/src/myeeprom.h index 7050b38d1..f9bbef176 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -475,7 +475,9 @@ enum Functions { FUNC_TRAINER_AIL, FUNC_INSTANT_TRIM, FUNC_PLAY_SOUND, +#if !defined(PCBTARANIS) FUNC_HAPTIC, +#endif FUNC_RESET, FUNC_VARIO, FUNC_PLAY_TRACK, @@ -951,23 +953,22 @@ enum SwitchSources { SWSRC_FIRST_MOMENT_SWITCH, SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_ON-1, +#if !defined(CPUM64) + SWSRC_TRAINER_SHORT, + SWSRC_TRAINER_LONG, +#endif + #if ROTARY_ENCODERS > 0 SWSRC_FIRST_ROTENC_SWITCH, SWSRC_LAST_ROTENC_SWITCH = SWSRC_FIRST_ROTENC_SWITCH+(2*ROTARY_ENCODERS)-1, #endif -#if defined(CPUARM) - SWSRC_FIRST_SHORT_SWITCH, - SWSRC_LAST_SHORT_SWITCH = SWSRC_FIRST_SHORT_SWITCH + MAX_PSWITCH - 1, - SWSRC_FIRST_LONG_SWITCH, - SWSRC_LAST_LONG_SWITCH = SWSRC_FIRST_LONG_SWITCH + MAX_PSWITCH - 1, -#endif - SWSRC_COUNT, SWSRC_FIRST = -SWSRC_LAST_MOMENT_SWITCH, SWSRC_LAST = SWSRC_COUNT-1, - SWSRC_OFF = -SWSRC_ON + SWSRC_OFF = -SWSRC_ON, + SWSRC_TRAINER = SWSRC_SW1-1, }; enum MixSources { diff --git a/src/opentx.cpp b/src/opentx.cpp index 253c0a4f6..dfe223d81 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -985,8 +985,8 @@ bool __getSwitch(int8_t swtch) } } else { - int16_t x = getValue(cs->v1-1); - int16_t y; + getvalue_t x = getValue(cs->v1-1); + getvalue_t y; if (s == CS_VCOMP) { y = getValue(cs->v2-1); @@ -2163,7 +2163,7 @@ tmr10ms_t lastFunctionTime[NUM_CFN] = { 0 }; #if defined(VOICE) PLAY_FUNCTION(playValue, uint8_t idx) { - int16_t val = getValue(idx); + getvalue_t val = getValue(idx); switch (idx) { case MIXSRC_FIRST_TELEM-1+TELEM_TX_VOLTAGE-1: @@ -2284,11 +2284,15 @@ PLAY_FUNCTION(playValue, uint8_t idx) } #endif +#if !defined(CPUM64) +uint8_t mSwitchDuration[1+NUM_ROTARY_ENCODERS] = { 0 }; +#define CFN_PRESSLONG_DURATION 100 +#endif + #if defined(CPUARM) uint8_t currentSpeakerVolume = 255; uint8_t requiredSpeakerVolume; uint8_t fnSwitchDuration[NUM_CFN] = { 0 }; -#define CFN_PRESSLONG_DURATION 100 inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id) { @@ -2298,7 +2302,6 @@ inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id) strcat(lfn+sizeof(SOUNDS_PATH), SOUNDS_EXT); PLAY_FILE(lfn, sd->func==FUNC_BACKGND_MUSIC ? PLAY_BACKGROUND : 0, id); } - #endif void evalFunctions() @@ -2327,27 +2330,30 @@ void evalFunctions() MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i); uint8_t momentary = 0; -#if defined(CPUARM) +#if !defined(CPUM64) #define MOMENTARY_START_TEST() ( (momentary && !(activeSwitches & switch_mask) && active) || \ - (shortPress && !active && fnSwitchDuration[i]>0 && fnSwitchDuration[i]=CFN_PRESSLONG_DURATION) ) + (short_long==1 && !active && mSwitchDuration[mswitch]>0 && mSwitchDuration[mswitch]=CFN_PRESSLONG_DURATION) ) - uint8_t shortPress=0, longPress=0; - if (swtch > MAX_SWITCH+1+MAX_SWITCH+1+MAX_PSWITCH) { - longPress = 1; - swtch -= MAX_SWITCH+1+MAX_SWITCH+1+MAX_PSWITCH; + uint8_t short_long = 0; + uint8_t mswitch = 0; + + if (swtch == SWSRC_TRAINER_LONG) { + short_long = 2; + swtch = SWSRC_TRAINER; + mswitch = 0; } - else if (swtch > MAX_SWITCH+1+MAX_SWITCH+1) { - shortPress = 1; - swtch -= MAX_SWITCH+1+MAX_SWITCH+1; + else if (swtch == SWSRC_TRAINER_SHORT) { + short_long = 1; + swtch = SWSRC_TRAINER; + mswitch = 0; } else #else - #define shortPress 0 - #define longPress 0 + #define short_long 0 #define MOMENTARY_START_TEST() (!(activeSwitches & switch_mask) && active) #endif @@ -2363,37 +2369,43 @@ void evalFunctions() bool active = getSwitch(swtch, 0); if (active) newActiveSwitches |= switch_mask; - if (momentary || longPress || shortPress) { + if (momentary || short_long) { -#if defined(CPUARM) +#if !defined(CPUM64) bool swState = active; #endif if (MOMENTARY_START_TEST()) { - active = !(activeFnSwitches & switch_mask); -#if !defined(CPUARM) - if (CFN_FUNC(sd) == FUNC_PLAY_BOTH && !active) { - momentary = 1; + if (short_long) { + active = false; + momentary = true; } - else + else { + active = !(activeFnSwitches & switch_mask); +#if !defined(CPUARM) + if (CFN_FUNC(sd) == FUNC_PLAY_BOTH && !active) { + momentary = 1; + } + else #endif - { - momentary = 0; + { + momentary = 0; + } } } else { active = (activeFnSwitches & switch_mask); momentary = 0; } -#if defined(CPUARM) - if (shortPress || longPress) { +#if !defined(CPUM64) + if (short_long) { if (swState) { - if (fnSwitchDuration[i] < 255) - fnSwitchDuration[i]++; + if (mSwitchDuration[mswitch] < 255) + mSwitchDuration[mswitch]++; } else { - fnSwitchDuration[i] = 0; + mSwitchDuration[mswitch] = 0; } } #endif @@ -2617,9 +2629,9 @@ void perOut(uint8_t mode, uint8_t tick10ms) if(g_model.swashR.type) { - int16_t vp = anas[ELE_STICK]+trims[ELE_STICK]; - int16_t vr = anas[AIL_STICK]+trims[AIL_STICK]; - int16_t vc = 0; + getvalue_t vp = anas[ELE_STICK]+trims[ELE_STICK]; + getvalue_t vr = anas[AIL_STICK]+trims[AIL_STICK]; + getvalue_t vc = 0; if (g_model.swashR.collectiveSource) vc = getValue(g_model.swashR.collectiveSource-1); @@ -2694,7 +2706,7 @@ void perOut(uint8_t mode, uint8_t tick10ms) bool sw = getSwitch(md->swtch, 1); //========== VALUE =============== - int16_t v = 0; + getvalue_t v = 0; if (mode != e_perout_mode_normal) { if (!sw || k >= NUM_STICKS || (k == THR_STICK && g_model.thrTrim)) { continue; @@ -3453,13 +3465,23 @@ void perMain() lcd_clear(); const char *warn = s_warning; + uint8_t menu = s_menu_count; if (EEPROM_MASSSTORAGE()) { menuMainView(0); } else { - g_menuStack[g_menuStackPtr](warn ? 0 : evt); + g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt); if (warn) displayWarning(evt); +#if defined(NAVIGATION_MENUS) + if (menu) { + const char * result = displayMenu(evt); + if (result) { + menuHandler(result); + putEvent(EVT_MENU_UP); + } + } +#endif } drawStatusLine(); diff --git a/src/opentx.h b/src/opentx.h index f63fcd50c..b69d5281f 100644 --- a/src/opentx.h +++ b/src/opentx.h @@ -569,33 +569,34 @@ enum CswFunctions { #define SPLASH_TIMEOUT (4*100) // 4 seconds #endif -#define EVT_KEY_MASK(e) ((e) & 0x0f) +#define EVT_KEY_MASK(e) ((e) & 0x1f) -#define _MSK_KEY_BREAK 0x20 -#define _MSK_KEY_REPT 0x40 -#define _MSK_KEY_FIRST 0x60 -#define _MSK_KEY_LONG 0x80 +#define _MSK_KEY_BREAK 0x20 +#define _MSK_KEY_REPT 0x40 +#define _MSK_KEY_FIRST 0x60 +#define _MSK_KEY_LONG 0x80 -#define EVT_KEY_BREAK(key) ((key)|_MSK_KEY_BREAK) -#define EVT_KEY_FIRST(key) ((key)|_MSK_KEY_FIRST) -#define EVT_KEY_REPT(key) ((key)|_MSK_KEY_REPT) -#define EVT_KEY_LONG(key) ((key)|_MSK_KEY_LONG) +#define EVT_KEY_BREAK(key) ((key)|_MSK_KEY_BREAK) +#define EVT_KEY_FIRST(key) ((key)|_MSK_KEY_FIRST) +#define EVT_KEY_REPT(key) ((key)|_MSK_KEY_REPT) +#define EVT_KEY_LONG(key) ((key)|_MSK_KEY_LONG) -#define IS_KEY_BREAK(evt) (((evt)&0xf0) == _MSK_KEY_BREAK) -#define IS_KEY_FIRST(evt) (((evt)&0xf0) == _MSK_KEY_FIRST) -#define IS_KEY_LONG(evt) (((evt)&0xf0) == _MSK_KEY_LONG) +#define IS_KEY_BREAK(evt) (((evt)&0xe0) == _MSK_KEY_BREAK) +#define IS_KEY_FIRST(evt) (((evt)&0xe0) == _MSK_KEY_FIRST) +#define IS_KEY_LONG(evt) (((evt)&0xe0) == _MSK_KEY_LONG) -#define EVT_ENTRY 0xbf -#define EVT_ENTRY_UP 0xbe +#define EVT_ENTRY 0xbf +#define EVT_ENTRY_UP 0xbe +#define EVT_MENU_UP 0xbd #if defined(PCBTARANIS) -#define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER) -#define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER) + #define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER) + #define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER) #else -#define EVT_ROTARY_BREAK 0xcf -#define EVT_ROTARY_LONG 0xce -#define EVT_ROTARY_LEFT 0xdf -#define EVT_ROTARY_RIGHT 0xde + #define EVT_ROTARY_BREAK 0xcf + #define EVT_ROTARY_LONG 0xce + #define EVT_ROTARY_LEFT 0xdf + #define EVT_ROTARY_RIGHT 0xde #endif #if defined(PCBTARANIS) diff --git a/src/sky9x/board_sky9x.h b/src/sky9x/board_sky9x.h index cee591c22..b267b5068 100644 --- a/src/sky9x/board_sky9x.h +++ b/src/sky9x/board_sky9x.h @@ -241,7 +241,7 @@ void eepromInit(); void rotencInit(); void rotencEnd(); -#if defined(ROTARY_ENCODERS) +#if ROTARY_ENCODERS > 0 #define rotencDown() (!(PIOB->PIO_PDSR & 0x40)) #else #define rotencDown() 0 diff --git a/src/sky9x/keys_driver.cpp b/src/sky9x/keys_driver.cpp index 099cd6b48..512f57e4e 100644 --- a/src/sky9x/keys_driver.cpp +++ b/src/sky9x/keys_driver.cpp @@ -122,7 +122,7 @@ void readKeysAndTrims() { register uint32_t i; -#if defined(ROTARY_ENCODERS) +#if ROTARY_ENCODERS > 0 keys[BTN_REa].input(rotencDown(), BTN_REa); #endif diff --git a/src/taranis/usbd_usr.cpp b/src/taranis/usbd_usr.cpp index 2a7657aa9..736b0e5a4 100644 --- a/src/taranis/usbd_usr.cpp +++ b/src/taranis/usbd_usr.cpp @@ -113,6 +113,7 @@ void USBD_USR_DeviceConnected (void) f_mount(0, 0); // unmount SD } + eeCheck(true); usb_connected = 1; } @@ -127,6 +128,9 @@ void USBD_USR_DeviceDisconnected (void) { usb_connected = 0; + eeReadAll(); + eeLoadModel(g_eeGeneral.currModel); + sdInit(); } diff --git a/src/translations/de.h b/src/translations/de.h index 7d3006b45..b8cde7ab8 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -2,7 +2,7 @@ * Authors (alphabetical order) * - Andre Bernet * - Andreas Weitl - * - Hellmut Renz + * - Helmut Renz * - Thomas Husterer * * opentx is based on code named @@ -135,12 +135,14 @@ #endif #if defined(AUDIO) - #define TR_SOUND "Play Sound" + #define TR_SOUND "Spiel T\203ne" #else - #define TR_SOUND "Piep\0 " + #define TR_SOUND "Spiel\0 " #endif -#if defined(HAPTIC) +#if defined(PCBTARANIS) + #define TR_HAPTIC +#elif defined(HAPTIC) #define TR_HAPTIC "Haptic\0 " #else #define TR_HAPTIC "[Haptic]\0 " @@ -148,16 +150,16 @@ #if defined(VOICE) #if defined(PCBSKY9X) - #define TR_PY_TRACK "Play\0 " + #define TR_PY_TRACK "Spiel\0 " #else - #define TR_PLAY_TRACK "Play Track" + #define TR_PLAY_TRACK "Sag Text\0 " #endif - #define TR_PLAY_BOTH "Play Beide" - #define TR_PLAY_VALUE "Play Wert\0" + #define TR_PLAY_BOTH "Sag Beide " + #define TR_PLAY_VALUE "Sag Wert\0 " #else - #define TR_PLAY_TRACK "[Play Trk]" - #define TR_PLAY_BOTH "[Play Bth]" - #define TR_PLAY_VALUE "[Play Val]" + #define TR_PLAY_TRACK "[Sag Text]" + #define TR_PLAY_BOTH "[SagBeide]" + #define TR_PLAY_VALUE "[Sag Wert]" #endif #define TR_CFN_VOLUME "Lautst\201rke" @@ -194,7 +196,7 @@ #if defined(FRSKY) #define TR_FSW_RESET_TELEM TR("Telem", "Telemetry") #else - #define TR_FSW_RESET_TELEM + #define TR_FSW_RESET_TELEM #endif #if ROTARY_ENCODERS > 0 @@ -203,7 +205,7 @@ #define TR_FSW_RESET_ROTENC #endif -#define TR_VFSWRESET TR("Tmr1\0""Tmr2\0""All\0 " TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, "Timer 1 ""Timer 2 ""Alles " TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC) +#define TR_VFSWRESET TR("Tmr1\0""Tmr2\0""Alle\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, "Timer 1 ""Timer 2 ""Alle Tmr." TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC) #define LEN_FUNCSOUNDS "\006" #define TR_FUNCSOUNDS "Piep1\0""Piep2\0""Piep3\0""Warn1\0""Warn2\0""Cheep\0""Ring\0 ""SciFi\0""Robot\0""Chirp\0""Tada\0 ""Crickt""Siren\0""AlmClk""Ratata""Tick\0 " @@ -253,7 +255,7 @@ #define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0" #define LEN_VKEYS "\005" -#define TR_VKEYS " Menu"" Exit""Enter"" Page"" Plus""Minus" +#define TR_VKEYS TR(" Menu"" Exit"" Down"" Up""Right"" Left", " Menu"" Exit""Enter"" Page"" Plus""Minus") #define LEN_VRENCODERS "\003" #define TR_VRENCODERS "DGa""DGb" //Digitalgeber a und b = Drehgeber @@ -330,7 +332,7 @@ #define TR_MOVINGMODEL "Schiebe Modell" #define TR_LOADINGMODEL "Lade Modell..." #define TR_NAME "Name" -#define TR_MODELNAME "Model Name" +#define TR_MODELNAME "Modell Name" #define TR_PHASENAME "Phase Name" #define TR_MIXNAME "Mix Name" #define TR_EXPONAME "Expo Name" @@ -383,13 +385,13 @@ #define TR_MIXER "MISCHER" #define TR_CV "KV" #define TR_GV "GV" -#define TR_ACHANNEL "A\004channel" +#define TR_ACHANNEL "A\004Kanal " #define TR_RANGE INDENT"Skala" #define TR_BAR "Streifen" #define TR_ALARM INDENT"Alarm" #define TR_USRDATA "Daten" #define TR_BLADES INDENT"Bl\201tter" -#define TR_SCREEN "Schirm" +#define TR_SCREEN "Bild " #define TR_SOUND_LABEL "Ton" #define TR_LENGTH INDENT"Dauer" #define TR_SPKRPITCH INDENT"Tonh\203he" @@ -403,11 +405,11 @@ #define TR_MEMORYWARNING INDENT"Speicher voll" #define TR_ALARMWARNING INDENT"Ton aus" #define TR_RENAVIG "Drehgeb. Navig." -#define TR_THROTTLEREVERSE TR("Gasumkehrung?","Gasumkehrung?") +#define TR_THROTTLEREVERSE TR("Vollgas hinten?", "Vollgas hinten?") #define TR_MINUTEBEEP TR(INDENT"Minute",INDENT"Jede Minute") #define TR_BEEPCOUNTDOWN INDENT"Countdown" #define TR_PERSISTENT TR(INDENT"Dauernd",INDENT"Dauernd ein") -#define TR_BACKLIGHT_LABEL "LCD Licht" +#define TR_BACKLIGHT_LABEL "LCD Licht an" #define TR_BLDELAY INDENT"Dauer" #define TR_BLONBRIGHTNESS INDENT"An Helligkeit" #define TR_BLOFFBRIGHTNESS INDENT"Aus Helligkeit" diff --git a/src/translations/en.h b/src/translations/en.h index 756df56f1..28cc0593f 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -152,7 +152,9 @@ #define TR_SOUND "Beep\0 " #endif -#if defined(HAPTIC) +#if defined(PCBTARANIS) + #define TR_HAPTIC +#elif defined(HAPTIC) #define TR_HAPTIC "Haptic\0 " #else #define TR_HAPTIC "[Haptic]\0 " @@ -209,8 +211,10 @@ #define TR_FSW_RESET_TELEM #endif -#if ROTARY_ENCODERS > 0 - #define TR_FSW_RESET_ROTENC TR("R.Enc", "RotEnc ") +#if ROTARY_ENCODERS == 2 + #define TR_FSW_RESET_ROTENC TR("REa\0 ""REb\0 ", "RotEnc A\0""RotEnc B\0") +#elif ROTARY_ENCODERS == 1 + #define TR_FSW_RESET_ROTENC TR("R.Enc", "RotEnc\0 ") #else #define TR_FSW_RESET_ROTENC #endif @@ -265,7 +269,7 @@ #define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0" #define LEN_VKEYS "\005" -#define TR_VKEYS " Menu"" Exit"" Down"" Up""Right"" Left" +#define TR_VKEYS TR(" Menu"" Exit"" Down"" Up""Right"" Left", " Menu"" Exit""Enter"" Page"" Plus""Minus") #define LEN_VRENCODERS "\003" #define TR_VRENCODERS "REa""REb" diff --git a/src/view_main.cpp b/src/view_main.cpp index fe6728a3f..5dabe4dba 100644 --- a/src/view_main.cpp +++ b/src/view_main.cpp @@ -594,8 +594,8 @@ void menuMainView(uint8_t event) // Switches for (uint8_t i=0; i<8; i++) { - uint8_t sw; - int16_t val; + getvalue_t sw; + getvalue_t val; // TODO simplify this + reuse code in checkSwitches() + Menu MODELSETUP switch(i) { case 5: diff --git a/src/view_telemetry.cpp b/src/view_telemetry.cpp index 403d965b1..e2a8503ab 100644 --- a/src/view_telemetry.cpp +++ b/src/view_telemetry.cpp @@ -368,7 +368,7 @@ void menuTelemetryFrsky(uint8_t event) s_frsky_view = 0; break; - case EVT_KEY_FIRST(KEY_MENU): + case EVT_KEY_FIRST(KEY_ENTER): resetTelemetry(); break; } @@ -384,14 +384,14 @@ void menuTelemetryFrsky(uint8_t event) for (int8_t i=3; i>=0; i--) { FrSkyBarData & bar = screen.bars[i]; uint8_t source = bar.source; - int16_t barMin = convertTelemValue(source, bar.barMin); - int16_t barMax = convertTelemValue(source, 255-bar.barMax); + getvalue_t barMin = convertTelemValue(source, bar.barMin); + getvalue_t barMax = convertTelemValue(source, 255-bar.barMax); if (source && barMax > barMin) { uint8_t y = barHeight+6+i*(barHeight+6); lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0); lcd_rect(25, y, 101, barHeight+2); - int16_t value = getValue(MIXSRC_FIRST_TELEM+source-2); - int16_t threshold = 0; + getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-2); + getvalue_t threshold = 0; uint8_t thresholdX = 0; if (source <= TELEM_TM2) threshold = 0;