Merge pull request #3111 from opentx/projectkk2glider/issue_2469_lua_keys_for_next_part1
Re #2469: part1: Menu system renaming of variables and refactoring
This commit is contained in:
@@ -323,13 +323,13 @@ void evalFunctions()
|
||||
newActiveFunctions |= (1 << FUNCTION_INSTANT_TRIM);
|
||||
if (!isFunctionActive(FUNCTION_INSTANT_TRIM)) {
|
||||
#if defined(GUI)
|
||||
if (g_menuStack[0] == menuMainView
|
||||
if (menuHandlers[0] == menuMainView
|
||||
#if defined(FRSKY) && !defined(PCBFLAMENCO) && !defined(PCBHORUS)
|
||||
|| g_menuStack[0] == menuTelemetryFrsky
|
||||
|| menuHandlers[0] == menuTelemetryFrsky
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
|| g_menuStack[0] == menuMainViewChannelsMonitor
|
||||
|| g_menuStack[0] == menuChannelsView
|
||||
|| menuHandlers[0] == menuMainViewChannelsMonitor
|
||||
|| menuHandlers[0] == menuChannelsView
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
|
||||
@@ -88,7 +88,7 @@ enum EnumTabDiag {
|
||||
e_Calib
|
||||
};
|
||||
|
||||
const MenuFuncP menuTabGeneral[] PROGMEM = {
|
||||
const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralSetup,
|
||||
CASE_SDCARD(menuGeneralSdManager)
|
||||
CASE_CPUARM(menuGeneralCustomFunctions)
|
||||
|
||||
@@ -79,24 +79,24 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==1 ? INVERS : 0));
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
|
||||
static uint16_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
|
||||
lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
|
||||
lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(menuVerticalPosition==1 ? INVERS : 0));
|
||||
#else
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (menuVerticalPosition==1 ? INVERS : 0));
|
||||
#endif
|
||||
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
if (menuVerticalPosition==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
lcd_putsLeft(6*FH+1, STR_CURRENT_CALIB);
|
||||
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ;
|
||||
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
|
||||
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (menuVerticalPosition==2 ? INVERS : 0)) ;
|
||||
if (menuVerticalPosition==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
@@ -109,7 +109,7 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
#endif
|
||||
|
||||
lcd_putsLeft(TEMP_CALIB_POS, STR_TEMP_CALIB);
|
||||
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (m_posVert==TEMP_CALIB_MENU_POS ? INVERS : 0)) ;
|
||||
if (m_posVert==TEMP_CALIB_MENU_POS) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (menuVerticalPosition==TEMP_CALIB_MENU_POS ? INVERS : 0)) ;
|
||||
if (menuVerticalPosition==TEMP_CALIB_MENU_POS) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) CASE_BLUETOOTH(0)});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void onSdManagerMenu(const char *result)
|
||||
{
|
||||
TCHAR lfn[_MAX_LFN+1];
|
||||
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
uint8_t index = menuVerticalPosition-1-menuVerticalOffset;
|
||||
if (result == STR_SD_INFO) {
|
||||
pushMenu(menuGeneralSdManagerInfo);
|
||||
}
|
||||
@@ -91,8 +91,8 @@ void onSdManagerMenu(const char *result)
|
||||
strncpy(statusLineMsg, reusableBuffer.sdmanager.lines[index], 13);
|
||||
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
|
||||
showStatusLine();
|
||||
if ((uint16_t)m_posVert == reusableBuffer.sdmanager.count) m_posVert--;
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs-1;
|
||||
if ((uint16_t)menuVerticalPosition == reusableBuffer.sdmanager.count) menuVerticalPosition--;
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset-1;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
/* TODO else if (result == STR_LOAD_FILE) {
|
||||
@@ -121,8 +121,8 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
#if defined(SDCARD)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
displayPopup(STR_FORMATTING);
|
||||
closeLogs();
|
||||
#if defined(PCBSKY9X)
|
||||
@@ -157,63 +157,63 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
{
|
||||
if (m_posVert > 0) {
|
||||
vertpos_t index = m_posVert-1-s_pgOfs;
|
||||
if (menuVerticalPosition > 0) {
|
||||
vertpos_t index = menuVerticalPosition-1-menuVerticalOffset;
|
||||
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||
s_pgOfs = 0;
|
||||
m_posVert = 1;
|
||||
menuVerticalOffset = 0;
|
||||
menuVerticalPosition = 1;
|
||||
reusableBuffer.sdmanager.offset = 65535;
|
||||
killEvents(_event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!IS_ROTARY_BREAK(_event) || m_posVert==0)
|
||||
if (!IS_ROTARY_BREAK(_event) || menuVerticalPosition==0)
|
||||
break;
|
||||
// no break;
|
||||
}
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(_event);
|
||||
if (m_posVert == 0) {
|
||||
MENU_ADD_ITEM(STR_SD_INFO);
|
||||
MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
if (menuVerticalPosition == 0) {
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
uint8_t index = menuVerticalPosition-1-menuVerticalOffset;
|
||||
// TODO duplicated code for finding extension
|
||||
char * ext = reusableBuffer.sdmanager.lines[index];
|
||||
int len = strlen(ext) - 4;
|
||||
ext += len;
|
||||
/* TODO if (!strcasecmp(ext, MODELS_EXT)) {
|
||||
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
||||
popupMenuItems[popupMenuNoItems++] = STR_LOAD_FILE;
|
||||
}
|
||||
else */ if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
}
|
||||
#endif
|
||||
if (!READ_ONLY()) {
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
// MENU_ADD_ITEM(STR_RENAME_FILE); TODO: Implement
|
||||
// MENU_ADD_ITEM(STR_COPY_FILE); TODO: Implement
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
// POPUP_MENU_ADD_ITEM(STR_RENAME_FILE); TODO: Implement
|
||||
// POPUP_MENU_ADD_ITEM(STR_COPY_FILE); TODO: Implement
|
||||
}
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
if (reusableBuffer.sdmanager.offset != s_pgOfs) {
|
||||
if (s_pgOfs == 0) {
|
||||
if (reusableBuffer.sdmanager.offset != menuVerticalOffset) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
reusableBuffer.sdmanager.offset = 0;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs == reusableBuffer.sdmanager.count-7) {
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
else if (menuVerticalOffset == reusableBuffer.sdmanager.count-7) {
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], 6*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[6], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
reusableBuffer.sdmanager.lines[6][SD_SCREEN_FILE_LENGTH+1] = 1;
|
||||
@@ -242,7 +242,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
|
||||
bool isfile = !(fno.fattrib & AM_DIR);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
@@ -254,7 +254,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.sdmanager.offset == s_pgOfs) {
|
||||
else if (reusableBuffer.sdmanager.offset == menuVerticalOffset) {
|
||||
for (int8_t i=6; i>=0; i--) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) {
|
||||
@@ -266,7 +266,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[5]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[6])) {
|
||||
memset(reusableBuffer.sdmanager.lines[6], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[6], fn);
|
||||
@@ -284,12 +284,12 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
lcdNextPos = 0;
|
||||
uint8_t attr = (m_posVert-1-s_pgOfs == i ? BSS|INVERS : BSS);
|
||||
uint8_t attr = (menuVerticalPosition-1-menuVerticalOffset == i ? BSS|INVERS : BSS);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcdDrawChar(0, y, '[', attr); }
|
||||
lcdDrawText(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
|
||||
@@ -137,7 +137,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
|
||||
if ((m_posVert==ITEM_SETUP_DATE+1 || m_posVert==ITEM_SETUP_TIME+1) &&
|
||||
if ((menuVerticalPosition==ITEM_SETUP_DATE+1 || menuVerticalPosition==ITEM_SETUP_TIME+1) &&
|
||||
(s_editMode>0) &&
|
||||
(event==EVT_KEY_FIRST(KEY_ENTER) || event==EVT_KEY_FIRST(KEY_EXIT) || IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event))) {
|
||||
// set the date and time into RTC chip
|
||||
@@ -146,8 +146,8 @@ void menuGeneralSetup(uint8_t event)
|
||||
#endif
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
g_eeGeneral.fai = true;
|
||||
storageDirty(EE_GENERAL);
|
||||
}
|
||||
@@ -155,11 +155,11 @@ void menuGeneralSetup(uint8_t event)
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX+1, {0, CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) CASE_BUZZER(0) CASE_VOICE(0) CASE_CPUARM(0) CASE_CPUARM(0) CASE_CPUARM(0) 0, CASE_AUDIO(0) CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_CAPACITY(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_CPUARM(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) CASE_CPUARM(0) CASE_CPUARM(0) IF_FAI_CHOICE(0) CASE_MAVLINK(0) CASE_CPUARM(0) 0, COL_TX_MODE, 1/*to force edit mode*/});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
@@ -169,7 +169,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_DATE);
|
||||
lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr);
|
||||
@@ -200,7 +200,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_TIME);
|
||||
lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0, 2);
|
||||
@@ -224,11 +224,11 @@ void menuGeneralSetup(uint8_t event)
|
||||
#if defined(BATTGRAPH)
|
||||
case ITEM_SETUP_BATT_RANGE:
|
||||
lcd_putsLeft(y, STR_BATTERY_RANGE);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
lcdDrawChar(lcdLastPos, y, '-');
|
||||
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && s_editMode>0) {
|
||||
if (m_posHorz==0)
|
||||
if (menuHorizontalPosition==0)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMin, -50, g_eeGeneral.vBatMax+29); // min=4.0V
|
||||
else
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMax, g_eeGeneral.vBatMin-29, +40); // max=16.0V
|
||||
|
||||
@@ -60,11 +60,11 @@ void menuGeneralTrainer(uint8_t event)
|
||||
uint8_t chan = channel_order(i);
|
||||
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
||||
|
||||
putsMixerSource(0, y, MIXSRC_Rud-1+chan, (m_posVert==i && CURSOR_ON_LINE()) ? INVERS : 0);
|
||||
putsMixerSource(0, y, MIXSRC_Rud-1+chan, (menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0);
|
||||
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
|
||||
attr = ((m_posVert==i && m_posHorz==j) ? blink : 0);
|
||||
attr = ((menuVerticalPosition==i && menuHorizontalPosition==j) ? blink : 0);
|
||||
|
||||
switch(j) {
|
||||
case 0:
|
||||
@@ -86,12 +86,12 @@ void menuGeneralTrainer(uint8_t event)
|
||||
y += FH;
|
||||
}
|
||||
|
||||
attr = (m_posVert==5) ? blink : 0;
|
||||
attr = (menuVerticalPosition==5) ? blink : 0;
|
||||
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER);
|
||||
lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
|
||||
|
||||
attr = (m_posVert==6) ? INVERS : 0;
|
||||
attr = (menuVerticalPosition==6) ? INVERS : 0;
|
||||
if (attr) s_editMode = 0;
|
||||
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+1+6*FH, STR_CAL, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
|
||||
@@ -99,7 +99,7 @@ uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, cons
|
||||
}
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
|
||||
const MenuFuncP menuTabModel[] PROGMEM = {
|
||||
const MenuHandlerFunc menuTabModel[] PROGMEM = {
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
@@ -122,7 +122,7 @@ static int8_t s_copySrcRow;
|
||||
static int8_t s_copyTgtOfs;
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define editNameCursorPos m_posHorz
|
||||
#define editNameCursorPos menuHorizontalPosition
|
||||
#else
|
||||
static uint8_t editNameCursorPos = 0;
|
||||
#endif
|
||||
|
||||
@@ -117,7 +117,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_editMode <= 0)
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
if (s_editMode == 1 && crv.custom)
|
||||
s_editMode = 2;
|
||||
else
|
||||
@@ -125,10 +125,10 @@ void menuModelCurveOne(uint8_t event)
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (s_editMode <= 0) {
|
||||
if (int8_t(++m_posHorz) > 4)
|
||||
m_posHorz = -4;
|
||||
if (int8_t(++menuHorizontalPosition) > 4)
|
||||
menuHorizontalPosition = -4;
|
||||
for (uint8_t i=0; i<crv.points; i++)
|
||||
crv.crv[i] = (i-(crv.points/2)) * int8_t(m_posHorz) * 50 / (crv.points-1);
|
||||
crv.crv[i] = (i-(crv.points/2)) * int8_t(menuHorizontalPosition) * 50 / (crv.points-1);
|
||||
storageDirty(EE_MODEL);
|
||||
killEvents(event);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_editMode > 0) {
|
||||
if (--s_editMode == 0)
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
@@ -146,7 +146,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
/* CASE_EVT_ROTARY_LEFT */
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
if (s_editMode==1 && m_posHorz>0) m_posHorz--;
|
||||
if (s_editMode==1 && menuHorizontalPosition>0) menuHorizontalPosition--;
|
||||
if (s_editMode <= 0) {
|
||||
if (crv.custom) {
|
||||
moveCurve(s_curveChan, -crv.points+2);
|
||||
@@ -164,7 +164,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
/* CASE_EVT_ROTARY_RIGHT */
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
if (s_editMode==1 && m_posHorz<(crv.points-1)) m_posHorz++;
|
||||
if (s_editMode==1 && menuHorizontalPosition<(crv.points-1)) menuHorizontalPosition++;
|
||||
if (s_editMode <= 0) {
|
||||
if (!crv.custom) {
|
||||
moveCurve(s_curveChan, crv.points-2, crv.points);
|
||||
@@ -194,7 +194,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
DrawCurve();
|
||||
|
||||
if (s_editMode>0) {
|
||||
uint8_t i = m_posHorz;
|
||||
uint8_t i = menuHorizontalPosition;
|
||||
point_t point = getPoint(i);
|
||||
|
||||
if (s_editMode==1 || !BLINK_ON_PHASE) {
|
||||
@@ -232,7 +232,7 @@ void menuModelCurvesAll(uint8_t event)
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES);
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert - 1;
|
||||
int8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
@@ -249,7 +249,7 @@ void menuModelCurvesAll(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
uint8_t attr = (sub == k ? INVERS : 0);
|
||||
#if defined(GVARS) && defined(PCBSTD)
|
||||
if (k >= MAX_CURVES) {
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
#if defined(CPUARM) && defined(SDCARD)
|
||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert - 1;
|
||||
int sub = menuVerticalPosition - 1;
|
||||
CustomFunctionData * cfn;
|
||||
uint8_t eeFlags;
|
||||
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions) {
|
||||
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
|
||||
cfn = &g_model.customFn[sub];
|
||||
eeFlags = EE_MODEL;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
}
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
popupMenuFlags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -87,7 +87,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
|
||||
{
|
||||
int8_t sub = m_posVert - 1;
|
||||
int8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
@@ -97,12 +97,12 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
CustomFunctionData *cfn = &functions[k];
|
||||
uint8_t func = CFN_FUNC(cfn);
|
||||
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 && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
switch (j) {
|
||||
case 0:
|
||||
@@ -129,7 +129,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
}
|
||||
else {
|
||||
j = 4; // skip other fields
|
||||
if (sub==k && m_posHorz > 0) {
|
||||
if (sub==k && menuHorizontalPosition > 0) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
@@ -245,11 +245,11 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
menuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
popupMenuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
popupMenuFlags = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -90,7 +90,7 @@ void menuModelPhaseOne(uint8_t event)
|
||||
#define PHASE_ONE_FIRST_LINE (1+1*FH)
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
@@ -98,7 +98,7 @@ void menuModelPhaseOne(uint8_t event)
|
||||
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
int8_t i = k + s_pgOfs;
|
||||
int8_t i = k + menuVerticalOffset;
|
||||
if (s_currIdx == 0 && i>=ITEM_MODEL_PHASE_SWITCH) i += ITEM_MODEL_PHASE_FADE_IN-ITEM_MODEL_PHASE_SWITCH;
|
||||
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
#else
|
||||
@@ -116,8 +116,8 @@ void menuModelPhaseOne(uint8_t event)
|
||||
case ITEM_MODEL_PHASE_TRIMS:
|
||||
lcd_putsLeft(y, STR_TRIMS);
|
||||
for (uint8_t t=0; t<NUM_STICKS; t++) {
|
||||
putsTrimMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, m_posHorz==t ? attr : 0);
|
||||
if (attr && m_posHorz==t && ((editMode>0) || p1valdiff)) {
|
||||
putsTrimMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) {
|
||||
int16_t v = getRawTrimValue(s_currIdx, t);
|
||||
if (v < TRIM_EXTENDED_MAX) v = TRIM_EXTENDED_MAX;
|
||||
v = checkIncDec(event, v, TRIM_EXTENDED_MAX, TRIM_EXTENDED_MAX+MAX_FLIGHT_MODES-1, EE_MODEL);
|
||||
@@ -133,8 +133,8 @@ void menuModelPhaseOne(uint8_t event)
|
||||
case ITEM_MODEL_PHASE_ROTARY_ENCODERS:
|
||||
lcd_putsLeft(y, STR_ROTARY_ENCODER);
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, m_posHorz==t ? attr : 0);
|
||||
if (attr && m_posHorz==t && ((editMode>0) || p1valdiff)) {
|
||||
putsRotaryEncoderMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) {
|
||||
int16_t v = flightModeAddress(s_currIdx)->rotaryEncoders[t];
|
||||
if (v < ROTARY_ENCODER_MAX) v = ROTARY_ENCODER_MAX;
|
||||
v = checkIncDec(event, v, ROTARY_ENCODER_MAX, ROTARY_ENCODER_MAX+MAX_FLIGHT_MODES-1, EE_MODEL);
|
||||
@@ -163,7 +163,7 @@ void menuModelPhaseOne(uint8_t event)
|
||||
default:
|
||||
{
|
||||
uint8_t idx = i-ITEM_MODEL_PHASE_GV1;
|
||||
uint8_t posHorz = m_posHorz;
|
||||
uint8_t posHorz = menuHorizontalPosition;
|
||||
if (attr && posHorz > 0 && s_currIdx==0) posHorz++;
|
||||
|
||||
putsStrIdx(INDENT_WIDTH, y, STR_GV, idx+1);
|
||||
@@ -223,7 +223,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, 1+MAX_FLIGHT_MODES+1);
|
||||
|
||||
int8_t sub = m_posVert - 1;
|
||||
int8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
switch (event) {
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
@@ -244,7 +244,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
uint8_t att;
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
#if defined(CPUARM)
|
||||
int8_t y = 1 + (1+i-s_pgOfs)*FH;
|
||||
int8_t y = 1 + (1+i-menuVerticalOffset)*FH;
|
||||
if (y<1*FH+1 || y>(LCD_LINES-1)*FH+1) continue;
|
||||
#else
|
||||
uint8_t y = 1 + (i+1)*FH;
|
||||
@@ -275,7 +275,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (s_pgOfs != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
|
||||
if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
|
||||
#endif
|
||||
|
||||
lcd_putsLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
|
||||
|
||||
@@ -50,7 +50,7 @@ void menuModelHeli(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, 7);
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
for (uint8_t i=0; i<6; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
|
||||
@@ -44,7 +44,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, STR_FLMODE);
|
||||
|
||||
uint8_t posHorz = m_posHorz;
|
||||
uint8_t posHorz = menuHorizontalPosition;
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool expoMenu = (x==EXPO_ONE_2ND_COLUMN-5*FW);
|
||||
@@ -301,7 +301,7 @@ void menuModelExpoOne(uint8_t event)
|
||||
|
||||
SET_SCROLLBAR_X(EXPO_ONE_2ND_COLUMN+10*FW);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1;
|
||||
|
||||
@@ -470,9 +470,9 @@ void menuModelMixOne(uint8_t event)
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
#if defined(CURVES)
|
||||
if ((m_posVert == MIX_FIELD_TRIM && md2->srcRaw > NUM_STICKS) || (m_posVert == MIX_FIELD_CURVE && md2->curveMode == MODE_CURVE))
|
||||
if ((menuVerticalPosition == MIX_FIELD_TRIM && md2->srcRaw > NUM_STICKS) || (menuVerticalPosition == MIX_FIELD_CURVE && md2->curveMode == MODE_CURVE))
|
||||
#else
|
||||
if (m_posVert == MIX_FIELD_TRIM && md2->srcRaw > NUM_STICKS)
|
||||
if (menuVerticalPosition == MIX_FIELD_TRIM && md2->srcRaw > NUM_STICKS)
|
||||
#endif
|
||||
SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, 0, CASE_CURVES(0) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/})
|
||||
else
|
||||
@@ -485,7 +485,7 @@ void menuModelMixOne(uint8_t event)
|
||||
lcdDrawSolidVerticalLine(MENU_COLUMN2_X-4, FH+1, LCD_H-FH-1);
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
for (uint8_t k=0; k<MENU_COLUMNS*(LCD_LINES-1); k++) {
|
||||
@@ -504,7 +504,7 @@ void menuModelMixOne(uint8_t event)
|
||||
int8_t i = k;
|
||||
#else
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
int8_t i = k + s_pgOfs;
|
||||
int8_t i = k + menuVerticalOffset;
|
||||
#endif
|
||||
|
||||
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
@@ -541,12 +541,12 @@ void menuModelMixOne(uint8_t event)
|
||||
uint8_t not_stick = (md2->srcRaw > NUM_STICKS);
|
||||
int8_t carryTrim = -md2->carryTrim;
|
||||
lcd_putsColumnLeft(COLUMN_X, y, STR_TRIM);
|
||||
lcdDrawTextAtIndex((not_stick ? COLUMN_X+MIXES_2ND_COLUMN : COLUMN_X+6*FW-3), y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, m_posHorz==0 ? attr : 0);
|
||||
if (attr && m_posHorz==0 && (not_stick || editMode>0)) md2->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
|
||||
lcdDrawTextAtIndex((not_stick ? COLUMN_X+MIXES_2ND_COLUMN : COLUMN_X+6*FW-3), y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==0 && (not_stick || editMode>0)) md2->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
|
||||
if (!not_stick) {
|
||||
lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, STR_DREX);
|
||||
menu_lcd_onoff(COLUMN_X+MIXES_2ND_COLUMN+DREX_CHBOX_OFFSET, y, !md2->noExpo, m_posHorz==1 ? attr : 0);
|
||||
if (attr && m_posHorz==1 && editMode>0) md2->noExpo = !checkIncDecModel(event, !md2->noExpo, 0, 1);
|
||||
menu_lcd_onoff(COLUMN_X+MIXES_2ND_COLUMN+DREX_CHBOX_OFFSET, y, !md2->noExpo, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==1 && editMode>0) md2->noExpo = !checkIncDecModel(event, !md2->noExpo, 0, 1);
|
||||
}
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
@@ -574,9 +574,9 @@ void menuModelMixOne(uint8_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, PSTR("Diff"), m_posHorz==0 ? attr : 0);
|
||||
md2->curveParam = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN+5*FW, y, curveParam, -100, 100, LEFT|(m_posHorz==1 ? attr : 0), 0, editMode>0 ? event : 0);
|
||||
if (attr && editMode>0 && m_posHorz==0) {
|
||||
lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, PSTR("Diff"), menuHorizontalPosition==0 ? attr : 0);
|
||||
md2->curveParam = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN+5*FW, y, curveParam, -100, 100, LEFT|(menuHorizontalPosition==1 ? attr : 0), 0, editMode>0 ? event : 0);
|
||||
if (attr && editMode>0 && menuHorizontalPosition==0) {
|
||||
int8_t tmp = 0;
|
||||
CHECK_INCDEC_MODELVAR(event, tmp, -1, 1);
|
||||
if (tmp != 0) {
|
||||
@@ -664,7 +664,7 @@ static uint8_t s_copySrcCh;
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onExpoMixMenu(const char *result)
|
||||
{
|
||||
bool expo = (g_menuStack[g_menuStackPtr] == menuModelExposAll);
|
||||
bool expo = (menuHandlers[menuLevel] == menuModelExposAll);
|
||||
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
|
||||
|
||||
if (result == STR_EDIT) {
|
||||
@@ -673,7 +673,7 @@ void onExpoMixMenu(const char *result)
|
||||
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++; }
|
||||
if (result == STR_INSERT_AFTER) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
}
|
||||
@@ -682,7 +682,7 @@ void onExpoMixMenu(const char *result)
|
||||
s_copyMode = (result == STR_COPY ? COPY_MODE : MOVE_MODE);
|
||||
s_copySrcIdx = s_currIdx;
|
||||
s_copySrcCh = chn;
|
||||
s_copySrcRow = m_posVert;
|
||||
s_copySrcRow = menuVerticalPosition;
|
||||
}
|
||||
else if (result == STR_DELETE) {
|
||||
deleteExpoMix(expo, s_currIdx);
|
||||
@@ -745,7 +745,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
|
||||
void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
{
|
||||
uint8_t sub = m_posVert;
|
||||
uint8_t sub = menuVerticalPosition;
|
||||
|
||||
if (s_editMode > 0)
|
||||
s_editMode = 0;
|
||||
@@ -786,7 +786,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
} while (s_copyTgtOfs != 0);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
m_posVert = s_copySrcRow;
|
||||
menuVerticalPosition = s_copySrcRow;
|
||||
s_copyTgtOfs = 0;
|
||||
}
|
||||
s_copyMode = 0;
|
||||
@@ -830,13 +830,13 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
else {
|
||||
event = 0;
|
||||
s_copyMode = 0;
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_MOVE);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onExpoMixMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onExpoMixMenu;
|
||||
}
|
||||
#else
|
||||
if (s_currCh) {
|
||||
@@ -855,7 +855,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
if (s_copyMode && !s_copyTgtOfs) {
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
s_currCh = chn;
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; m_posVert++; }
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
@@ -880,7 +880,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
copyExpoMix(expo, s_currIdx);
|
||||
if (IS_ROTARY_RIGHT(event) || key==KEY_DOWN) s_currIdx++;
|
||||
else if (sub-s_pgOfs >= 6) s_pgOfs++;
|
||||
else if (sub-menuVerticalOffset >= 6) menuVerticalOffset++;
|
||||
}
|
||||
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
|
||||
// delete the mix
|
||||
@@ -903,16 +903,16 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
|
||||
SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? e_InputsAll : e_MixAll, s_maxLines);
|
||||
|
||||
sub = m_posVert;
|
||||
sub = menuVerticalPosition;
|
||||
s_currCh = 0;
|
||||
uint8_t cur = 1;
|
||||
uint8_t i = 0;
|
||||
|
||||
for (uint8_t ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
|
||||
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
|
||||
coord_t y = MENU_HEADER_HEIGHT-FH+1+(cur-s_pgOfs)*FH;
|
||||
coord_t y = MENU_HEADER_HEIGHT-FH+1+(cur-menuVerticalOffset)*FH;
|
||||
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
|
||||
if (s_pgOfs < cur && cur-s_pgOfs < LCD_LINES) {
|
||||
if (menuVerticalOffset < cur && cur-menuVerticalOffset < LCD_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(0, y, MIXSRC_Rud+ch-1, 0);
|
||||
}
|
||||
@@ -923,19 +923,19 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
uint8_t mixCnt = 0;
|
||||
do {
|
||||
if (s_copyMode) {
|
||||
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < 8 && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && menuVerticalOffset < cur && cur-menuVerticalOffset < 8 && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcdDrawRect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
if (s_currIdx == i) {
|
||||
sub = m_posVert = cur;
|
||||
sub = menuVerticalPosition = cur;
|
||||
s_currCh = ch;
|
||||
}
|
||||
}
|
||||
else if (sub == cur) {
|
||||
s_currIdx = i;
|
||||
}
|
||||
if (s_pgOfs < cur && cur-s_pgOfs < 8) {
|
||||
if (menuVerticalOffset < cur && cur-menuVerticalOffset < 8) {
|
||||
uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||
if (expo) {
|
||||
ed->weight = GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, event);
|
||||
@@ -973,7 +973,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
}
|
||||
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
|
||||
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
|
||||
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < LCD_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && menuVerticalOffset < cur && cur-menuVerticalOffset < LCD_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
@@ -987,7 +987,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
attr = INVERS;
|
||||
}
|
||||
}
|
||||
if (s_pgOfs < cur && cur-s_pgOfs < LCD_LINES) {
|
||||
if (menuVerticalOffset < cur && cur-menuVerticalOffset < LCD_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(0, y, MIXSRC_Rud+ch-1, attr);
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
}
|
||||
}
|
||||
s_maxLines = cur;
|
||||
if (sub >= s_maxLines-1) m_posVert = s_maxLines-1;
|
||||
if (sub >= s_maxLines-1) menuVerticalPosition = s_maxLines-1;
|
||||
}
|
||||
|
||||
void menuModelExposAll(uint8_t event)
|
||||
|
||||
@@ -104,7 +104,7 @@ enum LimitsItems {
|
||||
|
||||
void menuModelLimits(uint8_t event)
|
||||
{
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
if (sub < NUM_CHNOUT) {
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||
@@ -121,8 +121,8 @@ void menuModelLimits(uint8_t event)
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, 0});
|
||||
#endif
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
LimitData *ld = limitAddress(sub);
|
||||
ld->revert = !ld->revert;
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -130,16 +130,16 @@ void menuModelLimits(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
if (k==NUM_CHNOUT) {
|
||||
// last line available - add the "copy trim menu" line
|
||||
uint8_t attr = (sub==NUM_CHNOUT) ? INVERS : 0;
|
||||
lcdDrawText(CENTER_OFS, y, STR_TRIMS2OFFSETS, s_noHi ? 0 : attr);
|
||||
lcdDrawText(CENTER_OFS, y, STR_TRIMS2OFFSETS, NO_HIGHLIGHT() ? 0 : attr);
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
killEvents(event);
|
||||
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void menuModelLimits(uint8_t event)
|
||||
putsChn(0, y, k+1, 0);
|
||||
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
|
||||
@@ -100,7 +100,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
|
||||
SUBMENU_NOTITLE(LS_FIELD_COUNT, {0, 0, 1, 0 /*, 0...*/});
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
INCDEC_DECLARE_VARS(EE_MODEL);
|
||||
|
||||
@@ -108,7 +108,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + s_pgOfs;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t cstate = lswFamily(cs->func);
|
||||
switch(i) {
|
||||
@@ -169,9 +169,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
v2_max = 122;
|
||||
}
|
||||
else if (cstate == LS_FAMILY_EDGE) {
|
||||
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, m_posHorz==0 ? attr : 0, m_posHorz==1 ? attr : 0);
|
||||
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, menuHorizontalPosition==0 ? attr : 0, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (s_editMode <= 0) continue;
|
||||
if (attr && m_posHorz==1) {
|
||||
if (attr && menuHorizontalPosition==1) {
|
||||
CHECK_INCDEC_MODELVAR(event, cs->v3, -1, 222 - cs->v2);
|
||||
break;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
|
||||
coord_t y = 0;
|
||||
uint8_t k = 0;
|
||||
int8_t sub = m_posVert - 1;
|
||||
int8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
@@ -264,7 +264,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
y = 1 + (i+1)*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
LogicalSwitchData * cs = lswAddress(k);
|
||||
|
||||
// CSW name
|
||||
@@ -325,12 +325,12 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
|
||||
|
||||
uint8_t k = 0;
|
||||
int8_t sub = m_posVert - 1;
|
||||
horzpos_t horz = m_posHorz;
|
||||
int8_t sub = menuVerticalPosition - 1;
|
||||
horzpos_t horz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t attr1 = (horz==1 ? attr : 0);
|
||||
uint8_t attr2 = (horz==2 ? attr : 0);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onModelSelectMenu(const char *result)
|
||||
{
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) {
|
||||
selectModel(sub);
|
||||
@@ -64,7 +64,7 @@ void onModelSelectMenu(const char *result)
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
|
||||
POPUP_WARNING(STR_NO_MODELS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
popupMenuFlags = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -82,7 +82,7 @@ void onModelSelectMenu(const char *result)
|
||||
else {
|
||||
// The user choosed a file on SD to restore
|
||||
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
|
||||
if (!s_warning && g_eeGeneral.currModel == sub) {
|
||||
if (!warningText && g_eeGeneral.currModel == sub) {
|
||||
eeLoadModel(sub);
|
||||
}
|
||||
}
|
||||
@@ -92,9 +92,9 @@ void onModelSelectMenu(const char *result)
|
||||
|
||||
void menuModelSelect(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
eeDeleteModel(m_posVert); // delete file
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ void menuModelSelect(uint8_t event)
|
||||
_event_ -= KEY_EXIT;
|
||||
}
|
||||
|
||||
int8_t oldSub = m_posVert;
|
||||
int8_t oldSub = menuVerticalPosition;
|
||||
|
||||
check_submenu_simple(_event_, MAX_MODELS-1);
|
||||
|
||||
@@ -123,13 +123,13 @@ void menuModelSelect(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
m_posVert = sub = g_eeGeneral.currModel;
|
||||
if (sub >= LCD_LINES-1) s_pgOfs = sub-LCD_LINES+2;
|
||||
menuVerticalPosition = sub = g_eeGeneral.currModel;
|
||||
if (sub >= LCD_LINES-1) menuVerticalOffset = sub-LCD_LINES+2;
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
storageCheck(true);
|
||||
@@ -149,7 +149,7 @@ void menuModelSelect(uint8_t event)
|
||||
}
|
||||
else {
|
||||
s_copyMode = 0;
|
||||
m_posVert = g_eeGeneral.currModel;
|
||||
menuVerticalPosition = g_eeGeneral.currModel;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -161,7 +161,7 @@ void menuModelSelect(uint8_t event)
|
||||
break;
|
||||
}
|
||||
else if (!s_copyMode) {
|
||||
m_posVert = sub = g_eeGeneral.currModel;
|
||||
menuVerticalPosition = sub = g_eeGeneral.currModel;
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
}
|
||||
@@ -170,11 +170,11 @@ void menuModelSelect(uint8_t event)
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_copyMode) {
|
||||
sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
|
||||
sub = menuVerticalPosition = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
|
||||
s_copyMode = 0;
|
||||
}
|
||||
else if (m_posVert != g_eeGeneral.currModel) {
|
||||
m_posVert = g_eeGeneral.currModel;
|
||||
else if (menuVerticalPosition != g_eeGeneral.currModel) {
|
||||
menuVerticalPosition = g_eeGeneral.currModel;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
@@ -235,27 +235,27 @@ void menuModelSelect(uint8_t event)
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
if (g_eeGeneral.currModel != sub) {
|
||||
if (eeModelExists(sub)) {
|
||||
MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
}
|
||||
else {
|
||||
#if defined(SDCARD)
|
||||
MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
#else
|
||||
selectModel(sub);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
}
|
||||
menuHandler = onModelSelectMenu;
|
||||
popupMenuHandler = onModelSelectMenu;
|
||||
#else
|
||||
if (g_eeGeneral.currModel != sub) {
|
||||
selectModel(sub);
|
||||
@@ -295,7 +295,7 @@ void menuModelSelect(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
if (s_copyMode) {
|
||||
int8_t next_ofs = s_copyTgtOfs + oldSub - m_posVert;
|
||||
int8_t next_ofs = s_copyTgtOfs + oldSub - menuVerticalPosition;
|
||||
if (next_ofs == MAX_MODELS || next_ofs == -MAX_MODELS)
|
||||
next_ofs = 0;
|
||||
|
||||
@@ -310,7 +310,7 @@ void menuModelSelect(uint8_t event)
|
||||
s_copyMode = 0;
|
||||
}
|
||||
next_ofs = 0;
|
||||
m_posVert = sub;
|
||||
menuVerticalPosition = sub;
|
||||
}
|
||||
s_copyTgtOfs = next_ofs;
|
||||
}
|
||||
@@ -333,7 +333,7 @@ void menuModelSelect(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
lcdDrawNumber(3*FW+2, y, k+1, LEADING0+((!s_copyMode && sub==k) ? INVERS : 0), 2);
|
||||
|
||||
@@ -364,11 +364,11 @@ void menuModelSelect(uint8_t event)
|
||||
putsModelName(4*FW, y, name, k, 0);
|
||||
lcdDrawNumber(20*FW, y, eeModelSize(k), 0);
|
||||
#endif
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+s_pgOfs!=(vertpos_t)sub))
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub))
|
||||
lcdDrawChar(1, y, '*');
|
||||
}
|
||||
|
||||
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
|
||||
if (s_copyMode && (vertpos_t)sub==i+menuVerticalOffset) {
|
||||
lcdDrawFilledRect(9, y, MODELSEL_W-1-9, 7);
|
||||
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
}
|
||||
|
||||
@@ -160,12 +160,12 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
TITLE(STR_MENUSETUP);
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW) {
|
||||
@@ -195,11 +195,11 @@ void menuModelSetup(uint8_t event)
|
||||
unsigned int timerIdx = (k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0));
|
||||
TimerData * timer = &g_model.timers[timerIdx];
|
||||
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
{
|
||||
int8_t timerMode = timer->mode;
|
||||
@@ -285,11 +285,11 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
else {
|
||||
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timer->mode, SWSRC_FIRST, TMRMODE_COUNT+SWSRC_LAST-1/*SWSRC_None removed*/, isSwitchAvailableInTimers);
|
||||
break;
|
||||
@@ -326,12 +326,12 @@ void menuModelSetup(uint8_t event)
|
||||
#if defined(CPUM64)
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, attr, event);
|
||||
#else
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, m_posHorz<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_RESET_BTN, m_posHorz>0 && !s_noHi ? attr : 0);
|
||||
if (attr && m_posHorz>0) {
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
|
||||
}
|
||||
@@ -399,11 +399,11 @@ void menuModelSetup(uint8_t event)
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
g_model.switchWarningEnable ^= (1 << m_posHorz);
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (m_posHorz < NUM_SWITCHES-1) {
|
||||
g_model.switchWarningEnable ^= (1 << m_posHorz);
|
||||
if (menuHorizontalPosition < NUM_SWITCHES-1) {
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
@@ -416,8 +416,8 @@ void menuModelSetup(uint8_t event)
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (m_posHorz == NUM_SWITCHES-1) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
if (menuHorizontalPosition == NUM_SWITCHES-1) {
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
@@ -446,14 +446,14 @@ void menuModelSetup(uint8_t event)
|
||||
c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*(i+1)));
|
||||
states >>= 1;
|
||||
}
|
||||
if (line && (m_posHorz == i)) {
|
||||
if (line && (menuHorizontalPosition == i)) {
|
||||
attr = BLINK;
|
||||
if (swactive)
|
||||
attr |= INVERS;
|
||||
}
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
|
||||
#if !defined(CPUM64)
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (m_posHorz == NUM_SWITCHES-1 && !s_noHi) ? line : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? line : 0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@@ -464,13 +464,13 @@ void menuModelSetup(uint8_t event)
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
|
||||
// TODO flash saving, \001 not needed in STR_RETA123
|
||||
coord_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
|
||||
lcdDrawTextAtIndex(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && CURSOR_ON_LINE())) ? INVERS : 0 ) );
|
||||
lcdDrawTextAtIndex(x, y, STR_RETA123, i, ((menuHorizontalPosition==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && CURSOR_ON_LINE())) ? INVERS : 0 ) );
|
||||
}
|
||||
if (attr && CURSOR_ON_CELL) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff) {
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
@@ -498,13 +498,13 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_MODE:
|
||||
lcd_putsLeft(y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -540,12 +540,12 @@ void menuModelSetup(uint8_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcd_putsLeft(y, STR_CHANNELRANGE);
|
||||
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (m_posHorz==0 ? attr : 0));
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawChar(lcdLastPos, y, '-');
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount);
|
||||
break;
|
||||
@@ -573,13 +573,13 @@ void menuModelSetup(uint8_t event)
|
||||
if (IS_MODULE_PPM(moduleIdx)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, moduleData.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
@@ -593,7 +593,7 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
|
||||
if (IS_MODULE_XJT(moduleIdx) && IS_D8_RX(moduleIdx)) {
|
||||
xOffsetBind = 0;
|
||||
@@ -650,18 +650,18 @@ void menuModelSetup(uint8_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcd_putsLeft(y, TR_FAILSAFE);
|
||||
if (IS_MODULE_XJT(moduleIdx)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, m_posHorz==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr) {
|
||||
if (moduleData.failsafeMode != FAILSAFE_CUSTOM)
|
||||
m_posHorz = 0;
|
||||
if (m_posHorz==0) {
|
||||
menuHorizontalPosition = 0;
|
||||
if (menuHorizontalPosition==0) {
|
||||
if (editMode>0 || p1valdiff) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.failsafeMode, FAILSAFE_LAST);
|
||||
if (checkIncDec_Ret) SEND_FAILSAFE_NOW(moduleIdx);
|
||||
}
|
||||
}
|
||||
else if (m_posHorz==1) {
|
||||
else if (menuHorizontalPosition==1) {
|
||||
s_editMode = 0;
|
||||
if (moduleData.failsafeMode==FAILSAFE_CUSTOM && event==EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
g_moduleIdx = moduleIdx;
|
||||
@@ -680,15 +680,15 @@ void menuModelSetup(uint8_t event)
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_MODEL_PPM1_PROTOCOL:
|
||||
lcd_putsLeft(y, NO_INDENT(STR_PROTO));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, m_posHorz<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, menuHorizontalPosition<=0 ? attr : 0);
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz!=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, menuHorizontalPosition!=0 ? attr : 0);
|
||||
}
|
||||
else if (m_posHorz>0 && attr) {
|
||||
else if (menuHorizontalPosition>0 && attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && (editMode>0 || p1valdiff || (!IS_PPM_PROTOCOL(protocol) && !IS_DSM2_PROTOCOL(protocol)))) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.protocol, PROTO_MAX-1);
|
||||
break;
|
||||
@@ -705,12 +705,12 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_PPM2_PROTOCOL:
|
||||
lcd_putsLeft(y, PSTR("Port2"));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, m_posHorz<=0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (m_posHorz<=0 ? attr : 0));
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0));
|
||||
lcdDrawChar(lcdLastPos, y, '-');
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, g_model.moduleData[1].channelsStart+8+g_model.moduleData[1].channelsCount, LEFT | (m_posHorz!=0 ? attr : 0));
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, g_model.moduleData[1].channelsStart+8+g_model.moduleData[1].channelsCount, LEFT | (menuHorizontalPosition!=0 ? attr : 0));
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[1].channelsStart, 32-8-g_model.moduleData[1].channelsCount);
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(1);
|
||||
@@ -726,12 +726,12 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_PPM2_PARAMS:
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.moduleData[1].ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.moduleData[1].ppmDelay*50)+300, (menuHorizontalPosition < 0 || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (menuHorizontalPosition < 0 || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].ppmFrameLength, -20, 35);
|
||||
break;
|
||||
@@ -751,12 +751,12 @@ void menuModelSetup(uint8_t event)
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
@@ -771,19 +771,19 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
else if (IS_DSM2_PROTOCOL(protocol) || IS_PXX_PROTOCOL(protocol)) {
|
||||
if (attr && m_posHorz > 1) {
|
||||
if (attr && menuHorizontalPosition > 1) {
|
||||
REPEAT_LAST_CURSOR_MOVE(); // limit 3 column row to 2 colums (Rx_Num and RANGE fields)
|
||||
}
|
||||
lcd_putsLeft(y, STR_RXNUM);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (m_posHorz<=0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && (m_posHorz==0 && (editMode>0 || p1valdiff))) {
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (menuHorizontalPosition<=0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && (menuHorizontalPosition==0 && (editMode>0 || p1valdiff))) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[0], 99);
|
||||
}
|
||||
#if defined(PXX)
|
||||
if (protocol == PROTO_PXX) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_SYNCMENU, m_posHorz!=0 ? attr : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_SYNCMENU, menuHorizontalPosition!=0 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
if (attr && m_posHorz>0 && editMode>0) {
|
||||
if (attr && menuHorizontalPosition>0 && editMode>0) {
|
||||
// send reset code
|
||||
newFlag = MODULE_BIND;
|
||||
}
|
||||
@@ -792,8 +792,8 @@ void menuModelSetup(uint8_t event)
|
||||
#endif
|
||||
#if defined(DSM2)
|
||||
if (IS_DSM2_PROTOCOL(protocol)) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_MODULE_RANGE, m_posHorz!=0 ? attr : 0);
|
||||
moduleFlag[0] = (attr && m_posHorz>0 && editMode>0) ? MODULE_RANGECHECK : 0; // [MENU] key toggles range check mode
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_MODULE_RANGE, menuHorizontalPosition!=0 ? attr : 0);
|
||||
moduleFlag[0] = (attr && menuHorizontalPosition>0 && editMode>0) ? MODULE_RANGECHECK : 0; // [MENU] key toggles range check mode
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -819,8 +819,8 @@ void menuModelFailsafe(uint8_t event)
|
||||
uint8_t ch = 0;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && s_editMode) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
|
||||
START_NO_HIGHLIGHT();
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition];
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
@@ -832,7 +832,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
|
||||
#define COL_W (LCD_W)
|
||||
const uint8_t SLIDER_W = 90;
|
||||
ch = 8 * (m_posVert / 8);
|
||||
ch = 8 * (menuVerticalPosition / 8);
|
||||
|
||||
lcd_putsCenter(0*FH, FAILSAFESET);
|
||||
lcdInvertLine(0);
|
||||
@@ -850,7 +850,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
|
||||
if (ch < g_model.moduleData[g_moduleIdx].channelsStart || ch >= NUM_CHANNELS(g_moduleIdx) + g_model.moduleData[g_moduleIdx].channelsStart)
|
||||
val = 0;
|
||||
else if (s_editMode && m_posVert == ch)
|
||||
else if (s_editMode && menuVerticalPosition == ch)
|
||||
val = channelOutputs[ch];
|
||||
else
|
||||
val = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
@@ -859,7 +859,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch && !s_noHi) {
|
||||
if (menuVerticalPosition == ch && !NO_HIGHLIGHT()) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode)
|
||||
flags |= BLINK;
|
||||
|
||||
@@ -284,11 +284,11 @@ void menuModelSensor(uint8_t event)
|
||||
|
||||
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, 0, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), LEFT);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
|
||||
for (int j=0; j<k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
||||
@@ -318,10 +318,10 @@ void menuModelSensor(uint8_t event)
|
||||
case SENSOR_FIELD_ID:
|
||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||
lcd_putsLeft(y, STR_ID);
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(m_posHorz==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(m_posHorz==1 ? attr : 0));
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->id, 0xffff);
|
||||
break;
|
||||
@@ -487,7 +487,7 @@ void menuModelSensor(uint8_t event)
|
||||
|
||||
void onSensorMenu(const char *result)
|
||||
{
|
||||
uint8_t index = m_posVert - 1 - ITEM_TELEMETRY_SENSOR1;
|
||||
uint8_t index = menuVerticalPosition - 1 - ITEM_TELEMETRY_SENSOR1;
|
||||
|
||||
if (index < MAX_SENSORS) {
|
||||
if (result == STR_EDIT) {
|
||||
@@ -497,9 +497,9 @@ void onSensorMenu(const char *result)
|
||||
delTelemetryIndex(index);
|
||||
index += 1;
|
||||
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
|
||||
m_posVert += 1;
|
||||
menuVerticalPosition += 1;
|
||||
else
|
||||
m_posVert = 1+ITEM_TELEMETRY_NEW_SENSOR;
|
||||
menuVerticalPosition = 1+ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
@@ -524,8 +524,8 @@ void onSensorMenu(const char *result)
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
@@ -534,7 +534,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
@@ -548,7 +548,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
||||
@@ -590,10 +590,10 @@ void menuModelTelemetry(uint8_t event)
|
||||
s_currIdx = index;
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onSensorMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onSensorMenu;
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
pushMenu(menuModelSensor);
|
||||
@@ -663,10 +663,10 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_A1_RANGE:
|
||||
case ITEM_TELEMETRY_A2_RANGE:
|
||||
lcd_putsLeft(y, STR_RANGE);
|
||||
putsTelemetryChannelValue(TELEM_COL2, y, dest, 255-channel.offset, (m_posHorz<=0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcdDrawTextAtIndex(lcdLastPos, y, STR_VTELEMUNIT, channel.type, m_posHorz!=0 ? attr : 0);
|
||||
putsTelemetryChannelValue(TELEM_COL2, y, dest, 255-channel.offset, (menuHorizontalPosition<=0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcdDrawTextAtIndex(lcdLastPos, y, STR_VTELEMUNIT, channel.type, menuHorizontalPosition!=0 ? attr : 0);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (m_posHorz == 0) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint16_t ratio = checkIncDec(event, channel.ratio, 0, 256, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (ratio == 127 && channel.multiplier > 0) {
|
||||
@@ -700,13 +700,13 @@ void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
uint8_t alarm = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), m_posHorz<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0) | LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
putsTelemetryChannelValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0) | LEFT);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
uint8_t t;
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
t = ALARM_LEVEL(ch, alarm);
|
||||
channel.alarms_level = (channel.alarms_level & ~(3<<(2*alarm))) + (checkIncDecModel(event, t, 0, 3) << (2*alarm));
|
||||
@@ -735,12 +735,12 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1;
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), m_posHorz<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawChar(TELEM_COL2+4*FW, y, '<');
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(m_posHorz!=0 ? attr : 0), 3);
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(menuHorizontalPosition!=0 ? attr : 0), 3);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].level, -3, 2); // circular (saves flash)
|
||||
break;
|
||||
@@ -815,10 +815,10 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_LIMIT);
|
||||
#if defined(PCBSTD)
|
||||
lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (m_posHorz==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -15, +15);
|
||||
break;
|
||||
@@ -828,12 +828,12 @@ void menuModelTelemetry(uint8_t event)
|
||||
}
|
||||
}
|
||||
#else
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0));
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (menuHorizontalPosition<=0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==3) ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7);
|
||||
break;
|
||||
@@ -861,7 +861,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
|
||||
if (newScreenType != oldScreenType) {
|
||||
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
|
||||
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));
|
||||
@@ -926,29 +926,29 @@ void menuModelTelemetry(uint8_t event)
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
#if defined(CPUARM)
|
||||
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
|
||||
putsMixerSource(TELEM_COL1, y, barSource, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
#else
|
||||
lcdDrawTextAtIndex(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL1, y, STR_VTELEMCHNS, barSource, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
putsTelemetryChannelValue(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannelValue(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannelValue(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannelValue(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
#endif
|
||||
else if (attr && m_posHorz>0) {
|
||||
m_posHorz = 0;
|
||||
else if (attr && menuHorizontalPosition>0) {
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
#if defined(CPUARM)
|
||||
bar.source = CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, barSource, MIXSRC_LAST_TELEM, isSourceAvailable);
|
||||
@@ -985,7 +985,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
#endif
|
||||
{
|
||||
for (uint8_t c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
uint8_t cellAttr = (m_posHorz==c ? attr : 0);
|
||||
uint8_t cellAttr = (menuHorizontalPosition==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
uint8_t pos[] = {INDENT_WIDTH, TELEM_COL2};
|
||||
#if defined(CPUARM)
|
||||
@@ -1000,7 +1000,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (attr && m_posHorz == NUM_LINE_ITEMS) {
|
||||
if (attr && menuHorizontalPosition == NUM_LINE_ITEMS) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ void menuModelTemplates(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, e_Templates, 1+TMPL_COUNT);
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
if (sub < TMPL_COUNT) {
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
applyTemplate(sub);
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void menuModelTemplates(uint8_t event)
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1;
|
||||
uint8_t k = 0;
|
||||
for (uint8_t i=0; i<LCD_LINES-1 && k<TMPL_COUNT; i++) {
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
lcdDrawNumber(3*FW, y, k, (sub==k ? INVERS : 0)|LEADING0, 2);
|
||||
lcdDrawTextAtIndex(4*FW, y, STR_VTEMPLATES, k, (sub==k ? INVERS : 0));
|
||||
y+=FH;
|
||||
|
||||
+15
-15
@@ -36,43 +36,43 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
MenuFuncP g_menuStack[5];
|
||||
MenuHandlerFunc menuHandlers[5];
|
||||
uint8_t menuEvent = 0;
|
||||
uint8_t g_menuPos[4];
|
||||
uint8_t g_menuStackPtr = 0;
|
||||
uint8_t menuVerticalPositions[4];
|
||||
uint8_t menuLevel = 0;
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
assert(g_menuStackPtr>0);
|
||||
g_menuStackPtr = g_menuStackPtr-1;
|
||||
assert(menuLevel>0);
|
||||
menuLevel = menuLevel-1;
|
||||
menuEvent = EVT_ENTRY_UP;
|
||||
}
|
||||
|
||||
void chainMenu(MenuFuncP newMenu)
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
}
|
||||
|
||||
void pushMenu(MenuFuncP newMenu)
|
||||
void pushMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killEvents(KEY_ENTER);
|
||||
|
||||
if (g_menuStackPtr == 0) {
|
||||
if (menuLevel == 0) {
|
||||
if (newMenu == menuGeneralSetup)
|
||||
g_menuPos[0] = 1;
|
||||
menuVerticalPositions[0] = 1;
|
||||
if (newMenu == menuModelSelect)
|
||||
g_menuPos[0] = 0;
|
||||
menuVerticalPositions[0] = 0;
|
||||
}
|
||||
else {
|
||||
g_menuPos[g_menuStackPtr] = m_posVert;
|
||||
menuVerticalPositions[menuLevel] = menuVerticalPosition;
|
||||
}
|
||||
|
||||
g_menuStackPtr++;
|
||||
menuLevel++;
|
||||
|
||||
assert(g_menuStackPtr < DIM(g_menuStack));
|
||||
assert(menuLevel < DIM(menuHandlers));
|
||||
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
}
|
||||
|
||||
|
||||
+51
-48
@@ -37,8 +37,6 @@
|
||||
#ifndef _MENUS_H_
|
||||
#define _MENUS_H_
|
||||
|
||||
#define NO_HI_LEN 25
|
||||
|
||||
#define MENUS_SCROLLBAR_WIDTH 0
|
||||
#define MENU_COLUMNS 1
|
||||
#define COLUMN_X 0
|
||||
@@ -58,33 +56,37 @@ typedef uint8_t check_event_t;
|
||||
extern tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
extern vertpos_t s_pgOfs;
|
||||
extern uint8_t s_noHi;
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
extern vertpos_t menuVerticalOffset;
|
||||
extern uint8_t calibrationState;
|
||||
|
||||
// Temporary no highlight
|
||||
extern uint8_t noHighlightCounter;
|
||||
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
||||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef void (*MenuFuncP)(uint8_t event);
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
typedef void (*MenuHandlerFunc)(uint8_t event);
|
||||
extern const MenuHandlerFunc menuTabModel[];
|
||||
extern const MenuHandlerFunc menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
extern uint8_t g_menuStackPtr;
|
||||
extern MenuHandlerFunc menuHandlers[5];
|
||||
extern uint8_t menuVerticalPositions[4];
|
||||
extern uint8_t menuLevel;
|
||||
extern uint8_t menuEvent;
|
||||
|
||||
/// goto given Menu, but substitute current menu in menuStack
|
||||
void chainMenu(MenuFuncP newMenu);
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
/// goto given Menu, store current menu in menuStack
|
||||
void pushMenu(MenuFuncP newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
/// return to last menu in menustack
|
||||
void popMenu();
|
||||
///deliver address of last menu which was popped from
|
||||
inline MenuFuncP lastPopMenu()
|
||||
inline MenuHandlerFunc lastPopMenu()
|
||||
{
|
||||
return g_menuStack[g_menuStackPtr+1];
|
||||
return menuHandlers[menuLevel+1];
|
||||
}
|
||||
|
||||
void drawPotsBars();
|
||||
@@ -255,8 +257,8 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#define NAVIGATION_LINE_BY_LINE 0
|
||||
#define CURSOR_ON_LINE() (0)
|
||||
|
||||
void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
|
||||
void title(const pm_char * s);
|
||||
@@ -336,11 +338,11 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const pm_char * s_warning;
|
||||
extern const pm_char * s_warning_info;
|
||||
extern uint8_t s_warning_info_len;
|
||||
extern uint8_t s_warning_result;
|
||||
extern uint8_t s_warning_type;
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
|
||||
#define MENU_X 10
|
||||
#define MENU_Y 16
|
||||
@@ -355,10 +357,10 @@ void displayWarning(uint8_t event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern void (*popupFunc)(uint8_t event);
|
||||
extern int16_t s_warning_input_value;
|
||||
extern int16_t s_warning_input_min;
|
||||
extern int16_t s_warning_input_max;
|
||||
extern uint8_t s_warning_info_flags;
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
#endif
|
||||
|
||||
#if !defined(GUI)
|
||||
@@ -370,38 +372,39 @@ void displayWarning(uint8_t event);
|
||||
#define SET_WARNING_INFO(...)
|
||||
#elif defined(CPUARM)
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
#else
|
||||
#define DISPLAY_WARNING displayWarning
|
||||
#define POPUP_WARNING(s) s_warning = s
|
||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM)
|
||||
#define POPUP_WARNING(s) warningText = s
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM)
|
||||
#define WARNING_INFO_FLAGS ZCHAR
|
||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len)
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len)
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD) || (defined(ROTARY_ENCODER_NAVIGATION) && !defined(CPUM64))
|
||||
#define NAVIGATION_MENUS
|
||||
#define MENU_ADD_ITEM(s) s_menu[s_menu_count++] = s
|
||||
#define MENU_MAX_LINES 6
|
||||
#define MENU_MAX_DISPLAY_LINES MENU_MAX_LINES
|
||||
#define POPUP_MENU_ADD_ITEM(s) popupMenuItems[popupMenuNoItems++] = s
|
||||
#define POPUP_MENU_MAX_LINES 6
|
||||
#define MENU_MAX_DISPLAY_LINES POPUP_MENU_MAX_LINES
|
||||
#if defined(SDCARD)
|
||||
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
|
||||
#else
|
||||
#define MENU_ADD_SD_ITEM(s)
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s)
|
||||
#endif
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
|
||||
extern const char *s_menu[MENU_MAX_LINES];
|
||||
extern uint16_t s_menu_count;
|
||||
extern uint8_t s_menu_flags;
|
||||
extern uint16_t s_menu_offset;
|
||||
const char * displayMenu(uint8_t event);
|
||||
extern void (*menuHandler)(const char *result);
|
||||
#define POPUP_MENU_ITEMS_FROM_BSS() (popupMenuFlags = BSS)
|
||||
extern const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
extern uint8_t popupMenuFlags;
|
||||
extern uint16_t popupMenuOffset;
|
||||
const char * displayPopupMenu(uint8_t event);
|
||||
extern void (*popupMenuHandler)(const char *result);
|
||||
#else
|
||||
#define s_menu_count 0
|
||||
#define popupMenuNoItems 0
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
@@ -440,7 +443,7 @@ void displayWarning(uint8_t event);
|
||||
#define CASE_EVT_ROTARY_RIGHT case EVT_ROTARY_RIGHT:
|
||||
void repeatLastCursorMove(uint8_t event);
|
||||
#define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else repeatLastCursorMove(event); }
|
||||
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||
#else
|
||||
#define IS_ROTARY_LEFT(evt) (0)
|
||||
#define IS_ROTARY_RIGHT(evt) (0)
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
vertpos_t s_pgOfs;
|
||||
vertpos_t menuVerticalOffset;
|
||||
int8_t s_editMode;
|
||||
uint8_t s_noHi;
|
||||
uint8_t noHighlightCounter;
|
||||
uint8_t calibrationState;
|
||||
vertpos_t m_posVert;
|
||||
horzpos_t m_posHorz;
|
||||
vertpos_t menuVerticalPosition;
|
||||
horzpos_t menuHorizontalPosition;
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
int16_t p1valdiff;
|
||||
@@ -350,10 +350,10 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
{
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
|
||||
uint8_t maxcol = MAXCOL(l_posVert);
|
||||
|
||||
@@ -441,7 +441,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (cc != curr) {
|
||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
@@ -633,7 +633,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#if defined(CPUARM)
|
||||
int linesCount = maxrow;
|
||||
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||
s_pgOfs = 0;
|
||||
menuVerticalOffset = 0;
|
||||
if (horTab) {
|
||||
linesCount = 0;
|
||||
for (int i=0; i<maxrow; i++) {
|
||||
@@ -647,13 +647,13 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (maxrow > maxLines) {
|
||||
while (1) {
|
||||
vertpos_t firstLine = 0;
|
||||
for (int numLines=0; firstLine<maxrow && numLines<s_pgOfs; firstLine++) {
|
||||
for (int numLines=0; firstLine<maxrow && numLines<menuVerticalOffset; firstLine++) {
|
||||
if (firstLine>=horTabMax || horTab[firstLine+1] != HIDDEN_ROW) {
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (l_posVert <= firstLine) {
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
}
|
||||
else {
|
||||
vertpos_t lastLine = firstLine;
|
||||
@@ -663,10 +663,10 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
}
|
||||
if (l_posVert > lastLine) {
|
||||
s_pgOfs++;
|
||||
menuVerticalOffset++;
|
||||
}
|
||||
else {
|
||||
linesCount = s_pgOfs + maxLines;
|
||||
linesCount = menuVerticalOffset + maxLines;
|
||||
for (int i=lastLine; i<maxrow; i++) {
|
||||
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||
linesCount++;
|
||||
@@ -680,32 +680,32 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
#else
|
||||
if (l_posVert<1) {
|
||||
s_pgOfs=0;
|
||||
menuVerticalOffset=0;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
if (l_posVert>maxLines+s_pgOfs) {
|
||||
s_pgOfs = l_posVert-maxLines;
|
||||
if (l_posVert>maxLines+menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert-maxLines;
|
||||
}
|
||||
else if (l_posVert<=s_pgOfs) {
|
||||
s_pgOfs = l_posVert-1;
|
||||
else if (l_posVert<=menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert-1;
|
||||
}
|
||||
}
|
||||
|
||||
m_posVert = l_posVert;
|
||||
m_posHorz = l_posHorz;
|
||||
menuVerticalPosition = l_posVert;
|
||||
menuHorizontalPosition = l_posHorz;
|
||||
#if !defined(CPUM64)
|
||||
// cosmetics on 9x
|
||||
if (s_pgOfs > 0) {
|
||||
if (menuVerticalOffset > 0) {
|
||||
l_posVert--;
|
||||
if (l_posVert == s_pgOfs && CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)) {
|
||||
s_pgOfs = l_posVert-1;
|
||||
if (l_posVert == menuVerticalOffset && CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)) {
|
||||
menuVerticalOffset = l_posVert-1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
|
||||
{
|
||||
check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
|
||||
}
|
||||
@@ -721,6 +721,6 @@ void repeatLastCursorMove(uint8_t event)
|
||||
putEvent(event);
|
||||
}
|
||||
else {
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+47
-47
@@ -36,17 +36,17 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
const pm_char * s_warning = NULL;
|
||||
const pm_char * s_warning_info;
|
||||
uint8_t s_warning_info_len;
|
||||
uint8_t s_warning_type;
|
||||
uint8_t s_warning_result = 0;
|
||||
const pm_char * warningText = NULL;
|
||||
const pm_char * warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t s_warning_info_flags = ZCHAR;
|
||||
int16_t s_warning_input_value;
|
||||
int16_t s_warning_input_min;
|
||||
int16_t s_warning_input_max;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
#endif
|
||||
|
||||
void displayBox()
|
||||
@@ -54,18 +54,18 @@ void displayBox()
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, s_warning, WARNING_LINE_LEN);
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN);
|
||||
#else
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, s_warning);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, warningText);
|
||||
#endif
|
||||
// could be a place for a s_warning_info
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void displayPopup(const pm_char * pstr)
|
||||
{
|
||||
s_warning = pstr;
|
||||
warningText = pstr;
|
||||
displayBox();
|
||||
s_warning = NULL;
|
||||
warningText = NULL;
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
@@ -100,34 +100,34 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
||||
|
||||
void displayWarning(uint8_t event)
|
||||
{
|
||||
s_warning_result = false;
|
||||
warningResult = false;
|
||||
displayBox();
|
||||
if (s_warning_info) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, s_warning_info, s_warning_info_len, WARNING_INFO_FLAGS);
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, s_warning_type == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_BREAK:
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_warning_type == WARNING_TYPE_ASTERISK)
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
s_warning_result = true;
|
||||
warningResult = true;
|
||||
// no break
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_LONG:
|
||||
killEvents(event);
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_warning = NULL;
|
||||
s_warning_type = WARNING_TYPE_ASTERISK;
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
#if defined(CPUARM)
|
||||
default:
|
||||
if (s_warning_type != WARNING_TYPE_INPUT) break;
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
s_warning_input_value = checkIncDec(event, s_warning_input_value, s_warning_input_min, s_warning_input_max);
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
#endif
|
||||
@@ -139,28 +139,28 @@ void (*popupFunc)(uint8_t event) = NULL;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
const char *s_menu[MENU_MAX_LINES];
|
||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
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)
|
||||
uint16_t popupMenuNoItems = 0;
|
||||
uint8_t popupMenuFlags = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
void (*popupMenuHandler)(const char *result);
|
||||
const char * displayPopupMenu(uint8_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
|
||||
uint8_t display_count = min<uint8_t>(s_menu_count, MENU_MAX_LINES);
|
||||
uint8_t display_count = min<uint8_t>(popupMenuNoItems, POPUP_MENU_MAX_LINES);
|
||||
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
|
||||
lcdDrawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, s_menu[i], s_menu_flags);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i], popupMenuFlags);
|
||||
if (i == s_menu_item) lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
if (popupMenuNoItems > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, POPUP_MENU_MAX_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, POPUP_MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
@@ -173,16 +173,16 @@ const char * displayMenu(uint8_t event)
|
||||
s_menu_item--;
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (s_menu_offset > 0) {
|
||||
s_menu_offset--;
|
||||
else if (popupMenuOffset > 0) {
|
||||
popupMenuOffset--;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
s_menu_item = display_count - 1;
|
||||
#if defined(SDCARD)
|
||||
if (s_menu_count > MENU_MAX_LINES) {
|
||||
s_menu_offset = s_menu_count - display_count;
|
||||
if (popupMenuNoItems > POPUP_MENU_MAX_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - display_count;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
@@ -194,20 +194,20 @@ const char * displayMenu(uint8_t event)
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(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 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
|
||||
s_menu_item++;
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (s_menu_count > s_menu_offset + display_count) {
|
||||
s_menu_offset++;
|
||||
else if (popupMenuNoItems > popupMenuOffset + display_count) {
|
||||
popupMenuOffset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
s_menu_item = 0;
|
||||
#if defined(SDCARD)
|
||||
if (s_menu_offset) {
|
||||
s_menu_offset = 0;
|
||||
if (popupMenuOffset) {
|
||||
popupMenuOffset = 0;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
@@ -215,17 +215,17 @@ const char * displayMenu(uint8_t event)
|
||||
break;
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
result = s_menu[s_menu_item];
|
||||
result = popupMenuItems[s_menu_item];
|
||||
// no break
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
CASE_EVT_ROTARY_LONG
|
||||
killEvents(event);
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_menu_count = 0;
|
||||
popupMenuNoItems = 0;
|
||||
s_menu_item = 0;
|
||||
s_menu_flags = 0;
|
||||
s_menu_offset = 0;
|
||||
popupMenuFlags = 0;
|
||||
popupMenuOffset = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+591
-591
File diff suppressed because it is too large
Load Diff
@@ -502,11 +502,11 @@ void menuTelemetryMavlinkSetup(uint8_t event) {
|
||||
|
||||
MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, e_MavSetup, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
uint8_t sub = menuVerticalPosition - 1;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
uint8_t y = 1 + 1*FH + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
switch(k) {
|
||||
|
||||
@@ -83,7 +83,7 @@ enum mavlink_menu_ {
|
||||
};
|
||||
|
||||
//! \brief Pointer array to mavlink settings menus.
|
||||
const MenuFuncP menuTabMav[] PROGMEM = {
|
||||
const MenuHandlerFunc menuTabMav[] PROGMEM = {
|
||||
menuTelemetryMavlinkSetup
|
||||
};
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ void readTextFile(int & lines_count)
|
||||
|
||||
result = f_open(&file, s_text_file, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result == FR_OK) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-s_pgOfs<LCD_LINES-1); i++) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-menuVerticalOffset<LCD_LINES-1); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
else if (c!='\r' && current_line>=menuVerticalOffset && current_line-menuVerticalOffset<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
if (c=='\\' && escape==0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
@@ -90,7 +90,7 @@ void readTextFile(int & lines_count)
|
||||
c = 0x1D; //tab
|
||||
}
|
||||
escape = 0;
|
||||
s_text_screen[current_line-s_pgOfs][line_length++] = c;
|
||||
s_text_screen[current_line-menuVerticalOffset][line_length++] = c;
|
||||
}
|
||||
}
|
||||
if (c != '\n') {
|
||||
@@ -110,24 +110,24 @@ void menuTextView(uint8_t event)
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
s_pgOfs = 0;
|
||||
menuVerticalOffset = 0;
|
||||
lines_count = 0;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
if (s_pgOfs == 0)
|
||||
if (menuVerticalOffset == 0)
|
||||
break;
|
||||
else
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
// no break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
// if (event == EVT_KEY_BREAK(KEY_DOWN)) {
|
||||
if (s_pgOfs+LCD_LINES-1 >= lines_count)
|
||||
if (menuVerticalOffset+LCD_LINES-1 >= lines_count)
|
||||
break;
|
||||
else
|
||||
++s_pgOfs;
|
||||
++menuVerticalOffset;
|
||||
// }
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
@@ -151,7 +151,7 @@ void menuTextView(uint8_t event)
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (lines_count > LCD_LINES-1) {
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, menuVerticalOffset, lines_count, LCD_LINES-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, c
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
if (attr) value = checkIncDec(event, value, min, max, (g_menuPos[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ enum EnumTabDiag {
|
||||
e_Vers,
|
||||
};
|
||||
|
||||
const MenuFuncP menuTabGeneral[] PROGMEM = {
|
||||
const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralSetup,
|
||||
menuGeneralSdManager,
|
||||
menuGeneralCustomFunctions,
|
||||
|
||||
@@ -228,7 +228,7 @@ bool menuGeneralCalib(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
m_posVert = -1;
|
||||
menuVerticalPosition = -1;
|
||||
|
||||
if (menuEvent) {
|
||||
calibrationState = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ void getSelectionFullPath(char *lfn)
|
||||
{
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[m_posVert - s_pgOfs]);
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - menuVerticalOffset]);
|
||||
}
|
||||
|
||||
void onSdManagerMenu(const char *result)
|
||||
@@ -90,7 +90,7 @@ void onSdManagerMenu(const char *result)
|
||||
|
||||
// TODO possible buffer overflows here!
|
||||
|
||||
uint8_t index = m_posVert-s_pgOfs;
|
||||
uint8_t index = menuVerticalPosition-menuVerticalOffset;
|
||||
char *line = reusableBuffer.sdmanager.lines[index];
|
||||
|
||||
if (result == STR_SD_INFO) {
|
||||
@@ -169,8 +169,8 @@ void onSdManagerMenu(const char *result)
|
||||
|
||||
bool menuGeneralSdManager(evt_t _event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
displayPopup(STR_FORMATTING);
|
||||
closeLogs();
|
||||
audioQueue.stopSD();
|
||||
@@ -186,7 +186,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
int index = m_posVert-s_pgOfs;
|
||||
int index = menuVerticalPosition-menuVerticalOffset;
|
||||
|
||||
switch(_event) {
|
||||
case EVT_ENTRY:
|
||||
@@ -198,9 +198,9 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
if (!READ_ONLY() && s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
MENU_ADD_ITEM(STR_SD_INFO);
|
||||
MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
menuHandler = onSdManagerMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -210,9 +210,9 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (m_posVert < 0) {
|
||||
if (menuVerticalPosition < 0) {
|
||||
if (reusableBuffer.sdmanager.count > 0) {
|
||||
m_posVert = 0;
|
||||
menuVerticalPosition = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -222,8 +222,8 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
else {
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[index])) {
|
||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||
s_pgOfs = 0;
|
||||
m_posVert = 1;
|
||||
menuVerticalOffset = 0;
|
||||
menuVerticalPosition = 1;
|
||||
index = 1;
|
||||
REFRESH_FILES();
|
||||
killEvents(_event);
|
||||
@@ -242,32 +242,32 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
if (ext) {
|
||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
}
|
||||
else if (!strcasecmp(ext, TEXT_EXT)) {
|
||||
MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (!strcasecmp(ext, SCRIPTS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!READ_ONLY()) {
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (reusableBuffer.sdmanager.offset != s_pgOfs) {
|
||||
if (reusableBuffer.sdmanager.offset != menuVerticalOffset) {
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
@@ -275,15 +275,15 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
reusableBuffer.sdmanager.offset = 0;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs == reusableBuffer.sdmanager.count-NUM_BODY_LINES) {
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
else if (menuVerticalOffset == reusableBuffer.sdmanager.count-NUM_BODY_LINES) {
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = 1;
|
||||
@@ -312,7 +312,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
|
||||
bool isfile = !(fno.fattrib & AM_DIR);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
@@ -324,7 +324,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.sdmanager.offset == s_pgOfs) {
|
||||
else if (reusableBuffer.sdmanager.offset == menuVerticalOffset) {
|
||||
for (int8_t i=NUM_BODY_LINES-1; i>=0; i--) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) {
|
||||
@@ -336,7 +336,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-2]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1])) {
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], fn);
|
||||
@@ -354,7 +354,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
@@ -373,10 +373,10 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
|
||||
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext && !strcasecmp(ext, BITMAPS_EXT)) {
|
||||
if (lastBitmap != m_posVert) {
|
||||
if (lastBitmap != menuVerticalPosition) {
|
||||
if (bmpLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||
((uint32_t *)modelBitmap)[0] = 0;
|
||||
lastBitmap = m_posVert;
|
||||
lastBitmap = menuVerticalPosition;
|
||||
}
|
||||
}
|
||||
lcdDrawBitmap(LCD_W/2, (LCD_H-MODEL_BITMAP_HEIGHT)/2, modelBitmap);
|
||||
|
||||
@@ -110,7 +110,7 @@ bool menuGeneralSetup(evt_t event)
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
|
||||
if ((m_posVert==ITEM_SETUP_DATE || m_posVert==ITEM_SETUP_TIME) &&
|
||||
if ((menuVerticalPosition==ITEM_SETUP_DATE || menuVerticalPosition==ITEM_SETUP_TIME) &&
|
||||
(s_editMode>0) &&
|
||||
(event==EVT_KEY_FIRST(KEY_ENTER) || event==EVT_KEY_BREAK(KEY_ENTER) || event==EVT_KEY_LONG(KEY_ENTER) || event==EVT_KEY_FIRST(KEY_EXIT))) {
|
||||
// set the date and time into RTC chip
|
||||
@@ -119,8 +119,8 @@ bool menuGeneralSetup(evt_t event)
|
||||
#endif
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
g_eeGeneral.fai = true;
|
||||
storageDirty(EE_GENERAL);
|
||||
}
|
||||
@@ -128,11 +128,11 @@ bool menuGeneralSetup(evt_t event)
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, CASE_MAVLINK(0) 0, 0, 0, 0, 1/*to force edit mode*/ });
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
@@ -141,14 +141,14 @@ bool menuGeneralSetup(evt_t event)
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_DATE);
|
||||
LcdFlags flags = 0;
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
flags |= INVERS;
|
||||
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+YEAR_SEPARATOR_OFFSET, y, "-", flags);
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+MONTH_SEPARATOR_OFFSET, y, "-", flags);
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, t.tm_year+1900, LEFT|flags|rowattr);
|
||||
@@ -180,14 +180,14 @@ bool menuGeneralSetup(evt_t event)
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TIME);
|
||||
LcdFlags flags = 0;
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
flags |= INVERS;
|
||||
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+HOUR_SEPARATOR_OFFSET, y, ":", flags);
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+MINUTE_SEPARATOR_OFFSET, y, ":", flags);
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
if (rowattr && s_editMode>0) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0);
|
||||
@@ -213,15 +213,15 @@ bool menuGeneralSetup(evt_t event)
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BATTERY_RANGE);
|
||||
LcdFlags color = WHITE;
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
color = BLACK;
|
||||
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 90, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, color|(m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, color|(menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+20, y, "-");
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN+28, y, 120+g_eeGeneral.vBatMax, color|(m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN+28, y, 120+g_eeGeneral.vBatMax, color|(menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && s_editMode>0) {
|
||||
if (m_posHorz==0)
|
||||
if (menuHorizontalPosition==0)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMin, -50, g_eeGeneral.vBatMax+29); // min=4.0V
|
||||
else
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMax, g_eeGeneral.vBatMin-29, +40); // max=16.0V
|
||||
|
||||
@@ -64,7 +64,7 @@ bool menuGeneralTrainer(evt_t event)
|
||||
*/
|
||||
|
||||
y = MENU_CONTENT_TOP + FH;
|
||||
int sub = m_posVert + 1;
|
||||
int sub = menuVerticalPosition + 1;
|
||||
|
||||
for (int i=1; i<=NUM_STICKS; i++) {
|
||||
uint8_t chan = channel_order(i);
|
||||
@@ -74,7 +74,7 @@ bool menuGeneralTrainer(evt_t event)
|
||||
|
||||
for (int j=0; j<3; j++) {
|
||||
|
||||
attr = ((sub==i && m_posHorz==j) ? blink : 0);
|
||||
attr = ((sub==i && menuHorizontalPosition==j) ? blink : 0);
|
||||
|
||||
switch(j) {
|
||||
case 0:
|
||||
|
||||
@@ -84,7 +84,7 @@ uint8_t editDelay(const coord_t x, const coord_t y, const evt_t event, const uin
|
||||
return delay;
|
||||
}
|
||||
|
||||
const MenuFuncP menuTabModel[] = {
|
||||
const MenuHandlerFunc menuTabModel[] = {
|
||||
// menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
@@ -201,7 +201,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, evt_t event, uint
|
||||
|
||||
if (c != v) {
|
||||
name[editNameCursorPos] = v;
|
||||
storageDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
|
||||
storageDirty(menuVerticalPositions[0] == 0 ? EE_MODEL : EE_GENERAL);
|
||||
}
|
||||
|
||||
lcdDrawSizedText(x, y, name, size, flags);
|
||||
|
||||
@@ -97,14 +97,14 @@ bool moveCurve(uint8_t index, int8_t shift)
|
||||
void displayPresetChoice(evt_t event)
|
||||
{
|
||||
displayWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*s_warning_input_value/4, LEFT|INVERS, 0, NULL, "@");
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*warningInputValue/4, LEFT|INVERS, 0, NULL, "@");
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = (i-((5+crv.points)/2)) * s_warning_input_value * 50 / (4+crv.points);
|
||||
points[i] = (i-((5+crv.points)/2)) * warningInputValue * 50 / (4+crv.points);
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
for (int i=0; i<3+crv.points; i++)
|
||||
points[crv.points+i] = -100 + ((i+1)*200) / (4+crv.points);
|
||||
@@ -158,10 +158,10 @@ bool menuModelCurveOne(evt_t event)
|
||||
|
||||
// Curve name
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, STR_NAME);
|
||||
editName(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==ITEM_CURVE_NAME);
|
||||
editName(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, menuVerticalPosition==ITEM_CURVE_NAME);
|
||||
|
||||
// Curve type
|
||||
LcdFlags attr = (m_posVert==ITEM_CURVE_TYPE ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
LcdFlags attr = (menuVerticalPosition==ITEM_CURVE_TYPE ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, "Type");
|
||||
lcdDrawTextAtIndex(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + FH, STR_CURVE_TYPES, crv.type, attr);
|
||||
if (attr) {
|
||||
@@ -179,7 +179,7 @@ bool menuModelCurveOne(evt_t event)
|
||||
}
|
||||
|
||||
// Curve points count
|
||||
attr = (m_posVert==ITEM_CURVE_POINTS ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
attr = (menuVerticalPosition==ITEM_CURVE_POINTS ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, STR_COUNT);
|
||||
lcdDrawNumber(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + 2*FH, 5+crv.points, LEFT|attr, 0, NULL, STR_PTS);
|
||||
if (attr) {
|
||||
@@ -202,20 +202,20 @@ bool menuModelCurveOne(evt_t event)
|
||||
|
||||
// Curve smooth
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, STR_SMOOTH);
|
||||
drawCheckBox(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + 3*FH, crv.smooth, m_posVert==ITEM_CURVE_SMOOTH ? INVERS : 0);
|
||||
if (m_posVert==ITEM_CURVE_SMOOTH) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
drawCheckBox(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + 3*FH, crv.smooth, menuVerticalPosition==ITEM_CURVE_SMOOTH ? INVERS : 0);
|
||||
if (menuVerticalPosition==ITEM_CURVE_SMOOTH) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
pointsOfs = 0;
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (m_posVert > ITEM_CURVE_POINTS) {
|
||||
if (menuVerticalPosition > ITEM_CURVE_POINTS) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
MENU_ADD_ITEM(STR_MIRROR);
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onCurveOneMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_MIRROR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onCurveOneMenu;
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
@@ -225,25 +225,25 @@ bool menuModelCurveOne(evt_t event)
|
||||
|
||||
DrawCurve();
|
||||
drawCurveHorizontalScale();
|
||||
if (m_posVert < ITEM_CURVE_COORDS1) drawCurveVerticalScale(CURVE_CENTER_X-CURVE_SIDE_WIDTH-15);
|
||||
if (menuVerticalPosition < ITEM_CURVE_COORDS1) drawCurveVerticalScale(CURVE_CENTER_X-CURVE_SIDE_WIDTH-15);
|
||||
|
||||
coord_t posX = 47;
|
||||
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
|
||||
for (int i=0; i<5+crv.points; i++) {
|
||||
point_t point = getPoint(i);
|
||||
uint8_t selectionMode = 0;
|
||||
if (m_posHorz == i) {
|
||||
if (m_posVert == ITEM_CURVE_COORDS1)
|
||||
if (menuHorizontalPosition == i) {
|
||||
if (menuVerticalPosition == ITEM_CURVE_COORDS1)
|
||||
selectionMode = (crv.type==CURVE_TYPE_CUSTOM ? 1 : 2);
|
||||
else if (m_posVert == ITEM_CURVE_COORDS2)
|
||||
else if (menuVerticalPosition == ITEM_CURVE_COORDS2)
|
||||
selectionMode = 2;
|
||||
}
|
||||
|
||||
if (selectionMode == 1) {
|
||||
if (m_posHorz == 0) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
REPEAT_LAST_CURSOR_MOVE(1);
|
||||
}
|
||||
else if (m_posHorz == 4+crv.points) {
|
||||
else if (menuHorizontalPosition == 4+crv.points) {
|
||||
REPEAT_LAST_CURSOR_MOVE(3+crv.points);
|
||||
}
|
||||
}
|
||||
@@ -313,23 +313,23 @@ bool menuModelCurveOne(evt_t event)
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr)
|
||||
{
|
||||
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, (m_posHorz==0 ? attr : 0));
|
||||
if (attr && m_posHorz==0) {
|
||||
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, (menuHorizontalPosition==0 ? attr : 0));
|
||||
if (attr && menuHorizontalPosition==0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, curve.type, CURVE_REF_CUSTOM);
|
||||
if (checkIncDec_Ret) curve.value = 0;
|
||||
}
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
case CURVE_REF_EXPO:
|
||||
curve.value = GVAR_MENU_ITEM(lcdNextPos+10, y, curve.value, -100, 100, m_posHorz==1 ? LEFT|attr : LEFT, 0, event);
|
||||
curve.value = GVAR_MENU_ITEM(lcdNextPos+10, y, curve.value, -100, 100, menuHorizontalPosition==1 ? LEFT|attr : LEFT, 0, event);
|
||||
break;
|
||||
case CURVE_REF_FUNC:
|
||||
lcdDrawTextAtIndex(lcdNextPos+10, y, STR_VCURVEFUNC, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
if (attr && m_posHorz==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
lcdDrawTextAtIndex(lcdNextPos+10, y, STR_VCURVEFUNC, curve.value, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && menuHorizontalPosition==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
break;
|
||||
case CURVE_REF_CUSTOM:
|
||||
putsCurve(lcdNextPos+10, y, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
if (attr && m_posHorz==1) {
|
||||
putsCurve(lcdNextPos+10, y, curve.value, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && menuHorizontalPosition==1) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
|
||||
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
pushMenu(menuModelCurveOne);
|
||||
@@ -346,7 +346,7 @@ bool menuModelCurvesAll(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
@@ -359,7 +359,7 @@ bool menuModelCurvesAll(evt_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
LcdFlags attr = (sub == k ? INVERS : 0);
|
||||
{
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_CV, k+1, attr);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
CustomFunctionData * cf = &g_model.customFn[sub];
|
||||
uint8_t func = CFN_FUNC(cf);
|
||||
|
||||
@@ -59,7 +59,6 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
}
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cf->play.name), NULL)) {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -74,11 +73,11 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
|
||||
void onCustomFunctionsMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
CustomFunctionData * cfn;
|
||||
uint8_t eeFlags;
|
||||
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions) {
|
||||
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
|
||||
cfn = &g_model.customFn[sub];
|
||||
eeFlags = EE_MODEL;
|
||||
}
|
||||
@@ -113,40 +112,40 @@ void onCustomFunctionsMenu(const char *result)
|
||||
|
||||
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
{
|
||||
uint32_t sub = m_posVert;
|
||||
uint32_t sub = menuVerticalPosition;
|
||||
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
|
||||
if (m_posHorz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
CustomFunctionData *cfn = &functions[sub];
|
||||
if (!CFN_EMPTY(cfn))
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
if (!CFN_EMPTY(cfn) && CFN_EMPTY(&functions[NUM_CFN-1]))
|
||||
MENU_ADD_ITEM(STR_INSERT);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT);
|
||||
if (!CFN_EMPTY(cfn))
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
for (int i=sub+1; i<NUM_CFN; i++) {
|
||||
if (!CFN_EMPTY(&functions[i])) {
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
menuHandler = onCustomFunctionsMenu;
|
||||
popupMenuHandler = onCustomFunctionsMenu;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
unsigned int k = i+s_pgOfs;
|
||||
unsigned int k = i+menuVerticalOffset;
|
||||
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && menuHorizontalPosition<0) ? INVERS : 0);
|
||||
|
||||
CustomFunctionData *cfn = &functions[k];
|
||||
unsigned int func = CFN_FUNC(cfn);
|
||||
for (int j=0; j<5; j++) {
|
||||
LcdFlags attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags active = (attr && s_editMode>0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
@@ -164,7 +163,7 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
}
|
||||
else {
|
||||
j = 4; // skip other fields
|
||||
if (sub==k && m_posHorz > 0) {
|
||||
if (sub==k && menuHorizontalPosition > 0) {
|
||||
REPEAT_LAST_CURSOR_MOVE(0);
|
||||
}
|
||||
}
|
||||
@@ -258,11 +257,10 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
menuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
popupMenuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -50,7 +50,7 @@ enum FlightModesItems {
|
||||
|
||||
bool isTrimModeAvailable(int mode)
|
||||
{
|
||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != m_posVert);
|
||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != menuVerticalPosition);
|
||||
}
|
||||
|
||||
#define FLIGHT_MODES_NAME_COLUMN 60
|
||||
@@ -64,12 +64,12 @@ bool menuModelFlightModesAll(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
horzpos_t posHorz = m_posHorz;
|
||||
horzpos_t posHorz = menuHorizontalPosition;
|
||||
if (sub==0 && posHorz == 1) {
|
||||
REPEAT_LAST_CURSOR_MOVE(0);
|
||||
posHorz = m_posHorz;
|
||||
posHorz = menuHorizontalPosition;
|
||||
}
|
||||
|
||||
if (sub<MAX_FLIGHT_MODES && posHorz>=0) {
|
||||
@@ -78,7 +78,7 @@ bool menuModelFlightModesAll(evt_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
|
||||
if (k==MAX_FLIGHT_MODES) {
|
||||
// last line available - add the "check trims" line
|
||||
@@ -111,7 +111,7 @@ bool menuModelFlightModesAll(evt_t event)
|
||||
|
||||
FlightModeData *p = flightModeAddress(k);
|
||||
|
||||
putsFlightMode(MENUS_MARGIN_LEFT, y, k+1, (getFlightMode()==k ? 0/*BOLD*/ : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
putsFlightMode(MENUS_MARGIN_LEFT, y, k+1, (getFlightMode()==k ? 0/*BOLD*/ : 0) | ((sub==k && menuHorizontalPosition<0) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) {
|
||||
LcdFlags attr = ((sub==k && posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
void onGVARSMenu(const char *result)
|
||||
{
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
if (result == STR_ENABLE_POPUP) {
|
||||
g_model.gvars[sub].popup = true;
|
||||
@@ -61,16 +61,16 @@ bool menuModelGVars(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUGLOBALVARS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int l=0; l<NUM_BODY_LINES; l++) {
|
||||
int i = l+s_pgOfs;
|
||||
int i = l+menuVerticalOffset;
|
||||
coord_t y = MENU_CONTENT_TOP + l*FH;
|
||||
if (g_model.gvars[i].popup) lcdDrawText(MENUS_MARGIN_LEFT+25, y, "!");
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_GV, i+1, ((sub==i && m_posHorz<0) ? INVERS : 0));
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_GV, i+1, ((sub==i && menuHorizontalPosition<0) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<1+MAX_FLIGHT_MODES; j++) {
|
||||
LcdFlags attr = ((sub==i && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr = ((sub==i && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
coord_t x = GVARS_FM_COLUMN(j-1);
|
||||
switch(j)
|
||||
{
|
||||
@@ -111,14 +111,14 @@ bool menuModelGVars(evt_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
if (menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
if (g_model.gvars[sub].popup)
|
||||
MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
||||
else
|
||||
MENU_ADD_ITEM(STR_ENABLE_POPUP);
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onGVARSMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_ENABLE_POPUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onGVARSMenu;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -53,11 +53,11 @@ bool menuModelHeli(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
LcdFlags flags = ((m_posHorz==i && attr) ? INVERS : 0);
|
||||
LcdFlags flags = ((menuHorizontalPosition==i && attr) ? INVERS : 0);
|
||||
flags |= ((value & (1<<i))) ? TEXT_DISABLE_COLOR : TEXT_COLOR;
|
||||
if (attr && m_posHorz < 0) flags |= INVERS;
|
||||
if (attr && menuHorizontalPosition < 0) flags |= INVERS;
|
||||
char s[] = " ";
|
||||
s[0] = '0' + i;
|
||||
lcdDrawText(x, y, s, flags);
|
||||
@@ -53,7 +53,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t att
|
||||
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, evt_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
int posHorz = m_posHorz;
|
||||
int posHorz = menuHorizontalPosition;
|
||||
|
||||
displayFlightModes(x, y, value, attr);
|
||||
|
||||
@@ -306,7 +306,7 @@ bool menuModelExpoOne(evt_t event)
|
||||
|
||||
SUBMENU(STR_MENUINPUTS, EXPO_FIELD_MAX, 0, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
coord_t y = MENU_CONTENT_TOP;
|
||||
|
||||
@@ -361,14 +361,14 @@ bool menuModelExpoOne(evt_t event)
|
||||
|
||||
case EXPO_FIELD_SOURCE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE));
|
||||
putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|(m_posHorz==0?attr:0));
|
||||
if (attr && m_posHorz==0) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
|
||||
putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|(menuHorizontalPosition==0?attr:0));
|
||||
if (attr && menuHorizontalPosition==0) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
|
||||
if (ed->srcRaw >= MIXSRC_FIRST_TELEM) {
|
||||
putsTelemetryChannelValue(EXPO_ONE_2ND_COLUMN+60, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|(m_posHorz==1?attr:0));
|
||||
if (attr && m_posHorz == 1) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
|
||||
putsTelemetryChannelValue(EXPO_ONE_2ND_COLUMN+60, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|(menuHorizontalPosition==1?attr:0));
|
||||
if (attr && menuHorizontalPosition == 1) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
|
||||
}
|
||||
else if (attr) {
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -410,7 +410,7 @@ bool menuModelExpoOne(evt_t event)
|
||||
uint8_t not_stick = (ed->srcRaw > MIXSRC_Ail);
|
||||
int8_t carryTrim = -ed->carryTrim;
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TRIM);
|
||||
lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (attr) ed->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
|
||||
break;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ bool menuModelMixOne(evt_t event)
|
||||
// The separation line between 2 columns
|
||||
lcdDrawSolidVerticalLine(MENU_COLUMN2_X-20, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+5, TEXT_COLOR);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
for (int k=0; k<2*NUM_BODY_LINES; k++) {
|
||||
@@ -621,7 +621,7 @@ void lineSurround(bool expo, coord_t y, LcdFlags flags=CURVE_AXIS_COLOR)
|
||||
|
||||
void onExpoMixMenu(const char *result)
|
||||
{
|
||||
bool expo = (g_menuStack[g_menuStackPtr] == menuModelExposAll);
|
||||
bool expo = (menuHandlers[menuLevel] == menuModelExposAll);
|
||||
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
|
||||
|
||||
if (result == STR_EDIT) {
|
||||
@@ -630,7 +630,7 @@ void onExpoMixMenu(const char *result)
|
||||
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++; }
|
||||
if (result == STR_INSERT_AFTER) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
}
|
||||
@@ -639,7 +639,7 @@ void onExpoMixMenu(const char *result)
|
||||
s_copyMode = (result == STR_COPY ? COPY_MODE : MOVE_MODE);
|
||||
s_copySrcIdx = s_currIdx;
|
||||
s_copySrcCh = chn;
|
||||
s_copySrcRow = m_posVert;
|
||||
s_copySrcRow = menuVerticalPosition;
|
||||
}
|
||||
else if (result == STR_DELETE) {
|
||||
deleteExpoMix(expo, s_currIdx);
|
||||
@@ -696,7 +696,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
|
||||
bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
if (s_editMode > 0)
|
||||
s_editMode = 0;
|
||||
@@ -734,7 +734,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
} while (s_copyTgtOfs != 0);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
m_posVert = s_copySrcRow;
|
||||
menuVerticalPosition = s_copySrcRow;
|
||||
s_copyTgtOfs = 0;
|
||||
}
|
||||
s_copyMode = 0;
|
||||
@@ -774,13 +774,13 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
else {
|
||||
event = 0;
|
||||
s_copyMode = 0;
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_MOVE);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onExpoMixMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onExpoMixMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,7 +790,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
if (s_copyMode && !s_copyTgtOfs) {
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
s_currCh = chn;
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; m_posVert++; }
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
@@ -810,7 +810,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
copyExpoMix(expo, s_currIdx);
|
||||
if (event==EVT_ROTARY_RIGHT || key==KEY_DOWN) s_currIdx++;
|
||||
else if (sub-s_pgOfs >= 6) s_pgOfs++;
|
||||
else if (sub-menuVerticalOffset >= 6) menuVerticalOffset++;
|
||||
}
|
||||
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
|
||||
// delete the mix
|
||||
@@ -832,16 +832,16 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
sprintf(str, "%d/%d", getExpoMixCount(expo), expo ? MAX_EXPOS : MAX_MIXERS);
|
||||
lcdDrawText(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, str, HEADER_COLOR);
|
||||
|
||||
sub = m_posVert;
|
||||
sub = menuVerticalPosition;
|
||||
s_currCh = 0;
|
||||
int cur = 0;
|
||||
int i = 0;
|
||||
|
||||
for (int ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
|
||||
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
|
||||
coord_t y = MENU_CONTENT_TOP + (cur-s_pgOfs)*FH;
|
||||
coord_t y = MENU_CONTENT_TOP + (cur-menuVerticalOffset)*FH;
|
||||
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(MENUS_MARGIN_LEFT, y, ch);
|
||||
}
|
||||
@@ -852,19 +852,19 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
uint8_t mixCnt = 0;
|
||||
do {
|
||||
if (s_copyMode) {
|
||||
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lineSurround(expo, y);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
if (s_currIdx == i) {
|
||||
sub = m_posVert = cur;
|
||||
sub = menuVerticalPosition = cur;
|
||||
s_currCh = ch;
|
||||
}
|
||||
}
|
||||
else if (sub == cur) {
|
||||
s_currIdx = i;
|
||||
}
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||
if (expo) {
|
||||
GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
|
||||
@@ -903,7 +903,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
}
|
||||
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
|
||||
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
|
||||
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lineSurround(expo, y);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
attr = INVERS;
|
||||
}
|
||||
}
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(MENUS_MARGIN_LEFT, y, ch, attr);
|
||||
}
|
||||
@@ -935,7 +935,7 @@ bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (sub >= linesCount-1) m_posVert = linesCount-1;
|
||||
if (sub >= linesCount-1) menuVerticalPosition = linesCount-1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ enum LimitsItems {
|
||||
|
||||
void onLimitsMenu(const char *result)
|
||||
{
|
||||
uint8_t ch = m_posVert - 1;
|
||||
uint8_t ch = menuVerticalPosition - 1;
|
||||
|
||||
if (result == STR_RESET) {
|
||||
LimitData *ld = limitAddress(ch);
|
||||
@@ -126,7 +126,7 @@ bool menuModelLimits(evt_t event)
|
||||
NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
|
||||
0 });
|
||||
|
||||
uint32_t sub = m_posVert;
|
||||
uint32_t sub = menuVerticalPosition;
|
||||
|
||||
if (sub < NUM_CHNOUT) {
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||
@@ -136,12 +136,12 @@ bool menuModelLimits(evt_t event)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sub<NUM_CHNOUT && m_posHorz>=0) {
|
||||
displayColumnHeader(STR_LIMITS_HEADERS, m_posHorz);
|
||||
if (sub<NUM_CHNOUT && menuHorizontalPosition>=0) {
|
||||
displayColumnHeader(STR_LIMITS_HEADERS, menuHorizontalPosition);
|
||||
}
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
LimitData *ld = limitAddress(sub);
|
||||
ld->revert = !ld->revert;
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -149,7 +149,7 @@ bool menuModelLimits(evt_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
if (k==NUM_CHNOUT) {
|
||||
// last line available - add the "copy trim menu" line
|
||||
@@ -159,7 +159,7 @@ bool menuModelLimits(evt_t event)
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
killEvents(event);
|
||||
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
|
||||
}
|
||||
@@ -177,17 +177,17 @@ bool menuModelLimits(evt_t event)
|
||||
|
||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||
|
||||
putsChn(MENUS_MARGIN_LEFT, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
putsChn(MENUS_MARGIN_LEFT, y, k+1, (sub==k && menuHorizontalPosition < 0) ? INVERS : 0);
|
||||
if (sub==k && menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET);
|
||||
MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
menuHandler = onLimitsMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
popupMenuHandler = onLimitsMenu;
|
||||
}
|
||||
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && s_editMode>0) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
|
||||
@@ -78,7 +78,7 @@ void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lat
|
||||
|
||||
void onLogicalSwitchesMenu(const char *result)
|
||||
{
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
LogicalSwitchData * cs = lswAddress(sub);
|
||||
|
||||
if (result == STR_COPY) {
|
||||
@@ -102,8 +102,8 @@ bool menuModelLogicalSwitches(evt_t event)
|
||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
|
||||
|
||||
int k = 0;
|
||||
int sub = m_posVert;
|
||||
horzpos_t horz = m_posHorz;
|
||||
int sub = menuVerticalPosition;
|
||||
horzpos_t horz = menuHorizontalPosition;
|
||||
|
||||
if (sub>= 0 && horz>=0) {
|
||||
displayColumnHeader(STR_CSW_HEADERS, horz);
|
||||
@@ -113,17 +113,17 @@ bool menuModelLogicalSwitches(evt_t event)
|
||||
killEvents(event);
|
||||
LogicalSwitchData * cs = lswAddress(sub);
|
||||
if (cs->func)
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onLogicalSwitchesMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onLogicalSwitchesMenu;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr1 = (horz==1 ? attr : 0);
|
||||
LcdFlags attr2 = (horz==2 ? attr : 0);
|
||||
|
||||
@@ -96,7 +96,7 @@ void onCategorySelectMenu(const char * result)
|
||||
storageCheck(true);
|
||||
createModel(currentCategory);
|
||||
selectMode = MODE_SELECT_MODEL;
|
||||
m_posVert = 255;
|
||||
menuVerticalPosition = 255;
|
||||
}
|
||||
else if (result == STR_CREATE_CATEGORY) {
|
||||
storageInsertCategory("Category", -1);
|
||||
@@ -137,20 +137,20 @@ void onModelSelectMenu(const char * result)
|
||||
}
|
||||
}
|
||||
|
||||
#define MODEL_INDEX() (m_posVert*2+m_posHorz)
|
||||
#define MODEL_INDEX() (menuVerticalPosition*2+menuHorizontalPosition)
|
||||
|
||||
bool menuModelSelect(evt_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
int modelIndex = MODEL_INDEX();
|
||||
storageRemoveModel(currentCategory, modelIndex);
|
||||
s_copyMode = 0;
|
||||
event = EVT_REFRESH;
|
||||
if (modelIndex > 0) {
|
||||
modelIndex--;
|
||||
m_posVert = modelIndex / 2;
|
||||
m_posHorz = modelIndex & 1;
|
||||
menuVerticalPosition = modelIndex / 2;
|
||||
menuHorizontalPosition = modelIndex & 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ bool menuModelSelect(evt_t event)
|
||||
|
||||
case EVT_ENTRY:
|
||||
selectMode = MODE_SELECT_CATEGORY;
|
||||
currentCategory = m_posVert = 0;
|
||||
currentCategory = menuVerticalPosition = 0;
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
@@ -171,7 +171,7 @@ bool menuModelSelect(evt_t event)
|
||||
return false;
|
||||
case MODE_SELECT_MODEL:
|
||||
selectMode = MODE_SELECT_CATEGORY;
|
||||
m_posVert = currentCategory;
|
||||
menuVerticalPosition = currentCategory;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -181,7 +181,7 @@ bool menuModelSelect(evt_t event)
|
||||
switch (selectMode) {
|
||||
case MODE_SELECT_CATEGORY:
|
||||
selectMode = MODE_SELECT_MODEL;
|
||||
m_posVert = 0;
|
||||
menuVerticalPosition = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -189,27 +189,27 @@ bool menuModelSelect(evt_t event)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (selectMode == MODE_SELECT_CATEGORY) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
MENU_ADD_ITEM(STR_CREATE_CATEGORY);
|
||||
MENU_ADD_ITEM(STR_RENAME_CATEGORY);
|
||||
POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_CREATE_CATEGORY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RENAME_CATEGORY);
|
||||
if (currentCategory > 0)
|
||||
MENU_ADD_ITEM(STR_DELETE_CATEGORY);
|
||||
menuHandler = onCategorySelectMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_CATEGORY);
|
||||
popupMenuHandler = onCategorySelectMenu;
|
||||
}
|
||||
else if (selectMode == MODE_SELECT_MODEL) {
|
||||
killEvents(event);
|
||||
ModelHeader header;
|
||||
const char * error = readModel(selectedFilename, (uint8_t *)&header, sizeof(header));
|
||||
if (!error) {
|
||||
MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
MENU_ADD_ITEM(STR_DUPLICATE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_DUPLICATE_MODEL);
|
||||
}
|
||||
// MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
// MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
// MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
// MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
menuHandler = onModelSelectMenu;
|
||||
// POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
// POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
// POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
// POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
popupMenuHandler = onModelSelectMenu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ bool menuModelSelect(evt_t event)
|
||||
if (navigate(event, index, 9)) {
|
||||
TRACE("Refresh 1");
|
||||
putEvent(EVT_REFRESH);
|
||||
currentCategory = m_posVert;
|
||||
currentCategory = menuVerticalPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,8 +280,8 @@ bool menuModelSelect(evt_t event)
|
||||
if (!result) {
|
||||
break;
|
||||
}
|
||||
if (count >= s_pgOfs*2 && count < (s_pgOfs+3)*2) {
|
||||
bool selected = (selectMode==MODE_SELECT_MODEL && m_posVert*2+m_posHorz==count);
|
||||
if (count >= menuVerticalOffset*2 && count < (menuVerticalOffset+3)*2) {
|
||||
bool selected = (selectMode==MODE_SELECT_MODEL && menuVerticalPosition*2+menuHorizontalPosition==count);
|
||||
if (count & 1) {
|
||||
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+162, y, line, selected);
|
||||
y += 66;
|
||||
@@ -298,14 +298,14 @@ bool menuModelSelect(evt_t event)
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
if (count == 0) {
|
||||
selectMode = MODE_SELECT_CATEGORY;
|
||||
m_posVert = currentCategory;
|
||||
menuVerticalPosition = currentCategory;
|
||||
putEvent(EVT_REFRESH);
|
||||
}
|
||||
else if (navigate(event, count, 3, 2)) {
|
||||
putEvent(EVT_REFRESH);
|
||||
}
|
||||
}
|
||||
drawVerticalScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, s_pgOfs, (count+1)/2, 3);
|
||||
drawVerticalScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, menuVerticalOffset, (count+1)/2, 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -107,7 +107,6 @@ void onModelSetupBitmapMenu(const char *result)
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -121,14 +120,14 @@ void onModelSetupBitmapMenu(const char *result)
|
||||
void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
|
||||
{
|
||||
TimerData * timer = &g_model.timers[timerIdx];
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN+1, 90+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_TIMER, timerIdx+1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, (m_posHorz<=0 ? attr : 0));
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+50, y, timer->start, (m_posHorz!=0 ? attr : 0));
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, (menuHorizontalPosition<=0 ? attr : 0));
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+50, y, timer->start, (menuHorizontalPosition!=0 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
{
|
||||
int8_t timerMode = timer->mode;
|
||||
@@ -173,7 +172,7 @@ int getSwitchWarningsCount()
|
||||
|
||||
bool menuModelSetup(evt_t event)
|
||||
{
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_TRAINER_ON(x) (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define IF_EXTERNAL_MODULE_XJT(x) (IS_MODULE_XJT(EXTERNAL_MODULE) ? (uint8_t)x : HIDDEN_ROW)
|
||||
@@ -191,7 +190,7 @@ bool menuModelSetup(evt_t event)
|
||||
#elif TIMERS == 3
|
||||
#define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS, TIMER_ROWS
|
||||
#endif
|
||||
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
||||
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
|
||||
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, LABEL(PreflightCheck), 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2) });
|
||||
|
||||
@@ -204,11 +203,11 @@ bool menuModelSetup(evt_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
@@ -232,11 +231,10 @@ bool menuModelSetup(evt_t event)
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
|
||||
menuHandler = onModelSetupBitmapMenu;
|
||||
popupMenuHandler = onModelSetupBitmapMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -324,12 +322,12 @@ bool menuModelSetup(evt_t event)
|
||||
|
||||
case ITEM_MODEL_EXTENDED_TRIMS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ETRIMS);
|
||||
g_model.extendedTrims = onoffMenuItem(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, m_posHorz<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+18, y, STR_RESET_BTN, m_posHorz>0 && !s_noHi ? attr : 0);
|
||||
if (attr && m_posHorz>0) {
|
||||
g_model.extendedTrims = onoffMenuItem(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+18, y, STR_RESET_BTN, menuHorizontalPosition>0 && !s_noHi ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
|
||||
}
|
||||
@@ -394,16 +392,16 @@ bool menuModelSetup(evt_t event)
|
||||
case ITEM_MODEL_SWITCHES_WARNING:
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCHWARNING);
|
||||
if (!READ_ONLY() && attr && m_posHorz<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
if (!READ_ONLY() && attr && menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, NUM_SWITCHES*18+INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
|
||||
@@ -416,7 +414,7 @@ bool menuModelSetup(evt_t event)
|
||||
}
|
||||
unsigned int state = ((g_model.switchWarningState >> (3*i)) & 0x07);
|
||||
LcdFlags color = (state > 0 ? TEXT_COLOR : TEXT_DISABLE_COLOR);
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
color |= INVERS;
|
||||
}
|
||||
char s[3];
|
||||
@@ -439,8 +437,8 @@ bool menuModelSetup(evt_t event)
|
||||
max = 2;
|
||||
}
|
||||
s[2] = '\0';
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+i*18, y, s, color|(m_posHorz==current ? attr : 0));
|
||||
if (attr && m_posHorz==current) CHECK_INCDEC_MODELVAR_ZERO(event, state, max);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+i*18, y, s, color|(menuHorizontalPosition==current ? attr : 0));
|
||||
if (attr && menuHorizontalPosition==current) CHECK_INCDEC_MODELVAR_ZERO(event, state, max);
|
||||
newStates |= (state << (3*i));
|
||||
++current;
|
||||
}
|
||||
@@ -453,36 +451,36 @@ bool menuModelSetup(evt_t event)
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POTWARNING);
|
||||
if (attr) {
|
||||
if (m_posHorz) s_editMode = 0;
|
||||
if (!READ_ONLY() && m_posHorz) {
|
||||
if (menuHorizontalPosition) s_editMode = 0;
|
||||
if (!READ_ONLY() && menuHorizontalPosition) {
|
||||
switch (event) {
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
||||
SAVE_POT_POSITION(m_posHorz-1);
|
||||
SAVE_POT_POSITION(menuHorizontalPosition-1);
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
g_model.potsWarnEnabled ^= (1 << (m_posHorz-1));
|
||||
g_model.potsWarnEnabled ^= (1 << (menuHorizontalPosition-1));
|
||||
storageDirty(EE_MODEL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (m_posHorz == 0) ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
||||
if (g_model.potsWarnMode) {
|
||||
coord_t x = MODEL_SETUP_2ND_COLUMN+30;
|
||||
for (int i=0; i<NUM_POTS; ++i) {
|
||||
LcdFlags flags = (((m_posHorz==i+1) && attr) ? INVERS : 0);
|
||||
LcdFlags flags = (((menuHorizontalPosition==i+1) && attr) ? INVERS : 0);
|
||||
flags |= (g_model.potsWarnEnabled & (1 << i)) ? TEXT_DISABLE_COLOR : TEXT_COLOR;
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, NUM_STICKS+1+i, flags);
|
||||
x += 20;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr && (m_posHorz == 0)) {
|
||||
if (attr && (menuHorizontalPosition == 0)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
@@ -491,21 +489,21 @@ bool menuModelSetup(evt_t event)
|
||||
|
||||
case ITEM_MODEL_BEEP_CENTER:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCTR);
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, (NUM_STICKS+NUM_POTS)*13+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
coord_t x = MODEL_SETUP_2ND_COLUMN+i*13;
|
||||
LcdFlags flags = ((m_posHorz==i && attr) ? INVERS : 0);
|
||||
LcdFlags flags = ((menuHorizontalPosition==i && attr) ? INVERS : 0);
|
||||
flags |= (g_model.beepANACenter & ((BeepANACenter)1<<i)) ? TEXT_COLOR : TEXT_DISABLE_COLOR;
|
||||
if (attr && m_posHorz < 0) flags |= INVERS;
|
||||
if (attr && menuHorizontalPosition < 0) flags |= INVERS;
|
||||
lcdDrawTextAtIndex(x, y, STR_RETA123, i, flags);
|
||||
}
|
||||
if (attr && CURSOR_ON_CELL) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
@@ -529,13 +527,13 @@ bool menuModelSetup(evt_t event)
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_MODE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, (m_posHorz==0 ? attr : 0));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, (menuHorizontalPosition==0 ? attr : 0));
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+40, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+40, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+40, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+40, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -571,11 +569,11 @@ bool menuModelSetup(evt_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CHANNELRANGE);
|
||||
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_CH, moduleData.channelsStart+1, m_posHorz==0 ? attr : 0);
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_CH, moduleData.channelsStart+1, menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+30, y, "-");
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN+40, y, STR_CH, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), m_posHorz==1 ? attr : 0);
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN+40, y, STR_CH, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount);
|
||||
break;
|
||||
@@ -599,12 +597,12 @@ bool menuModelSetup(evt_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
if (IS_MODULE_PPM(moduleIdx)) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PPMFRAME);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT, 0, NULL, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+70, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0, 0, NULL, "us");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+90, y, moduleData.ppmPulsePol ? "+" : "-", (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT, 0, NULL, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+70, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0, 0, NULL, "us");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+90, y, moduleData.ppmPulsePol ? "+" : "-", (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, moduleData.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
@@ -618,7 +616,7 @@ bool menuModelSetup(evt_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
|
||||
if (IS_MODULE_XJT(moduleIdx) && IS_D8_RX(moduleIdx)) {
|
||||
xOffsetBind = 0;
|
||||
@@ -655,18 +653,18 @@ bool menuModelSetup(evt_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, TR_FAILSAFE);
|
||||
if (IS_MODULE_XJT(moduleIdx)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, m_posHorz==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr) {
|
||||
if (moduleData.failsafeMode != FAILSAFE_CUSTOM)
|
||||
m_posHorz = 0;
|
||||
if (m_posHorz==0) {
|
||||
menuHorizontalPosition = 0;
|
||||
if (menuHorizontalPosition==0) {
|
||||
if (s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.failsafeMode, FAILSAFE_LAST);
|
||||
if (checkIncDec_Ret) SEND_FAILSAFE_NOW(moduleIdx);
|
||||
}
|
||||
}
|
||||
else if (m_posHorz==1) {
|
||||
else if (menuHorizontalPosition==1) {
|
||||
s_editMode = 0;
|
||||
if (moduleData.failsafeMode==FAILSAFE_CUSTOM && event==EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
g_moduleIdx = moduleIdx;
|
||||
@@ -698,8 +696,8 @@ bool menuModelFailsafe(evt_t event)
|
||||
uint8_t ch = 0;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && s_editMode) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
|
||||
START_NO_HIGHLIGHT();
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition];
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
@@ -712,7 +710,7 @@ bool menuModelFailsafe(evt_t event)
|
||||
// Column separator
|
||||
// TODO lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
|
||||
|
||||
if (m_posVert >= 16) {
|
||||
if (menuVerticalPosition >= 16) {
|
||||
ch = 16;
|
||||
}
|
||||
|
||||
@@ -730,7 +728,7 @@ bool menuModelFailsafe(evt_t event)
|
||||
|
||||
if (ch < g_model.moduleData[g_moduleIdx].channelsStart || ch >= NUM_CHANNELS(g_moduleIdx) + g_model.moduleData[g_moduleIdx].channelsStart)
|
||||
val = 0;
|
||||
else if (s_editMode && m_posVert == ch)
|
||||
else if (s_editMode && menuVerticalPosition == ch)
|
||||
val = channelOutputs[ch];
|
||||
else
|
||||
val = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
@@ -748,7 +746,7 @@ bool menuModelFailsafe(evt_t event)
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch && !s_noHi) {
|
||||
if (menuVerticalPosition == ch && !s_noHi) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode)
|
||||
flags |= BLINK;
|
||||
|
||||
@@ -222,11 +222,11 @@ bool menuModelSensor(evt_t event)
|
||||
// lcdDrawNumber(MENUS_MARGIN_LEFT+getTextWidth(TR_MENUSENSOR)+5, MENU_FOOTER_TOP, s_currIdx+1, HEADER_COLOR|LEFT);
|
||||
// putsTelemetryChannelValue(SENSOR_2ND_COLUMN, MENU_FOOTER_TOP, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), HEADER_COLOR|LEFT);
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (unsigned int i=0; i<NUM_BODY_LINES+1; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW) {
|
||||
@@ -259,10 +259,10 @@ bool menuModelSensor(evt_t event)
|
||||
case SENSOR_FIELD_ID:
|
||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ID);
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(m_posHorz==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(m_posHorz==1 ? attr : 0));
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
sensor->id = checkIncDec(event, sensor->id, 0x0000, 0xffff, INCDEC_REP10|NO_INCDEC_MARKS);
|
||||
break;
|
||||
@@ -457,7 +457,7 @@ bool menuModelSensor(evt_t event)
|
||||
|
||||
void onSensorMenu(const char *result)
|
||||
{
|
||||
int index = m_posVert - ITEM_TELEMETRY_SENSOR1;
|
||||
int index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
|
||||
|
||||
if (index < MAX_SENSORS) {
|
||||
if (result == STR_EDIT) {
|
||||
@@ -467,9 +467,9 @@ void onSensorMenu(const char *result)
|
||||
delTelemetryIndex(index);
|
||||
index += 1;
|
||||
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
|
||||
m_posVert += 1;
|
||||
menuVerticalPosition += 1;
|
||||
else
|
||||
m_posVert = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
menuVerticalPosition = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
@@ -493,13 +493,12 @@ void onSensorMenu(const char *result)
|
||||
#if defined(LUA)
|
||||
void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
int screenIndex = TELEMETRY_CURRENT_SCREEN(sub);
|
||||
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -513,8 +512,8 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
|
||||
bool menuModelTelemetry(evt_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
@@ -522,11 +521,11 @@ bool menuModelTelemetry(evt_t event)
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, DEFAULT_SCROLLBAR_X, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
@@ -559,10 +558,10 @@ bool menuModelTelemetry(evt_t event)
|
||||
s_currIdx = index;
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onSensorMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onSensorMenu;
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
pushMenu(menuModelSensor);
|
||||
@@ -653,10 +652,10 @@ bool menuModelTelemetry(evt_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RANGE);
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz==0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL3, y, 10+g_model.frsky.varioMax, (m_posHorz==1 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL3, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)|LEFT);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7);
|
||||
break;
|
||||
@@ -669,11 +668,11 @@ bool menuModelTelemetry(evt_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_CENTER:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CENTER);
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (m_posHorz==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL3, y, 5+g_model.frsky.varioCenterMax, (m_posHorz==1 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL4, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (m_posHorz==2 ? attr : 0));
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL3, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==1 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL4, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMin, -16, 5+min<int8_t>(10, g_model.frsky.varioCenterMax+5));
|
||||
break;
|
||||
@@ -716,7 +715,7 @@ bool menuModelTelemetry(evt_t event)
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_COL2, y, STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_COL2, y, STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
|
||||
if (newScreenType != oldScreenType) {
|
||||
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
|
||||
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));
|
||||
@@ -728,18 +727,17 @@ bool menuModelTelemetry(evt_t event)
|
||||
// TODO better function name for ---
|
||||
// TODO function for these lines
|
||||
if (ZEXIST(scriptData.file))
|
||||
lcdDrawSizedText(TELEM_COL3, y, scriptData.file, sizeof(scriptData.file), (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawSizedText(TELEM_COL3, y, scriptData.file, sizeof(scriptData.file), (menuHorizontalPosition==1 ? attr : 0));
|
||||
else
|
||||
lcdDrawTextAtIndex(TELEM_COL3, y, STR_VCSWFUNC, 0, (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(TELEM_COL3, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
||||
|
||||
if (m_posHorz==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
|
||||
menuHandler = onTelemetryScriptFileSelectionMenu;
|
||||
popupMenuHandler = onTelemetryScriptFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -789,24 +787,24 @@ bool menuModelTelemetry(evt_t event)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
putsMixerSource(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, barSource, (m_posHorz==0 ? attr : 0));
|
||||
putsMixerSource(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, barSource, (menuHorizontalPosition==0 ? attr : 0));
|
||||
int barMax = getMaximumValue(barSource);
|
||||
int barMin = -barMax;
|
||||
if (barSource) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(TELEM_COL2, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL4, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL2, y, barSource, calc100toRESX(bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL4, y, barSource, calc100toRESX(bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(TELEM_COL2, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL4, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL2, y, barSource, bar.barMin, (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_COL4, y, barSource, bar.barMax, (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
else if (attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
bar.source = checkIncDec(event, barSource, 0, MIXSRC_LAST_TELEM, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -833,7 +831,7 @@ bool menuModelTelemetry(evt_t event)
|
||||
#endif
|
||||
{
|
||||
for (int c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
LcdFlags cellAttr = (m_posHorz==c ? attr : 0);
|
||||
LcdFlags cellAttr = (menuHorizontalPosition==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
const coord_t pos[] = {MENUS_MARGIN_LEFT+INDENT_WIDTH, TELEM_COL2, TELEM_COL4};
|
||||
putsMixerSource(pos[c], y, value, cellAttr);
|
||||
@@ -841,7 +839,7 @@ bool menuModelTelemetry(evt_t event)
|
||||
value = checkIncDec(event, value, 0, MIXSRC_LAST_TELEM, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable);
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz == NUM_LINE_ITEMS) {
|
||||
if (attr && menuHorizontalPosition == NUM_LINE_ITEMS) {
|
||||
REPEAT_LAST_CURSOR_MOVE(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,44 +36,47 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
MenuFuncP g_menuStack[5];
|
||||
MenuHandlerFunc menuHandlers[5];
|
||||
evt_t menuEvent = 0;
|
||||
uint8_t g_menuPos[4];
|
||||
uint8_t g_menuStackPtr = 0;
|
||||
uint8_t menuVerticalPositions[4];
|
||||
uint8_t menuLevel = 0;
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
assert(g_menuStackPtr>0);
|
||||
g_menuStackPtr = g_menuStackPtr-1;
|
||||
assert(menuLevel>0);
|
||||
menuLevel = menuLevel-1;
|
||||
menuEvent = EVT_ENTRY_UP;
|
||||
TRACE("popMenu(%d)", menuLevel);
|
||||
}
|
||||
|
||||
void chainMenu(MenuFuncP newMenu)
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
TRACE("chainMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
void pushMenu(MenuFuncP newMenu)
|
||||
void pushMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killEvents(KEY_ENTER);
|
||||
|
||||
if (g_menuStackPtr == 0) {
|
||||
if (menuLevel == 0) {
|
||||
if (newMenu == menuGeneralSetup)
|
||||
g_menuPos[0] = 1;
|
||||
menuVerticalPositions[0] = 1;
|
||||
if (newMenu == menuModelSetup)
|
||||
g_menuPos[0] = 0;
|
||||
menuVerticalPositions[0] = 0;
|
||||
}
|
||||
else {
|
||||
g_menuPos[g_menuStackPtr] = m_posVert;
|
||||
menuVerticalPositions[menuLevel] = menuVerticalPosition;
|
||||
}
|
||||
|
||||
g_menuStackPtr++;
|
||||
menuLevel++;
|
||||
|
||||
assert(g_menuStackPtr < DIM(g_menuStack));
|
||||
assert(menuLevel < DIM(menuHandlers));
|
||||
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
bool menuModelNotes(evt_t event)
|
||||
|
||||
+44
-42
@@ -39,8 +39,6 @@
|
||||
|
||||
#include "../../keys.h"
|
||||
|
||||
#define NO_HI_LEN 25
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
#define MENU_COLUMNS 1
|
||||
#define COLUMN_X 0
|
||||
@@ -58,27 +56,31 @@ typedef evt_t & check_event_t;
|
||||
extern uint8_t menuPageIndex;
|
||||
extern uint8_t menuPageCount;
|
||||
extern uint16_t linesCount;
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
extern vertpos_t s_pgOfs;
|
||||
extern uint8_t s_noHi;
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
extern vertpos_t menuVerticalOffset;
|
||||
extern uint8_t calibrationState;
|
||||
|
||||
// Temporary no highlight
|
||||
extern uint8_t noHighlightCounter;
|
||||
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
||||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef bool (*MenuFuncP)(evt_t event);
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
typedef bool (*MenuHandlerFunc)(evt_t event);
|
||||
extern const MenuHandlerFunc menuTabModel[];
|
||||
extern const MenuHandlerFunc menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
extern uint8_t g_menuStackPtr;
|
||||
extern MenuHandlerFunc menuHandlers[5];
|
||||
extern uint8_t menuVerticalPositions[4];
|
||||
extern uint8_t menuLevel;
|
||||
extern evt_t menuEvent;
|
||||
|
||||
/// goto given Menu, but substitute current menu in menuStack
|
||||
void chainMenu(MenuFuncP newMenu);
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
/// goto given Menu, store current menu in menuStack
|
||||
void pushMenu(MenuFuncP newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
/// return to last menu in menustack
|
||||
void popMenu();
|
||||
|
||||
@@ -189,12 +191,12 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
var = checkIncDecGen(event, var, min, max)
|
||||
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
|
||||
|
||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||
bool navigate(evt_t event, int count, int rows, int columns=1);
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
bool check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
@@ -253,11 +255,11 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, evt_t event, uint8
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const pm_char * s_warning;
|
||||
extern const pm_char * s_warning_info;
|
||||
extern uint8_t s_warning_info_len;
|
||||
extern uint8_t s_warning_result;
|
||||
extern uint8_t s_warning_type;
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
|
||||
#define MENU_X 80
|
||||
#define MENU_W LCD_W-(2*MENU_X)
|
||||
@@ -275,30 +277,30 @@ void displayPopup(const char *title);
|
||||
void displayWarning(evt_t event);
|
||||
|
||||
extern void (*popupFunc)(evt_t event);
|
||||
extern int16_t s_warning_input_value;
|
||||
extern int16_t s_warning_input_min;
|
||||
extern int16_t s_warning_input_max;
|
||||
extern uint8_t s_warning_info_flags;
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define MENU_ADD_ITEM(s) s_menu[s_menu_count++] = s
|
||||
#define MENU_MAX_LINES 6
|
||||
#define POPUP_MENU_ADD_ITEM(s) popupMenuItems[popupMenuNoItems++] = s
|
||||
#define POPUP_MENU_MAX_LINES 6
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
extern const char *s_menu[MENU_MAX_LINES];
|
||||
extern uint16_t s_menu_count;
|
||||
extern uint8_t s_menu_flags;
|
||||
extern uint16_t s_menu_offset;
|
||||
const char * displayMenu(evt_t event);
|
||||
extern void (*menuHandler)(const char *result);
|
||||
#define POPUP_MENU_ITEMS_FROM_BSS()
|
||||
extern const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
extern uint16_t popupMenuOffset;
|
||||
const char * displayPopupMenu(evt_t event);
|
||||
extern void (*popupMenuHandler)(const char *result);
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
@@ -310,8 +312,8 @@ void pushModelNotes();
|
||||
#define CURSOR_MOVED_LEFT(event) (event==EVT_ROTARY_LEFT || EVT_KEY_MASK(event) == KEY_LEFT)
|
||||
#define CURSOR_MOVED_RIGHT(event) (event==EVT_ROTARY_RIGHT || EVT_KEY_MASK(event) == KEY_RIGHT)
|
||||
|
||||
#define REPEAT_LAST_CURSOR_MOVE(defaultPosition) { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = (defaultPosition); }
|
||||
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE(0)
|
||||
#define REPEAT_LAST_CURSOR_MOVE(defaultPosition) { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = (defaultPosition); }
|
||||
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE(0)
|
||||
|
||||
#define MENU_FIRST_LINE_EDIT (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0)
|
||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||
|
||||
+100
-100
@@ -36,9 +36,9 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
vertpos_t s_pgOfs;
|
||||
vertpos_t m_posVert;
|
||||
horzpos_t m_posHorz;
|
||||
vertpos_t menuVerticalOffset;
|
||||
vertpos_t menuVerticalPosition;
|
||||
horzpos_t menuHorizontalPosition;
|
||||
int8_t s_editMode;
|
||||
uint8_t s_noHi;
|
||||
uint8_t calibrationState; // TODO rename this variable
|
||||
@@ -224,81 +224,81 @@ uint16_t linesCount;
|
||||
|
||||
bool navigate(evt_t event, int count, int rows, int columns)
|
||||
{
|
||||
int prevPosHorz = m_posHorz;
|
||||
int prevPosVert = m_posVert;
|
||||
int prevPosHorz = menuHorizontalPosition;
|
||||
int prevPosVert = menuVerticalPosition;
|
||||
|
||||
int maxrow = ((count+columns-1) / columns) - 1;
|
||||
int maxlastcol = count-maxrow*columns-1;
|
||||
int maxcol = (m_posVert != maxrow ? columns-1 : maxlastcol);
|
||||
int maxcol = (menuVerticalPosition != maxrow ? columns-1 : maxlastcol);
|
||||
|
||||
if (m_posVert > maxrow) {
|
||||
m_posVert = maxrow;
|
||||
m_posHorz = maxlastcol;
|
||||
if (menuVerticalPosition > maxrow) {
|
||||
menuVerticalPosition = maxrow;
|
||||
menuHorizontalPosition = maxlastcol;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
INC(m_posHorz, 0, maxcol);
|
||||
INC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
DEC(m_posHorz, 0, maxcol);
|
||||
DEC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
INC(m_posVert, 0, maxrow);
|
||||
if (m_posVert == maxrow && m_posHorz > maxlastcol) {
|
||||
m_posHorz = maxlastcol;
|
||||
INC(menuVerticalPosition, 0, maxrow);
|
||||
if (menuVerticalPosition == maxrow && menuHorizontalPosition > maxlastcol) {
|
||||
menuHorizontalPosition = maxlastcol;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_KEY_REPT(KEY_UP):
|
||||
DEC(m_posVert, 0, maxrow);
|
||||
if (m_posVert == maxrow && m_posHorz > maxlastcol) {
|
||||
m_posHorz = maxlastcol;
|
||||
DEC(menuVerticalPosition, 0, maxrow);
|
||||
if (menuVerticalPosition == maxrow && menuHorizontalPosition > maxlastcol) {
|
||||
menuHorizontalPosition = maxlastcol;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (m_posHorz > 0) {
|
||||
m_posHorz--;
|
||||
if (menuHorizontalPosition > 0) {
|
||||
menuHorizontalPosition--;
|
||||
}
|
||||
else {
|
||||
DEC(m_posVert, 0, maxrow);
|
||||
m_posHorz = (m_posVert != maxrow ? columns-1 : maxlastcol);
|
||||
DEC(menuVerticalPosition, 0, maxrow);
|
||||
menuHorizontalPosition = (menuVerticalPosition != maxrow ? columns-1 : maxlastcol);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (m_posHorz < maxcol) {
|
||||
m_posHorz++;
|
||||
if (menuHorizontalPosition < maxcol) {
|
||||
menuHorizontalPosition++;
|
||||
}
|
||||
else {
|
||||
INC(m_posVert, 0, maxrow);
|
||||
m_posHorz = 0;
|
||||
INC(menuVerticalPosition, 0, maxrow);
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (s_pgOfs > m_posVert) {
|
||||
s_pgOfs = m_posVert;
|
||||
if (menuVerticalOffset > menuVerticalPosition) {
|
||||
menuVerticalOffset = menuVerticalPosition;
|
||||
}
|
||||
else if (s_pgOfs <= m_posVert - rows) {
|
||||
s_pgOfs = m_posVert - rows + 1;
|
||||
else if (menuVerticalOffset <= menuVerticalPosition - rows) {
|
||||
menuVerticalOffset = menuVerticalPosition - rows + 1;
|
||||
}
|
||||
|
||||
return (prevPosHorz != m_posHorz || prevPosVert != m_posVert);
|
||||
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition);
|
||||
}
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
uint8_t maxcol = MAXCOL(m_posVert);
|
||||
uint8_t maxcol = MAXCOL(menuVerticalPosition);
|
||||
|
||||
if (menuTab && !calibrationState && m_posVert<0) {
|
||||
if (menuTab && !calibrationState && menuVerticalPosition<0) {
|
||||
int cc = curr;
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
@@ -315,19 +315,19 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (rowcount > 0) {
|
||||
m_posVert = MENU_FIRST_LINE_EDIT;
|
||||
menuVerticalPosition = MENU_FIRST_LINE_EDIT;
|
||||
event = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
m_posHorz = -1;
|
||||
menuHorizontalPosition = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cc != curr) {
|
||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -338,20 +338,20 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
switch(event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
m_posVert = (menuTab ? -1 : MENU_FIRST_LINE_EDIT);
|
||||
m_posHorz = POS_HORZ_INIT(0);
|
||||
menuVerticalPosition = (menuTab ? -1 : MENU_FIRST_LINE_EDIT);
|
||||
menuHorizontalPosition = POS_HORZ_INIT(0);
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
break;
|
||||
|
||||
case EVT_ENTRY_UP:
|
||||
s_editMode = 0;
|
||||
m_posHorz = POS_HORZ_INIT(m_posVert);
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode > 1) break;
|
||||
if (m_posHorz < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
m_posHorz = 0;
|
||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
else if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = (s_editMode<=0);
|
||||
@@ -369,18 +369,18 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_posHorz >= 0 && (COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||
m_posHorz = -1;
|
||||
if (menuHorizontalPosition >= 0 && (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
menuHorizontalPosition = -1;
|
||||
}
|
||||
else if (menuTab && m_posVert >= 0) {
|
||||
m_posVert = -1;
|
||||
m_posHorz = 0;
|
||||
else if (menuTab && menuVerticalPosition >= 0) {
|
||||
menuVerticalPosition = -1;
|
||||
menuHorizontalPosition = 0;
|
||||
#if 0
|
||||
int posVertInit = -1;
|
||||
if (s_pgOfs != 0 || m_posVert != posVertInit) {
|
||||
s_pgOfs = 0;
|
||||
m_posVert = posVertInit;
|
||||
m_posHorz = POS_HORZ_INIT(m_posVert);
|
||||
if (menuVerticalOffset != 0 || menuVerticalPosition != posVertInit) {
|
||||
menuVerticalOffset = 0;
|
||||
menuVerticalPosition = posVertInit;
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -392,87 +392,87 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
if (s_editMode != 0) break;
|
||||
INC(m_posHorz, 0, maxcol);
|
||||
INC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
if (s_editMode != 0) break;
|
||||
DEC(m_posHorz, 0, maxcol);
|
||||
DEC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (s_editMode != 0) break;
|
||||
if ((COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (m_posHorz >= 0) {
|
||||
INC(m_posHorz, 0, maxcol);
|
||||
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (menuHorizontalPosition >= 0) {
|
||||
INC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_posHorz < maxcol) {
|
||||
m_posHorz++;
|
||||
else if (menuHorizontalPosition < maxcol) {
|
||||
menuHorizontalPosition++;
|
||||
break;
|
||||
}
|
||||
do {
|
||||
INC(m_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(m_posVert));
|
||||
m_posHorz = POS_HORZ_INIT(m_posVert);
|
||||
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
{
|
||||
do {
|
||||
INC(m_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(m_posVert));
|
||||
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
s_editMode = 0; // if we go down, we must be in this mode
|
||||
uint8_t newmaxcol = MAXCOL(m_posVert);
|
||||
if (COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE) {
|
||||
m_posHorz = -1;
|
||||
uint8_t newmaxcol = MAXCOL(menuVerticalPosition);
|
||||
if (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE) {
|
||||
menuHorizontalPosition = -1;
|
||||
}
|
||||
else if (m_posHorz < 0 || m_posHorz > newmaxcol) {
|
||||
m_posHorz = POS_HORZ_INIT(m_posVert);
|
||||
else if (menuHorizontalPosition < 0 || menuHorizontalPosition > newmaxcol) {
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (s_editMode != 0) break;
|
||||
if ((COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (m_posHorz >= 0) {
|
||||
DEC(m_posHorz, 0, maxcol);
|
||||
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (menuHorizontalPosition >= 0) {
|
||||
DEC(menuHorizontalPosition, 0, maxcol);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_posHorz > 0) {
|
||||
m_posHorz--;
|
||||
else if (menuHorizontalPosition > 0) {
|
||||
menuHorizontalPosition--;
|
||||
break;
|
||||
}
|
||||
do {
|
||||
DEC(m_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(m_posVert));
|
||||
if (COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE)
|
||||
m_posHorz = -1;
|
||||
DEC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
if (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)
|
||||
menuHorizontalPosition = -1;
|
||||
else
|
||||
m_posHorz = min((uint8_t)m_posHorz, MAXCOL(m_posVert));
|
||||
menuHorizontalPosition = min((uint8_t)menuHorizontalPosition, MAXCOL(menuVerticalPosition));
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_KEY_REPT(KEY_UP):
|
||||
{
|
||||
do {
|
||||
DEC(m_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(m_posVert));
|
||||
DEC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
s_editMode = 0; // if we go up, we must be in this mode
|
||||
uint8_t newmaxcol = MAXCOL(m_posVert);
|
||||
if ((COLATTR(m_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||
m_posHorz = -1;
|
||||
uint8_t newmaxcol = MAXCOL(menuVerticalPosition);
|
||||
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
menuHorizontalPosition = -1;
|
||||
}
|
||||
else if (m_posHorz < 0) {
|
||||
m_posHorz = POS_HORZ_INIT(m_posVert);
|
||||
else if (menuHorizontalPosition < 0) {
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
}
|
||||
else if (m_posHorz > newmaxcol) {
|
||||
m_posHorz = min((uint8_t)m_posHorz, newmaxcol);
|
||||
else if (menuHorizontalPosition > newmaxcol) {
|
||||
menuHorizontalPosition = min((uint8_t)menuHorizontalPosition, newmaxcol);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -481,8 +481,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
linesCount = rowcount;
|
||||
int maxBodyLines = (menuTab ? NUM_BODY_LINES : NUM_BODY_LINES+1);
|
||||
|
||||
if (m_posVert <= MENU_FIRST_LINE_EDIT) {
|
||||
s_pgOfs = 0;
|
||||
if (menuVerticalPosition <= MENU_FIRST_LINE_EDIT) {
|
||||
menuVerticalOffset = 0;
|
||||
if (horTab) {
|
||||
linesCount = 0;
|
||||
for (int i=0; i<rowcount; i++) {
|
||||
@@ -496,13 +496,13 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
if (rowcount > maxBodyLines) {
|
||||
while (1) {
|
||||
vertpos_t firstLine = 0;
|
||||
for (int numLines=0; firstLine<rowcount && numLines<s_pgOfs; firstLine++) {
|
||||
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
|
||||
if (firstLine>=horTabMax || horTab[firstLine] != HIDDEN_ROW) {
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (m_posVert < firstLine) {
|
||||
s_pgOfs--;
|
||||
if (menuVerticalPosition < firstLine) {
|
||||
menuVerticalOffset--;
|
||||
}
|
||||
else {
|
||||
vertpos_t lastLine = firstLine;
|
||||
@@ -511,11 +511,11 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (m_posVert >= lastLine) {
|
||||
s_pgOfs++;
|
||||
if (menuVerticalPosition >= lastLine) {
|
||||
menuVerticalOffset++;
|
||||
}
|
||||
else {
|
||||
linesCount = s_pgOfs + maxBodyLines;
|
||||
linesCount = menuVerticalOffset + maxBodyLines;
|
||||
for (int i=lastLine; i<rowcount; i++) {
|
||||
if (i > horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||
linesCount++;
|
||||
@@ -528,18 +528,18 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_posVert >= maxBodyLines + s_pgOfs) {
|
||||
s_pgOfs = m_posVert-maxBodyLines+1;
|
||||
if (menuVerticalPosition >= maxBodyLines + menuVerticalOffset) {
|
||||
menuVerticalOffset = menuVerticalPosition-maxBodyLines+1;
|
||||
}
|
||||
else if (m_posVert < s_pgOfs) {
|
||||
s_pgOfs = m_posVert;
|
||||
else if (menuVerticalPosition < menuVerticalOffset) {
|
||||
menuVerticalOffset = menuVerticalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
{
|
||||
return check(event, curr, menuTab, menuTabSize, NULL, 0, rowcount);
|
||||
}
|
||||
@@ -555,6 +555,6 @@ void repeatLastCursorMove(evt_t event)
|
||||
putEvent(event);
|
||||
}
|
||||
else {
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,21 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
const char *s_warning = NULL;
|
||||
const char *s_warning_info;
|
||||
uint8_t s_warning_info_len;
|
||||
uint8_t s_warning_type;
|
||||
uint8_t s_warning_result = 0;
|
||||
uint8_t s_warning_info_flags = ZCHAR;
|
||||
int16_t s_warning_input_value;
|
||||
int16_t s_warning_input_min;
|
||||
int16_t s_warning_input_max;
|
||||
const char *warningText = NULL;
|
||||
const char *warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
void (*popupFunc)(evt_t event) = NULL;
|
||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
uint8_t s_menu_item = 0;
|
||||
uint16_t popupMenuNoItems = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
void (*popupMenuHandler)(const char *result);
|
||||
|
||||
void displayAlertBox()
|
||||
{
|
||||
@@ -103,47 +109,39 @@ void displayPopup(const char *title)
|
||||
|
||||
void displayWarning(evt_t event)
|
||||
{
|
||||
s_warning_result = false;
|
||||
if (s_warning_type == WARNING_TYPE_INPUT)
|
||||
warningResult = false;
|
||||
if (warningType == WARNING_TYPE_INPUT)
|
||||
displayMessageBox();
|
||||
else
|
||||
displayWarningBox();
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, s_warning, WARNING_LINE_LEN, DBLSIZE | (s_warning_type == WARNING_TYPE_INPUT ? WARNING_COLOR : ALARM_COLOR));
|
||||
if (s_warning_info) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_INFOLINE_Y, s_warning_info, s_warning_info_len, WARNING_INFO_FLAGS);
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN, DBLSIZE | (warningType == WARNING_TYPE_INPUT ? WARNING_COLOR : ALARM_COLOR));
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_INFOLINE_Y, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+20, s_warning_type == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+20, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_warning_type == WARNING_TYPE_ASTERISK)
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
s_warning_result = true;
|
||||
warningResult = true;
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_warning = NULL;
|
||||
s_warning_type = WARNING_TYPE_ASTERISK;
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
default:
|
||||
if (s_warning_type != WARNING_TYPE_INPUT) break;
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
s_warning_input_value = checkIncDec(event, s_warning_input_value, s_warning_input_min, s_warning_input_max);
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void (*popupFunc)(evt_t event) = NULL;
|
||||
|
||||
const char *s_menu[MENU_MAX_LINES];
|
||||
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(evt_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
uint8_t display_count = min(s_menu_count, (uint16_t)MENU_MAX_LINES);
|
||||
uint8_t display_count = min(popupMenuNoItems, (uint16_t)POPUP_MENU_MAX_LINES);
|
||||
|
||||
switch (event) {
|
||||
case EVT_ROTARY_LEFT:
|
||||
@@ -152,14 +150,14 @@ const char * displayMenu(evt_t event)
|
||||
if (s_menu_item > 0) {
|
||||
s_menu_item--;
|
||||
}
|
||||
else if (s_menu_offset > 0) {
|
||||
s_menu_offset--;
|
||||
else if (popupMenuOffset > 0) {
|
||||
popupMenuOffset--;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
else {
|
||||
s_menu_item = display_count - 1;
|
||||
if (s_menu_count > MENU_MAX_LINES) {
|
||||
s_menu_offset = s_menu_count - display_count;
|
||||
if (popupMenuNoItems > POPUP_MENU_MAX_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - display_count;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
}
|
||||
@@ -168,29 +166,28 @@ const char * displayMenu(evt_t event)
|
||||
case EVT_ROTARY_RIGHT:
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(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 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
|
||||
s_menu_item++;
|
||||
}
|
||||
else if (s_menu_count > s_menu_offset + display_count) {
|
||||
s_menu_offset++;
|
||||
else if (popupMenuNoItems > popupMenuOffset + display_count) {
|
||||
popupMenuOffset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
else {
|
||||
s_menu_item = 0;
|
||||
if (s_menu_offset) {
|
||||
s_menu_offset = 0;
|
||||
if (popupMenuOffset) {
|
||||
popupMenuOffset = 0;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
result = s_menu[s_menu_item];
|
||||
result = popupMenuItems[s_menu_item];
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_menu_count = 0;
|
||||
popupMenuNoItems = 0;
|
||||
s_menu_item = 0;
|
||||
s_menu_flags = 0;
|
||||
s_menu_offset = 0;
|
||||
popupMenuOffset = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -202,15 +199,15 @@ const char * displayMenu(evt_t event)
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
if (i == s_menu_item) {
|
||||
lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 4, s_menu[i], TEXT_INVERTED_COLOR|s_menu_flags);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 4, popupMenuItems[i], TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 4, s_menu[i], s_menu_flags);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 4, popupMenuItems[i], 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
if (popupMenuNoItems > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, POPUP_MENU_MAX_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, POPUP_MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -270,11 +270,11 @@ void onMainViewMenu(const char *result)
|
||||
pushModelNotes();
|
||||
}
|
||||
else if (result == STR_RESET_SUBMENU) {
|
||||
MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
}
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
@@ -305,14 +305,14 @@ bool menuMainView(evt_t event)
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_MODEL_SELECT);
|
||||
POPUP_MENU_ADD_ITEM(STR_MODEL_SELECT);
|
||||
if (modelHasNotes()) {
|
||||
MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
}
|
||||
MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
MENU_ADD_ITEM(STR_STATISTICS);
|
||||
MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
menuHandler = onMainViewMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
POPUP_MENU_ADD_ITEM(STR_STATISTICS);
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
popupMenuHandler = onMainViewMenu;
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_MENU):
|
||||
|
||||
@@ -184,7 +184,7 @@ bool menuTraceBuffer(evt_t event)
|
||||
|
||||
uint8_t y = 0;
|
||||
uint8_t k = 0;
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
lcdDrawChar(0, FH, '#', TEXT_COLOR);
|
||||
lcdDrawText(4*10, FH, "Time");
|
||||
@@ -193,7 +193,7 @@ bool menuTraceBuffer(evt_t event)
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
y = 1 + (i+2)*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
|
||||
// item
|
||||
lcdDrawNumber(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
|
||||
@@ -56,13 +56,13 @@ void readTextFile(int & lines_count)
|
||||
|
||||
result = f_open(&file, s_text_file, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result == FR_OK) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-s_pgOfs<NUM_BODY_LINES); i++) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-menuVerticalOffset<NUM_BODY_LINES); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<NUM_BODY_LINES && line_length<LCD_COLS) {
|
||||
else if (c!='\r' && current_line>=menuVerticalOffset && current_line-menuVerticalOffset<NUM_BODY_LINES && line_length<LCD_COLS) {
|
||||
if (c=='\\' && escape==0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
@@ -89,7 +89,7 @@ void readTextFile(int & lines_count)
|
||||
c = 0x1D; //tab
|
||||
}
|
||||
escape = 0;
|
||||
s_text_screen[current_line-s_pgOfs][line_length++] = c;
|
||||
s_text_screen[current_line-menuVerticalOffset][line_length++] = c;
|
||||
}
|
||||
}
|
||||
if (c != '\n') {
|
||||
@@ -111,24 +111,24 @@ bool menuTextView(evt_t event)
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
s_pgOfs = 0;
|
||||
menuVerticalOffset = 0;
|
||||
lines_count = 0;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
if (s_pgOfs == 0)
|
||||
if (menuVerticalOffset == 0)
|
||||
break;
|
||||
else
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
if (s_pgOfs+NUM_BODY_LINES >= lines_count)
|
||||
if (menuVerticalOffset+NUM_BODY_LINES >= lines_count)
|
||||
break;
|
||||
else
|
||||
++s_pgOfs;
|
||||
++menuVerticalOffset;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
@@ -147,7 +147,7 @@ bool menuTextView(evt_t event)
|
||||
#endif
|
||||
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
|
||||
drawVerticalScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||
drawVerticalScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, menuVerticalOffset, lines_count, NUM_BODY_LINES);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
|
||||
lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
|
||||
|
||||
const uint8_t * const * icons = (g_menuPos[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS);
|
||||
const uint8_t * const * icons = (menuVerticalPositions[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS);
|
||||
|
||||
lcdDrawBitmapPattern(5, 7, icons[0], MENU_TITLE_COLOR);
|
||||
|
||||
@@ -201,7 +201,7 @@ void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES+1) {
|
||||
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+MENU_FOOTER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES+1);
|
||||
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+MENU_FOOTER_HEIGHT, menuVerticalOffset, linesCount, NUM_BODY_LINES+1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||
|
||||
if (m_posVert < 0) {
|
||||
if (menuVerticalPosition < 0) {
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
@@ -224,7 +224,7 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
const uint8_t * const * icons = (g_menuPos[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS);
|
||||
const uint8_t * const * icons = (menuVerticalPositions[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS);
|
||||
|
||||
lcdDrawBitmapPattern(5, 7, icons[0], MENU_TITLE_COLOR);
|
||||
|
||||
@@ -232,7 +232,7 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, icons[i+1], MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
if (m_posVert < 0) {
|
||||
if (menuVerticalPosition < 0) {
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
|
||||
}
|
||||
@@ -245,13 +245,13 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, menuVerticalOffset, linesCount, NUM_BODY_LINES);
|
||||
}
|
||||
}
|
||||
|
||||
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event)
|
||||
{
|
||||
if (attr) value = checkIncDec(event, value, min, max, (g_menuPos[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ bool loadModelBitmap(char * name, uint8_t * bitmap);
|
||||
|
||||
struct MenuItem {
|
||||
const char *name;
|
||||
const MenuFuncP action;
|
||||
const MenuHandlerFunc action;
|
||||
};
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
|
||||
@@ -225,20 +225,11 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
||||
uint32_t fontsize = FONTSIZE(flags);
|
||||
bool setx = false;
|
||||
while (len--) {
|
||||
unsigned char c;
|
||||
switch (flags & (BSS+ZCHAR)) {
|
||||
case BSS:
|
||||
c = *s;
|
||||
break;
|
||||
#if !defined(BOOT)
|
||||
case ZCHAR:
|
||||
c = idx2char(*s);
|
||||
break;
|
||||
#if defined(BOOT)
|
||||
unsigned char c = *s;
|
||||
#else
|
||||
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
#endif
|
||||
default:
|
||||
c = pgm_read_byte(s);
|
||||
break;
|
||||
}
|
||||
|
||||
if (setx) {
|
||||
x = c;
|
||||
@@ -305,7 +296,7 @@ void lcd_putsLeft(coord_t y, const pm_char * s)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
uint8_t length = pgm_read_byte(s++);
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
|
||||
}
|
||||
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
/* lcd puts flags */
|
||||
/* no 0x80 here because of "GV"1 which is aligned LEFT */
|
||||
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
|
||||
#define BSS 0x00
|
||||
#define ZCHAR 0x80
|
||||
|
||||
/* lcd outdez flags */
|
||||
|
||||
@@ -88,7 +88,7 @@ enum EnumTabDiag {
|
||||
e_Calib
|
||||
};
|
||||
|
||||
const MenuFuncP menuTabGeneral[] = {
|
||||
const MenuHandlerFunc menuTabGeneral[] = {
|
||||
menuGeneralSetup,
|
||||
menuGeneralSdManager,
|
||||
menuGeneralCustomFunctions,
|
||||
|
||||
@@ -100,11 +100,11 @@ void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
|
||||
|
||||
uint8_t sub = m_posVert;
|
||||
uint8_t sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
@@ -135,13 +135,13 @@ void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
int idx = k - ITEM_SETUP_HW_LS2;
|
||||
uint8_t mask = (0x01 << idx);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+2+idx+1, m_posHorz < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx]) || (attr && m_posHorz == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx], LEN_ANA_NAME, event, attr && m_posHorz == 0);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+2+idx+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, m_posHorz == 1 ? attr : 0, event);
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
g_eeGeneral.slidersConfig &= ~mask;
|
||||
g_eeGeneral.slidersConfig |= (potType << idx);
|
||||
break;
|
||||
@@ -162,13 +162,13 @@ void menuGeneralHardware(uint8_t event)
|
||||
int idx = k - ITEM_SETUP_HW_POT1;
|
||||
uint8_t shift = (2*idx);
|
||||
uint8_t mask = (0x03 << shift);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, m_posHorz < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && m_posHorz == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && m_posHorz == 0);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, m_posHorz == 1 ? attr : 0, event);
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
g_eeGeneral.potsConfig &= ~mask;
|
||||
g_eeGeneral.potsConfig |= (potType << shift);
|
||||
break;
|
||||
@@ -199,12 +199,12 @@ void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
int index = k-ITEM_SETUP_HW_SA;
|
||||
int config = SWITCH_CONFIG(index);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, m_posHorz < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && m_posHorz == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, m_posHorz == 0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), m_posHorz == 1 ? attr : 0, event);
|
||||
config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
swconfig_t mask = (swconfig_t)0x03 << (2*index);
|
||||
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
|
||||
@@ -214,11 +214,11 @@ void menuGeneralHardware(uint8_t event)
|
||||
#if defined(REV9E)
|
||||
case ITEM_SETUP_HW_BLUETOOTH:
|
||||
lcd_putsLeft(y, "Bluetooth");
|
||||
menu_lcd_onoff(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, m_posHorz == 0 ? attr : 0);
|
||||
if (attr && m_posHorz == 0) {
|
||||
menu_lcd_onoff(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition == 0) {
|
||||
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
|
||||
}
|
||||
editName(HW_SETTINGS_COLUMN+5*FW, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, m_posHorz == 1 ? attr : 0);
|
||||
editName(HW_SETTINGS_COLUMN+5*FW, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, menuHorizontalPosition == 1 ? attr : 0);
|
||||
break;
|
||||
#endif
|
||||
case ITEM_SETUP_HW_UART3_MODE:
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define REFRESH_FILES() do { reusableBuffer.sdmanager.offset = 65535; m_posVert = 0; } while(0)
|
||||
#define REFRESH_FILES() do { reusableBuffer.sdmanager.offset = 65535; menuVerticalPosition = 0; } while(0)
|
||||
#define NODE_TYPE(fname) fname[SD_SCREEN_FILE_LENGTH+1]
|
||||
#define IS_DIRECTORY(fname) ((bool)(!NODE_TYPE(fname)))
|
||||
#define IS_FILE(fname) ((bool)(NODE_TYPE(fname)))
|
||||
@@ -150,7 +150,7 @@ void getSelectionFullPath(char *lfn)
|
||||
{
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[m_posVert - s_pgOfs]);
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - menuVerticalOffset]);
|
||||
}
|
||||
|
||||
void onSdManagerMenu(const char *result)
|
||||
@@ -159,7 +159,7 @@ void onSdManagerMenu(const char *result)
|
||||
|
||||
// TODO possible buffer overflows here!
|
||||
|
||||
uint8_t index = m_posVert-s_pgOfs;
|
||||
uint8_t index = menuVerticalPosition-menuVerticalOffset;
|
||||
char *line = reusableBuffer.sdmanager.lines[index];
|
||||
|
||||
if (result == STR_SD_INFO) {
|
||||
@@ -245,8 +245,8 @@ void onSdManagerMenu(const char *result)
|
||||
|
||||
void menuGeneralSdManager(evt_t _event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
displayPopup(STR_FORMATTING);
|
||||
closeLogs();
|
||||
audioQueue.stopSD();
|
||||
@@ -259,12 +259,12 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
|
||||
int lastPos = m_posVert;
|
||||
int lastPos = menuVerticalPosition;
|
||||
|
||||
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
|
||||
|
||||
int index = m_posVert-s_pgOfs;
|
||||
int index = menuVerticalPosition-menuVerticalOffset;
|
||||
|
||||
switch(_event) {
|
||||
case EVT_ENTRY:
|
||||
@@ -276,9 +276,9 @@ void menuGeneralSdManager(evt_t _event)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
if (!READ_ONLY() && s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
MENU_ADD_ITEM(STR_SD_INFO);
|
||||
MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
menuHandler = onSdManagerMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -293,8 +293,8 @@ void menuGeneralSdManager(evt_t _event)
|
||||
else {
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[index])) {
|
||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||
s_pgOfs = 0;
|
||||
m_posVert = 1;
|
||||
menuVerticalOffset = 0;
|
||||
menuVerticalPosition = 1;
|
||||
index = 1;
|
||||
REFRESH_FILES();
|
||||
killEvents(_event);
|
||||
@@ -313,48 +313,48 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
if (ext) {
|
||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
}
|
||||
else if (!strcasecmp(ext, BITMAPS_EXT)) {
|
||||
if (!READ_ONLY() && (ext-line) <= (int)sizeof(g_model.header.bitmap)) {
|
||||
MENU_ADD_ITEM(STR_ASSIGN_BITMAP);
|
||||
POPUP_MENU_ADD_ITEM(STR_ASSIGN_BITMAP);
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(ext, TEXT_EXT)) {
|
||||
MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (!strcasecmp(ext, SCRIPTS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
}
|
||||
#endif
|
||||
else if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
getSelectionFullPath(lfn);
|
||||
if (isBootloader(lfn)) {
|
||||
MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
|
||||
}
|
||||
}
|
||||
else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
||||
MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||
MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
}
|
||||
}
|
||||
if (!READ_ONLY()) {
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (reusableBuffer.sdmanager.offset != s_pgOfs) {
|
||||
if (reusableBuffer.sdmanager.offset != menuVerticalOffset) {
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
@@ -362,15 +362,15 @@ void menuGeneralSdManager(evt_t _event)
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
reusableBuffer.sdmanager.offset = 0;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs == reusableBuffer.sdmanager.count-NUM_BODY_LINES) {
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
else if (menuVerticalOffset == reusableBuffer.sdmanager.count-NUM_BODY_LINES) {
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = 1;
|
||||
@@ -399,7 +399,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
|
||||
bool isfile = !(fno.fattrib & AM_DIR);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
if (menuVerticalOffset == 0) {
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
@@ -411,7 +411,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.sdmanager.offset == s_pgOfs) {
|
||||
else if (reusableBuffer.sdmanager.offset == menuVerticalOffset) {
|
||||
for (int8_t i=NUM_BODY_LINES-1; i>=0; i--) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) {
|
||||
@@ -423,7 +423,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
else if (menuVerticalOffset > reusableBuffer.sdmanager.offset) {
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-2]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1])) {
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], fn);
|
||||
@@ -441,12 +441,12 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
reusableBuffer.sdmanager.offset = menuVerticalOffset;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
lcdNextPos = 0;
|
||||
LcdFlags attr = (index == i ? BSS|INVERS : BSS);
|
||||
LcdFlags attr = (index == i ? INVERS : 0);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) { lcdDrawChar(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
|
||||
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
||||
@@ -473,7 +473,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
|
||||
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext && !strcasecmp(ext, BITMAPS_EXT)) {
|
||||
if (lastPos != m_posVert) {
|
||||
if (lastPos != menuVerticalPosition) {
|
||||
if (bmpLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||
memcpy(modelBitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
|
||||
if ((m_posVert==ITEM_SETUP_DATE || m_posVert==ITEM_SETUP_TIME) &&
|
||||
if ((menuVerticalPosition==ITEM_SETUP_DATE || menuVerticalPosition==ITEM_SETUP_TIME) &&
|
||||
(s_editMode>0) &&
|
||||
(event==EVT_KEY_FIRST(KEY_ENTER) || event==EVT_KEY_BREAK(KEY_ENTER) || event==EVT_KEY_LONG(KEY_ENTER) || event==EVT_KEY_FIRST(KEY_EXIT))) {
|
||||
// set the date and time into RTC chip
|
||||
@@ -121,8 +121,8 @@ void menuGeneralSetup(uint8_t event)
|
||||
#endif
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
g_eeGeneral.fai = true;
|
||||
storageDirty(EE_GENERAL);
|
||||
}
|
||||
@@ -130,11 +130,11 @@ void menuGeneralSetup(uint8_t event)
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, { 2, 2, 1, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, 0, CASE_REVPLUS(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, IF_FAI_CHOICE(0) CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 0, 1/*to force edit mode*/ });
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
@@ -143,7 +143,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_DATE);
|
||||
lcdDrawChar(RADIO_SETUP_DATE_COLUMN, y, '-'); lcdDrawChar(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr);
|
||||
@@ -165,7 +165,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
if (attr && menuHorizontalPosition < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_TIME);
|
||||
lcdDrawChar(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcdDrawChar(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
uint8_t rowattr = (menuHorizontalPosition==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0, 2);
|
||||
@@ -191,19 +191,19 @@ void menuGeneralSetup(uint8_t event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
if (attr && menuHorizontalPosition < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
if (attr && checkIncDec_Ret)
|
||||
g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_BATT_RANGE:
|
||||
lcd_putsLeft(y, STR_BATTERY_RANGE);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
lcdDrawChar(lcdLastPos, y, '-');
|
||||
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && m_posHorz < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (menuHorizontalPosition>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && menuHorizontalPosition < 0) lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
if (attr && s_editMode>0) {
|
||||
if (m_posHorz==0)
|
||||
if (menuHorizontalPosition==0)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMin, -50, g_eeGeneral.vBatMax+29); // min=4.0V
|
||||
else
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMax, g_eeGeneral.vBatMin-29, +40); // max=16.0V
|
||||
|
||||
@@ -56,7 +56,7 @@ void menuGeneralTrainer(uint8_t event)
|
||||
lcdDrawText(3*FW, MENU_HEADER_HEIGHT+1, STR_MODESRC);
|
||||
|
||||
y = MENU_HEADER_HEIGHT + 1 + FH;
|
||||
int sub = m_posVert + 1;
|
||||
int sub = menuVerticalPosition + 1;
|
||||
|
||||
for (int i=1; i<=NUM_STICKS; i++) {
|
||||
uint8_t chan = channel_order(i);
|
||||
@@ -66,7 +66,7 @@ void menuGeneralTrainer(uint8_t event)
|
||||
|
||||
for (int j=0; j<3; j++) {
|
||||
|
||||
attr = ((sub==i && m_posHorz==j) ? blink : 0);
|
||||
attr = ((sub==i && menuHorizontalPosition==j) ? blink : 0);
|
||||
|
||||
switch(j) {
|
||||
case 0:
|
||||
|
||||
@@ -83,8 +83,8 @@ void backupEeprom()
|
||||
|
||||
void menuGeneralVersion(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
displayPopup(STR_STORAGE_FORMAT);
|
||||
storageEraseAll(false);
|
||||
#if !defined(SIMU)
|
||||
|
||||
@@ -108,7 +108,7 @@ uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, cons
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
#endif
|
||||
|
||||
const MenuFuncP menuTabModel[] = {
|
||||
const MenuHandlerFunc menuTabModel[] = {
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
@@ -208,7 +208,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
|
||||
if (c != v) {
|
||||
name[cur] = v;
|
||||
storageDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
|
||||
storageDirty(menuVerticalPositions[0] == 0 ? EE_MODEL : EE_GENERAL);
|
||||
}
|
||||
|
||||
if (attr == ZCHAR) {
|
||||
|
||||
@@ -98,15 +98,15 @@ bool moveCurve(uint8_t index, int8_t shift)
|
||||
void displayPresetChoice(uint8_t event)
|
||||
{
|
||||
displayWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*s_warning_input_value/4, LEFT|INVERS);
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
for (uint8_t i=0; i<5+crv.points; i++)
|
||||
points[i] = (i-((5+crv.points)/2)) * s_warning_input_value * 50 / (4+crv.points);
|
||||
points[i] = (i-((5+crv.points)/2)) * warningInputValue * 50 / (4+crv.points);
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
for (int i=0; i<3+crv.points; i++)
|
||||
points[crv.points+i] = -100 + ((i+1)*200) / (4+crv.points);
|
||||
@@ -150,9 +150,9 @@ void menuModelCurveOne(uint8_t event)
|
||||
lcdDrawNumber(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT);
|
||||
|
||||
lcd_putsLeft(FH+1, STR_NAME);
|
||||
editName(INDENT_WIDTH, 2*FH+1, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
|
||||
editName(INDENT_WIDTH, 2*FH+1, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, menuVerticalPosition==0);
|
||||
|
||||
uint8_t attr = (m_posVert==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
uint8_t attr = (menuVerticalPosition==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcd_putsLeft(3*FH+1, STR_TYPE);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, 4*FH+1, STR_CURVE_TYPES, crv.type, attr);
|
||||
if (attr) {
|
||||
@@ -169,7 +169,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
attr = (m_posVert==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
attr = (menuVerticalPosition==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcd_putsLeft(5*FH+1, STR_COUNT);
|
||||
lcdDrawNumber(INDENT_WIDTH, 6*FH+1, 5+crv.points, LEFT|attr);
|
||||
lcdDrawText(lcdLastPos, 6*FH+1, STR_PTS, attr);
|
||||
@@ -192,8 +192,8 @@ void menuModelCurveOne(uint8_t event)
|
||||
}
|
||||
|
||||
lcd_putsLeft(7*FH+1, STR_SMOOTH);
|
||||
menu_lcd_onoff(7*FW, 7*FH+1, crv.smooth, m_posVert==3 ? INVERS : 0);
|
||||
if (m_posVert==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
menu_lcd_onoff(7*FW, 7*FH+1, crv.smooth, menuVerticalPosition==3 ? INVERS : 0);
|
||||
if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
@@ -201,12 +201,12 @@ void menuModelCurveOne(uint8_t event)
|
||||
SET_SCROLLBAR_X(0);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (m_posVert > 1) {
|
||||
if (menuVerticalPosition > 1) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
MENU_ADD_ITEM(STR_MIRROR);
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onCurveOneMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_MIRROR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onCurveOneMenu;
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
@@ -222,12 +222,12 @@ void menuModelCurveOne(uint8_t event)
|
||||
point_t point = getPoint(i);
|
||||
uint8_t selectionMode = 0;
|
||||
if (crv.type==CURVE_TYPE_CUSTOM) {
|
||||
if (m_posVert==4+2*i || (i==5+crv.points-1 && m_posVert==4+5+crv.points+5+crv.points-2-1))
|
||||
if (menuVerticalPosition==4+2*i || (i==5+crv.points-1 && menuVerticalPosition==4+5+crv.points+5+crv.points-2-1))
|
||||
selectionMode = 2;
|
||||
else if (i>0 && m_posVert==3+2*i)
|
||||
else if (i>0 && menuVerticalPosition==3+2*i)
|
||||
selectionMode = 1;
|
||||
}
|
||||
else if (m_posVert == 4+i) {
|
||||
else if (menuVerticalPosition == 4+i) {
|
||||
selectionMode = 2;
|
||||
}
|
||||
|
||||
@@ -260,23 +260,23 @@ void menuModelCurveOne(uint8_t event)
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr)
|
||||
{
|
||||
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, m_posHorz==0 ? attr : 0);
|
||||
if (attr && m_posHorz==0) {
|
||||
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, curve.type, CURVE_REF_CUSTOM);
|
||||
if (checkIncDec_Ret) curve.value = 0;
|
||||
}
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
case CURVE_REF_EXPO:
|
||||
curve.value = GVAR_MENU_ITEM(x+5*FW, y, curve.value, -100, 100, m_posHorz==1 ? LEFT|attr : LEFT, 0, event);
|
||||
curve.value = GVAR_MENU_ITEM(x+5*FW, y, curve.value, -100, 100, menuHorizontalPosition==1 ? LEFT|attr : LEFT, 0, event);
|
||||
break;
|
||||
case CURVE_REF_FUNC:
|
||||
lcdDrawTextAtIndex(x+5*FW, y, STR_VCURVEFUNC, curve.value, m_posHorz==1 ? attr : 0);
|
||||
if (attr && m_posHorz==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
lcdDrawTextAtIndex(x+5*FW, y, STR_VCURVEFUNC, curve.value, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
break;
|
||||
case CURVE_REF_CUSTOM:
|
||||
putsCurve(x+5*FW+2, y, curve.value, m_posHorz==1 ? attr : 0);
|
||||
if (attr && m_posHorz==1) {
|
||||
putsCurve(x+5*FW+2, y, curve.value, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==1) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
|
||||
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
pushMenu(menuModelCurveOne);
|
||||
@@ -293,7 +293,7 @@ void menuModelCurvesAll(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES);
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
@@ -306,7 +306,7 @@ void menuModelCurvesAll(uint8_t event)
|
||||
|
||||
for (int i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
LcdFlags attr = (sub == k ? INVERS : 0);
|
||||
{
|
||||
putsStrIdx(0, y, STR_CV, k+1, attr);
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
|
||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
CustomFunctionData * cfn;
|
||||
uint8_t eeFlags;
|
||||
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions) {
|
||||
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
|
||||
cfn = &g_model.customFn[sub];
|
||||
eeFlags = EE_MODEL;
|
||||
}
|
||||
@@ -69,7 +69,6 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
}
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -84,11 +83,11 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
|
||||
void onCustomFunctionsMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
CustomFunctionData * cfn;
|
||||
uint8_t eeFlags;
|
||||
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions) {
|
||||
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
|
||||
cfn = &g_model.customFn[sub];
|
||||
eeFlags = EE_MODEL;
|
||||
}
|
||||
@@ -123,7 +122,7 @@ void onCustomFunctionsMenu(const char *result)
|
||||
|
||||
void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
{
|
||||
CustomFunctionData * cfn = &g_model.customFn[m_posVert];
|
||||
CustomFunctionData * cfn = &g_model.customFn[menuVerticalPosition];
|
||||
|
||||
if (result == STR_CONSTANT) {
|
||||
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
|
||||
@@ -152,38 +151,38 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
if (m_posHorz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
CustomFunctionData *cfn = &functions[sub];
|
||||
if (!CFN_EMPTY(cfn))
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
if (!CFN_EMPTY(cfn) && CFN_EMPTY(&functions[NUM_CFN-1]))
|
||||
MENU_ADD_ITEM(STR_INSERT);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT);
|
||||
if (!CFN_EMPTY(cfn))
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
for (int i=sub+1; i<NUM_CFN; i++) {
|
||||
if (!CFN_EMPTY(&functions[i])) {
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
menuHandler = onCustomFunctionsMenu;
|
||||
popupMenuHandler = onCustomFunctionsMenu;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
|
||||
putsStrIdx(0, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
|
||||
putsStrIdx(0, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && menuHorizontalPosition<0) ? INVERS : 0);
|
||||
|
||||
CustomFunctionData *cfn = &functions[k];
|
||||
uint8_t func = CFN_FUNC(cfn);
|
||||
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 && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && s_editMode>0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
@@ -204,7 +203,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
}
|
||||
else {
|
||||
j = 4; // skip other fields
|
||||
if (sub==k && m_posHorz > 0) {
|
||||
if (sub==k && menuHorizontalPosition > 0) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
@@ -304,11 +303,10 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
menuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
popupMenuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -391,14 +389,14 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
if (func == FUNC_ADJUST_GVAR && attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
|
||||
MENU_ADD_ITEM(STR_CONSTANT);
|
||||
POPUP_MENU_ADD_ITEM(STR_CONSTANT);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
|
||||
MENU_ADD_ITEM(STR_MIXSOURCE);
|
||||
POPUP_MENU_ADD_ITEM(STR_MIXSOURCE);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
|
||||
MENU_ADD_ITEM(STR_GLOBALVAR);
|
||||
POPUP_MENU_ADD_ITEM(STR_GLOBALVAR);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
|
||||
MENU_ADD_ITEM(STR_INCDEC);
|
||||
menuHandler = onAdjustGvarSourceLongEnterPress;
|
||||
POPUP_MENU_ADD_ITEM(STR_INCDEC);
|
||||
popupMenuHandler = onAdjustGvarSourceLongEnterPress;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ void onModelCustomScriptMenu(const char *result)
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), NULL)) {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -73,11 +72,11 @@ void menuModelCustomScriptOne(uint8_t event)
|
||||
|
||||
SUBMENU_NOTITLE(3+scriptInputsOutputs[s_currIdx].inputsCount, { 0, 0, LABEL(inputs), 0/*repeated*/ });
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
for (int k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
int i = k + s_pgOfs;
|
||||
int i = k + menuVerticalOffset;
|
||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
if (i == ITEM_MODEL_CUSTOMSCRIPT_FILE) {
|
||||
@@ -89,11 +88,10 @@ void menuModelCustomScriptOne(uint8_t event)
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
||||
menuHandler = onModelCustomScriptMenu;
|
||||
popupMenuHandler = onModelCustomScriptMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +140,7 @@ void menuModelCustomScripts(uint8_t event)
|
||||
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
|
||||
|
||||
coord_t y;
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
if (event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
s_currIdx = sub;
|
||||
|
||||
@@ -60,16 +60,16 @@ enum FlightModesItems {
|
||||
|
||||
bool isTrimModeAvailable(int mode)
|
||||
{
|
||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != m_posVert);
|
||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != menuVerticalPosition);
|
||||
}
|
||||
|
||||
void menuModelFlightModesAll(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0 });
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
horzpos_t posHorz = m_posHorz;
|
||||
horzpos_t posHorz = menuHorizontalPosition;
|
||||
if (sub==0 && posHorz > 0) { posHorz += 1; }
|
||||
|
||||
if (sub<MAX_FLIGHT_MODES && posHorz>=0) {
|
||||
@@ -78,7 +78,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
if (k==MAX_FLIGHT_MODES) {
|
||||
// last line available - add the "check trims" line
|
||||
@@ -109,7 +109,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
|
||||
FlightModeData *p = flightModeAddress(k);
|
||||
|
||||
putsFlightMode(0, y, k+1, (getFlightMode()==k ? BOLD : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
putsFlightMode(0, y, k+1, (getFlightMode()==k ? BOLD : 0) | ((sub==k && menuHorizontalPosition<0) ? INVERS : 0));
|
||||
|
||||
for (uint8_t j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
void onGVARSMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
if (result == STR_ENABLE_POPUP) {
|
||||
g_model.gvars[sub].popup = true;
|
||||
@@ -75,17 +75,17 @@ void menuModelGVars(uint8_t event)
|
||||
|
||||
MENU_FLAGS(menuTitle, menuTabModel, e_GVars, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES });
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int l=0; l<LCD_LINES-1; l++) {
|
||||
int i = l+s_pgOfs;
|
||||
int i = l+menuVerticalOffset;
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + l*FH;
|
||||
|
||||
if (g_model.gvars[i].popup) lcdDrawChar(3*FW, y, '!');
|
||||
putsStrIdx(0, y, STR_GV, i+1, (sub==i && m_posHorz<0) ? INVERS : 0);
|
||||
putsStrIdx(0, y, STR_GV, i+1, (sub==i && menuHorizontalPosition<0) ? INVERS : 0);
|
||||
|
||||
for (int j=0; j<1+MAX_FLIGHT_MODES; j++) {
|
||||
LcdFlags attr = ((sub==i && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr = ((sub==i && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
coord_t x = GVARS_FM_COLUMN(j-1);
|
||||
|
||||
switch(j)
|
||||
@@ -127,13 +127,13 @@ void menuModelGVars(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
if (menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
if (g_model.gvars[sub].popup)
|
||||
MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
||||
else
|
||||
MENU_ADD_ITEM(STR_ENABLE_POPUP);
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onGVARSMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_ENABLE_POPUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onGVARSMenu;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ void menuModelHeli(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX);
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i+s_pgOfs;
|
||||
int k = i+menuVerticalOffset;
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, STR_FLMODE);
|
||||
|
||||
int posHorz = m_posHorz;
|
||||
int posHorz = menuHorizontalPosition;
|
||||
|
||||
for (int p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
LcdFlags flags = 0;
|
||||
@@ -320,12 +320,12 @@ void menuModelExpoOne(uint8_t event)
|
||||
|
||||
SET_SCROLLBAR_X(EXPO_ONE_2ND_COLUMN+10*FW);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1;
|
||||
|
||||
for (unsigned int k=0; k<NUM_BODY_LINES; k++) {
|
||||
int i = k + s_pgOfs;
|
||||
int i = k + menuVerticalOffset;
|
||||
for (int j=0; j<=i; ++j) {
|
||||
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
||||
++i;
|
||||
@@ -389,7 +389,7 @@ void menuModelExpoOne(uint8_t event)
|
||||
uint8_t not_stick = (ed->srcRaw > MIXSRC_Ail);
|
||||
int8_t carryTrim = -ed->carryTrim;
|
||||
lcd_putsLeft(y, STR_TRIM);
|
||||
lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(EXPO_ONE_2ND_COLUMN, y, STR_VMIXTRIMS, (not_stick && carryTrim == 0) ? 0 : carryTrim+1, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (attr) ed->carryTrim = -checkIncDecModel(event, carryTrim, not_stick ? TRIM_ON : -TRIM_OFF, -TRIM_AIL);
|
||||
break;
|
||||
}
|
||||
@@ -504,7 +504,7 @@ void menuModelMixOne(uint8_t event)
|
||||
SET_SCROLLBAR_X(0);
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
for (int k=0; k<MENU_COLUMNS*(LCD_LINES-1); k++) {
|
||||
@@ -521,7 +521,7 @@ void menuModelMixOne(uint8_t event)
|
||||
int8_t i = k;
|
||||
|
||||
#if MENU_COLUMNS < 2
|
||||
i = i + s_pgOfs;
|
||||
i = i + menuVerticalOffset;
|
||||
#endif
|
||||
|
||||
LcdFlags attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
@@ -623,7 +623,7 @@ static uint8_t s_copySrcCh;
|
||||
|
||||
void onExpoMixMenu(const char *result)
|
||||
{
|
||||
bool expo = (g_menuStack[g_menuStackPtr] == menuModelExposAll);
|
||||
bool expo = (menuHandlers[menuLevel] == menuModelExposAll);
|
||||
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
|
||||
|
||||
if (result == STR_EDIT) {
|
||||
@@ -632,7 +632,7 @@ void onExpoMixMenu(const char *result)
|
||||
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++; }
|
||||
if (result == STR_INSERT_AFTER) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
}
|
||||
@@ -641,7 +641,7 @@ void onExpoMixMenu(const char *result)
|
||||
s_copyMode = (result == STR_COPY ? COPY_MODE : MOVE_MODE);
|
||||
s_copySrcIdx = s_currIdx;
|
||||
s_copySrcCh = chn;
|
||||
s_copySrcRow = m_posVert;
|
||||
s_copySrcRow = menuVerticalPosition;
|
||||
}
|
||||
else if (result == STR_DELETE) {
|
||||
deleteExpoMix(expo, s_currIdx);
|
||||
@@ -701,7 +701,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
|
||||
void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
{
|
||||
uint8_t sub = m_posVert;
|
||||
uint8_t sub = menuVerticalPosition;
|
||||
|
||||
if (s_editMode > 0)
|
||||
s_editMode = 0;
|
||||
@@ -736,7 +736,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
} while (s_copyTgtOfs != 0);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
m_posVert = s_copySrcRow;
|
||||
menuVerticalPosition = s_copySrcRow;
|
||||
s_copyTgtOfs = 0;
|
||||
}
|
||||
s_copyMode = 0;
|
||||
@@ -776,13 +776,13 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
else {
|
||||
event = 0;
|
||||
s_copyMode = 0;
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_MOVE);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onExpoMixMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_BEFORE);
|
||||
POPUP_MENU_ADD_ITEM(STR_INSERT_AFTER);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onExpoMixMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -792,7 +792,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
if (s_copyMode && !s_copyTgtOfs) {
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
s_currCh = chn;
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; m_posVert++; }
|
||||
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; menuVerticalPosition++; }
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
@@ -812,7 +812,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
copyExpoMix(expo, s_currIdx);
|
||||
if (key==KEY_DOWN) s_currIdx++;
|
||||
else if (sub-s_pgOfs >= 6) s_pgOfs++;
|
||||
else if (sub-menuVerticalOffset >= 6) menuVerticalOffset++;
|
||||
}
|
||||
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
|
||||
// delete the mix
|
||||
@@ -866,16 +866,16 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
sub = m_posVert;
|
||||
sub = menuVerticalPosition;
|
||||
s_currCh = 0;
|
||||
int cur = 0;
|
||||
int i = 0;
|
||||
|
||||
for (int ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
|
||||
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
|
||||
coord_t y = MENU_HEADER_HEIGHT+1+(cur-s_pgOfs)*FH;
|
||||
coord_t y = MENU_HEADER_HEIGHT+1+(cur-menuVerticalOffset)*FH;
|
||||
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(0, y, ch, 0);
|
||||
}
|
||||
@@ -886,19 +886,19 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
uint8_t mixCnt = 0;
|
||||
do {
|
||||
if (s_copyMode) {
|
||||
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcdDrawRect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
if (s_currIdx == i) {
|
||||
sub = m_posVert = cur;
|
||||
sub = menuVerticalPosition = cur;
|
||||
s_currCh = ch;
|
||||
}
|
||||
}
|
||||
else if (sub == cur) {
|
||||
s_currIdx = i;
|
||||
}
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||
if (expo) {
|
||||
GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
|
||||
@@ -936,7 +936,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
}
|
||||
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
|
||||
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
|
||||
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
if (s_copyMode == MOVE_MODE && cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
@@ -950,7 +950,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
attr = INVERS;
|
||||
}
|
||||
}
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(0, y, ch, attr);
|
||||
}
|
||||
@@ -965,7 +965,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
}
|
||||
}
|
||||
s_maxLines = cur;
|
||||
if (sub >= s_maxLines-1) m_posVert = s_maxLines-1;
|
||||
if (sub >= s_maxLines-1) menuVerticalPosition = s_maxLines-1;
|
||||
}
|
||||
|
||||
void menuModelExposAll(uint8_t event)
|
||||
|
||||
@@ -94,7 +94,7 @@ enum LimitsItems {
|
||||
|
||||
void onLimitsMenu(const char *result)
|
||||
{
|
||||
int ch = m_posVert;
|
||||
int ch = menuVerticalPosition;
|
||||
|
||||
if (result == STR_RESET) {
|
||||
LimitData *ld = limitAddress(ch);
|
||||
@@ -115,7 +115,7 @@ void onLimitsMenu(const char *result)
|
||||
|
||||
void menuModelLimits(uint8_t event)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
if (sub < NUM_CHNOUT) {
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||
@@ -128,12 +128,12 @@ void menuModelLimits(uint8_t event)
|
||||
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, NUM_CHNOUT+1, { NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, 0 });
|
||||
|
||||
if (sub<NUM_CHNOUT && m_posHorz>=0) {
|
||||
displayColumnHeader(STR_LIMITS_HEADERS, m_posHorz);
|
||||
if (sub<NUM_CHNOUT && menuHorizontalPosition>=0) {
|
||||
displayColumnHeader(STR_LIMITS_HEADERS, menuHorizontalPosition);
|
||||
}
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
LimitData *ld = limitAddress(sub);
|
||||
ld->revert = !ld->revert;
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -141,16 +141,16 @@ void menuModelLimits(uint8_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
if (k==NUM_CHNOUT) {
|
||||
// last line available - add the "copy trim menu" line
|
||||
uint8_t attr = (sub==NUM_CHNOUT) ? INVERS : 0;
|
||||
lcdDrawText(CENTER_OFS, y, STR_TRIMS2OFFSETS, s_noHi ? 0 : attr);
|
||||
lcdDrawText(CENTER_OFS, y, STR_TRIMS2OFFSETS, NO_HIGHLIGHT() ? 0 : attr);
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
killEvents(event);
|
||||
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
|
||||
}
|
||||
@@ -168,17 +168,17 @@ void menuModelLimits(uint8_t event)
|
||||
|
||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||
|
||||
putsChn(0, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
putsChn(0, y, k+1, (sub==k && menuHorizontalPosition < 0) ? INVERS : 0);
|
||||
if (sub==k && menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET);
|
||||
MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
menuHandler = onLimitsMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
popupMenuHandler = onLimitsMenu;
|
||||
}
|
||||
|
||||
for (int j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
LcdFlags attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && s_editMode>0) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
|
||||
@@ -75,7 +75,7 @@ void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lat
|
||||
|
||||
void onLogicalSwitchesMenu(const char *result)
|
||||
{
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
LogicalSwitchData * cs = lswAddress(sub);
|
||||
|
||||
if (result == STR_COPY) {
|
||||
@@ -99,8 +99,8 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/ });
|
||||
|
||||
int k = 0;
|
||||
int sub = m_posVert;
|
||||
horzpos_t horz = m_posHorz;
|
||||
int sub = menuVerticalPosition;
|
||||
horzpos_t horz = menuHorizontalPosition;
|
||||
|
||||
if (horz>=0) {
|
||||
displayColumnHeader(STR_CSW_HEADERS, horz);
|
||||
@@ -110,17 +110,17 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
killEvents(event);
|
||||
LogicalSwitchData * cs = lswAddress(sub);
|
||||
if (cs->func)
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onLogicalSwitchesMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onLogicalSwitchesMenu;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags attr1 = (horz==1 ? attr : 0);
|
||||
LcdFlags attr2 = (horz==2 ? attr : 0);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
void onModelSelectMenu(const char *result)
|
||||
{
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) {
|
||||
selectModel(sub);
|
||||
@@ -62,7 +62,6 @@ void onModelSelectMenu(const char *result)
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
|
||||
POPUP_WARNING(STR_NO_MODELS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
@@ -73,7 +72,7 @@ void onModelSelectMenu(const char *result)
|
||||
// The user choosed a file on SD to restore
|
||||
storageCheck(true);
|
||||
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
|
||||
if (!s_warning && g_eeGeneral.currModel == sub) {
|
||||
if (!warningText && g_eeGeneral.currModel == sub) {
|
||||
eeLoadModel(sub);
|
||||
}
|
||||
}
|
||||
@@ -81,10 +80,10 @@ void onModelSelectMenu(const char *result)
|
||||
|
||||
void menuModelSelect(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
storageCheck(true);
|
||||
eeDeleteModel(m_posVert); // delete file
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
}
|
||||
@@ -95,19 +94,19 @@ void menuModelSelect(uint8_t event)
|
||||
_event_ -= KEY_EXIT;
|
||||
}
|
||||
|
||||
int8_t oldSub = m_posVert;
|
||||
int8_t oldSub = menuVerticalPosition;
|
||||
|
||||
check_submenu_simple(NULL, _event_, MAX_MODELS);
|
||||
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
m_posVert = sub = g_eeGeneral.currModel;
|
||||
if (sub >= NUM_BODY_LINES) s_pgOfs = sub-(NUM_BODY_LINES-1);
|
||||
menuVerticalPosition = sub = g_eeGeneral.currModel;
|
||||
if (sub >= NUM_BODY_LINES) menuVerticalOffset = sub-(NUM_BODY_LINES-1);
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
break;
|
||||
@@ -122,13 +121,13 @@ void menuModelSelect(uint8_t event)
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_copyMode) {
|
||||
sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
|
||||
sub = menuVerticalPosition = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
|
||||
s_copyMode = 0;
|
||||
}
|
||||
else {
|
||||
if (m_posVert != g_eeGeneral.currModel) {
|
||||
sub = m_posVert = g_eeGeneral.currModel;
|
||||
s_pgOfs = 0;
|
||||
if (menuVerticalPosition != g_eeGeneral.currModel) {
|
||||
sub = menuVerticalPosition = g_eeGeneral.currModel;
|
||||
menuVerticalOffset = 0;
|
||||
}
|
||||
else if (event != EVT_KEY_LONG(KEY_EXIT)) {
|
||||
popMenu();
|
||||
@@ -178,23 +177,23 @@ void menuModelSelect(uint8_t event)
|
||||
killEvents(event);
|
||||
if (g_eeGeneral.currModel != sub) {
|
||||
if (eeModelExists(sub)) {
|
||||
MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
}
|
||||
else {
|
||||
MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
}
|
||||
menuHandler = onModelSelectMenu;
|
||||
popupMenuHandler = onModelSelectMenu;
|
||||
}
|
||||
else if (eeModelExists(sub)) {
|
||||
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
||||
@@ -214,7 +213,7 @@ void menuModelSelect(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
if (s_copyMode) {
|
||||
int8_t next_ofs = s_copyTgtOfs + oldSub - m_posVert;
|
||||
int8_t next_ofs = s_copyTgtOfs + oldSub - menuVerticalPosition;
|
||||
if (next_ofs == MAX_MODELS || next_ofs == -MAX_MODELS)
|
||||
next_ofs = 0;
|
||||
|
||||
@@ -229,7 +228,7 @@ void menuModelSelect(uint8_t event)
|
||||
s_copyMode = 0;
|
||||
}
|
||||
next_ofs = 0;
|
||||
m_posVert = sub;
|
||||
menuVerticalPosition = sub;
|
||||
}
|
||||
s_copyTgtOfs = next_ofs;
|
||||
}
|
||||
@@ -247,7 +246,7 @@ void menuModelSelect(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
|
||||
lcdDrawNumber(3*FW+2, y, k+1, LEADING0+((!s_copyMode && sub==k) ? INVERS : 0), 2);
|
||||
|
||||
@@ -272,11 +271,11 @@ void menuModelSelect(uint8_t event)
|
||||
if (eeModelExists(k)) {
|
||||
putsModelName(4*FW, y, modelHeaders[k].name, k, 0);
|
||||
lcdDrawNumber(20*FW, y, eeModelSize(k), 0);
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+s_pgOfs!=(vertpos_t)sub))
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub))
|
||||
lcdDrawChar(1, y, '*');
|
||||
}
|
||||
|
||||
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
|
||||
if (s_copyMode && (vertpos_t)sub==i+menuVerticalOffset) {
|
||||
lcdDrawFilledRect(9, y, MODELSEL_W-1-9, 7);
|
||||
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ void onModelSetupBitmapMenu(const char *result)
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -137,13 +136,13 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
|
||||
{
|
||||
TimerData * timer = &g_model.timers[timerIdx];
|
||||
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
|
||||
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
||||
if (attr && m_posHorz < 0) lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1);
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition < 0) lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1);
|
||||
if (attr && s_editMode>0) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
{
|
||||
swsrc_t timerMode = timer->mode;
|
||||
@@ -237,8 +236,8 @@ int getSwitchWarningsCount()
|
||||
|
||||
void menuModelSetup(uint8_t event)
|
||||
{
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
MENU_TAB({ 0, 0, TIMERS_ROWS, TOPLCD_ROWS 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
|
||||
NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0,
|
||||
@@ -277,11 +276,11 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
@@ -305,11 +304,10 @@ void menuModelSetup(uint8_t event)
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
|
||||
menuHandler = onModelSetupBitmapMenu;
|
||||
popupMenuHandler = onModelSetupBitmapMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -393,12 +391,12 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_EXTENDED_TRIMS:
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, m_posHorz<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_RESET_BTN, m_posHorz>0 && !s_noHi ? attr : 0);
|
||||
if (attr && m_posHorz>0) {
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
START_NO_HIGHLIGHT();
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
|
||||
}
|
||||
@@ -459,9 +457,9 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_POTS_WARNING2:
|
||||
if (i==0) {
|
||||
if (CURSOR_MOVED_LEFT(event))
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
else
|
||||
s_pgOfs++;
|
||||
menuVerticalOffset++;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -471,9 +469,9 @@ void menuModelSetup(uint8_t event)
|
||||
#if defined(REV9E)
|
||||
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > 8*(NUM_BODY_LINES-i)) {
|
||||
if (CURSOR_MOVED_LEFT(event))
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
else
|
||||
s_pgOfs++;
|
||||
menuVerticalOffset++;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -488,8 +486,8 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (m_posHorz < 0) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
if (menuHorizontalPosition < 0) {
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
@@ -513,13 +511,13 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
|
||||
c = "\300-\301"[states & 0x03];
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (m_posHorz==current) ? INVERS : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (menuHorizontalPosition==current) ? INVERS : 0);
|
||||
if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c);
|
||||
++current;
|
||||
}
|
||||
states >>= 2;
|
||||
}
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
#if defined(REV9E)
|
||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+7)/8));
|
||||
#else
|
||||
@@ -533,34 +531,34 @@ void menuModelSetup(uint8_t event)
|
||||
#if defined(REV9E)
|
||||
if (i==NUM_BODY_LINES-1 && g_model.potsWarnMode) {
|
||||
if (CURSOR_MOVED_LEFT(event))
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
else
|
||||
s_pgOfs++;
|
||||
menuVerticalOffset++;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
lcd_putsLeft(y, STR_POTWARNING);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (m_posHorz == 0) ? attr : 0);
|
||||
if (attr && (m_posHorz == 0)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
||||
if (attr && (menuHorizontalPosition == 0)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (m_posHorz > 0) s_editMode = 0;
|
||||
if (!READ_ONLY() && m_posHorz > 0) {
|
||||
if (menuHorizontalPosition > 0) s_editMode = 0;
|
||||
if (!READ_ONLY() && menuHorizontalPosition > 0) {
|
||||
switch (event) {
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
||||
SAVE_POT_POSITION(m_posHorz-1);
|
||||
SAVE_POT_POSITION(menuHorizontalPosition-1);
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
g_model.potsWarnEnabled ^= (1 << (m_posHorz-1));
|
||||
g_model.potsWarnEnabled ^= (1 << (menuHorizontalPosition-1));
|
||||
storageDirty(EE_MODEL);
|
||||
break;
|
||||
}
|
||||
@@ -570,7 +568,7 @@ void menuModelSetup(uint8_t event)
|
||||
coord_t x = MODEL_SETUP_2ND_COLUMN+28;
|
||||
for (int i=0; i<NUM_POTS; ++i) {
|
||||
if (i<NUM_XPOTS && !IS_POT_AVAILABLE(POT1+i)) {
|
||||
if (attr && (m_posHorz==i+1)) REPEAT_LAST_CURSOR_MOVE();
|
||||
if (attr && (menuHorizontalPosition==i+1)) REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
else {
|
||||
#if defined(REV9E)
|
||||
@@ -579,18 +577,18 @@ void menuModelSetup(uint8_t event)
|
||||
x = MODEL_SETUP_2ND_COLUMN;
|
||||
}
|
||||
#endif
|
||||
LcdFlags flags = ((m_posHorz==i+1) && attr) ? BLINK : 0;
|
||||
if ((!attr || m_posHorz >= 0) && !(g_model.potsWarnEnabled & (1 << i))) {
|
||||
LcdFlags flags = ((menuHorizontalPosition==i+1) && attr) ? BLINK : 0;
|
||||
if ((!attr || menuHorizontalPosition >= 0) && !(g_model.potsWarnEnabled & (1 << i))) {
|
||||
flags |= INVERS;
|
||||
}
|
||||
|
||||
// TODO add a new function
|
||||
lcdDrawSizedText(x, y, STR_VSRCRAW+2+STR_VSRCRAW[0]*(NUM_STICKS+1+i), STR_VSRCRAW[0]-1, flags & ~(BSS|ZCHAR));
|
||||
lcdDrawSizedText(x, y, STR_VSRCRAW+2+STR_VSRCRAW[0]*(NUM_STICKS+1+i), STR_VSRCRAW[0]-1, flags & ~ZCHAR);
|
||||
x = lcdNextPos+3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz < 0) {
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
#if defined(REV9E)
|
||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-FH-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, 2*FH+1);
|
||||
#else
|
||||
@@ -605,17 +603,17 @@ void menuModelSetup(uint8_t event)
|
||||
coord_t x = MODEL_SETUP_2ND_COLUMN;
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
|
||||
if (i>=POT1 && i<POT1+NUM_XPOTS && !IS_POT_AVAILABLE(i)) {
|
||||
if (attr && m_posHorz == i) REPEAT_LAST_CURSOR_MOVE();
|
||||
if (attr && menuHorizontalPosition == i) REPEAT_LAST_CURSOR_MOVE();
|
||||
continue;
|
||||
}
|
||||
lcdDrawTextAtIndex(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && CURSOR_ON_LINE())) ? INVERS : 0 ) );
|
||||
lcdDrawTextAtIndex(x, y, STR_RETA123, i, ((menuHorizontalPosition==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && CURSOR_ON_LINE())) ? INVERS : 0 ) );
|
||||
x += FW;
|
||||
}
|
||||
if (attr && CURSOR_ON_CELL) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
@@ -635,11 +633,11 @@ void menuModelSetup(uint8_t event)
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
case ITEM_MODEL_INTERNAL_MODULE_MODE:
|
||||
lcd_putsLeft(y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (IS_MODULE_XJT(INTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[INTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-2, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -681,13 +679,13 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_MODE:
|
||||
lcd_putsLeft(y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -722,12 +720,12 @@ void menuModelSetup(uint8_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcd_putsLeft(y, STR_CHANNELRANGE);
|
||||
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, m_posHorz==0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (m_posHorz==0 ? attr : 0));
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawChar(lcdLastPos, y, '-');
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawNumber(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount);
|
||||
break;
|
||||
@@ -759,13 +757,13 @@ void menuModelSetup(uint8_t event)
|
||||
if (IS_MODULE_PPM(moduleIdx)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, moduleData.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
@@ -779,7 +777,7 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
|
||||
if (IS_MODULE_XJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_D8) {
|
||||
xOffsetBind = 0;
|
||||
@@ -825,19 +823,19 @@ void menuModelSetup(uint8_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
lcd_putsLeft(y, TR_FAILSAFE);
|
||||
if (IS_MODULE_XJT(moduleIdx)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, m_posHorz==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, m_posHorz==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcdDrawText(MODEL_SETUP_2ND_COLUMN + MODEL_SETUP_SET_FAILSAFE_OFS, y, STR_SET, menuHorizontalPosition==1 ? attr : 0);
|
||||
if (attr) {
|
||||
if (moduleData.failsafeMode != FAILSAFE_CUSTOM) {
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
if (m_posHorz == 0) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
if (s_editMode > 0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.failsafeMode, FAILSAFE_LAST);
|
||||
if (checkIncDec_Ret) SEND_FAILSAFE_NOW(moduleIdx);
|
||||
}
|
||||
}
|
||||
else if (m_posHorz == 1) {
|
||||
else if (menuHorizontalPosition == 1) {
|
||||
s_editMode = 0;
|
||||
if (moduleData.failsafeMode==FAILSAFE_CUSTOM && event==EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
g_moduleIdx = moduleIdx;
|
||||
@@ -873,14 +871,14 @@ void menuModelFailsafe(uint8_t event)
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert+channelStart];
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
s_editMode = 0;
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert];
|
||||
int16_t & failsafe = g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
@@ -937,7 +935,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch) {
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
|
||||
@@ -224,11 +224,11 @@ void menuModelSensor(uint8_t event)
|
||||
|
||||
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, 0, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), LEFT);
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
|
||||
for (int j=0; j<k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW) {
|
||||
@@ -261,10 +261,10 @@ void menuModelSensor(uint8_t event)
|
||||
case SENSOR_FIELD_ID:
|
||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||
lcd_putsLeft(y, STR_ID);
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(m_posHorz==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(m_posHorz==1 ? attr : 0));
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
sensor->id = checkIncDec(event, sensor->id, 0x0000, 0xffff, INCDEC_REP10|NO_INCDEC_MARKS);
|
||||
break;
|
||||
@@ -450,7 +450,7 @@ void menuModelSensor(uint8_t event)
|
||||
|
||||
void onSensorMenu(const char *result)
|
||||
{
|
||||
int index = m_posVert - ITEM_TELEMETRY_SENSOR1;
|
||||
int index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
|
||||
|
||||
if (index < MAX_SENSORS) {
|
||||
if (result == STR_EDIT) {
|
||||
@@ -460,9 +460,9 @@ void onSensorMenu(const char *result)
|
||||
delTelemetryIndex(index);
|
||||
index += 1;
|
||||
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
|
||||
m_posVert += 1;
|
||||
menuVerticalPosition += 1;
|
||||
else
|
||||
m_posVert = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
menuVerticalPosition = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
@@ -486,13 +486,12 @@ void onSensorMenu(const char *result)
|
||||
#if defined(LUA)
|
||||
void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
int screenIndex = TELEMETRY_CURRENT_SCREEN(sub);
|
||||
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -506,8 +505,8 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
@@ -515,11 +514,11 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });
|
||||
|
||||
int sub = m_posVert;
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i + s_pgOfs;
|
||||
int k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
@@ -556,10 +555,10 @@ void menuModelTelemetry(uint8_t event)
|
||||
s_currIdx = index;
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_EDIT);
|
||||
MENU_ADD_ITEM(STR_COPY);
|
||||
MENU_ADD_ITEM(STR_DELETE);
|
||||
menuHandler = onSensorMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onSensorMenu;
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
pushMenu(menuModelSensor);
|
||||
@@ -648,10 +647,10 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_RANGE);
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz==0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW, y, 10+g_model.frsky.varioMax, (m_posHorz==1 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (menuHorizontalPosition==0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)|LEFT);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7);
|
||||
break;
|
||||
@@ -664,11 +663,11 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_CENTER:
|
||||
lcd_putsLeft(y, STR_CENTER);
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (m_posHorz==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW, y, 5+g_model.frsky.varioCenterMax, (m_posHorz==1 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL3, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (m_posHorz==2 ? attr : 0));
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+7*FW, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==1 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL3, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMin, -16, 5+min<int8_t>(10, g_model.frsky.varioCenterMax+5));
|
||||
break;
|
||||
@@ -711,7 +710,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
|
||||
if (newScreenType != oldScreenType) {
|
||||
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
|
||||
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));
|
||||
@@ -723,18 +722,17 @@ void menuModelTelemetry(uint8_t event)
|
||||
// TODO better function name for ---
|
||||
// TODO function for these lines
|
||||
if (ZEXIST(scriptData.file))
|
||||
lcdDrawSizedText(TELEM_SCRTYPE_COL+7*FW, y, scriptData.file, sizeof(scriptData.file), (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawSizedText(TELEM_SCRTYPE_COL+7*FW, y, scriptData.file, sizeof(scriptData.file), (menuHorizontalPosition==1 ? attr : 0));
|
||||
else
|
||||
lcdDrawTextAtIndex(TELEM_SCRTYPE_COL+7*FW, y, STR_VCSWFUNC, 0, (m_posHorz==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(TELEM_SCRTYPE_COL+7*FW, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
||||
|
||||
if (m_posHorz==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
|
||||
menuHandler = onTelemetryScriptFileSelectionMenu;
|
||||
popupMenuHandler = onTelemetryScriptFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -784,24 +782,24 @@ void menuModelTelemetry(uint8_t event)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
|
||||
putsMixerSource(TELEM_COL1, y, barSource, menuHorizontalPosition==0 ? attr : 0);
|
||||
int barMax = getMaximumValue(barSource);
|
||||
int barMin = -barMax;
|
||||
if (barSource) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
else if (attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
bar.source = checkIncDec(event, barSource, 0, MIXSRC_LAST_TELEM, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -828,7 +826,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
#endif
|
||||
{
|
||||
for (int c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
LcdFlags cellAttr = (m_posHorz==c ? attr : 0);
|
||||
LcdFlags cellAttr = (menuHorizontalPosition==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
const coord_t pos[] = {TELEM_COL1, TELEM_COL2, TELEM_COL3};
|
||||
putsMixerSource(pos[c], y, value, cellAttr);
|
||||
@@ -836,7 +834,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
value = checkIncDec(event, value, 0, MIXSRC_LAST_TELEM, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable);
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz == NUM_LINE_ITEMS) {
|
||||
if (attr && menuHorizontalPosition == NUM_LINE_ITEMS) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,44 +36,47 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
MenuFuncP g_menuStack[5];
|
||||
MenuHandlerFunc menuHandlers[5];
|
||||
uint8_t menuEvent = 0;
|
||||
uint8_t g_menuPos[4];
|
||||
uint8_t g_menuStackPtr = 0;
|
||||
uint8_t menuVerticalPositions[4];
|
||||
uint8_t menuLevel = 0;
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
assert(g_menuStackPtr>0);
|
||||
g_menuStackPtr = g_menuStackPtr-1;
|
||||
assert(menuLevel>0);
|
||||
menuLevel = menuLevel-1;
|
||||
menuEvent = EVT_ENTRY_UP;
|
||||
TRACE("popMenu(%d)", menuLevel);
|
||||
}
|
||||
|
||||
void chainMenu(MenuFuncP newMenu)
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
TRACE("chainMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
void pushMenu(MenuFuncP newMenu)
|
||||
void pushMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killEvents(KEY_ENTER);
|
||||
|
||||
if (g_menuStackPtr == 0) {
|
||||
if (menuLevel == 0) {
|
||||
if (newMenu == menuGeneralSetup)
|
||||
g_menuPos[0] = 1;
|
||||
menuVerticalPositions[0] = 1;
|
||||
if (newMenu == menuModelSelect)
|
||||
g_menuPos[0] = 0;
|
||||
menuVerticalPositions[0] = 0;
|
||||
}
|
||||
else {
|
||||
g_menuPos[g_menuStackPtr] = m_posVert;
|
||||
menuVerticalPositions[menuLevel] = menuVerticalPosition;
|
||||
}
|
||||
|
||||
g_menuStackPtr++;
|
||||
menuLevel++;
|
||||
|
||||
assert(g_menuStackPtr < DIM(g_menuStack));
|
||||
assert(menuLevel < DIM(menuHandlers));
|
||||
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
void menuModelNotes(uint8_t event)
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#ifndef _MENUS_H_
|
||||
#define _MENUS_H_
|
||||
|
||||
#define NO_HI_LEN 25
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
#define MENU_COLUMNS 1
|
||||
#else
|
||||
@@ -57,27 +55,31 @@ typedef uint8_t & check_event_t;
|
||||
|
||||
extern tmr10ms_t menuEntryTime;
|
||||
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
extern vertpos_t s_pgOfs;
|
||||
extern uint8_t s_noHi;
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
extern vertpos_t menuVerticalOffset;
|
||||
extern uint8_t calibrationState;
|
||||
|
||||
// Temporary no highlight
|
||||
extern uint8_t noHighlightCounter;
|
||||
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
||||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef void (*MenuFuncP)(uint8_t event);
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
typedef void (*MenuHandlerFunc)(uint8_t event);
|
||||
extern const MenuHandlerFunc menuTabModel[];
|
||||
extern const MenuHandlerFunc menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
extern uint8_t g_menuStackPtr;
|
||||
extern MenuHandlerFunc menuHandlers[5];
|
||||
extern uint8_t menuVerticalPositions[4];
|
||||
extern uint8_t menuLevel;
|
||||
extern uint8_t menuEvent;
|
||||
|
||||
/// goto given Menu, but substitute current menu in menuStack
|
||||
void chainMenu(MenuFuncP newMenu);
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
/// goto given Menu, store current menu in menuStack
|
||||
void pushMenu(MenuFuncP newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
/// return to last menu in menustack
|
||||
void popMenu();
|
||||
|
||||
@@ -197,11 +199,11 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
var = checkIncDecGen(event, var, min, max)
|
||||
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
|
||||
|
||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||
void check(const char *title, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check_simple(const char *title, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check(const char *title, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check_simple(const char *title, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(const char *title, check_event_t event, uint8_t maxrow);
|
||||
|
||||
void title(const pm_char * s);
|
||||
@@ -269,11 +271,11 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const pm_char * s_warning;
|
||||
extern const pm_char * s_warning_info;
|
||||
extern uint8_t s_warning_info_len;
|
||||
extern uint8_t s_warning_result;
|
||||
extern uint8_t s_warning_type;
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
|
||||
#define MENU_X 30
|
||||
#define MENU_Y 16
|
||||
@@ -287,35 +289,35 @@ void displayPopup(const char *title);
|
||||
void displayWarning(uint8_t event);
|
||||
|
||||
extern void (*popupFunc)(uint8_t event);
|
||||
extern int16_t s_warning_input_value;
|
||||
extern int16_t s_warning_input_min;
|
||||
extern int16_t s_warning_input_max;
|
||||
extern uint8_t s_warning_info_flags;
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define MENU_ADD_ITEM(s) do { s_menu_offset_type = MENU_OFFSET_INTERNAL; if (s_menu_count < MENU_MAX_LINES) s_menu[s_menu_count++] = s; } while (0)
|
||||
#define MENU_MAX_LINES 12
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
extern const char *s_menu[MENU_MAX_LINES];
|
||||
extern uint16_t s_menu_count;
|
||||
extern uint8_t s_menu_flags;
|
||||
extern uint16_t s_menu_offset;
|
||||
#define POPUP_MENU_ITEMS_FROM_BSS()
|
||||
extern const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
extern uint16_t popupMenuOffset;
|
||||
enum {
|
||||
MENU_OFFSET_INTERNAL,
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
extern uint8_t s_menu_offset_type;
|
||||
const char * displayMenu(uint8_t event);
|
||||
extern void (*menuHandler)(const char *result);
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
const char * displayPopupMenu(uint8_t event);
|
||||
extern void (*popupMenuHandler)(const char *result);
|
||||
|
||||
#define STATUS_LINE_LENGTH 32
|
||||
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
||||
@@ -348,8 +350,8 @@ void menuChannelsView(uint8_t event);
|
||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
|
||||
#endif
|
||||
|
||||
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
||||
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = 0; }
|
||||
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||
|
||||
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
|
||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
vertpos_t s_pgOfs;
|
||||
vertpos_t m_posVert;
|
||||
horzpos_t m_posHorz;
|
||||
vertpos_t menuVerticalOffset;
|
||||
vertpos_t menuVerticalPosition;
|
||||
horzpos_t menuHorizontalPosition;
|
||||
int8_t s_editMode;
|
||||
uint8_t s_noHi;
|
||||
uint8_t noHighlightCounter;
|
||||
uint8_t calibrationState;
|
||||
int checkIncDecSelection = 0;
|
||||
|
||||
@@ -273,40 +273,40 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
|
||||
|
||||
if (i_min <= MIXSRC_FIRST_INPUT && i_max >= MIXSRC_FIRST_INPUT) {
|
||||
if (getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable) != MIXSRC_NONE) {
|
||||
MENU_ADD_ITEM(STR_MENU_INPUTS);
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_INPUTS);
|
||||
}
|
||||
}
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
if (i_min <= MIXSRC_FIRST_LUA && i_max >= MIXSRC_FIRST_LUA) {
|
||||
if (getFirstAvailable(MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, isSourceAvailable) != MIXSRC_NONE) {
|
||||
MENU_ADD_ITEM(STR_MENU_LUA);
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_LUA);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (i_min <= MIXSRC_FIRST_STICK && i_max >= MIXSRC_FIRST_STICK) MENU_ADD_ITEM(STR_MENU_STICKS);
|
||||
if (i_min <= MIXSRC_FIRST_POT && i_max >= MIXSRC_FIRST_POT) MENU_ADD_ITEM(STR_MENU_POTS);
|
||||
if (i_min <= MIXSRC_MAX && i_max >= MIXSRC_MAX) MENU_ADD_ITEM(STR_MENU_MAX);
|
||||
if (i_min <= MIXSRC_FIRST_STICK && i_max >= MIXSRC_FIRST_STICK) POPUP_MENU_ADD_ITEM(STR_MENU_STICKS);
|
||||
if (i_min <= MIXSRC_FIRST_POT && i_max >= MIXSRC_FIRST_POT) POPUP_MENU_ADD_ITEM(STR_MENU_POTS);
|
||||
if (i_min <= MIXSRC_MAX && i_max >= MIXSRC_MAX) POPUP_MENU_ADD_ITEM(STR_MENU_MAX);
|
||||
#if defined(HELI)
|
||||
if (i_min <= MIXSRC_FIRST_HELI && i_max >= MIXSRC_FIRST_HELI) MENU_ADD_ITEM(STR_MENU_HELI);
|
||||
if (i_min <= MIXSRC_FIRST_HELI && i_max >= MIXSRC_FIRST_HELI) POPUP_MENU_ADD_ITEM(STR_MENU_HELI);
|
||||
#endif
|
||||
if (i_min <= MIXSRC_FIRST_TRIM && i_max >= MIXSRC_FIRST_TRIM) MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= MIXSRC_FIRST_SWITCH && i_max >= MIXSRC_FIRST_SWITCH) MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= MIXSRC_FIRST_TRAINER && i_max >= MIXSRC_FIRST_TRAINER) MENU_ADD_ITEM(STR_MENU_TRAINER);
|
||||
if (i_min <= MIXSRC_FIRST_CH && i_max >= MIXSRC_FIRST_CH) MENU_ADD_ITEM(STR_MENU_CHANNELS);
|
||||
if (i_min <= MIXSRC_FIRST_TRIM && i_max >= MIXSRC_FIRST_TRIM) POPUP_MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= MIXSRC_FIRST_SWITCH && i_max >= MIXSRC_FIRST_SWITCH) POPUP_MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= MIXSRC_FIRST_TRAINER && i_max >= MIXSRC_FIRST_TRAINER) POPUP_MENU_ADD_ITEM(STR_MENU_TRAINER);
|
||||
if (i_min <= MIXSRC_FIRST_CH && i_max >= MIXSRC_FIRST_CH) POPUP_MENU_ADD_ITEM(STR_MENU_CHANNELS);
|
||||
if (i_min <= MIXSRC_FIRST_GVAR && i_max >= MIXSRC_FIRST_GVAR && isValueAvailable(MIXSRC_FIRST_GVAR)) {
|
||||
MENU_ADD_ITEM(STR_MENU_GVARS);
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_GVARS);
|
||||
}
|
||||
|
||||
if (i_min <= MIXSRC_FIRST_TELEM && i_max >= MIXSRC_FIRST_TELEM) {
|
||||
for (int i = 0; i < MAX_SENSORS; i++) {
|
||||
TelemetrySensor * sensor = & g_model.telemetrySensors[i];
|
||||
if (sensor->isAvailable()) {
|
||||
MENU_ADD_ITEM(STR_MENU_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_TELEMETRY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
menuHandler = onSourceLongEnterPress;
|
||||
popupMenuHandler = onSourceLongEnterPress;
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
newval = checkIncDecSelection;
|
||||
@@ -319,19 +319,19 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
checkIncDecSelection = SWSRC_NONE;
|
||||
if (i_min <= SWSRC_FIRST_SWITCH && i_max >= SWSRC_LAST_SWITCH) MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= SWSRC_FIRST_TRIM && i_max >= SWSRC_LAST_TRIM) MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= SWSRC_FIRST_SWITCH && i_max >= SWSRC_LAST_SWITCH) POPUP_MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= SWSRC_FIRST_TRIM && i_max >= SWSRC_LAST_TRIM) POPUP_MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= SWSRC_FIRST_LOGICAL_SWITCH && i_max >= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
for (int i = 0; i < NUM_LOGICAL_SWITCH; i++) {
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_FIRST_LOGICAL_SWITCH+i)) {
|
||||
MENU_ADD_ITEM(STR_MENU_LOGICAL_SWITCHES);
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_LOGICAL_SWITCHES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_ON)) MENU_ADD_ITEM(STR_MENU_OTHER);
|
||||
if (isValueAvailable && isValueAvailable(-newval)) MENU_ADD_ITEM(STR_MENU_INVERT);
|
||||
menuHandler = onSwitchLongEnterPress;
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_ON)) POPUP_MENU_ADD_ITEM(STR_MENU_OTHER);
|
||||
if (isValueAvailable && isValueAvailable(-newval)) POPUP_MENU_ADD_ITEM(STR_MENU_INVERT);
|
||||
popupMenuHandler = onSwitchLongEnterPress;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
@@ -365,10 +365,10 @@ void onLongMenuPress(const char *result)
|
||||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
void check(const char *name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
|
||||
uint8_t maxcol = MAXCOL(l_posVert);
|
||||
|
||||
@@ -379,9 +379,9 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
if (menuTab == menuTabModel) {
|
||||
killEvents(event);
|
||||
if (modelHasNotes()) {
|
||||
MENU_ADD_SD_ITEM(STR_VIEW_CHANNELS);
|
||||
MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
menuHandler = onLongMenuPress;
|
||||
POPUP_MENU_ADD_SD_ITEM(STR_VIEW_CHANNELS);
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
popupMenuHandler = onLongMenuPress;
|
||||
}
|
||||
else {
|
||||
pushMenu(menuChannelsView);
|
||||
@@ -406,7 +406,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
}
|
||||
|
||||
if (!calibrationState && cc != curr) {
|
||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
}
|
||||
|
||||
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
||||
@@ -437,7 +437,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode > 1) break;
|
||||
if (m_posHorz < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
l_posHorz = 0;
|
||||
break;
|
||||
}
|
||||
@@ -463,8 +463,8 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
else
|
||||
{
|
||||
uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
|
||||
if (s_pgOfs != 0 || l_posVert != posVertInit) {
|
||||
s_pgOfs = 0;
|
||||
if (menuVerticalOffset != 0 || l_posVert != posVertInit) {
|
||||
menuVerticalOffset = 0;
|
||||
l_posVert = posVertInit;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
int linesCount = rowcount;
|
||||
|
||||
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||
s_pgOfs = 0;
|
||||
menuVerticalOffset = 0;
|
||||
if (horTab) {
|
||||
linesCount = 0;
|
||||
for (int i=0; i<rowcount; i++) {
|
||||
@@ -547,13 +547,13 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
if (rowcount > NUM_BODY_LINES) {
|
||||
while (1) {
|
||||
vertpos_t firstLine = 0;
|
||||
for (int numLines=0; firstLine<rowcount && numLines<s_pgOfs; firstLine++) {
|
||||
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
|
||||
if (firstLine>=horTabMax || horTab[firstLine] != HIDDEN_ROW) {
|
||||
numLines++;
|
||||
}
|
||||
}
|
||||
if (l_posVert < firstLine) {
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
}
|
||||
else {
|
||||
vertpos_t lastLine = firstLine;
|
||||
@@ -563,10 +563,10 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
}
|
||||
}
|
||||
if (l_posVert >= lastLine) {
|
||||
s_pgOfs++;
|
||||
menuVerticalOffset++;
|
||||
}
|
||||
else {
|
||||
linesCount = s_pgOfs + NUM_BODY_LINES;
|
||||
linesCount = menuVerticalOffset + NUM_BODY_LINES;
|
||||
for (int i=lastLine; i<rowcount; i++) {
|
||||
if (i>horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||
linesCount++;
|
||||
@@ -579,28 +579,28 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (l_posVert>=NUM_BODY_LINES+s_pgOfs) {
|
||||
s_pgOfs = l_posVert-NUM_BODY_LINES+1;
|
||||
if (l_posVert>=NUM_BODY_LINES+menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert-NUM_BODY_LINES+1;
|
||||
}
|
||||
else if (l_posVert<s_pgOfs) {
|
||||
s_pgOfs = l_posVert;
|
||||
else if (l_posVert<menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert;
|
||||
}
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||
drawVerticalScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
drawVerticalScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, menuVerticalOffset, linesCount, NUM_BODY_LINES);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
title(name);
|
||||
}
|
||||
|
||||
m_posVert = l_posVert;
|
||||
m_posHorz = l_posHorz;
|
||||
|
||||
menuVerticalPosition = l_posVert;
|
||||
menuHorizontalPosition = l_posHorz;
|
||||
}
|
||||
|
||||
|
||||
void check_simple(const char * name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
void check_simple(const char * name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
{
|
||||
check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
||||
}
|
||||
@@ -616,6 +616,6 @@ void repeatLastCursorMove(uint8_t event)
|
||||
putEvent(event);
|
||||
}
|
||||
else {
|
||||
m_posHorz = 0;
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,30 +36,29 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
const char *s_warning = NULL;
|
||||
const char *s_warning_info;
|
||||
uint8_t s_warning_info_len;
|
||||
uint8_t s_warning_type;
|
||||
uint8_t s_warning_result = 0;
|
||||
uint8_t s_warning_info_flags = ZCHAR;
|
||||
int16_t s_warning_input_value;
|
||||
int16_t s_warning_input_min;
|
||||
int16_t s_warning_input_max;
|
||||
const char *warningText = NULL;
|
||||
const char *warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
void (*popupFunc)(uint8_t event) = NULL;
|
||||
const char *s_menu[MENU_MAX_LINES];
|
||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
uint8_t s_menu_item = 0;
|
||||
uint16_t s_menu_count = 0;
|
||||
uint8_t s_menu_flags = 0;
|
||||
uint16_t s_menu_offset = 0;
|
||||
uint8_t s_menu_offset_type = MENU_OFFSET_INTERNAL;
|
||||
void (*menuHandler)(const char *result);
|
||||
uint16_t popupMenuNoItems = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupMenuHandler)(const char *result);
|
||||
|
||||
void displayBox(const char *title)
|
||||
{
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN);
|
||||
// could be a place for a s_warning_info
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void displayPopup(const char *title)
|
||||
@@ -99,47 +98,47 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
||||
|
||||
void displayWarning(uint8_t event)
|
||||
{
|
||||
s_warning_result = false;
|
||||
displayBox(s_warning);
|
||||
if (s_warning_info) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, s_warning_info, s_warning_info_len, WARNING_INFO_FLAGS);
|
||||
warningResult = false;
|
||||
displayBox(warningText);
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, s_warning_type == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_warning_type == WARNING_TYPE_ASTERISK)
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
s_warning_result = true;
|
||||
warningResult = true;
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_warning = NULL;
|
||||
s_warning_type = WARNING_TYPE_ASTERISK;
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
default:
|
||||
if (s_warning_type != WARNING_TYPE_INPUT) break;
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
s_warning_input_value = checkIncDec(event, s_warning_input_value, s_warning_input_min, s_warning_input_max);
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char * displayMenu(uint8_t event)
|
||||
const char * displayPopupMenu(uint8_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
|
||||
uint8_t display_count = min<unsigned int>(s_menu_count, MENU_MAX_DISPLAY_LINES);
|
||||
uint8_t display_count = min<unsigned int>(popupMenuNoItems, MENU_MAX_DISPLAY_LINES);
|
||||
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
|
||||
lcdDrawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, s_menu[i+(s_menu_offset_type == MENU_OFFSET_INTERNAL ? s_menu_offset : 0)], s_menu_flags);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i+(popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)], 0);
|
||||
if (i == s_menu_item) lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), s_menu_offset, s_menu_count, display_count);
|
||||
if (popupMenuNoItems > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, display_count);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
@@ -148,14 +147,14 @@ const char * displayMenu(uint8_t event)
|
||||
if (s_menu_item > 0) {
|
||||
s_menu_item--;
|
||||
}
|
||||
else if (s_menu_offset > 0) {
|
||||
s_menu_offset--;
|
||||
else if (popupMenuOffset > 0) {
|
||||
popupMenuOffset--;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
else {
|
||||
s_menu_item = min<uint8_t>(display_count, MENU_MAX_DISPLAY_LINES) - 1;
|
||||
if (s_menu_count > MENU_MAX_DISPLAY_LINES) {
|
||||
s_menu_offset = s_menu_count - MENU_MAX_DISPLAY_LINES;
|
||||
if (popupMenuNoItems > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - MENU_MAX_DISPLAY_LINES;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
}
|
||||
@@ -163,29 +162,28 @@ const char * displayMenu(uint8_t event)
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(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 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
|
||||
s_menu_item++;
|
||||
}
|
||||
else if (s_menu_count > s_menu_offset + display_count) {
|
||||
s_menu_offset++;
|
||||
else if (popupMenuNoItems > popupMenuOffset + display_count) {
|
||||
popupMenuOffset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
else {
|
||||
s_menu_item = 0;
|
||||
if (s_menu_offset) {
|
||||
s_menu_offset = 0;
|
||||
if (popupMenuOffset) {
|
||||
popupMenuOffset = 0;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
result = s_menu[s_menu_item + (s_menu_offset_type == MENU_OFFSET_INTERNAL ? s_menu_offset : 0)];
|
||||
result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)];
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
s_menu_count = 0;
|
||||
popupMenuNoItems = 0;
|
||||
s_menu_item = 0;
|
||||
s_menu_flags = 0;
|
||||
s_menu_offset = 0;
|
||||
popupMenuOffset = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -370,11 +370,11 @@ void onMainViewMenu(const char *result)
|
||||
pushModelNotes();
|
||||
}
|
||||
else if (result == STR_RESET_SUBMENU) {
|
||||
MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
}
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
@@ -469,12 +469,12 @@ void menuMainView(uint8_t event)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (modelHasNotes()) {
|
||||
MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
}
|
||||
MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
MENU_ADD_ITEM(STR_STATISTICS);
|
||||
MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
menuHandler = onMainViewMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
POPUP_MENU_ADD_ITEM(STR_STATISTICS);
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
popupMenuHandler = onMainViewMenu;
|
||||
break;
|
||||
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
|
||||
@@ -112,8 +112,8 @@ void menuStatisticsDebug(uint8_t event)
|
||||
TITLE(STR_MENUDEBUG);
|
||||
|
||||
#if defined(WATCHDOG_TEST)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
// do a user requested watchdog test
|
||||
TRACE("Performing watchdog test");
|
||||
pausePulses();
|
||||
@@ -223,7 +223,7 @@ void menuTraceBuffer(uint8_t event)
|
||||
|
||||
uint8_t y = 0;
|
||||
uint8_t k = 0;
|
||||
int8_t sub = m_posVert;
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
lcdDrawChar(0, FH, '#');
|
||||
lcdDrawText(4*FW, FH, "Time");
|
||||
@@ -232,7 +232,7 @@ void menuTraceBuffer(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-2; i++) {
|
||||
y = 1 + (i+2)*FH;
|
||||
k = i+s_pgOfs;
|
||||
k = i+menuVerticalOffset;
|
||||
|
||||
//item
|
||||
lcdDrawNumber(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
|
||||
@@ -249,9 +249,9 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
menuHandler = onMainViewMenu;
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
popupMenuHandler = onMainViewMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,13 @@ void readTextFile(int & lines_count)
|
||||
|
||||
result = f_open(&file, s_text_file, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result == FR_OK) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-s_pgOfs<LCD_LINES-1); i++) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-menuVerticalOffset<LCD_LINES-1); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
else if (c!='\r' && current_line>=menuVerticalOffset && current_line-menuVerticalOffset<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
if (c=='\\' && escape==0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
@@ -89,7 +89,7 @@ void readTextFile(int & lines_count)
|
||||
c = 0x1D; //tab
|
||||
}
|
||||
escape = 0;
|
||||
s_text_screen[current_line-s_pgOfs][line_length++] = c;
|
||||
s_text_screen[current_line-menuVerticalOffset][line_length++] = c;
|
||||
}
|
||||
}
|
||||
if (c != '\n') {
|
||||
@@ -109,24 +109,24 @@ void menuTextView(uint8_t event)
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
s_pgOfs = 0;
|
||||
menuVerticalOffset = 0;
|
||||
lines_count = 0;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
if (s_pgOfs == 0)
|
||||
if (menuVerticalOffset == 0)
|
||||
break;
|
||||
else
|
||||
s_pgOfs--;
|
||||
menuVerticalOffset--;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
if (s_pgOfs+LCD_LINES-1 >= lines_count)
|
||||
if (menuVerticalOffset+LCD_LINES-1 >= lines_count)
|
||||
break;
|
||||
else
|
||||
++s_pgOfs;
|
||||
++menuVerticalOffset;
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
@@ -149,7 +149,7 @@ void menuTextView(uint8_t event)
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (lines_count > LCD_LINES-1) {
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, menuVerticalOffset, lines_count, LCD_LINES-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, c
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
if (attr) value = checkIncDec(event, value, min, max, (g_menuPos[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void drawStatusLine()
|
||||
}
|
||||
|
||||
lcdDrawFilledRect(0, LCD_H-statusLineHeight, LCD_W, FH, SOLID, ERASE);
|
||||
lcdDrawText(5, LCD_H+1-statusLineHeight, statusLineMsg, BSS);
|
||||
lcdDrawText(5, LCD_H+1-statusLineHeight, statusLineMsg, 0);
|
||||
lcdDrawFilledRect(0, LCD_H-statusLineHeight, LCD_W, FH, SOLID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch)
|
||||
{
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
|
||||
if (menuHandlers[menuLevel] == menuModelCustomFunctions)
|
||||
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
|
||||
else
|
||||
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
|
||||
@@ -346,7 +346,7 @@ bool isLogicalSwitchFunctionAvailable(int function)
|
||||
bool isAssignableFunctionAvailable(int function)
|
||||
{
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION) || defined(GVARS)
|
||||
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
|
||||
bool modelFunctions = (menuHandlers[menuLevel] == menuModelCustomFunctions);
|
||||
#endif
|
||||
|
||||
switch (function) {
|
||||
|
||||
@@ -616,23 +616,23 @@ Run function (key pressed)
|
||||
static int luaPopupInput(lua_State *L)
|
||||
{
|
||||
uint8_t event = luaL_checkinteger(L, 2);
|
||||
s_warning_input_value = luaL_checkinteger(L, 3);
|
||||
s_warning_input_min = luaL_checkinteger(L, 4);
|
||||
s_warning_input_max = luaL_checkinteger(L, 5);
|
||||
s_warning = luaL_checkstring(L, 1);
|
||||
s_warning_type = WARNING_TYPE_INPUT;
|
||||
warningInputValue = luaL_checkinteger(L, 3);
|
||||
warningInputValueMin = luaL_checkinteger(L, 4);
|
||||
warningInputValueMax = luaL_checkinteger(L, 5);
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
warningType = WARNING_TYPE_INPUT;
|
||||
displayWarning(event);
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
lua_pushstring(L, "OK");
|
||||
}
|
||||
else if (!s_warning) {
|
||||
else if (!warningText) {
|
||||
lua_pushstring(L, "CANCEL");
|
||||
}
|
||||
else {
|
||||
lua_pushinteger(L, s_warning_input_value);
|
||||
lua_pushinteger(L, warningInputValue);
|
||||
}
|
||||
s_warning = NULL;
|
||||
warningText = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -481,10 +481,10 @@ void displayLuaError(const char * title)
|
||||
|
||||
void displayAcknowledgeLuaError(evt_t event)
|
||||
{
|
||||
s_warning_result = false;
|
||||
displayLuaError(s_warning);
|
||||
warningResult = false;
|
||||
displayLuaError(warningText);
|
||||
if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
s_warning = NULL;
|
||||
warningText = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ void luaError(uint8_t error, bool acknowledge)
|
||||
}
|
||||
|
||||
if (acknowledge) {
|
||||
s_warning = errorTitle;
|
||||
warningText = errorTitle;
|
||||
popupFunc = displayAcknowledgeLuaError;
|
||||
}
|
||||
else {
|
||||
@@ -664,9 +664,9 @@ bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType)
|
||||
#endif
|
||||
if ((scriptType & RUN_TELEM_FG_SCRIPT) &&
|
||||
#if defined(COLORLCD)
|
||||
(g_menuStack[0]==menuMainView && sid.reference==SCRIPT_TELEMETRY_FIRST+g_eeGeneral.view-VIEW_TELEM1)) {
|
||||
(menuHandlers[0]==menuMainView && sid.reference==SCRIPT_TELEMETRY_FIRST+g_eeGeneral.view-VIEW_TELEM1)) {
|
||||
#else
|
||||
(g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view)) {
|
||||
(menuHandlers[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view)) {
|
||||
#endif
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
||||
lua_pushinteger(L, evt);
|
||||
|
||||
+17
-17
@@ -152,13 +152,13 @@ void guiMain(evt_t evt)
|
||||
if (!standaloneScriptWasRun) {
|
||||
while (1) {
|
||||
// normal GUI from menus
|
||||
const char * warn = s_warning;
|
||||
uint8_t menu = s_menu_count;
|
||||
const char * warn = warningText;
|
||||
uint8_t menu = popupMenuNoItems;
|
||||
|
||||
static bool popupDisplayed = false;
|
||||
if (warn || menu) {
|
||||
if (popupDisplayed == false) {
|
||||
g_menuStack[g_menuStackPtr](EVT_REFRESH);
|
||||
menuHandlers[menuLevel](EVT_REFRESH);
|
||||
lcdDrawBlackOverlay();
|
||||
TIME_MEASURE_START(storebackup);
|
||||
lcdStoreBackupBuffer();
|
||||
@@ -168,9 +168,9 @@ void guiMain(evt_t evt)
|
||||
lcdRestoreBackupBuffer();
|
||||
if (warn) DISPLAY_WARNING(evt);
|
||||
if (menu) {
|
||||
const char * result = displayMenu(evt);
|
||||
const char * result = displayPopupMenu(evt);
|
||||
if (result) {
|
||||
menuHandler(result);
|
||||
popupMenuHandler(result);
|
||||
evt = EVT_REFRESH;
|
||||
continue;
|
||||
}
|
||||
@@ -186,18 +186,18 @@ void guiMain(evt_t evt)
|
||||
}
|
||||
popupDisplayed = false;
|
||||
}
|
||||
refreshNeeded = g_menuStack[g_menuStackPtr](evt);
|
||||
refreshNeeded = menuHandlers[menuLevel](evt);
|
||||
}
|
||||
|
||||
if (menuEvent == EVT_ENTRY) {
|
||||
m_posVert = -1;
|
||||
m_posHorz = 0;
|
||||
menuVerticalPosition = -1;
|
||||
menuHorizontalPosition = 0;
|
||||
evt = menuEvent;
|
||||
menuEvent = 0;
|
||||
}
|
||||
else if (menuEvent == EVT_ENTRY_UP) {
|
||||
m_posVert = g_menuPos[g_menuStackPtr];
|
||||
m_posHorz = 0;
|
||||
menuVerticalPosition = menuVerticalPositions[menuLevel];
|
||||
menuHorizontalPosition = 0;
|
||||
evt = menuEvent;
|
||||
menuEvent = 0;
|
||||
}
|
||||
@@ -254,22 +254,22 @@ void guiMain(evt_t evt)
|
||||
lcdClear();
|
||||
|
||||
// normal GUI from menus
|
||||
const char * warn = s_warning;
|
||||
uint8_t menu = s_menu_count;
|
||||
const char * warn = warningText;
|
||||
uint8_t menu = popupMenuNoItems;
|
||||
if (menuEvent) {
|
||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
||||
m_posHorz = 0;
|
||||
menuVerticalPosition = menuEvent == EVT_ENTRY_UP ? menuVerticalPositions[menuLevel] : 0;
|
||||
menuHorizontalPosition = 0;
|
||||
evt = menuEvent;
|
||||
menuEvent = 0;
|
||||
AUDIO_MENUS();
|
||||
}
|
||||
|
||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
||||
menuHandlers[menuLevel]((warn || menu) ? 0 : evt);
|
||||
if (warn) DISPLAY_WARNING(evt);
|
||||
if (menu) {
|
||||
const char * result = displayMenu(evt);
|
||||
const char * result = displayPopupMenu(evt);
|
||||
if (result) {
|
||||
menuHandler(result);
|
||||
popupMenuHandler(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,26 +129,26 @@ void perMain()
|
||||
#endif
|
||||
|
||||
#if defined(GUI)
|
||||
const char *warn = s_warning;
|
||||
uint8_t menu = s_menu_count;
|
||||
const char *warn = warningText;
|
||||
bool popupMenuActive = (popupMenuNoItems > 0);
|
||||
|
||||
if (IS_LCD_REFRESH_ALLOWED()) { // No need to redraw until lcdRefresh_ST7920(0) below completely refreshes the display.
|
||||
lcdClear();
|
||||
if (menuEvent) {
|
||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
||||
m_posHorz = 0;
|
||||
menuVerticalPosition = menuEvent == EVT_ENTRY_UP ? menuVerticalPositions[menuLevel] : 0;
|
||||
menuHorizontalPosition = 0;
|
||||
evt = menuEvent;
|
||||
menuEvent = 0;
|
||||
AUDIO_MENUS();
|
||||
}
|
||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
||||
menuHandlers[menuLevel]((warn || popupMenuActive) ? 0 : evt);
|
||||
|
||||
if (warn) DISPLAY_WARNING(evt);
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
if (menu) {
|
||||
const char * result = displayMenu(evt);
|
||||
if (popupMenuActive) {
|
||||
const char * result = displayPopupMenu(evt);
|
||||
if (result) {
|
||||
menuHandler(result);
|
||||
popupMenuHandler(result);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -153,7 +153,7 @@ void per10ms()
|
||||
#if defined(GUI)
|
||||
if (lightOffCounter) lightOffCounter--;
|
||||
if (flashCounter) flashCounter--;
|
||||
if (s_noHi) s_noHi--;
|
||||
if (noHighlightCounter) noHighlightCounter--;
|
||||
#endif
|
||||
|
||||
if (trimsCheckTimer) trimsCheckTimer--;
|
||||
@@ -2030,7 +2030,7 @@ void checkBattery()
|
||||
static uint8_t counter = 0;
|
||||
#if defined(GUI) && !defined(COLORLCD)
|
||||
// TODO not the right menu I think ...
|
||||
if (g_menuStack[g_menuStackPtr] == menuGeneralDiagAna) {
|
||||
if (menuHandlers[menuLevel] == menuGeneralDiagAna) {
|
||||
g_vbat100mV = 0;
|
||||
counter = 0;
|
||||
}
|
||||
@@ -2528,9 +2528,9 @@ int main(void)
|
||||
stackPaint();
|
||||
|
||||
#if defined(GUI)
|
||||
g_menuStack[0] = menuMainView;
|
||||
menuHandlers[0] = menuMainView;
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
g_menuStack[1] = menuModelSelect;
|
||||
menuHandlers[1] = menuModelSelect;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2665,11 +2665,11 @@ uint32_t pwrCheck()
|
||||
evt_t evt = getEvent(false);
|
||||
DISPLAY_WARNING(evt);
|
||||
lcdRefresh();
|
||||
if (s_warning_result == true) {
|
||||
if (warningResult == true) {
|
||||
pwr_check_state = PWR_CHECK_OFF;
|
||||
return e_power_off;
|
||||
}
|
||||
else if (!s_warning) {
|
||||
else if (!warningText) {
|
||||
// shutdown has been cancelled
|
||||
pwr_check_state = PWR_CHECK_PAUSED;
|
||||
return e_power_on;
|
||||
|
||||
+1
-1
@@ -1554,7 +1554,7 @@ union ReusableBuffer
|
||||
uint16_t eepromfree;
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
char menu_bss[MENU_MAX_LINES][MENU_LINE_LENGTH];
|
||||
char menu_bss[POPUP_MENU_MAX_LINES][MENU_LINE_LENGTH];
|
||||
char mainname[45]; // because reused for SD backup / restore, max backup filename 44 chars: "/MODELS/MODEL0134353-2014-06-19-04-51-27.bin"
|
||||
#else
|
||||
char mainname[LEN_MODEL_NAME];
|
||||
|
||||
+27
-27
@@ -134,9 +134,9 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
s_menu_offset_type = MENU_OFFSET_EXTERNAL;
|
||||
popupMenuOffsetType = MENU_OFFSET_EXTERNAL;
|
||||
#endif
|
||||
static uint16_t s_last_menu_offset = 0;
|
||||
static uint16_t lastpopupMenuOffset = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
static uint8_t s_last_flags;
|
||||
@@ -157,19 +157,19 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s_menu_offset == 0) {
|
||||
s_last_menu_offset = 0;
|
||||
if (popupMenuOffset == 0) {
|
||||
lastpopupMenuOffset = 0;
|
||||
memset(reusableBuffer.modelsel.menu_bss, 0, sizeof(reusableBuffer.modelsel.menu_bss));
|
||||
}
|
||||
else if (s_menu_offset == s_menu_count - MENU_MAX_DISPLAY_LINES) {
|
||||
s_last_menu_offset = 0xffff;
|
||||
else if (popupMenuOffset == popupMenuNoItems - MENU_MAX_DISPLAY_LINES) {
|
||||
lastpopupMenuOffset = 0xffff;
|
||||
memset(reusableBuffer.modelsel.menu_bss, 0, sizeof(reusableBuffer.modelsel.menu_bss));
|
||||
}
|
||||
else if (s_menu_offset == s_last_menu_offset) {
|
||||
else if (popupMenuOffset == lastpopupMenuOffset) {
|
||||
// should not happen, only there because of Murphy's law
|
||||
return true;
|
||||
}
|
||||
else if (s_menu_offset > s_last_menu_offset) {
|
||||
else if (popupMenuOffset > lastpopupMenuOffset) {
|
||||
memmove(reusableBuffer.modelsel.menu_bss[0], reusableBuffer.modelsel.menu_bss[1], (MENU_MAX_DISPLAY_LINES-1)*MENU_LINE_LENGTH);
|
||||
memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_DISPLAY_LINES-1], 0xff, MENU_LINE_LENGTH);
|
||||
}
|
||||
@@ -178,22 +178,22 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
memset(reusableBuffer.modelsel.menu_bss[0], 0, MENU_LINE_LENGTH);
|
||||
}
|
||||
|
||||
s_menu_count = 0;
|
||||
s_menu_flags = BSS;
|
||||
popupMenuNoItems = 0;
|
||||
POPUP_MENU_ITEMS_FROM_BSS();
|
||||
|
||||
FRESULT res = f_opendir(&dir, path); /* Open the directory */
|
||||
if (res == FR_OK) {
|
||||
|
||||
if (flags & LIST_NONE_SD_FILE) {
|
||||
s_menu_count++;
|
||||
popupMenuNoItems++;
|
||||
if (selection) {
|
||||
s_last_menu_offset++;
|
||||
lastpopupMenuOffset++;
|
||||
}
|
||||
else if (s_menu_offset==0 || s_menu_offset < s_last_menu_offset) {
|
||||
else if (popupMenuOffset==0 || popupMenuOffset < lastpopupMenuOffset) {
|
||||
char *line = reusableBuffer.modelsel.menu_bss[0];
|
||||
memset(line, 0, MENU_LINE_LENGTH);
|
||||
strcpy(line, "---");
|
||||
s_menu[0] = line;
|
||||
popupMenuItems[0] = line;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,12 +210,12 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
uint8_t len = strlen(fn);
|
||||
if (len < 5 || len > maxlen+4 || strcasecmp(fn+len-4, extension) || (fno.fattrib & AM_DIR)) continue;
|
||||
|
||||
s_menu_count++;
|
||||
popupMenuNoItems++;
|
||||
fn[len-4] = '\0';
|
||||
|
||||
if (s_menu_offset == 0) {
|
||||
if (popupMenuOffset == 0) {
|
||||
if (selection && strncasecmp(fn, selection, maxlen) < 0) {
|
||||
s_last_menu_offset++;
|
||||
lastpopupMenuOffset++;
|
||||
}
|
||||
else {
|
||||
for (uint8_t i=0; i<MENU_MAX_DISPLAY_LINES; i++) {
|
||||
@@ -228,12 +228,12 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i<min(s_menu_count, (uint16_t)MENU_MAX_DISPLAY_LINES); i++) {
|
||||
s_menu[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||
for (uint8_t i=0; i<min(popupMenuNoItems, (uint16_t)MENU_MAX_DISPLAY_LINES); i++) {
|
||||
popupMenuItems[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||
}
|
||||
|
||||
}
|
||||
else if (s_last_menu_offset == 0xffff) {
|
||||
else if (lastpopupMenuOffset == 0xffff) {
|
||||
for (int i=MENU_MAX_DISPLAY_LINES-1; i>=0; i--) {
|
||||
char *line = reusableBuffer.modelsel.menu_bss[i];
|
||||
if (line[0] == '\0' || strcasecmp(fn, line) > 0) {
|
||||
@@ -243,11 +243,11 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i<min(s_menu_count, (uint16_t)MENU_MAX_DISPLAY_LINES); i++) {
|
||||
s_menu[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||
for (uint8_t i=0; i<min(popupMenuNoItems, (uint16_t)MENU_MAX_DISPLAY_LINES); i++) {
|
||||
popupMenuItems[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||
}
|
||||
}
|
||||
else if (s_menu_offset > s_last_menu_offset) {
|
||||
else if (popupMenuOffset > lastpopupMenuOffset) {
|
||||
if (strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_DISPLAY_LINES-2]) > 0 && strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_DISPLAY_LINES-1]) < 0) {
|
||||
memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_DISPLAY_LINES-1], 0, MENU_LINE_LENGTH);
|
||||
strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_DISPLAY_LINES-1], fn);
|
||||
@@ -262,12 +262,12 @@ bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen,
|
||||
}
|
||||
}
|
||||
|
||||
if (s_menu_offset > 0)
|
||||
s_last_menu_offset = s_menu_offset;
|
||||
if (popupMenuOffset > 0)
|
||||
lastpopupMenuOffset = popupMenuOffset;
|
||||
else
|
||||
s_menu_offset = s_last_menu_offset;
|
||||
popupMenuOffset = lastpopupMenuOffset;
|
||||
|
||||
return s_menu_count;
|
||||
return popupMenuNoItems;
|
||||
}
|
||||
|
||||
#if defined(CPUARM) && defined(SDCARD)
|
||||
|
||||
@@ -1314,7 +1314,7 @@ DRESULT disk_read (
|
||||
/* Write Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
extern const char * s_warning;
|
||||
extern const char * warningText;
|
||||
|
||||
DRESULT disk_write (
|
||||
BYTE drv, /* Physical drive nmuber (0) */
|
||||
|
||||
@@ -359,9 +359,9 @@ void *main_thread(void *)
|
||||
|
||||
s_current_protocol[0] = 255;
|
||||
|
||||
g_menuStackPtr = 0;
|
||||
g_menuStack[0] = menuMainView;
|
||||
g_menuStack[1] = menuModelSelect;
|
||||
menuLevel = 0;
|
||||
menuHandlers[0] = menuMainView;
|
||||
menuHandlers[1] = menuModelSelect;
|
||||
|
||||
storageReadAll(); // load general setup and selected model
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void parseTelemHubByte(uint8_t byte)
|
||||
// First received GPS position => Pilot GPS position
|
||||
getGpsPilotPosition();
|
||||
}
|
||||
else if (frskyData.hub.gpsDistNeeded || g_menuStack[g_menuStackPtr] == menuTelemetryFrsky) {
|
||||
else if (frskyData.hub.gpsDistNeeded || menuHandlers[menuLevel] == menuTelemetryFrsky) {
|
||||
getGpsDistance();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -62,8 +62,8 @@ int main(int argc, char **argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
simuInit();
|
||||
StartEepromThread(NULL);
|
||||
g_menuStackPtr = 0;
|
||||
g_menuStack[0] = menuMainView;
|
||||
menuLevel = 0;
|
||||
menuHandlers[0] = menuMainView;
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user