mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
Taranis navigation simplified (there was an unuseful line 0 - needed on
9x - in all menus which shifted everything).
This commit is contained in:
parent
db1de54314
commit
a63bb7f9be
19 changed files with 224 additions and 244 deletions
|
@ -100,6 +100,6 @@ const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
||||||
|
|
||||||
void menuGeneralCustomFunctions(uint8_t event)
|
void menuGeneralCustomFunctions(uint8_t event)
|
||||||
{
|
{
|
||||||
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
|
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||||
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
|
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
|
|
||||||
void menuGeneralDiagAna(uint8_t event)
|
void menuGeneralDiagAna(uint8_t event)
|
||||||
{
|
{
|
||||||
SIMPLE_MENU(STR_MENUANA, menuTabGeneral, e_Ana, 2);
|
SIMPLE_MENU(STR_MENUANA, menuTabGeneral, e_Ana, 1);
|
||||||
|
|
||||||
STICK_SCROLL_DISABLE();
|
STICK_SCROLL_DISABLE();
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||||
#if (NUM_STICKS+NUM_POTS) > 9
|
#if (NUM_STICKS+NUM_POTS) > 9
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + (i/3)*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + (i/3)*FH;
|
||||||
const uint8_t x_coord[] = {0, 70, 154};
|
const uint8_t x_coord[] = {0, 70, 154};
|
||||||
|
@ -65,7 +65,6 @@ void menuGeneralDiagAna(uint8_t event)
|
||||||
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
|
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
|
||||||
batCalV >>= 11;
|
batCalV >>= 11;
|
||||||
batCalV += 2; // because of the diode
|
batCalV += 2; // because of the diode
|
||||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+5*FH, batCalV, (m_posVert==1 ? INVERS : 0));
|
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+5*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
|
||||||
|
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
|
||||||
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,18 +91,18 @@ enum menuGeneralHwItems {
|
||||||
|
|
||||||
void menuGeneralHardware(uint8_t event)
|
void menuGeneralHardware(uint8_t event)
|
||||||
{
|
{
|
||||||
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0});
|
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0 });
|
||||||
|
|
||||||
uint8_t sub = m_posVert - 1;
|
uint8_t sub = m_posVert;
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; ++i) {
|
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i + s_pgOfs;
|
int k = i + s_pgOfs;
|
||||||
for (int j=0; j<=k; j++) {
|
for (int j=0; j<=k; j++) {
|
||||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
if (mstate_tab[j] == HIDDEN_ROW)
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
uint8_t attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case ITEM_SETUP_HW_LABEL_STICKS:
|
case ITEM_SETUP_HW_LABEL_STICKS:
|
||||||
lcd_putsLeft(y, "Sticks");
|
lcd_putsLeft(y, "Sticks");
|
||||||
|
|
|
@ -120,7 +120,7 @@ void onSdManagerMenu(const char *result)
|
||||||
|
|
||||||
// TODO possible buffer overflows here!
|
// TODO possible buffer overflows here!
|
||||||
|
|
||||||
uint8_t index = m_posVert-1-s_pgOfs;
|
uint8_t index = m_posVert-s_pgOfs;
|
||||||
char *line = reusableBuffer.sdmanager.lines[index];
|
char *line = reusableBuffer.sdmanager.lines[index];
|
||||||
|
|
||||||
if (result == STR_SD_INFO) {
|
if (result == STR_SD_INFO) {
|
||||||
|
@ -159,7 +159,7 @@ void onSdManagerMenu(const char *result)
|
||||||
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
|
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
|
||||||
showStatusLine();
|
showStatusLine();
|
||||||
REFRESH_FILES();
|
REFRESH_FILES();
|
||||||
if (m_posVert == reusableBuffer.sdmanager.count)
|
if (m_posVert == reusableBuffer.sdmanager.count-1)
|
||||||
m_posVert--;
|
m_posVert--;
|
||||||
}
|
}
|
||||||
/* TODO else if (result == STR_LOAD_FILE) {
|
/* TODO else if (result == STR_LOAD_FILE) {
|
||||||
|
@ -228,14 +228,15 @@ void menuGeneralSdManager(uint8_t _event)
|
||||||
int lastPos = m_posVert;
|
int lastPos = m_posVert;
|
||||||
|
|
||||||
uint8_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
uint8_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, 1+reusableBuffer.sdmanager.count);
|
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
|
||||||
|
|
||||||
int index = m_posVert-1-s_pgOfs;
|
int index = m_posVert-s_pgOfs;
|
||||||
|
|
||||||
switch(_event) {
|
switch(_event) {
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
f_chdir(ROOT_PATH);
|
f_chdir(ROOT_PATH);
|
||||||
REFRESH_FILES();
|
REFRESH_FILES();
|
||||||
|
lastPos = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
|
@ -256,16 +257,14 @@ void menuGeneralSdManager(uint8_t _event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_posVert > 0) {
|
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
||||||
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
s_pgOfs = 0;
|
||||||
s_pgOfs = 0;
|
m_posVert = 1;
|
||||||
m_posVert = 1;
|
index = 1;
|
||||||
index = 1;
|
REFRESH_FILES();
|
||||||
REFRESH_FILES();
|
killEvents(_event);
|
||||||
killEvents(_event);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no break
|
// no break
|
||||||
|
@ -348,7 +347,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||||
bool isfile = !(fno.fattrib & AM_DIR);
|
bool isfile = !(fno.fattrib & AM_DIR);
|
||||||
|
|
||||||
if (s_pgOfs == 0) {
|
if (s_pgOfs == 0) {
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
char *line = reusableBuffer.sdmanager.lines[i];
|
char *line = reusableBuffer.sdmanager.lines[i];
|
||||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||||
if (i < 6) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (6-i));
|
if (i < 6) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (6-i));
|
||||||
|
@ -391,10 +390,10 @@ void menuGeneralSdManager(uint8_t _event)
|
||||||
|
|
||||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
lcdNextPos = 0;
|
lcdNextPos = 0;
|
||||||
uint8_t attr = (index == i ? BSS|INVERS : BSS);
|
LcdFlags attr = (index == i ? BSS|INVERS : BSS);
|
||||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
|
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
|
||||||
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ void menuGeneralSetup(uint8_t event)
|
||||||
struct gtm t;
|
struct gtm t;
|
||||||
gettime(&t);
|
gettime(&t);
|
||||||
|
|
||||||
if ((m_posVert==ITEM_SETUP_DATE+1 || m_posVert==ITEM_SETUP_TIME+1) &&
|
if ((m_posVert==ITEM_SETUP_DATE || m_posVert==ITEM_SETUP_TIME) &&
|
||||||
(s_editMode>0) &&
|
(s_editMode>0) &&
|
||||||
(event==EVT_KEY_FIRST(KEY_ENTER) || event==EVT_KEY_FIRST(KEY_EXIT) || IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event))) {
|
(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
|
// set the date and time into RTC chip
|
||||||
|
@ -126,9 +126,9 @@ void menuGeneralSetup(uint8_t event)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX+1, { 0, 2, 2, 1, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 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, 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(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*/ });
|
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, { 2, 2, 1, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 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, 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(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*/ });
|
||||||
|
|
||||||
uint8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
|
|
|
@ -43,72 +43,73 @@ void menuGeneralTrainer(uint8_t event)
|
||||||
uint8_t y;
|
uint8_t y;
|
||||||
bool slave = SLAVE_MODE();
|
bool slave = SLAVE_MODE();
|
||||||
|
|
||||||
MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 1 : 7), {0, 2, 2, 2, 2, 0/*, 0*/});
|
MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
|
||||||
|
|
||||||
if (slave) {
|
if (slave) {
|
||||||
lcd_puts(7*FW, 4*FH, STR_SLAVE);
|
lcd_puts(7*FW, 4*FH, STR_SLAVE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
uint8_t attr;
|
|
||||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
|
||||||
|
|
||||||
lcd_puts(3*FW, MENU_TITLE_HEIGHT+1, STR_MODESRC);
|
LcdFlags attr;
|
||||||
|
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||||
|
|
||||||
y = MENU_TITLE_HEIGHT + 1 + FH;
|
lcd_puts(3*FW, MENU_TITLE_HEIGHT+1, STR_MODESRC);
|
||||||
|
|
||||||
for (uint8_t i=1; i<=NUM_STICKS; i++) {
|
y = MENU_TITLE_HEIGHT + 1 + FH;
|
||||||
uint8_t chan = channel_order(i);
|
int sub = m_posVert + 1;
|
||||||
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
|
||||||
|
|
||||||
putsMixerSource(0, y, MIXSRC_Rud-1+chan, (m_posVert==i && CURSOR_ON_LINE()) ? INVERS : 0);
|
for (int i=1; i<=NUM_STICKS; i++) {
|
||||||
|
uint8_t chan = channel_order(i);
|
||||||
|
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
||||||
|
|
||||||
for (uint8_t j=0; j<3; j++) {
|
putsMixerSource(0, y, MIXSRC_Rud-1+chan, (sub==i && CURSOR_ON_LINE()) ? INVERS : 0);
|
||||||
|
|
||||||
attr = ((m_posVert==i && m_posHorz==j) ? blink : 0);
|
for (int j=0; j<3; j++) {
|
||||||
|
|
||||||
switch(j) {
|
attr = ((sub==i && m_posHorz==j) ? blink : 0);
|
||||||
case 0:
|
|
||||||
lcd_putsiAtt(4*FW, y, STR_TRNMODE, td->mode, attr);
|
|
||||||
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->mode, 0, 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
switch(j) {
|
||||||
lcd_outdezAtt(11*FW, y, td->studWeight, attr);
|
case 0:
|
||||||
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->studWeight, -125, 125);
|
lcd_putsiAtt(4*FW, y, STR_TRNMODE, td->mode, attr);
|
||||||
break;
|
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->mode, 0, 2);
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 1:
|
||||||
lcd_putsiAtt(12*FW, y, STR_TRNCHN, td->srcChn, attr);
|
lcd_outdezAtt(11*FW, y, td->studWeight, attr);
|
||||||
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3);
|
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->studWeight, -125, 125);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
case 2:
|
||||||
|
lcd_putsiAtt(12*FW, y, STR_TRNCHN, td->srcChn, attr);
|
||||||
|
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
y += FH;
|
|
||||||
}
|
}
|
||||||
|
y += FH;
|
||||||
|
}
|
||||||
|
|
||||||
attr = (m_posVert==5) ? blink : 0;
|
attr = (sub==5) ? blink : 0;
|
||||||
lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_MULTIPLIER);
|
lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_MULTIPLIER);
|
||||||
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, MENU_TITLE_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
|
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, MENU_TITLE_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
|
||||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
|
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
|
||||||
|
|
||||||
attr = (m_posVert==6) ? INVERS : 0;
|
attr = (sub==6) ? INVERS : 0;
|
||||||
if (attr) s_editMode = 0;
|
if (attr) s_editMode = 0;
|
||||||
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+1+6*FH, STR_CAL, attr);
|
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+1+6*FH, STR_CAL, attr);
|
||||||
for (uint8_t i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
|
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
|
||||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||||
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||||
#else
|
#else
|
||||||
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
||||||
memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib));
|
memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib));
|
||||||
eeDirty(EE_GENERAL);
|
eeDirty(EE_GENERAL);
|
||||||
AUDIO_WARNING1();
|
AUDIO_WARNING1();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,32 +289,25 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GVARS)
|
|
||||||
#define CURVE_SELECTED() (sub >= 0 && sub < MAX_CURVES)
|
|
||||||
#define GVAR_SELECTED() (sub >= MAX_CURVES)
|
|
||||||
#else
|
|
||||||
#define CURVE_SELECTED() (sub >= 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void menuModelCurvesAll(uint8_t event)
|
void menuModelCurvesAll(uint8_t event)
|
||||||
{
|
{
|
||||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES);
|
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES);
|
||||||
|
|
||||||
int8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (CURVE_SELECTED() && !READ_ONLY()) {
|
if (!READ_ONLY()) {
|
||||||
s_curveChan = sub;
|
s_curveChan = sub;
|
||||||
pushMenu(menuModelCurveOne);
|
pushMenu(menuModelCurveOne);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<LCD_LINES-1; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i + s_pgOfs;
|
int k = i + s_pgOfs;
|
||||||
uint8_t attr = (sub == k ? INVERS : 0);
|
LcdFlags attr = (sub == k ? INVERS : 0);
|
||||||
{
|
{
|
||||||
putsStrIdx(0, y, STR_CV, k+1, attr);
|
putsStrIdx(0, y, STR_CV, k+1, attr);
|
||||||
editName(4*FW, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), 0, 0);
|
editName(4*FW, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), 0, 0);
|
||||||
|
@ -324,8 +317,6 @@ void menuModelCurvesAll(uint8_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CURVE_SELECTED()) {
|
s_curveChan = sub;
|
||||||
s_curveChan = sub;
|
DrawCurve(23);
|
||||||
DrawCurve(23);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
CustomFunctionData * cf = &g_model.customFn[sub];
|
CustomFunctionData * cf = &g_model.customFn[sub];
|
||||||
uint8_t func = CFN_FUNC(cf);
|
uint8_t func = CFN_FUNC(cf);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||||
|
|
||||||
void onCustomFunctionsMenu(const char *result)
|
void onCustomFunctionsMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert-1;
|
int sub = m_posVert;
|
||||||
CustomFunctionData * cfn;
|
CustomFunctionData * cfn;
|
||||||
uint8_t eeFlags;
|
uint8_t eeFlags;
|
||||||
|
|
||||||
|
@ -112,33 +112,31 @@ void onCustomFunctionsMenu(const char *result)
|
||||||
|
|
||||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||||
|
if (m_posHorz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||||
|
killEvents(event);
|
||||||
|
CustomFunctionData *cfn = &functions[sub];
|
||||||
|
if (!CFN_EMPTY(cfn))
|
||||||
|
MENU_ADD_ITEM(STR_COPY);
|
||||||
|
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION)
|
||||||
|
MENU_ADD_ITEM(STR_PASTE);
|
||||||
|
if (!CFN_EMPTY(cfn) && CFN_EMPTY(&functions[NUM_CFN-1]))
|
||||||
|
MENU_ADD_ITEM(STR_INSERT);
|
||||||
|
if (!CFN_EMPTY(cfn))
|
||||||
|
MENU_ADD_ITEM(STR_CLEAR);
|
||||||
|
for (int i=sub+1; i<NUM_CFN; i++) {
|
||||||
|
if (!CFN_EMPTY(&functions[i])) {
|
||||||
|
MENU_ADD_ITEM(STR_DELETE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menuHandler = onCustomFunctionsMenu;
|
||||||
|
}
|
||||||
|
|
||||||
if (sub>=0 && m_posHorz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
killEvents(event);
|
|
||||||
CustomFunctionData *cfn = &functions[sub];
|
|
||||||
if (!CFN_EMPTY(cfn))
|
|
||||||
MENU_ADD_ITEM(STR_COPY);
|
|
||||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_FUNCTION)
|
|
||||||
MENU_ADD_ITEM(STR_PASTE);
|
|
||||||
if (!CFN_EMPTY(cfn) && CFN_EMPTY(&functions[NUM_CFN-1]))
|
|
||||||
MENU_ADD_ITEM(STR_INSERT);
|
|
||||||
if (!CFN_EMPTY(cfn))
|
|
||||||
MENU_ADD_ITEM(STR_CLEAR);
|
|
||||||
for (int i=sub+1; i<NUM_CFN; i++) {
|
|
||||||
if (!CFN_EMPTY(&functions[i])) {
|
|
||||||
MENU_ADD_ITEM(STR_DELETE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
menuHandler = onCustomFunctionsMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i+s_pgOfs;
|
int k = i+s_pgOfs;
|
||||||
|
|
||||||
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 && m_posHorz<0) ? INVERS : 0);
|
||||||
|
|
||||||
|
@ -372,6 +370,6 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||||
|
|
||||||
void menuModelCustomFunctions(uint8_t event)
|
void menuModelCustomFunctions(uint8_t event)
|
||||||
{
|
{
|
||||||
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
|
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||||
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
|
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,10 +75,10 @@ void menuModelCustomScriptOne(uint8_t event)
|
||||||
|
|
||||||
int8_t sub = m_posVert;
|
int8_t sub = m_posVert;
|
||||||
|
|
||||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
for (int k=0; k<LCD_LINES-1; k++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
|
||||||
uint8_t i = k + s_pgOfs;
|
int i = k + s_pgOfs;
|
||||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
|
|
||||||
if (i == ITEM_MODEL_CUSTOMSCRIPT_FILE) {
|
if (i == ITEM_MODEL_CUSTOMSCRIPT_FILE) {
|
||||||
lcd_putsLeft(y, STR_SCRIPT);
|
lcd_putsLeft(y, STR_SCRIPT);
|
||||||
|
@ -139,18 +139,14 @@ void menuModelCustomScripts(uint8_t event)
|
||||||
lcd_outdezAtt(19*FW, 0, luaGetMemUsed(), 0);
|
lcd_outdezAtt(19*FW, 0, luaGetMemUsed(), 0);
|
||||||
lcd_puts(19*FW+1, 0, STR_BYTES);
|
lcd_puts(19*FW+1, 0, STR_BYTES);
|
||||||
|
|
||||||
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS+1, {0, NAVIGATION_LINE_BY_LINE|3/*repeated*/});
|
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
|
||||||
|
|
||||||
coord_t y;
|
coord_t y;
|
||||||
int8_t sub = m_posVert - 1;
|
int8_t sub = m_posVert;
|
||||||
|
|
||||||
switch (event) {
|
if (event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||||
case EVT_KEY_FIRST(KEY_ENTER):
|
s_currIdx = sub;
|
||||||
if (sub >= 0) {
|
pushMenu(menuModelCustomScriptOne);
|
||||||
s_currIdx = sub;
|
|
||||||
pushMenu(menuModelCustomScriptOne);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0, scriptIndex=0; i<MAX_SCRIPTS; i++) {
|
for (int i=0, scriptIndex=0; i<MAX_SCRIPTS; i++) {
|
||||||
|
|
|
@ -60,14 +60,14 @@ enum FlightModesItems {
|
||||||
|
|
||||||
bool isTrimModeAvailable(int mode)
|
bool isTrimModeAvailable(int mode)
|
||||||
{
|
{
|
||||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != (m_posVert-1));
|
return (mode < 0 || (mode%2) == 0 || (mode/2) != m_posVert);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menuModelFlightModesAll(uint8_t event)
|
void menuModelFlightModesAll(uint8_t event)
|
||||||
{
|
{
|
||||||
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, 1+MAX_FLIGHT_MODES+1, {0, 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});
|
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 - 1;
|
int8_t sub = m_posVert;
|
||||||
|
|
||||||
horzpos_t posHorz = m_posHorz;
|
horzpos_t posHorz = m_posHorz;
|
||||||
if (sub==0 && posHorz > 0) { posHorz += 1; }
|
if (sub==0 && posHorz > 0) { posHorz += 1; }
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
void onGVARSMenu(const char *result)
|
void onGVARSMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
if (result == STR_ENABLE_POPUP) {
|
if (result == STR_ENABLE_POPUP) {
|
||||||
g_model.gvars[sub].popup = true;
|
g_model.gvars[sub].popup = true;
|
||||||
|
@ -73,35 +73,21 @@ void menuModelGVars(uint8_t event)
|
||||||
menuTitle = STR_MENUGLOBALVARS;
|
menuTitle = STR_MENUGLOBALVARS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENU_FLAGS(menuTitle, menuTabModel, e_GVars, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0, 1+MAX_GVARS, {0, 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});
|
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 });
|
||||||
|
|
||||||
uint8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
#if MAX_GVARS > 6
|
for (int l=0; l<LCD_LINES-1; l++) {
|
||||||
for (uint8_t l=0; l<LCD_LINES-1; l++) {
|
int i = l+s_pgOfs;
|
||||||
uint8_t i = l+s_pgOfs;
|
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + l*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + l*FH;
|
||||||
#elif MAX_GVARS == 6
|
|
||||||
for (uint8_t i=0; i<MAX_GVARS; i++) {
|
|
||||||
coord_t y = MENU_TITLE_HEIGHT + FH + 1 + i*FH;
|
|
||||||
#else
|
|
||||||
for (uint8_t i=0; i<MAX_GVARS; i++) {
|
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 2*FH + 1 + i*FH;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (g_model.gvars[i].popup) lcd_putc(3*FW, y, '!');
|
if (g_model.gvars[i].popup) lcd_putc(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 && m_posHorz<0) ? INVERS : 0);
|
||||||
|
|
||||||
for (uint8_t j=0; j<1+MAX_FLIGHT_MODES; j++) {
|
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 && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||||
coord_t x = GVARS_FM_COLUMN(j-1);
|
coord_t x = GVARS_FM_COLUMN(j-1);
|
||||||
|
|
||||||
#if MAX_GVARS == 6
|
|
||||||
if (i==0 && j!=9) putsStrIdx(x+2, FH+1, STR_FP, j, SMLSIZE);
|
|
||||||
#elif MAX_GVARS <= 5
|
|
||||||
if (i==0 && j!=9) putsStrIdx(x+2, 2*FH, STR_FP, j, SMLSIZE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(j)
|
switch(j)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -141,7 +127,7 @@ void menuModelGVars(uint8_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_posVert > 0 && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
if (m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
if (g_model.gvars[sub].popup)
|
if (g_model.gvars[sub].popup)
|
||||||
MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
MENU_ADD_ITEM(STR_DISABLE_POPUP);
|
||||||
|
|
|
@ -44,9 +44,9 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
|
||||||
{
|
{
|
||||||
lcd_putsColumnLeft(x, y, STR_FLMODE);
|
lcd_putsColumnLeft(x, y, STR_FLMODE);
|
||||||
|
|
||||||
uint8_t posHorz = m_posHorz;
|
int posHorz = m_posHorz;
|
||||||
|
|
||||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
for (int p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||||
LcdFlags flags = 0;
|
LcdFlags flags = 0;
|
||||||
if (attr) {
|
if (attr) {
|
||||||
flags |= INVERS;
|
flags |= INVERS;
|
||||||
|
@ -320,14 +320,14 @@ void menuModelExpoOne(uint8_t event)
|
||||||
|
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1;
|
coord_t y = MENU_TITLE_HEIGHT + 1;
|
||||||
|
|
||||||
for (unsigned int k=0; k<LCD_LINES-1; k++) {
|
for (unsigned int k=0; k<NUM_BODY_LINES; k++) {
|
||||||
int i = k + s_pgOfs;
|
int i = k + s_pgOfs;
|
||||||
for (int j=0; j<=i; ++j) {
|
for (int j=0; j<=i; ++j) {
|
||||||
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case EXPO_FIELD_INPUT_NAME:
|
case EXPO_FIELD_INPUT_NAME:
|
||||||
|
@ -500,7 +500,7 @@ void menuModelMixOne(uint8_t event)
|
||||||
int8_t sub = m_posVert;
|
int8_t sub = m_posVert;
|
||||||
int8_t editMode = s_editMode;
|
int8_t editMode = s_editMode;
|
||||||
|
|
||||||
for (uint8_t k=0; k<MENU_COLUMNS*(LCD_LINES-1); k++) {
|
for (int k=0; k<MENU_COLUMNS*(LCD_LINES-1); k++) {
|
||||||
coord_t y;
|
coord_t y;
|
||||||
coord_t COLUMN_X;
|
coord_t COLUMN_X;
|
||||||
if (k >= LCD_LINES-1) {
|
if (k >= LCD_LINES-1) {
|
||||||
|
@ -513,7 +513,7 @@ void menuModelMixOne(uint8_t event)
|
||||||
}
|
}
|
||||||
int8_t i = k;
|
int8_t i = k;
|
||||||
|
|
||||||
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case MIX_FIELD_NAME:
|
case MIX_FIELD_NAME:
|
||||||
editSingleName(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXNAME, md2->name, sizeof(md2->name), event, attr);
|
editSingleName(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXNAME, md2->name, sizeof(md2->name), event, attr);
|
||||||
|
@ -735,7 +735,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (sub != 0 && (!s_currCh || (s_copyMode && !s_copyTgtOfs)) && !READ_ONLY()) {
|
if ((!s_currCh || (s_copyMode && !s_copyTgtOfs)) && !READ_ONLY()) {
|
||||||
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
||||||
s_copySrcIdx = s_currIdx;
|
s_copySrcIdx = s_currIdx;
|
||||||
s_copySrcCh = chn;
|
s_copySrcCh = chn;
|
||||||
|
@ -751,7 +751,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
s_copyMode = 0;
|
s_copyMode = 0;
|
||||||
s_copyTgtOfs = 0;
|
s_copyTgtOfs = 0;
|
||||||
}
|
}
|
||||||
else if (sub != 0) {
|
else {
|
||||||
if (READ_ONLY()) {
|
if (READ_ONLY()) {
|
||||||
if (!s_currCh) {
|
if (!s_currCh) {
|
||||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||||
|
@ -829,14 +829,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
|
|
||||||
sub = m_posVert;
|
sub = m_posVert;
|
||||||
s_currCh = 0;
|
s_currCh = 0;
|
||||||
uint8_t cur = 1;
|
int cur = 0;
|
||||||
uint8_t i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (uint8_t ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
|
for (int ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
|
||||||
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
|
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
|
||||||
coord_t y = MENU_TITLE_HEIGHT-FH+1+(cur-s_pgOfs)*FH;
|
coord_t y = MENU_TITLE_HEIGHT+1+(cur-s_pgOfs)*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 (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 (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||||
if (expo) {
|
if (expo) {
|
||||||
putsMixerSource(0, y, ch, 0);
|
putsMixerSource(0, y, ch, 0);
|
||||||
}
|
}
|
||||||
|
@ -847,7 +847,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
uint8_t mixCnt = 0;
|
uint8_t mixCnt = 0;
|
||||||
do {
|
do {
|
||||||
if (s_copyMode) {
|
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 && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||||
lcd_rect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
lcd_rect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
||||||
cur++; y+=FH;
|
cur++; y+=FH;
|
||||||
}
|
}
|
||||||
|
@ -859,7 +859,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
else if (sub == cur) {
|
else if (sub == cur) {
|
||||||
s_currIdx = i;
|
s_currIdx = i;
|
||||||
}
|
}
|
||||||
if (s_pgOfs < cur && cur-s_pgOfs < 8) {
|
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||||
uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||||
if (expo) {
|
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);
|
ed->weight = GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, event);
|
||||||
|
@ -901,7 +901,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
}
|
}
|
||||||
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
|
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));
|
} 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 && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
||||||
cur++; y+=FH;
|
cur++; y+=FH;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||||
attr = INVERS;
|
attr = INVERS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s_pgOfs < cur && cur-s_pgOfs < LCD_LINES) {
|
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||||
if (expo) {
|
if (expo) {
|
||||||
putsMixerSource(0, y, ch, attr);
|
putsMixerSource(0, y, ch, attr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
bool isThrottleOutput(uint8_t ch)
|
bool isThrottleOutput(uint8_t ch)
|
||||||
{
|
{
|
||||||
for (uint8_t i=0; i<MAX_MIXERS; i++) {
|
for (int i=0; i<MAX_MIXERS; i++) {
|
||||||
MixData *mix = mixAddress(i);
|
MixData *mix = mixAddress(i);
|
||||||
if (mix->destCh==ch && mix->srcRaw==MIXSRC_Thr)
|
if (mix->destCh==ch && mix->srcRaw==MIXSRC_Thr)
|
||||||
return true;
|
return true;
|
||||||
|
@ -94,7 +94,7 @@ enum LimitsItems {
|
||||||
|
|
||||||
void onLimitsMenu(const char *result)
|
void onLimitsMenu(const char *result)
|
||||||
{
|
{
|
||||||
uint8_t ch = m_posVert - 1;
|
int ch = m_posVert;
|
||||||
|
|
||||||
if (result == STR_RESET) {
|
if (result == STR_RESET) {
|
||||||
LimitData *ld = limitAddress(ch);
|
LimitData *ld = limitAddress(ch);
|
||||||
|
@ -115,7 +115,7 @@ void onLimitsMenu(const char *result)
|
||||||
|
|
||||||
void menuModelLimits(uint8_t event)
|
void menuModelLimits(uint8_t event)
|
||||||
{
|
{
|
||||||
uint8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
|
|
||||||
if (sub < NUM_CHNOUT) {
|
if (sub < NUM_CHNOUT) {
|
||||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||||
|
@ -126,7 +126,7 @@ void menuModelLimits(uint8_t event)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, 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});
|
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) {
|
if (sub<NUM_CHNOUT && m_posHorz>=0) {
|
||||||
displayColumnHeader(STR_LIMITS_HEADERS, m_posHorz);
|
displayColumnHeader(STR_LIMITS_HEADERS, m_posHorz);
|
||||||
|
@ -139,7 +139,7 @@ void menuModelLimits(uint8_t event)
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i+s_pgOfs;
|
uint8_t k = i+s_pgOfs;
|
||||||
|
|
||||||
|
@ -177,8 +177,8 @@ void menuModelLimits(uint8_t event)
|
||||||
menuHandler = onLimitsMenu;
|
menuHandler = onLimitsMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
for (int j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||||
uint8_t active = (attr && s_editMode>0) ;
|
uint8_t active = (attr && s_editMode>0) ;
|
||||||
if (active) STICK_SCROLL_DISABLE();
|
if (active) STICK_SCROLL_DISABLE();
|
||||||
switch(j)
|
switch(j)
|
||||||
|
|
|
@ -75,7 +75,7 @@ void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lat
|
||||||
|
|
||||||
void onLogicalSwitchesMenu(const char *result)
|
void onLogicalSwitchesMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert-1;
|
int8_t sub = m_posVert;
|
||||||
LogicalSwitchData * cs = lswAddress(sub);
|
LogicalSwitchData * cs = lswAddress(sub);
|
||||||
|
|
||||||
if (result == STR_COPY) {
|
if (result == STR_COPY) {
|
||||||
|
@ -96,17 +96,17 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||||
{
|
{
|
||||||
INCDEC_DECLARE_VARS(EE_MODEL);
|
INCDEC_DECLARE_VARS(EE_MODEL);
|
||||||
|
|
||||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
|
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/ });
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
horzpos_t horz = m_posHorz;
|
horzpos_t horz = m_posHorz;
|
||||||
|
|
||||||
if (horz>=0) {
|
if (horz>=0) {
|
||||||
displayColumnHeader(STR_CSW_HEADERS, horz);
|
displayColumnHeader(STR_CSW_HEADERS, horz);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub>=0 && horz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (horz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
LogicalSwitchData * cs = lswAddress(sub);
|
LogicalSwitchData * cs = lswAddress(sub);
|
||||||
if (cs->func)
|
if (cs->func)
|
||||||
|
@ -118,7 +118,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||||
menuHandler = onLogicalSwitchesMenu;
|
menuHandler = onLogicalSwitchesMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
k = i+s_pgOfs;
|
k = i+s_pgOfs;
|
||||||
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
#define MODELSIZE_POS_X 170
|
#define MODELSIZE_POS_X 170
|
||||||
|
|
||||||
#define MODELSEL_W 133
|
#define MODELSEL_W 133
|
||||||
|
|
||||||
void onModelSelectMenu(const char *result)
|
void onModelSelectMenu(const char *result)
|
||||||
|
@ -94,11 +93,11 @@ void menuModelSelect(uint8_t event)
|
||||||
|
|
||||||
int8_t oldSub = m_posVert;
|
int8_t oldSub = m_posVert;
|
||||||
|
|
||||||
check_submenu_simple(_event_, MAX_MODELS-1);
|
check_submenu_simple(_event_, MAX_MODELS);
|
||||||
|
|
||||||
if (s_editMode > 0) s_editMode = 0;
|
if (s_editMode > 0) s_editMode = 0;
|
||||||
|
|
||||||
int8_t sub = m_posVert;
|
int sub = m_posVert;
|
||||||
|
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,13 +135,12 @@ void menuModelSetup(uint8_t event)
|
||||||
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
|
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
|
||||||
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS() : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS() : TRAINER_CHANNELS_ROWS()))
|
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS() : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS() : TRAINER_CHANNELS_ROWS()))
|
||||||
#define FAILSAFE_ROWS(x) ((g_model.moduleData[x].rfProtocol==RF_PROTO_X16 || g_model.moduleData[x].rfProtocol==RF_PROTO_LR12) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW)
|
#define FAILSAFE_ROWS(x) ((g_model.moduleData[x].rfProtocol==RF_PROTO_X16 || g_model.moduleData[x].rfProtocol==RF_PROTO_LR12) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW)
|
||||||
#define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX)
|
|
||||||
#define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
|
#define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
|
||||||
#define TIMER_ROWS 2|NAVIGATION_LINE_BY_LINE, 0, CASE_PERSISTENT_TIMERS(0) 0, 0
|
#define TIMER_ROWS 2|NAVIGATION_LINE_BY_LINE, 0, CASE_PERSISTENT_TIMERS(0) 0, 0
|
||||||
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
||||||
MENU_TAB({ 0, 0, 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()), ONE_2x2POS_DEFINED() ? TITLE_ROW : HIDDEN_ROW, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), 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)});
|
MENU_TAB({ 0, 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()), ONE_2x2POS_DEFINED() ? TITLE_ROW : HIDDEN_ROW, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), 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)});
|
||||||
|
|
||||||
MENU_CHECK(menuTabModel, e_ModelSetup, MODEL_SETUP_MAX_LINES);
|
MENU_CHECK(menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX);
|
||||||
|
|
||||||
#if (defined(DSM2) || defined(PXX))
|
#if (defined(DSM2) || defined(PXX))
|
||||||
if (menuEvent) {
|
if (menuEvent) {
|
||||||
|
@ -152,14 +151,14 @@ void menuModelSetup(uint8_t event)
|
||||||
|
|
||||||
TITLE(STR_MENUSETUP);
|
TITLE(STR_MENUSETUP);
|
||||||
|
|
||||||
uint8_t sub = m_posVert - 1;
|
uint8_t sub = m_posVert;
|
||||||
int8_t editMode = s_editMode;
|
int8_t editMode = s_editMode;
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
|
for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i+s_pgOfs;
|
uint8_t k = i+s_pgOfs;
|
||||||
for (int j=0; j<=k; j++) {
|
for (int j=0; j<=k; j++) {
|
||||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
if (mstate_tab[j] == HIDDEN_ROW)
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +701,7 @@ void menuModelFailsafe(uint8_t event)
|
||||||
// Column separator
|
// Column separator
|
||||||
lcd_vline(LCD_W/2, FH, LCD_H-FH);
|
lcd_vline(LCD_W/2, FH, LCD_H-FH);
|
||||||
|
|
||||||
if (m_posVert >= 16) {
|
if (m_posVert > 16) {
|
||||||
ch = 16;
|
ch = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ bool isAltSensor(int sensor)
|
||||||
|
|
||||||
bool isVoltsSensor(int sensor)
|
bool isVoltsSensor(int sensor)
|
||||||
{
|
{
|
||||||
return isSensorUnit(sensor, UNIT_VOLTS);
|
return isSensorUnit(sensor, UNIT_VOLTS) || isSensorUnit(sensor, UNIT_CELLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCurrentSensor(int sensor)
|
bool isCurrentSensor(int sensor)
|
||||||
|
@ -214,18 +214,18 @@ void menuModelSensor(uint8_t event)
|
||||||
|
|
||||||
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, 0, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), LEFT);
|
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, 0, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), LEFT);
|
||||||
|
|
||||||
int8_t sub = m_posVert;
|
int sub = m_posVert;
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i + s_pgOfs;
|
int k = i + s_pgOfs;
|
||||||
|
|
||||||
for (int j=0; j<k; j++) {
|
for (int j=0; j<k; j++) {
|
||||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
if (mstate_tab[j] == HIDDEN_ROW)
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t attr = (sub==k ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==k ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ void menuModelSensor(uint8_t event)
|
||||||
|
|
||||||
void onSensorMenu(const char *result)
|
void onSensorMenu(const char *result)
|
||||||
{
|
{
|
||||||
uint8_t index = m_posVert - 1 - ITEM_TELEMETRY_SENSOR1;
|
int index = m_posVert - ITEM_TELEMETRY_SENSOR1;
|
||||||
|
|
||||||
if (index < TELEM_VALUES_MAX) {
|
if (index < TELEM_VALUES_MAX) {
|
||||||
if (result == STR_EDIT) {
|
if (result == STR_EDIT) {
|
||||||
|
@ -408,7 +408,7 @@ void onSensorMenu(const char *result)
|
||||||
if (index<TELEM_VALUES_MAX && isTelemetryFieldAvailable(index))
|
if (index<TELEM_VALUES_MAX && isTelemetryFieldAvailable(index))
|
||||||
m_posVert += 1;
|
m_posVert += 1;
|
||||||
else
|
else
|
||||||
m_posVert = 1+ITEM_TELEMETRY_NEWSENSOR;
|
m_posVert = ITEM_TELEMETRY_NEWSENSOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,8 +416,8 @@ void onSensorMenu(const char *result)
|
||||||
#if defined(LUA)
|
#if defined(LUA)
|
||||||
void onTelemetryScriptFileSelectionMenu(const char *result)
|
void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert - 1;
|
int sub = m_posVert;
|
||||||
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
|
int screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
|
||||||
|
|
||||||
if (result == STR_UPDATE_LIST) {
|
if (result == STR_UPDATE_LIST) {
|
||||||
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
|
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
|
||||||
|
@ -436,15 +436,15 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||||
|
|
||||||
void menuModelTelemetry(uint8_t event)
|
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) LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
|
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) LABEL(TopBar), 0, 0, 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;
|
int sub = m_posVert;
|
||||||
|
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||||
uint8_t k = i + s_pgOfs;
|
uint8_t k = i + s_pgOfs;
|
||||||
for (int j=0; j<=k; j++) {
|
for (int j=0; j<=k; j++) {
|
||||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
if (mstate_tab[j] == HIDDEN_ROW)
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,10 +229,10 @@ void title(const pm_char * s);
|
||||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||||
|
|
||||||
#define MENU_CHECK(tab, menu, lines_count) \
|
#define MENU_CHECK(tab, menu, lines_count) \
|
||||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1)
|
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
|
||||||
|
|
||||||
#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \
|
#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \
|
||||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1, flags)
|
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, flags)
|
||||||
|
|
||||||
#define MENU(title, tab, menu, lines_count, ...) \
|
#define MENU(title, tab, menu, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
|
@ -245,7 +245,7 @@ void title(const pm_char * s);
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||||
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
check_simple(event, menu, tab, DIM(tab), lines_count);
|
||||||
|
|
||||||
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
||||||
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
||||||
|
@ -253,16 +253,16 @@ void title(const pm_char * s);
|
||||||
|
|
||||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SUBMENU(title, lines_count, ...) \
|
#define SUBMENU(title, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||||
check_submenu_simple(event, (lines_count)-1);
|
check_submenu_simple(event, lines_count);
|
||||||
|
|
||||||
#define SIMPLE_SUBMENU(title, lines_count) \
|
#define SIMPLE_SUBMENU(title, lines_count) \
|
||||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||||
|
@ -368,7 +368,7 @@ void menuChannelsView(uint8_t event);
|
||||||
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
#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 MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||||
|
|
||||||
#define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? (MAXCOL((uint16_t)2) >= HIDDEN_ROW ? 3 : 2) : 1) : 0)
|
#define POS_VERT_INIT (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)
|
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||||
#define EDIT_MODE_INIT 0 // TODO enum
|
#define EDIT_MODE_INIT 0 // TODO enum
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ void onLongMenuPress(const char *result)
|
||||||
|
|
||||||
tmr10ms_t menuEntryTime;
|
tmr10ms_t menuEntryTime;
|
||||||
|
|
||||||
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, uint8_t flags)
|
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 rowcount, uint8_t flags)
|
||||||
{
|
{
|
||||||
vertpos_t l_posVert = m_posVert;
|
vertpos_t l_posVert = m_posVert;
|
||||||
horzpos_t l_posHorz = m_posHorz;
|
horzpos_t l_posHorz = m_posHorz;
|
||||||
|
@ -239,7 +239,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
uint8_t maxcol = MAXCOL(l_posVert);
|
uint8_t maxcol = MAXCOL(l_posVert);
|
||||||
|
|
||||||
if (menuTab) {
|
if (menuTab) {
|
||||||
int8_t cc = curr;
|
int cc = curr;
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
if (menuTab == menuTabModel) {
|
if (menuTab == menuTabModel) {
|
||||||
|
@ -307,10 +307,8 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
l_posHorz = 0;
|
l_posHorz = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!menuTab || l_posVert>0) {
|
if (READ_ONLY_UNLOCKED()) {
|
||||||
if (READ_ONLY_UNLOCKED()) {
|
s_editMode = (s_editMode<=0);
|
||||||
s_editMode = (s_editMode<=0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -363,7 +361,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
INC(l_posVert, POS_VERT_INIT, maxrow);
|
INC(l_posVert, POS_VERT_INIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
s_editMode = 0; // if we go down, we must be in this mode
|
s_editMode = 0; // if we go down, we must be in this mode
|
||||||
|
@ -394,7 +392,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
DEC(l_posVert, POS_VERT_INIT, maxrow);
|
DEC(l_posVert, POS_VERT_INIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
s_editMode = 0; // if we go up, we must be in this mode
|
s_editMode = 0; // if we go up, we must be in this mode
|
||||||
|
@ -407,33 +405,48 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_posVert == 0 || (l_posVert==2 && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW) || (l_posVert==3 && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW && MAXCOL(vertpos_t(2)) >= HIDDEN_ROW)) {
|
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;
|
s_pgOfs = 0;
|
||||||
|
if (horTab) {
|
||||||
|
linesCount = 0;
|
||||||
|
for (int i=0; i<rowcount; i++) {
|
||||||
|
if (horTab[i] != HIDDEN_ROW) {
|
||||||
|
linesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (horTab) {
|
else if (horTab) {
|
||||||
uint8_t max = menuTab ? NUM_BODY_LINES : NUM_BODY_LINES-1;
|
if (rowcount > NUM_BODY_LINES) {
|
||||||
if (maxrow > max) {
|
|
||||||
while (1) {
|
while (1) {
|
||||||
vertpos_t firstLine = 0;
|
vertpos_t firstLine = 0;
|
||||||
for (int numLines=0; firstLine<=maxrow && numLines<s_pgOfs; firstLine++) {
|
for (int numLines=0; firstLine<rowcount && numLines<s_pgOfs; firstLine++) {
|
||||||
if (horTab[firstLine+1] != HIDDEN_ROW) {
|
if (horTab[firstLine] != HIDDEN_ROW) {
|
||||||
numLines++;
|
numLines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l_posVert <= firstLine) {
|
if (l_posVert < firstLine) {
|
||||||
s_pgOfs--;
|
s_pgOfs--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vertpos_t lastLine = firstLine;
|
vertpos_t lastLine = firstLine;
|
||||||
for (int numLines=0; lastLine<=maxrow && numLines<max; lastLine++) {
|
for (int numLines=0; lastLine<rowcount && numLines<NUM_BODY_LINES; lastLine++) {
|
||||||
if (horTab[lastLine+1] != HIDDEN_ROW) {
|
if (horTab[lastLine] != HIDDEN_ROW) {
|
||||||
numLines++;
|
numLines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l_posVert > lastLine) {
|
if (l_posVert >= lastLine) {
|
||||||
s_pgOfs++;
|
s_pgOfs++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
linesCount = s_pgOfs + NUM_BODY_LINES;
|
||||||
|
for (int i=lastLine; i<rowcount; i++) {
|
||||||
|
if (horTab[i] != HIDDEN_ROW) {
|
||||||
|
linesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,17 +454,16 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8_t max = menuTab ? NUM_BODY_LINES : NUM_BODY_LINES-1;
|
if (l_posVert>=NUM_BODY_LINES+s_pgOfs) {
|
||||||
if (l_posVert>max+s_pgOfs) {
|
s_pgOfs = l_posVert-NUM_BODY_LINES+1;
|
||||||
s_pgOfs = l_posVert-max;
|
|
||||||
}
|
}
|
||||||
else if (l_posVert<1+s_pgOfs) {
|
else if (l_posVert<s_pgOfs) {
|
||||||
s_pgOfs = l_posVert-1;
|
s_pgOfs = l_posVert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxrow > NUM_BODY_LINES && scrollbar_X) {
|
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||||
displayScrollbar(scrollbar_X, MENU_TITLE_HEIGHT, LCD_H-MENU_TITLE_HEIGHT-MENU_NAVIG_HEIGHT, s_pgOfs, menuTab ? maxrow : maxrow+1, NUM_BODY_LINES);
|
displayScrollbar(scrollbar_X, MENU_TITLE_HEIGHT, LCD_H-MENU_TITLE_HEIGHT-MENU_NAVIG_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_posVert = l_posVert;
|
m_posVert = l_posVert;
|
||||||
|
@ -459,14 +471,14 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||||
{
|
{
|
||||||
check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
|
check(event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_submenu_simple(check_event_t event, uint8_t maxrow)
|
void check_submenu_simple(check_event_t event, uint8_t rowcount)
|
||||||
{
|
{
|
||||||
check_simple(event, 0, 0, 0, maxrow);
|
check_simple(event, 0, 0, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void repeatLastCursorMove(uint8_t event)
|
void repeatLastCursorMove(uint8_t event)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue