400bytes flash saved in GeneralMenus + ModelMenus
On V4.1 board both Rotary Encoder may be used for navigation TX/RX RSSI set to 0 when no telemetry received since too long
This commit is contained in:
+2
-11
@@ -45,12 +45,7 @@ TEMPLATES = YES
|
||||
# POT2 (menus scroll),
|
||||
# POT3 (cursor down/up),
|
||||
# POTS (POT1, POT2, POT3),
|
||||
# RE1 (Rotary encoder 1, on V4 boards)
|
||||
ifeq ($(PCB), V4)
|
||||
NAVIGATION = RE1
|
||||
else
|
||||
NAVIGATION = POTS
|
||||
endif
|
||||
NAVIGATION = NO
|
||||
|
||||
# AUDIO Mods
|
||||
# Values = YES, NO
|
||||
@@ -307,7 +302,7 @@ endif
|
||||
ifeq ($(PCB), V4)
|
||||
# V4 PCB, so ...
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBV4 -DAUDIO -DHAPTIC
|
||||
CPPDEFS += -DPCBV4 -DAUDIO -DHAPTIC -DROTARY_ENCODERS
|
||||
EXTRAINCDIRS += gruvin9x
|
||||
BOARDSRC += board_gruvin9x.cpp
|
||||
EEPROMSRC = eeprom_avr.cpp
|
||||
@@ -317,10 +312,6 @@ ifeq ($(PCB), V4)
|
||||
CPPSRC += gruvin9x/rtc.cpp
|
||||
CPPSRC += gruvin9x/ff.cpp
|
||||
CPPSRC += gruvin9x/diskio.cpp
|
||||
|
||||
ifeq ($(NAVIGATION), RE1)
|
||||
CPPDEFS += -DNAVIGATION_RE1
|
||||
endif
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
CPPDEFS += -DSDCARD
|
||||
|
||||
@@ -219,6 +219,7 @@ void audioDefevent(uint8_t e);
|
||||
#define AUDIO_VARIO_UP() audioDefevent(AU_KEYPAD_UP)
|
||||
#define AUDIO_VARIO_DOWN() audioDefevent(AU_KEYPAD_DOWN)
|
||||
#define AUDIO_TRIM_MIDDLE() audioDefevent(AU_TRIM_MIDDLE)
|
||||
#define AUDIO_TELEMETRY_ALARM() audioDefevent(AU_WARNING1)
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define AUDIO_DRIVER() audio.driver()
|
||||
|
||||
@@ -77,6 +77,7 @@ extern void beep(uint8_t val);
|
||||
#define AUDIO_VARIO_UP() _beep(1)
|
||||
#define AUDIO_VARIO_DOWN() _beep(1)
|
||||
#define AUDIO_TRIM_MIDDLE() beep(2)
|
||||
#define AUDIO_TELEMETRY_ALARM() { warble = !(g_tmr10ms % 60); AUDIO_WARNING2(); }
|
||||
|
||||
#define IS_AUDIO_BUSY() (g_beepCnt || beepAgain || beepOn)
|
||||
|
||||
|
||||
+5
-10
@@ -606,17 +606,12 @@ void check_frsky()
|
||||
if (frskyStreaming > 0) {
|
||||
frskyStreaming--;
|
||||
}
|
||||
else if (g_eeGeneral.enableTelemetryAlarm && (g_model.frsky.channels[0].ratio || g_model.frsky.channels[1].ratio)) {
|
||||
#if defined (AUDIO)
|
||||
else if (g_eeGeneral.enableTelemetryAlarm) {
|
||||
frskyRSSI[0].set(0);
|
||||
frskyRSSI[1].set(0);
|
||||
if (!(g_tmr10ms % 30)) {
|
||||
audioDefevent(AU_WARNING1);
|
||||
AUDIO_TELEMETRY_ALARM();
|
||||
}
|
||||
#else
|
||||
if (!(g_tmr10ms % 30)) {
|
||||
warble = !(g_tmr10ms % 60);
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -750,7 +745,7 @@ void FrskyRSSI::set(uint8_t value)
|
||||
this->value = value;
|
||||
else
|
||||
this->value = (((uint16_t)this->value * 7) + value + 4) / 8;
|
||||
if (!min || value < min)
|
||||
if (value && (!min || value < min))
|
||||
min = value;
|
||||
}
|
||||
|
||||
|
||||
+224
-205
@@ -72,41 +72,63 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
|
||||
};
|
||||
|
||||
#define GENERAL_PARAM_OFS (2+16*FW)
|
||||
NOINLINE int8_t selectMenuItem(uint8_t y, const pm_char *label, const pm_char *values, int8_t value, int8_t min, int8_t max, uint8_t condition, uint8_t event)
|
||||
NOINLINE int8_t selectMenuItem(uint8_t y, const pm_char *label, const pm_char *values, int8_t value, int8_t min, int8_t max, uint8_t attr, uint8_t event)
|
||||
{
|
||||
lcd_putsLeft(y, label);
|
||||
lcd_putsiAtt(GENERAL_PARAM_OFS, y, values, value-min, condition ? INVERS:0) ;
|
||||
if (condition) CHECK_INCDEC_GENVAR(event, value, min, max);
|
||||
lcd_putsiAtt(GENERAL_PARAM_OFS, y, values, value-min, attr) ;
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, value, min, max);
|
||||
return value;
|
||||
}
|
||||
|
||||
NOINLINE uint8_t onoffMenuItem(uint8_t value, uint8_t y, const pm_char *label, uint8_t condition, uint8_t event )
|
||||
NOINLINE uint8_t onoffMenuItem(uint8_t value, uint8_t y, const pm_char *label, uint8_t attr, uint8_t event )
|
||||
{
|
||||
return selectMenuItem(y, label, STR_OFFON, value, 0, 1, condition, event);
|
||||
return selectMenuItem(y, label, STR_OFFON, value, 0, 1, attr, event);
|
||||
}
|
||||
|
||||
enum menuProcSetupItems {
|
||||
ITEM_SETUP_BASE=18,
|
||||
#ifdef PCBARM
|
||||
ITEM_SETUP_OPTREX,
|
||||
ITEM_SETUP_BACKLIGHT_BRIGHT,
|
||||
ITEM_SETUP_VOLUME,
|
||||
ITEM_SETUP_BEEPER_MODE,
|
||||
#if defined(PCBARM)
|
||||
ITEM_SETUP_SPEAKER_VOLUME,
|
||||
#endif
|
||||
#ifdef AUDIO
|
||||
ITEM_SETUP_SPEAKER,
|
||||
ITEM_SETUP_BEEPER_LENGTH,
|
||||
#if defined(AUDIO)
|
||||
ITEM_SETUP_SPEAKER_PITCH,
|
||||
#endif
|
||||
#ifdef HAPTIC
|
||||
#if defined(HAPTIC)
|
||||
ITEM_SETUP_HAPTIC_MODE,
|
||||
ITEM_SETUP_HAPTIC_STRENGTH,
|
||||
#endif
|
||||
#ifdef SPLASH
|
||||
ITEM_SETUP_SPLASH,
|
||||
#if defined(PCBARM)
|
||||
ITEM_SETUP_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_BRIGHTNESS,
|
||||
#endif
|
||||
#ifdef FRSKY
|
||||
ITEM_SETUP_NODATA_ALARM,
|
||||
ITEM_SETUP_CONTRAST,
|
||||
ITEM_SETUP_BATTERY_WARNING,
|
||||
ITEM_SETUP_INACTIVITY_ALARM,
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
ITEM_SETUP_RE_NAVIGATION,
|
||||
#endif
|
||||
ITEM_SETUP_FILTER_ADC,
|
||||
ITEM_SETUP_THROTTLE_REVERSED,
|
||||
ITEM_SETUP_MINUTE_BEEP,
|
||||
ITEM_SETUP_COUNTDOWN_BEEP,
|
||||
ITEM_SETUP_FLASH_BEEP,
|
||||
ITEM_SETUP_LIGHT_SWITCH,
|
||||
ITEM_SETUP_LIGHT_OFF_AFTER,
|
||||
#if defined(SPLASH)
|
||||
ITEM_SETUP_DISABLE_SPLASH,
|
||||
#endif
|
||||
ITEM_SETUP_THROTTLE_WARNING,
|
||||
ITEM_SETUP_SWITCH_WARNING,
|
||||
ITEM_SETUP_MEMORY_WARNING,
|
||||
ITEM_SETUP_ALARM_WARNING,
|
||||
#if defined(FRSKY)
|
||||
ITEM_SETUP_TELEMETRY_ALARM,
|
||||
ITEM_SETUP_TIMEZONE,
|
||||
ITEM_SETUP_GPSCOORD,
|
||||
ITEM_SETUP_GPSFORMAT,
|
||||
#endif
|
||||
ITEM_SETUP_RX_CHANNEL_ORD,
|
||||
ITEM_SETUP_STICK_MODE,
|
||||
ITEM_SETUP_MAX
|
||||
};
|
||||
|
||||
@@ -137,231 +159,228 @@ void menuProcSetup(uint8_t event)
|
||||
#else
|
||||
#define ARM_ZEROS
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, 0, 0, AUDIO_ZEROS HAPTIC_ZEROS ARM_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1});
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
uint8_t y = 1*FH;
|
||||
|
||||
uint8_t subN = 1;
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.beeperMode = selectMenuItem(y, STR_BEEPERMODE, STR_VBEEPMODE, g_eeGeneral.beeperMode, -2, 1, sub==subN, event);
|
||||
#if defined(FRSKY)
|
||||
if (sub==subN && checkIncDec_Ret) FRSKY_setModelAlarms();
|
||||
#ifdef ROTARY_ENCODERS
|
||||
#define ROTARY_ENCODERS_ZEROS 0,
|
||||
#else
|
||||
#define ROTARY_ENCODERS_ZEROS
|
||||
#endif
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+2, {0, 0, 0, AUDIO_ZEROS HAPTIC_ZEROS ARM_ZEROS ROTARY_ENCODERS_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
for (uint8_t i=0; i<7; i++) {
|
||||
uint8_t y = 1*FH + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t attr = (sub == k ? INVERS : 0);
|
||||
|
||||
switch(k) {
|
||||
case ITEM_SETUP_BEEPER_MODE:
|
||||
g_eeGeneral.beeperMode = selectMenuItem(y, STR_BEEPERMODE, STR_VBEEPMODE, g_eeGeneral.beeperMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
if (attr && checkIncDec_Ret) FRSKY_setModelAlarms();
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(PCBARM)
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t current_volume = g_eeGeneral.speakerVolume;
|
||||
lcd_putsLeft(y, PSTR("Speaker Volume")); // TODO translations
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, current_volume, (sub==subN ? INVERS : 0)|LEFT);
|
||||
if(sub==subN) {
|
||||
CHECK_INCDEC_GENVAR(event, current_volume, 0, NUM_VOL_LEVELS-1);
|
||||
if (current_volume != g_eeGeneral.speakerVolume) {
|
||||
set_volume(g_eeGeneral.speakerVolume = current_volume);
|
||||
}
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_SPEAKER_VOLUME:
|
||||
uint8_t current_volume = g_eeGeneral.speakerVolume;
|
||||
lcd_putsLeft(y, PSTR("Speaker Volume")); // TODO translations
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, current_volume, attr|LEFT);
|
||||
if(attr) {
|
||||
CHECK_INCDEC_GENVAR(event, current_volume, 0, NUM_VOL_LEVELS-1);
|
||||
if (current_volume != g_eeGeneral.speakerVolume) {
|
||||
set_volume(g_eeGeneral.speakerVolume = current_volume);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.beeperLength = selectMenuItem(y, STR_BEEPERLEN, STR_VBEEPLEN, g_eeGeneral.beeperLength, -2, 2, sub==subN, event);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_BEEPER_LENGTH:
|
||||
g_eeGeneral.beeperLength = selectMenuItem(y, STR_BEEPERLEN, STR_VBEEPLEN, g_eeGeneral.beeperLength, -2, 2, attr, event);
|
||||
break;
|
||||
|
||||
#ifdef AUDIO
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_SPKRPITCH);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.speakerPitch,(sub==subN ? INVERS : 0)|LEFT);
|
||||
if (sub==subN) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 100);
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
#if defined(AUDIO)
|
||||
case ITEM_SETUP_SPEAKER_PITCH:
|
||||
lcd_putsLeft( y, STR_SPKRPITCH);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.speakerPitch, attr|LEFT);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 100);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef HAPTIC
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.hapticMode = selectMenuItem(y, STR_HAPTICMODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, sub==subN, event);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_HAPTIC_MODE:
|
||||
g_eeGeneral.hapticMode = selectMenuItem(y, STR_HAPTICMODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event);
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_HAPTICSTRENGTH);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.hapticStrength, (sub==subN ? INVERS : 0)|LEFT);
|
||||
if (sub==subN) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.hapticStrength, 0, 5);
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_HAPTIC_STRENGTH:
|
||||
lcd_putsLeft( y, STR_HAPTICSTRENGTH);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.hapticStrength, attr|LEFT);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.hapticStrength, 0, 5);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.optrexDisplay = onoffMenuItem( g_eeGeneral.optrexDisplay, y, PSTR("Optrex Display"), sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_OPTREX_DISPLAY:
|
||||
g_eeGeneral.optrexDisplay = onoffMenuItem( g_eeGeneral.optrexDisplay, y, PSTR("Optrex Display"), attr, event ) ;
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft(y, PSTR("Brightness")); // TODO translations in the whole file ...
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, 100-g_eeGeneral.backlightBright, (sub==subN ? INVERS : 0)|LEFT) ;
|
||||
if(sub==subN) {
|
||||
uint8_t b ;
|
||||
b = 100 - g_eeGeneral.backlightBright;
|
||||
CHECK_INCDEC_GENVAR(event, b, 0, 100);
|
||||
g_eeGeneral.backlightBright = 100 - b;
|
||||
PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright ;
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
} subN++;
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcd_putsLeft(y, PSTR("Brightness")); // TODO translations in the whole file ...
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
if(attr) {
|
||||
uint8_t b ;
|
||||
b = 100 - g_eeGeneral.backlightBright;
|
||||
CHECK_INCDEC_GENVAR(event, b, 0, 100);
|
||||
g_eeGeneral.backlightBright = 100 - b;
|
||||
PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright ;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_CONTRAST);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS,y,g_eeGeneral.contrast,(sub==subN ? INVERS : 0)|LEFT);
|
||||
if(sub==subN) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 10, 45);
|
||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_CONTRAST:
|
||||
lcd_putsLeft( y, STR_CONTRAST);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS,y,g_eeGeneral.contrast, attr|LEFT);
|
||||
if(attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 10, 45);
|
||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||
}
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y,STR_BATTERYWARNING);
|
||||
putsVolts(GENERAL_PARAM_OFS, y, g_eeGeneral.vBatWarn, (sub==subN ? INVERS : 0)|LEFT);
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_BATTERY_WARNING:
|
||||
lcd_putsLeft( y,STR_BATTERYWARNING);
|
||||
putsVolts(GENERAL_PARAM_OFS, y, g_eeGeneral.vBatWarn, attr|LEFT);
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y,STR_INACTIVITYALARM);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.inactivityTimer, (sub==subN ? INVERS : 0)|LEFT);
|
||||
lcd_putc(lcd_lastPos, y, 'm');
|
||||
if(sub==subN) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_INACTIVITY_ALARM:
|
||||
lcd_putsLeft( y,STR_INACTIVITYALARM);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.inactivityTimer, attr|LEFT);
|
||||
lcd_putc(lcd_lastPos, y, 'm');
|
||||
if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.filterInput = selectMenuItem(y, STR_FILTERADC, STR_ADCFILTER, g_eeGeneral.filterInput, 0, 2, sub==subN, event);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case ITEM_SETUP_RE_NAVIGATION:
|
||||
g_eeGeneral.reNavigation = selectMenuItem(y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, 2, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.throttleReversed = onoffMenuItem( g_eeGeneral.throttleReversed, y, STR_THROTTLEREVERSE, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_FILTER_ADC:
|
||||
g_eeGeneral.filterInput = selectMenuItem(y, STR_FILTERADC, STR_VFILTERADC, g_eeGeneral.filterInput, 0, 2, attr, event);
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.minuteBeep = onoffMenuItem( g_eeGeneral.minuteBeep, y, STR_MINUTEBEEP, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_THROTTLE_REVERSED:
|
||||
g_eeGeneral.throttleReversed = onoffMenuItem( g_eeGeneral.throttleReversed, y, STR_THROTTLEREVERSE, attr, event ) ;
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.preBeep = onoffMenuItem( g_eeGeneral.preBeep, y, STR_BEEPCOUNTDOWN, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_MINUTE_BEEP:
|
||||
g_eeGeneral.minuteBeep = onoffMenuItem( g_eeGeneral.minuteBeep, y, STR_MINUTEBEEP, attr, event ) ;
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.flashBeep = onoffMenuItem( g_eeGeneral.flashBeep, y, STR_FLASHONBEEP, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_COUNTDOWN_BEEP:
|
||||
g_eeGeneral.preBeep = onoffMenuItem( g_eeGeneral.preBeep, y, STR_BEEPCOUNTDOWN, attr, event ) ;
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_LIGHTSWITCH);
|
||||
putsSwitches(GENERAL_PARAM_OFS,y,g_eeGeneral.lightSw,sub==subN ? INVERS : 0);
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightSw, SWITCH_OFF, SWITCH_ON);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_FLASH_BEEP:
|
||||
g_eeGeneral.flashBeep = onoffMenuItem( g_eeGeneral.flashBeep, y, STR_FLASHONBEEP, attr, event ) ;
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_LIGHTOFFAFTER);
|
||||
if(g_eeGeneral.lightAutoOff) {
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.lightAutoOff*5,LEFT|(sub==subN ? INVERS : 0));
|
||||
lcd_putc(lcd_lastPos, y, 's');
|
||||
}
|
||||
else {
|
||||
lcd_putsiAtt(GENERAL_PARAM_OFS, y, STR_OFFON, 0,(sub==subN ? INVERS:0));
|
||||
}
|
||||
if(sub==subN) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_LIGHT_SWITCH:
|
||||
lcd_putsLeft( y, STR_LIGHTSWITCH);
|
||||
putsSwitches(GENERAL_PARAM_OFS,y,g_eeGeneral.lightSw,attr ? INVERS : 0);
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightSw, SWITCH_OFF, SWITCH_ON);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_LIGHT_OFF_AFTER:
|
||||
lcd_putsLeft( y, STR_LIGHTOFFAFTER);
|
||||
if(g_eeGeneral.lightAutoOff) {
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.lightAutoOff*5, attr|LEFT);
|
||||
lcd_putc(lcd_lastPos, y, 's');
|
||||
}
|
||||
else {
|
||||
lcd_putsiAtt(GENERAL_PARAM_OFS, y, STR_OFFON, 0, attr);
|
||||
}
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
break;
|
||||
|
||||
#ifdef SPLASH
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = 1-g_eeGeneral.disableSplashScreen;
|
||||
g_eeGeneral.disableSplashScreen = 1 - onoffMenuItem( b, y, STR_SPLASHSCREEN, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
uint8_t b = 1-g_eeGeneral.disableSplashScreen;
|
||||
g_eeGeneral.disableSplashScreen = 1 - onoffMenuItem( b, y, STR_SPLASHSCREEN, attr, event ) ;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = 1-g_eeGeneral.disableThrottleWarning;
|
||||
g_eeGeneral.disableThrottleWarning = 1-onoffMenuItem( b, y, STR_THROTTLEWARNING, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_THROTTLE_WARNING:
|
||||
{
|
||||
uint8_t b = 1-g_eeGeneral.disableThrottleWarning;
|
||||
g_eeGeneral.disableThrottleWarning = 1-onoffMenuItem( b, y, STR_THROTTLEWARNING, attr, event ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.switchWarning = selectMenuItem(y, STR_SWITCHWARNING, STR_WARNSW, g_eeGeneral.switchWarning, -1, 1, sub==subN, event);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_SWITCH_WARNING:
|
||||
g_eeGeneral.switchWarning = selectMenuItem(y, STR_SWITCHWARNING, STR_WARNSW, g_eeGeneral.switchWarning, -1, 1, attr, event);
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
|
||||
g_eeGeneral.disableMemoryWarning = 1 - onoffMenuItem( b, y, STR_MEMORYWARNING, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_MEMORY_WARNING:
|
||||
{
|
||||
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
|
||||
g_eeGeneral.disableMemoryWarning = 1 - onoffMenuItem( b, y, STR_MEMORYWARNING, attr, event ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = 1-g_eeGeneral.disableAlarmWarning;
|
||||
g_eeGeneral.disableAlarmWarning = 1 - onoffMenuItem( b, y, STR_ALARMWARNING, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_ALARM_WARNING:
|
||||
{
|
||||
uint8_t b = 1-g_eeGeneral.disableAlarmWarning;
|
||||
g_eeGeneral.disableAlarmWarning = 1 - onoffMenuItem( b, y, STR_ALARMWARNING, attr, event ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef FRSKY
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t b = g_eeGeneral.enableTelemetryAlarm;
|
||||
g_eeGeneral.disableAlarmWarning = onoffMenuItem( b, y, STR_NODATAALARM, sub==subN, event ) ;
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
#if defined(FRSKY)
|
||||
case ITEM_SETUP_TELEMETRY_ALARM:
|
||||
{
|
||||
uint8_t b = g_eeGeneral.enableTelemetryAlarm;
|
||||
g_eeGeneral.disableAlarmWarning = onoffMenuItem( b, y, STR_NODATAALARM, attr, event ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft(y, STR_TIMEZONE);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.timezone, LEFT|(sub==subN ? INVERS : 0));
|
||||
if (sub==subN)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
g_eeGeneral.gpsFormat = selectMenuItem(y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, sub==subN, event);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_TIMEZONE:
|
||||
lcd_putsLeft(y, STR_TIMEZONE);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_GPSFORMAT:
|
||||
g_eeGeneral.gpsFormat = selectMenuItem(y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
uint8_t attr = sub==subN?INVERS:0;
|
||||
lcd_putsLeft( y,STR_RXCHANNELORD);// RAET->AETR
|
||||
for (uint8_t i=1; i<=4; i++)
|
||||
putsChnLetter(GENERAL_PARAM_OFS - FW + i*FW, y, channel_order(i), attr);
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
case ITEM_SETUP_RX_CHANNEL_ORD:
|
||||
lcd_putsLeft( y,STR_RXCHANNELORD);// RAET->AETR
|
||||
for (uint8_t i=1; i<=4; i++)
|
||||
putsChnLetter(GENERAL_PARAM_OFS - FW + i*FW, y, channel_order(i), attr);
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
||||
break;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts( 1*FW, y, STR_MODE);
|
||||
for(uint8_t i=0; i<4; i++) lcd_img((6+4*i)*FW, y, sticks,i,0);
|
||||
if((y+=FH)>7*FH) return;
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
lcd_puts( 1*FW, y, STR_MODE);
|
||||
for(uint8_t i=0; i<4; i++) lcd_img((6+4*i)*FW, y, sticks,i,0);
|
||||
if((y+=FH)>7*FH) return;
|
||||
lcd_putcAtt( 3*FW, y, '1'+g_eeGeneral.stickMode,(sub==k+1) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
for(uint8_t i=0; i<4; i++) putsChnRaw( (6+4*i)*FW, y, pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
||||
|
||||
lcd_putcAtt( 3*FW, y, '1'+g_eeGeneral.stickMode,(sub==subN+1) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
for(uint8_t i=0; i<4; i++) putsChnRaw( (6+4*i)*FW, y, pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
||||
|
||||
if (sub==subN+1 && s_editMode>0)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
|
||||
else
|
||||
stickMode = g_eeGeneral.stickMode;
|
||||
if (sub==k+1 && s_editMode>0)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
|
||||
else
|
||||
stickMode = g_eeGeneral.stickMode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -315,7 +315,7 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t le
|
||||
|
||||
if (neg) lcd_putcAtt(x, y, '-', flags);
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (flags & SURROUNDED) {
|
||||
xn = lcd_lastPos - x + 2;
|
||||
if (!neg) { x+=FW; xn-=FW; }
|
||||
|
||||
+12
-8
@@ -140,7 +140,7 @@ void menuMainView(uint8_t event)
|
||||
if(s_timerState[0]==TMR_BEEPING) {
|
||||
s_timerState[0] = TMR_STOPPED;
|
||||
}
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (s_warning) {
|
||||
s_warning = NULL;
|
||||
}
|
||||
@@ -162,16 +162,20 @@ void menuMainView(uint8_t event)
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
break;
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
killEvents(event);
|
||||
if (s_inflight_value && !s_warning) {
|
||||
s_warning = s_inflight_label;
|
||||
s_editMode = 1;
|
||||
break;
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (navigationRotaryEncoder(event)) {
|
||||
killEvents(event);
|
||||
if (s_inflight_value && !s_warning) {
|
||||
s_warning = s_inflight_label;
|
||||
s_editMode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
s_warning = NULL;
|
||||
break;
|
||||
#endif
|
||||
@@ -323,7 +327,7 @@ void menuMainView(uint8_t event)
|
||||
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
|
||||
}
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
check_rotary_encoder();
|
||||
if (s_warning) {
|
||||
int8_t value = (((uint8_t)(*s_inflight_value)) >> s_inflight_bitshift) - s_inflight_shift;
|
||||
|
||||
+28
-24
@@ -53,7 +53,7 @@ void DisplayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
lcd_outdezAtt(1+128-FW*(count>9 ? 3 : 2),0,index+1,attr);
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_RE1)
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int8_t scrollRE;
|
||||
int16_t p1valdiff;
|
||||
#elif defined(NAVIGATION_POT1)
|
||||
@@ -93,7 +93,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
killEvents(event);
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_POT1) || defined (NAVIGATION_RE1)
|
||||
#if defined (ROTARY_ENCODERS) || defined(NAVIGATION_POT1)
|
||||
//change values based on P1
|
||||
newval -= p1valdiff;
|
||||
#endif
|
||||
@@ -147,18 +147,22 @@ bool check_submenu_simple(uint8_t event, uint8_t maxrow)
|
||||
return check_simple(event, 0, 0, 0, maxrow);
|
||||
}
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
void check_rotary_encoder()
|
||||
{
|
||||
// check rotary encoder 1 if changed -> cursor down/up
|
||||
static int16_t re1valprev;
|
||||
p1valdiff = 0;
|
||||
scrollRE = re1valprev - g_rotenc[0];
|
||||
if (scrollRE) {
|
||||
re1valprev = g_rotenc[0];
|
||||
if (s_editMode > 0) {
|
||||
p1valdiff = -scrollRE;
|
||||
scrollRE = 0;
|
||||
|
||||
if (g_eeGeneral.reNavigation) {
|
||||
uint8_t re = g_eeGeneral.reNavigation - 1;
|
||||
p1valdiff = 0;
|
||||
scrollRE = re1valprev - g_rotenc[re];
|
||||
if (scrollRE) {
|
||||
re1valprev = g_rotenc[re];
|
||||
if (s_editMode > 0) {
|
||||
p1valdiff = -scrollRE;
|
||||
scrollRE = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +171,7 @@ void check_rotary_encoder()
|
||||
#define SCROLL_TH 64
|
||||
#define SCROLL_POT1_TH 32
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
#define MAXCOL(row) ((horTab && row >= 0) ? pgm_read_byte(horTab+min(row, (int8_t)horTabMax)) : (const uint8_t)0)
|
||||
#else
|
||||
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, horTabMax)) : (const uint8_t)0)
|
||||
@@ -178,14 +182,14 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
{
|
||||
int8_t maxcol = MAXCOL(m_posVert);
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
check_rotary_encoder();
|
||||
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(BTN_REb) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||
popMenu();
|
||||
killEvents(event);
|
||||
return false;
|
||||
}
|
||||
if (event == EVT_KEY_BREAK(BTN_REa)) {
|
||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_BREAK(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
||||
if (s_editMode > 0 && (maxcol & ZCHAR)) {
|
||||
if (m_posHorz < maxcol-ZCHAR) {
|
||||
m_posHorz++;
|
||||
@@ -267,7 +271,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
s_noScroll = 0;
|
||||
DisplayScreenIndex(curr, menuTabSize, attr);
|
||||
}
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (m_posVert < 0) {
|
||||
lcd_putsAtt(DISPLAY_W-LEN_BACK*FW, 0, STR_BACK, INVERS);
|
||||
}
|
||||
@@ -287,7 +291,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
BLINK_SYNC;
|
||||
}
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
while (!s_editMode && scrollRE) {
|
||||
if (scrollRE > 0) {
|
||||
--scrollRE;
|
||||
@@ -330,7 +334,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
minit();
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (menuTab) {
|
||||
s_editMode = -1;
|
||||
break;
|
||||
@@ -340,7 +344,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
s_editMode = -1;
|
||||
break;
|
||||
#endif
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_ENTRY_UP:
|
||||
s_editMode = 0;
|
||||
break;
|
||||
@@ -391,7 +395,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
do {
|
||||
INC(m_posVert, maxrow);
|
||||
} while(MAXCOL(m_posVert) == (uint8_t)-1);
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_editMode = 0;
|
||||
#endif
|
||||
m_posHorz = min(m_posHorz, MAXCOL(m_posVert));
|
||||
@@ -421,7 +425,7 @@ MenuFuncP g_menuStack[5];
|
||||
uint8_t g_menuPos[4];
|
||||
uint8_t g_menuStackPtr = 0;
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int8_t m_posVert;
|
||||
#else
|
||||
uint8_t m_posVert;
|
||||
@@ -444,7 +448,7 @@ void popMenu()
|
||||
|
||||
void chainMenu(MenuFuncP newMenu)
|
||||
{
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_warning = NULL;
|
||||
#endif
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
@@ -454,7 +458,7 @@ void chainMenu(MenuFuncP newMenu)
|
||||
|
||||
void pushMenu(MenuFuncP newMenu)
|
||||
{
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_warning = NULL;
|
||||
#endif
|
||||
|
||||
@@ -567,7 +571,7 @@ const char * displayMenu(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int8_t *s_inflight_value = NULL;
|
||||
int8_t s_inflight_min;
|
||||
int8_t s_inflight_max;
|
||||
@@ -579,7 +583,7 @@ void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t
|
||||
{
|
||||
*value = (((uint8_t)(*value)) & ((1 << bitshift) - 1)) + ((i_shift + checkIncDecModel(event, (((uint8_t)(*value)) >> bitshift)-i_shift, i_min, i_max)) << bitshift);
|
||||
|
||||
if (event == EVT_KEY_LONG(BTN_REa)) {
|
||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_LONG(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
||||
if (value == s_inflight_value) {
|
||||
s_inflight_value = NULL;
|
||||
}
|
||||
|
||||
+7
-7
@@ -79,14 +79,14 @@ void menuProcFunctionSwitches(uint8_t event);
|
||||
void menuProcStatistic(uint8_t event);
|
||||
void menuProcDebug(uint8_t event);
|
||||
|
||||
#if defined(NAVIGATION_RE1)
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern int8_t scrollRE;
|
||||
extern int16_t p1valdiff;
|
||||
#define IS_RE1_EVT_TYPE(event, type) (event==type(BTN_REa))
|
||||
#define IS_RE1_EVT(event) ((event&0x0f)==BTN_REa)
|
||||
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (g_eeGeneral.reNavigation && event==type(BTN_REa + g_eeGeneral.reNavigation - 1))
|
||||
#define IS_RE_NAVIGATION_EVT(event) (g_eeGeneral.reNavigation && (event&EVT_KEY_MASK)==(BTN_REa + g_eeGeneral.reNavigation - 1))
|
||||
#else
|
||||
#define IS_RE1_EVT_TYPE(event, type) (0)
|
||||
#define IS_RE1_EVT(event) (0)
|
||||
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (0)
|
||||
#define IS_RE_NAVIGATION_EVT(event) (0)
|
||||
#if defined(NAVIGATION_POT1)
|
||||
extern int16_t p1valdiff;
|
||||
#else
|
||||
@@ -111,7 +111,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#define CHECK_INCDEC_GENVAR( event, var, min, max) \
|
||||
var = checkIncDecGen(event,var,min,max)
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern int8_t *s_inflight_value;
|
||||
extern const pm_char *s_inflight_label;
|
||||
extern int8_t s_inflight_min;
|
||||
@@ -136,7 +136,7 @@ void check_rotary_encoder();
|
||||
#endif
|
||||
|
||||
// Menus related stuff ...
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern int8_t m_posVert;
|
||||
#else
|
||||
extern uint8_t m_posVert;
|
||||
|
||||
+246
-204
@@ -192,7 +192,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
#else
|
||||
uint8_t _event = s_warning ? 0 : event;
|
||||
#endif
|
||||
uint8_t _event_ = (IS_RE1_EVT(_event) ? 0 : _event);
|
||||
uint8_t _event_ = (IS_RE_NAVIGATION_EVT(_event) ? 0 : _event);
|
||||
|
||||
if (s_copyMode || !eeModelExists(g_eeGeneral.currModel)) {
|
||||
if ((_event & 0x1f) == KEY_EXIT)
|
||||
@@ -201,13 +201,13 @@ void menuProcModelSelect(uint8_t event)
|
||||
|
||||
int8_t oldSub = m_posVert;
|
||||
if (!check_submenu_simple(_event_, MAX_MODELS-1)) return;
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (m_posVert < 0) m_posVert = 0;
|
||||
#endif
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (scrollRE > 0 && s_editMode < 0) {
|
||||
chainMenu(menuProcModel);
|
||||
return;
|
||||
@@ -239,11 +239,16 @@ void menuProcModelSelect(uint8_t event)
|
||||
killEvents(_event);
|
||||
}
|
||||
break;
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
s_editMode = (s_editMode == 0 && sub == g_eeGeneral.currModel) ? -1 : 0;
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
if (navigationRotaryEncoder(_event))
|
||||
s_editMode = (s_editMode == 0 && sub == g_eeGeneral.currModel) ? -1 : 0;
|
||||
break;
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (!navigationRotaryEncoder(_event))
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
case EVT_KEY_BREAK(KEY_MENU):
|
||||
@@ -279,8 +284,8 @@ void menuProcModelSelect(uint8_t event)
|
||||
s_copyTgtOfs = 0;
|
||||
return;
|
||||
}
|
||||
else if (_event == EVT_KEY_LONG(KEY_MENU) || IS_RE1_EVT_TYPE(_event, EVT_KEY_LONG)) {
|
||||
#ifdef NAVIGATION_RE1
|
||||
else if (_event == EVT_KEY_LONG(KEY_MENU) || IS_RE_NAVIGATION_EVT_TYPE(_event, EVT_KEY_LONG)) {
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_editMode = -1;
|
||||
#endif
|
||||
s_copyMode = 0;
|
||||
@@ -475,13 +480,17 @@ void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, boo
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (next<size-1) next++;
|
||||
break;
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (!navigationRotaryEncoder(event))
|
||||
break;
|
||||
if (v==0) {
|
||||
s_editMode = 0;
|
||||
killEvents(BTN_REa);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
@@ -504,203 +513,225 @@ void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, boo
|
||||
}
|
||||
}
|
||||
|
||||
#undef PARAM_OFS
|
||||
#define PARAM_OFS (9*FW+2)
|
||||
enum menuProcModelItems {
|
||||
ITEM_MODEL_NAME,
|
||||
ITEM_MODEL_TIMER1,
|
||||
ITEM_MODEL_TIMER2,
|
||||
ITEM_MODEL_EXTENDED_LIMITS,
|
||||
ITEM_MODEL_EXTENDED_TRIMS,
|
||||
ITEM_MODEL_TRIM_INC,
|
||||
ITEM_MODEL_THROTTLE_TRACE,
|
||||
ITEM_MODEL_THROTTLE_TRIM,
|
||||
ITEM_MODEL_BEEP_CENTER,
|
||||
ITEM_MODEL_PROTOCOL,
|
||||
ITEM_MODEL_PROTOCOL_PARAMS
|
||||
};
|
||||
|
||||
// TODO little flash saving with the test on protocol below
|
||||
|
||||
#define MODEL_PARAM_OFS (9*FW+2)
|
||||
void menuProcModel(uint8_t event)
|
||||
{
|
||||
lcd_outdezNAtt(7*FW,0,g_eeGeneral.currModel+1,INVERS+LEADING0,2);
|
||||
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_Model, (protocol==PROTO_PPM||protocol==PROTO_FAAST||protocol==PROTO_DSM2||protocol==PROTO_PXX ? 12 : 11), {0,ZCHAR|(sizeof(g_model.name)-1),2,2,0,0,0,0,0,NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1,2,1});
|
||||
|
||||
uint8_t sub = m_posVert;
|
||||
uint8_t y = 1*FH;
|
||||
|
||||
uint8_t subN = 1;
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_puts(0*FW, y, STR_NAME);
|
||||
EditName(PARAM_OFS, y, g_model.name, sizeof(g_model.name), event, sub==subN, m_posHorz);
|
||||
#if defined(PCBARM)
|
||||
memcpy(ModelNames[g_eeGeneral.currModel], g_model.name, sizeof(g_model.name));
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_Model, ((protocol==PROTO_PPM||protocol==PROTO_FAAST
|
||||
#if defined(DSM2)
|
||||
||protocol==PROTO_DSM2
|
||||
#endif
|
||||
if((y+=FH)>7*FH) return;
|
||||
} subN++;
|
||||
|
||||
for (uint8_t i=0; i<2; i++) {
|
||||
TimerData *timer = &g_model.timers[i];
|
||||
if (s_pgOfs<subN) {
|
||||
putsStrIdx(0*FW, y, STR_TIMER, i+1);
|
||||
putsTmrMode(PARAM_OFS, y, timer->mode, sub==subN && m_posHorz==0 ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
putsTime(14*FW, y, timer->val,
|
||||
(sub==subN && m_posHorz==1 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0),
|
||||
(sub==subN && m_posHorz==2 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0) );
|
||||
if (sub==subN && (s_editMode>0 || p1valdiff)) {
|
||||
uint16_t timer_val = timer->val;
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(MAX_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(MAX_PSWITCH+NUM_CSW));
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int8_t min = timer_val/60;
|
||||
CHECK_INCDEC_MODELVAR(event, min, 0, 59);
|
||||
timer_val = timer_val%60 + min*60;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
int8_t sec = timer_val%60;
|
||||
sec -= checkIncDecModel(event, sec+2, 1, 62)-2;
|
||||
timer_val -= sec ;
|
||||
if ((int16_t)timer_val < 0) timer_val=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
timer->val = timer_val;
|
||||
}
|
||||
if ((y+=FH)>7*FH) return;
|
||||
} subN++;
|
||||
}
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_ELIMITS);
|
||||
menu_lcd_onoff( PARAM_OFS, y, g_model.extendedLimits, sub==subN ) ;
|
||||
if(sub==subN) CHECK_INCDEC_MODELVAR(event,g_model.extendedLimits,0,1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_ETRIMS);
|
||||
menu_lcd_onoff( PARAM_OFS, y, g_model.extendedTrims, sub==subN ) ;
|
||||
if(sub==subN) CHECK_INCDEC_MODELVAR(event,g_model.extendedTrims,0,1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_TRIMINC);
|
||||
lcd_putsiAtt(PARAM_OFS, y, STR_VTRIMINC, g_model.trimInc, (sub==subN ? INVERS:0));
|
||||
if(sub==subN) CHECK_INCDEC_MODELVAR(event,g_model.trimInc,0,4);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_TTRACE);
|
||||
int8_t idx = 3;
|
||||
if (g_model.thrTraceSrc > NUM_POTS) idx = NUM_STICKS+NUM_ROTARY_ENCODERS+2+3+NUM_PPM+g_model.thrTraceSrc;
|
||||
else if (g_model.thrTraceSrc > 0) idx = NUM_STICKS+g_model.thrTraceSrc;
|
||||
putsChnRaw(PARAM_OFS, y, idx, (sub==subN ? INVERS:0));
|
||||
if (sub==subN) CHECK_INCDEC_MODELVAR(event, g_model.thrTraceSrc, 0, NUM_POTS+NUM_CHNOUT);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_TTRIM);
|
||||
menu_lcd_onoff(PARAM_OFS, y, g_model.thrTrim, sub==subN && m_posHorz==0) ;
|
||||
if (sub==subN) CHECK_INCDEC_MODELVAR(event,g_model.thrTrim,0,1);
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_BEEPCTR);
|
||||
for (uint8_t i=0;i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS;i++)
|
||||
lcd_putsiAtt(PARAM_OFS+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && (sub==subN)) ? BLINK|INVERS : ((g_model.beepANACenter & ((BeepANACenter)1<<i)) ? INVERS : 0 ) );
|
||||
if (sub==subN) {
|
||||
if((event==EVT_KEY_FIRST(KEY_MENU)) || p1valdiff) {
|
||||
killEvents(event);
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
lcd_putsLeft( y, STR_PROTO);
|
||||
lcd_putsiAtt(PARAM_OFS, y, STR_VPROTOS, protocol,
|
||||
(sub==subN && m_posHorz==0 ? (s_editMode>0 ? BLINK|INVERS : INVERS):0));
|
||||
if (protocol == PROTO_PPM || protocol == PROTO_FAAST) {
|
||||
lcd_putsiAtt(PARAM_OFS+4*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
lcd_puts(PARAM_OFS+11*FW, y, PSTR("u"));
|
||||
lcd_outdezAtt(PARAM_OFS+11*FW, y, (g_model.ppmDelay*50)+300, ((sub==subN && m_posHorz==2) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0));
|
||||
}
|
||||
#ifdef DSM2
|
||||
else if (protocol == PROTO_DSM2) {
|
||||
if (m_posHorz > 1) m_posHorz = 1;
|
||||
int8_t x = limit((int8_t)0, (int8_t)g_model.ppmNCH, (int8_t)2);
|
||||
g_model.ppmNCH = x;
|
||||
lcd_putsiAtt(PARAM_OFS+5*FW, y, STR_DSM2MODE, x, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
}
|
||||
#endif
|
||||
else if (sub==subN) {
|
||||
m_posHorz = 0;
|
||||
}
|
||||
if (sub==subN && (s_editMode>0 || p1valdiff || (protocol!=PROTO_PPM && protocol!=PROTO_FAAST && protocol!=PROTO_DSM2))) { // TODO avoid DSM2 when not defined
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.protocol,0, PROTO_MAX-1);
|
||||
break;
|
||||
case 1:
|
||||
#ifdef DSM2
|
||||
if (protocol == PROTO_DSM2)
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, 0, 2);
|
||||
else
|
||||
#endif
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((y+=FH)>7*FH) return;
|
||||
}subN++;
|
||||
|
||||
if(s_pgOfs<subN) {
|
||||
if (protocol == PROTO_PPM || protocol == PROTO_FAAST) {
|
||||
lcd_putsLeft( y, STR_PPMFRAME);
|
||||
lcd_puts(PARAM_OFS+3*FW, y, STR_MS);
|
||||
lcd_outdezAtt(PARAM_OFS, y, (int16_t)g_model.ppmFrameLength*5 + 225, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | PREC1|LEFT);
|
||||
lcd_putsiAtt(PARAM_OFS+6*FW, y, STR_POSNEG, g_model.pulsePol, (sub==subN && m_posHorz==1) ? INVERS : 0);
|
||||
if(sub==subN && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 20);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.pulsePol, 0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO port PPM16 ppmDelay from er9x
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
else if (protocol == PROTO_DSM2 || protocol == PROTO_PXX) {
|
||||
lcd_putsLeft( y, STR_RXNUM);
|
||||
lcd_outdezNAtt(PARAM_OFS-(protocol==PROTO_DSM2 ? 0 : 3*FW), y, g_model.modelId, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | LEADING0|LEFT, 2);
|
||||
|
||||
if (sub==subN && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.modelId, 0, 99);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PXX)
|
||||
if (protocol == PROTO_PXX) {
|
||||
lcd_putsAtt(PARAM_OFS, y, STR_SYNCMENU, ((sub==subN && m_posHorz==1) ? INVERS : 0));
|
||||
if (sub==subN && m_posHorz==1) {
|
||||
s_editMode = false;
|
||||
if (event==EVT_KEY_LONG(KEY_MENU)) {
|
||||
// send reset code
|
||||
pxxFlag = PXX_SEND_RXNUM;
|
||||
||protocol==PROTO_PXX
|
||||
#endif
|
||||
) ? 12 : 11), {0,ZCHAR|(sizeof(g_model.name)-1),2,2,0,0,0,0,0,NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1,2,1});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
for (uint8_t i=0; i<7; i++) {
|
||||
uint8_t y = 1*FH + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t attr = (sub == k ? INVERS : 0);
|
||||
|
||||
switch(k) {
|
||||
case ITEM_MODEL_NAME:
|
||||
lcd_putsLeft(y, STR_NAME);
|
||||
EditName(MODEL_PARAM_OFS, y, g_model.name, sizeof(g_model.name), event, attr, m_posHorz);
|
||||
#if defined(PCBARM)
|
||||
memcpy(ModelNames[g_eeGeneral.currModel], g_model.name, sizeof(g_model.name));
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER1:
|
||||
case ITEM_MODEL_TIMER2:
|
||||
{
|
||||
TimerData *timer = &g_model.timers[k-ITEM_MODEL_TIMER1];
|
||||
putsStrIdx(0*FW, y, STR_TIMER, k-ITEM_MODEL_TIMER1+1); // TODO keep that?
|
||||
putsTmrMode(MODEL_PARAM_OFS, y, timer->mode, (attr && m_posHorz==0) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
putsTime(14*FW, y, timer->val,
|
||||
(attr && m_posHorz==1 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0),
|
||||
(attr && m_posHorz==2 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0) );
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
uint16_t timer_val = timer->val;
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(MAX_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(MAX_PSWITCH+NUM_CSW));
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int8_t min = timer_val/60;
|
||||
CHECK_INCDEC_MODELVAR(event, min, 0, 59);
|
||||
timer_val = timer_val%60 + min*60;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
int8_t sec = timer_val%60;
|
||||
sec -= checkIncDecModel(event, sec+2, 1, 62)-2;
|
||||
timer_val -= sec ;
|
||||
if ((int16_t)timer_val < 0) timer_val=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
timer->val = timer_val;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_MODEL_EXTENDED_LIMITS:
|
||||
lcd_putsLeft(y, STR_ELIMITS);
|
||||
menu_lcd_onoff( MODEL_PARAM_OFS, y, g_model.extendedLimits, attr ) ;
|
||||
if(attr) CHECK_INCDEC_MODELVAR(event,g_model.extendedLimits,0,1);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_EXTENDED_TRIMS:
|
||||
lcd_putsLeft(y, STR_ETRIMS);
|
||||
menu_lcd_onoff( MODEL_PARAM_OFS, y, g_model.extendedTrims, attr ) ;
|
||||
if(attr) CHECK_INCDEC_MODELVAR(event,g_model.extendedTrims,0,1);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TRIM_INC:
|
||||
lcd_putsLeft(y, STR_TRIMINC);
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS, y, STR_VTRIMINC, g_model.trimInc, attr);
|
||||
if(attr) CHECK_INCDEC_MODELVAR(event,g_model.trimInc,0,4);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_THROTTLE_TRACE:
|
||||
{
|
||||
lcd_putsLeft(y, STR_TTRACE);
|
||||
int8_t idx = 3;
|
||||
if (g_model.thrTraceSrc > NUM_POTS) idx = NUM_STICKS+NUM_ROTARY_ENCODERS+2+3+NUM_PPM+g_model.thrTraceSrc;
|
||||
else if (g_model.thrTraceSrc > 0) idx = NUM_STICKS+g_model.thrTraceSrc;
|
||||
putsChnRaw(MODEL_PARAM_OFS, y, idx, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.thrTraceSrc, 0, NUM_POTS+NUM_CHNOUT);
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_MODEL_THROTTLE_TRIM:
|
||||
lcd_putsLeft(y, STR_TTRIM);
|
||||
menu_lcd_onoff(MODEL_PARAM_OFS, y, g_model.thrTrim, attr) ;
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event,g_model.thrTrim,0,1);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_BEEP_CENTER:
|
||||
lcd_putsLeft(y, STR_BEEPCTR);
|
||||
for (uint8_t i=0;i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS;i++)
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : ((g_model.beepANACenter & ((BeepANACenter)1<<i)) ? INVERS : 0 ) );
|
||||
if (attr) {
|
||||
if((event==EVT_KEY_FIRST(KEY_MENU)) || p1valdiff) {
|
||||
killEvents(event);
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_PROTOCOL:
|
||||
lcd_putsLeft(y, STR_PROTO);
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS, y, STR_VPROTOS, protocol,
|
||||
(attr && m_posHorz==0 ? (s_editMode>0 ? BLINK|INVERS : INVERS):0));
|
||||
if (protocol == PROTO_PPM || protocol == PROTO_FAAST) {
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS+4*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, (attr && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
lcd_puts(MODEL_PARAM_OFS+11*FW, y, PSTR("u"));
|
||||
lcd_outdezAtt(MODEL_PARAM_OFS+11*FW, y, (g_model.ppmDelay*50)+300, ((attr && m_posHorz==2) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0));
|
||||
}
|
||||
#ifdef DSM2
|
||||
else if (protocol == PROTO_DSM2) {
|
||||
if (m_posHorz > 1) m_posHorz = 1;
|
||||
int8_t x = limit((int8_t)0, (int8_t)g_model.ppmNCH, (int8_t)2);
|
||||
g_model.ppmNCH = x;
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS+5*FW, y, STR_DSM2MODE, x, (attr && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
}
|
||||
#endif
|
||||
else if (attr) {
|
||||
m_posHorz = 0;
|
||||
}
|
||||
if (attr && (s_editMode>0 || p1valdiff || (protocol!=PROTO_PPM && protocol!=PROTO_FAAST && protocol!=PROTO_DSM2))) { // TODO avoid DSM2 when not defined
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.protocol,0, PROTO_MAX-1);
|
||||
break;
|
||||
case 1:
|
||||
#ifdef DSM2
|
||||
if (protocol == PROTO_DSM2)
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, 0, 2);
|
||||
else
|
||||
#endif
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_PROTOCOL_PARAMS:
|
||||
if (protocol == PROTO_PPM || protocol == PROTO_FAAST) {
|
||||
lcd_putsLeft( y, STR_PPMFRAME);
|
||||
lcd_puts(MODEL_PARAM_OFS+3*FW, y, STR_MS);
|
||||
lcd_outdezAtt(MODEL_PARAM_OFS, y, (int16_t)g_model.ppmFrameLength*5 + 225, ((attr && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | PREC1|LEFT);
|
||||
lcd_putsiAtt(MODEL_PARAM_OFS+6*FW, y, STR_POSNEG, g_model.pulsePol, (attr && m_posHorz==1) ? INVERS : 0);
|
||||
if(attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 20);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.pulsePol, 0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO port PPM16 ppmDelay from er9x
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
else if (protocol == PROTO_DSM2 || protocol == PROTO_PXX) {
|
||||
lcd_putsLeft( y, STR_RXNUM);
|
||||
lcd_outdezNAtt(MODEL_PARAM_OFS-(protocol==PROTO_DSM2 ? 0 : 3*FW), y, g_model.modelId, ((attr && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | LEADING0|LEFT, 2);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.modelId, 0, 99);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PXX)
|
||||
if (protocol == PROTO_PXX) {
|
||||
lcd_putsAtt(MODEL_PARAM_OFS, y, STR_SYNCMENU, (m_posHorz==1 ? attr : 0));
|
||||
if (attr && m_posHorz==1) {
|
||||
s_editMode = false;
|
||||
if (event==EVT_KEY_LONG(KEY_MENU)) {
|
||||
// send reset code
|
||||
pxxFlag = PXX_SEND_RXNUM;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,10 +813,13 @@ void menuProcPhasesAll(uint8_t event)
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
if (!navigationRotaryEncoder(event))
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (sub == MAX_PHASES) {
|
||||
s_editMode = 0;
|
||||
trimsCheckTimer = 200; // 2 seconds
|
||||
@@ -965,14 +999,17 @@ void menuProcCurveOne(uint8_t event)
|
||||
case EVT_ENTRY:
|
||||
dfltCrv = 0;
|
||||
autoThrStep = 0;
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_editMode = -1;
|
||||
#endif
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
if (!navigationRotaryEncoder(event))
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (s_editMode<=0) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -1525,7 +1562,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
||||
lcd_puts(lcd_lastPos, 0, expo ? PSTR("/14") : PSTR("/32"));
|
||||
SIMPLE_MENU_NOTITLE(menuTabModel, expo ? e_ExposAll : e_MixAll, s_maxLines);
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int8_t sub = m_posVert;
|
||||
#else
|
||||
uint8_t sub = m_posVert;
|
||||
@@ -1573,9 +1610,11 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (sub == 0)
|
||||
break;
|
||||
#endif
|
||||
@@ -1844,11 +1883,14 @@ void menuProcCurvesAll(uint8_t event)
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
if (!navigationRotaryEncoder(event))
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
#ifdef NAVIGATION_RE1
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
#endif
|
||||
if (sub >= 0) {
|
||||
s_curveChan = sub;
|
||||
pushMenu(menuProcCurveOne);
|
||||
|
||||
@@ -134,7 +134,11 @@ PACK(typedef struct t_EEGeneral {
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
int8_t PPM_Multiplier;
|
||||
int8_t hapticLength;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
uint8_t reNavigation;
|
||||
#else
|
||||
uint8_t spare3;
|
||||
#endif
|
||||
int8_t beeperLength:3;
|
||||
uint8_t hapticStrength:3;
|
||||
uint8_t gpsFormat:1;
|
||||
|
||||
+8
-2
@@ -42,7 +42,10 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
||||
ISTR(NCHANNELS)
|
||||
ISTR(VBEEPMODE)
|
||||
ISTR(VBEEPLEN)
|
||||
ISTR(ADCFILTER)
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
ISTR(VRENAVIG)
|
||||
#endif
|
||||
ISTR(VFILTERADC)
|
||||
ISTR(WARNSW)
|
||||
ISTR(TRNMODE)
|
||||
ISTR(TRNCHN)
|
||||
@@ -163,6 +166,9 @@ const pm_char STR_HAPTICLENGTH[] PROGMEM = TR_HAPTICLENGTH;
|
||||
const pm_char STR_CONTRAST[] PROGMEM = TR_CONTRAST;
|
||||
const pm_char STR_BATTERYWARNING[] PROGMEM = TR_BATTERYWARNING;
|
||||
const pm_char STR_INACTIVITYALARM[] PROGMEM = TR_INACTIVITYALARM;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
const pm_char STR_RENAVIG[] PROGMEM = TR_RENAVIG;
|
||||
#endif
|
||||
const pm_char STR_FILTERADC[] PROGMEM = TR_FILTERADC;
|
||||
const pm_char STR_THROTTLEREVERSE[] PROGMEM = TR_THROTTLEREVERSE;
|
||||
const pm_char STR_MINUTEBEEP[] PROGMEM = TR_MINUTEBEEP;
|
||||
@@ -273,7 +279,7 @@ const pm_char STR_RXNUM[] PROGMEM = TR_RXNUM;
|
||||
const pm_char STR_SYNCMENU[] PROGMEM = TR_SYNCMENU;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_RE1)
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
const pm_char STR_BACK[] PROGMEM = TR_BACK;
|
||||
const pm_char STR_MIXERWEIGHT[] PROGMEM = TR_MIXERWEIGHT;
|
||||
const pm_char STR_MIXEROFFSET[] PROGMEM = TR_MIXEROFFSET;
|
||||
|
||||
+7
-4
@@ -59,8 +59,9 @@ extern const pm_char STR_OPEN9X[];
|
||||
#define OFS_NCHANNELS (OFS_MMMINV + sizeof(TR_MMMINV))
|
||||
#define OFS_VBEEPMODE (OFS_NCHANNELS + sizeof(TR_NCHANNELS))
|
||||
#define OFS_VBEEPLEN (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
||||
#define OFS_ADCFILTER (OFS_VBEEPLEN + sizeof(TR_VBEEPLEN))
|
||||
#define OFS_WARNSW (OFS_ADCFILTER + sizeof(TR_ADCFILTER))
|
||||
#define OFS_VRENAVIG (OFS_VBEEPLEN + sizeof(TR_VBEEPLEN))
|
||||
#define OFS_VFILTERADC (OFS_VRENAVIG + sizeof(TR_VRENAVIG))
|
||||
#define OFS_WARNSW (OFS_VFILTERADC + sizeof(TR_VFILTERADC))
|
||||
#define OFS_TRNMODE (OFS_WARNSW + sizeof(TR_WARNSW))
|
||||
#define OFS_TRNCHN (OFS_TRNMODE + sizeof(TR_TRNMODE))
|
||||
#define OFS_VTRIMINC (OFS_TRNCHN + sizeof(TR_TRNCHN))
|
||||
@@ -120,7 +121,8 @@ extern const pm_char STR_OPEN9X[];
|
||||
#define STR_NCHANNELS (STR_OPEN9X + OFS_NCHANNELS)
|
||||
#define STR_VBEEPMODE (STR_OPEN9X + OFS_VBEEPMODE)
|
||||
#define STR_VBEEPLEN (STR_OPEN9X + OFS_VBEEPLEN)
|
||||
#define STR_ADCFILTER (STR_OPEN9X + OFS_ADCFILTER)
|
||||
#define STR_VRENAVIG (STR_OPEN9X + OFS_VRENAVIG)
|
||||
#define STR_VFILTERADC (STR_OPEN9X + OFS_VFILTERADC)
|
||||
#define STR_WARNSW (STR_OPEN9X + OFS_WARNSW)
|
||||
#define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE)
|
||||
#define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN)
|
||||
@@ -246,6 +248,7 @@ extern const pm_char STR_HAPTICLENGTH[];
|
||||
extern const pm_char STR_CONTRAST[];
|
||||
extern const pm_char STR_BATTERYWARNING[];
|
||||
extern const pm_char STR_INACTIVITYALARM[];
|
||||
extern const pm_char STR_RENAVIG[];
|
||||
extern const pm_char STR_FILTERADC[];
|
||||
extern const pm_char STR_THROTTLEREVERSE[];
|
||||
extern const pm_char STR_MINUTEBEEP[];
|
||||
@@ -334,7 +337,7 @@ extern const pm_char STR_RXNUM[];
|
||||
extern const pm_char STR_SYNCMENU[];
|
||||
#endif
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern const pm_char STR_BACK[];
|
||||
#define LEN_BACK PSIZE(TR_BACK)
|
||||
extern const pm_char STR_MIXERWEIGHT[];
|
||||
|
||||
+5
-1
@@ -295,7 +295,7 @@ enum EnumKeys {
|
||||
TRM_RV_UP ,
|
||||
TRM_RH_DWN ,
|
||||
TRM_RH_UP ,
|
||||
#ifdef PCBV4
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
BTN_REa,
|
||||
BTN_REb,
|
||||
#endif
|
||||
@@ -516,6 +516,10 @@ extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim);
|
||||
extern uint8_t s_perOut_flight_phase;
|
||||
int16_t getRotaryEncoder(uint8_t idx);
|
||||
void incRotaryEncoder(uint8_t idx, int8_t inc);
|
||||
inline bool navigationRotaryEncoder(uint8_t event)
|
||||
{
|
||||
return g_eeGeneral.reNavigation == ((event & EVT_KEY_MASK) - BTN_REa + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern uint16_t s_timeCumTot;
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
#define LEN_VBEEPLEN "\005"
|
||||
#define TR_VBEEPLEN "xShrt""Short""Norml""Long ""xLong"
|
||||
|
||||
#define LEN_ADCFILTER "\004"
|
||||
#define TR_ADCFILTER "SING""OSMP""FILT"
|
||||
#define LEN_VRENAVIG "\003"
|
||||
#define TR_VRENAVIG "No REaREb"
|
||||
|
||||
#define LEN_VFILTERADC "\004"
|
||||
#define TR_VFILTERADC "SING""OSMP""FILT"
|
||||
|
||||
#define LEN_WARNSW "\004"
|
||||
#define TR_WARNSW "Down""OFF ""Up "
|
||||
@@ -255,6 +258,7 @@
|
||||
#define TR_CONTRAST "Contrast"
|
||||
#define TR_BATTERYWARNING "Battery Warning"
|
||||
#define TR_INACTIVITYALARM "Inactivity alrm"
|
||||
#define TR_RENAVIG "Navig RotEnc"
|
||||
#define TR_FILTERADC "Filter ADC"
|
||||
#define TR_THROTTLEREVERSE "Thr reverse"
|
||||
#define TR_MINUTEBEEP "Minute beep"
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
#define LEN_VBEEPLEN "\005"
|
||||
#define TR_VBEEPLEN "xShrt""Short""Norml""Long ""xLong"
|
||||
|
||||
#define LEN_ADCFILTER "\004"
|
||||
#define TR_ADCFILTER "SING""OSMP""FILT"
|
||||
#define LEN_VRENAVIG "\003"
|
||||
#define TR_VRENAVIG "No REaREb"
|
||||
|
||||
#define LEN_VFILTERADC "\004"
|
||||
#define TR_VFILTERADC "SING""OSMP""FILT"
|
||||
|
||||
#define LEN_WARNSW "\004"
|
||||
#define TR_WARNSW "Bas ""OFF ""Haut"
|
||||
@@ -252,6 +255,7 @@
|
||||
#define TR_CONTRAST "Contraste"
|
||||
#define TR_BATTERYWARNING "Alarme Batterie"
|
||||
#define TR_INACTIVITYALARM "Alarme Inactiv."
|
||||
#define TR_RENAVIG "Navig RotEnc"
|
||||
#define TR_FILTERADC "Filtre ADC"
|
||||
#define TR_THROTTLEREVERSE "Inversion Gaz"
|
||||
#define TR_MINUTEBEEP "Bip t.minutes"
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
#define LEN_VBEEPLEN "\005"
|
||||
#define TR_VBEEPLEN "xKort""Kort ""Norml""L\200ng ""xL\200ng"
|
||||
|
||||
#define LEN_ADCFILTER "\004"
|
||||
#define TR_ADCFILTER "SING""OSMP""FILT"
|
||||
#define LEN_VRENAVIG "\003"
|
||||
#define TR_VRENAVIG "No REaREb"
|
||||
|
||||
#define LEN_VFILTERADC "\004"
|
||||
#define TR_VFILTERADC "SING""OSMP""FILT"
|
||||
|
||||
#define LEN_WARNSW "\004"
|
||||
#define TR_WARNSW "Ned ""AV ""Upp "
|
||||
@@ -252,6 +255,7 @@
|
||||
#define TR_CONTRAST "Kontrast"
|
||||
#define TR_BATTERYWARNING "Batterivarning"
|
||||
#define TR_INACTIVITYALARM "Inaktivitetslarm"
|
||||
#define TR_RENAVIG "Navig RotEnc"
|
||||
#define TR_FILTERADC "ADC-filter"
|
||||
#define TR_THROTTLEREVERSE "Inverterad Gas"
|
||||
#define TR_MINUTEBEEP "Minutpip"
|
||||
|
||||
Reference in New Issue
Block a user