本文整理汇总了C++中EVT_KEY_LONG函数的典型用法代码示例。如果您正苦于以下问题:C++ EVT_KEY_LONG函数的具体用法?C++ EVT_KEY_LONG怎么用?C++ EVT_KEY_LONG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EVT_KEY_LONG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuGeneralVersion
void menuGeneralVersion(uint8_t event)
{
if (s_warning_result) {
s_warning_result = 0;
displayPopup(STR_EEPROMFORMATTING);
eeErase(false);
#if !defined(SIMU)
NVIC_SystemReset();
#else
exit(0);
#endif
}
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1);
lcd_putsLeft(MENU_HEADER_HEIGHT+1, vers_stamp);
lcd_putsLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
lcd_putsLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);
drawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID);
if (event == EVT_KEY_LONG(KEY_ENTER)) {
backupEeprom();
}
else if (event == EVT_KEY_LONG(KEY_MENU)) {
POPUP_CONFIRMATION(STR_CONFIRMRESET);
}
}
示例2: menuProcNMEA4
void menuProcNMEA4(uint8_t event)
{
switch(event) // new event received, branch accordingly
{
case EVT_KEY_BREAK(KEY_LEFT):
chainMenu(menuProcNMEA3);
break;
case EVT_KEY_BREAK(KEY_RIGHT):
chainMenu(menuProcNMEA1);
break;
case EVT_KEY_LONG(KEY_UP):
NMEA_DisableRXD();
chainMenu(menuProcStatistic);
break;
case EVT_KEY_LONG(KEY_DOWN):
NMEA_DisableRXD();
chainMenu(menuProc0);
break;
}
// expecting LAT value in POS packet to be stored in the first buffer
initval (LONG_BUF(0), PACK_GGA, LAT);
initval (SHORT_BUF(0), PACK_GGA, NOS);
// and LON value in POS packet stored in the second buffer
initval (LONG_BUF(1), PACK_GGA, LON);
initval (SHORT_BUF(1), PACK_GGA, EOW);
initval (SHORT_BUF(2), PACK_GGA, SAT); // -> sbuf[2]
// title of the screen
title ('4');
lcd_puts_P ( 3*FW, 1*FH, PSTR("Latitude Sat")); // line 1 column 3
// first buffer into line 2 column 2
if (rbuf[0][0])
{
lcd_putcAtt ( 13*FW, 1*FH, sbuf[0], 0); // N or S
lcd_putcAtt ( 19*FW, 1*FH, sbuf[2], 0); // satellites in view
lcd_putsnAtt ( 1*FW, 2*FH, rbuf[0], 2, APSIZE);
lcd_putcAtt ( 5*FW, 2*FH, '@',0);
lcd_putsAtt ( 6*FW, 2*FH, &rbuf[0][2], APSIZE); // minutes with small decimal point
}
else
lcd_putsAtt ( 2*FW, 2*FH, val_unknown, APSIZE);
lcd_puts_P ( 3*FW, 4*FH, PSTR("Longitude")); // line 4 column 5
// second buffer into line 5 column 2
if (rbuf[0][0])
{
lcd_putcAtt ( 13*FW, 4*FH, sbuf[1], 0); // E or W
lcd_putsnAtt ( 0*FW, 5*FH, rbuf[1], 3, APSIZE);
lcd_putcAtt ( 6*FW, 5*FH, '@',0);
lcd_putsAtt ( 7*FW, 5*FH, &rbuf[1][3], APSIZE); // minutes with small decimal point
}
else
lcd_putsAtt ( 2*FW, 5*FH, val_unknown, APSIZE);
}
示例3: menuTelemetryFrsky
void menuTelemetryFrsky(uint8_t event)
{
enum NavigationDirection direction = none;
switch (event) {
case EVT_KEY_FIRST(KEY_EXIT):
case EVT_KEY_LONG(KEY_EXIT):
killEvents(event);
chainMenu(menuMainView);
break;
case EVT_KEY_LONG(KEY_PAGE):
killEvents(event);
// no break;
case EVT_KEY_FIRST(KEY_UP):
decrTelemetryScreen();
break;
case EVT_KEY_BREAK(KEY_PAGE):
case EVT_KEY_FIRST(KEY_DOWN):
incrTelemetryScreen();
break;
case EVT_KEY_LONG(KEY_ENTER):
killEvents(event);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
popupMenuHandler = onMainViewMenu;
break;
}
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
if (direction == up) {
if (s_frsky_view-- == 0)
s_frsky_view = TELEMETRY_VIEW_MAX;
}
else if (direction == down) {
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
s_frsky_view = 0;
}
else {
direction = down;
}
if (displayTelemetryScreen()) {
return;
}
}
lcdDrawTelemetryTopBar();
lcd_puts(8*FW, 3*FH, "No Telemetry Screens");
displayRssiLine();
}
示例4: menuStatisticsView
void menuStatisticsView(uint8_t event)
{
TITLE(STR_MENUSTAT);
switch(event)
{
case EVT_KEY_FIRST(KEY_UP):
chainMenu(menuStatisticsDebug);
break;
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
sessionTimer = 0;
break;
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
}
// Session and Total timers
lcd_putsAtt(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
lcd_putsAtt(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD);
putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
// Throttle special timers
lcd_putsAtt(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD);
putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0);
lcd_putsAtt(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD);
putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0);
// Timers
for (int i=0; i<TIMERS; i++) {
putsStrIdx(STATS_3RD_COLUMN, FH*i+1, "TM", i+1, BOLD);
if (timersStates[i].val > 3600)
putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0);
else
putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
}
#if defined(THRTRACE)
coord_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
const coord_t x = 5;
const coord_t y = 60;
lcd_hline(x-3, y, MAXTRACE+3+3);
lcd_vline(x, y-32, 32+3);
for (coord_t i=0; i<MAXTRACE; i+=6) {
lcd_vline(x+i+6, y-1, 3);
}
for (coord_t i=1; i<=MAXTRACE; i++) {
lcd_vline(x+i, y-s_traceBuf[traceRd], s_traceBuf[traceRd]);
traceRd++;
if (traceRd>=MAXTRACE) traceRd = 0;
if (traceRd==s_traceWr) break;
}
#endif
}
示例5: menuProcNMEA3
void menuProcNMEA3(uint8_t event)
{
switch(event)
{
case EVT_KEY_BREAK(KEY_LEFT):
chainMenu(menuProcNMEA2);
break;
case EVT_KEY_BREAK(KEY_RIGHT):
chainMenu(menuProcNMEA4);
break;
case EVT_KEY_LONG(KEY_UP):
NMEA_DisableRXD();
chainMenu(menuProcStatistic);
break;
case EVT_KEY_LONG(KEY_DOWN):
NMEA_DisableRXD();
chainMenu(menuProc0);
break;
}
initval (LONG_BUF(0), PACK_RMC, SOG);
initval (LONG_BUF(1), PACK_RMC, COG);
initval (SHORT_BUF(2), PACK_GGA, SAT); // -> sbuf[2]
title ('3');
lcd_puts_P ( 0*FW, 1*FH, PSTR("GrndSpeed[knt] Sat"));
if (rbuf[0][0]) // if first position is 00, buffer is empty, taken as false
{ // any other value is true
uint8_t i = 0;
while (rbuf[0][i])
{
if (rbuf[0][i] == '.') // find decimal point and insert End of String 3 positions higher
{
rbuf[0][i+3] = 0;
break;
}
i++;
}
lcd_putsAtt ( 2*FW, 2*FH, VALSTR(0), APSIZE); // speed over ground
}
else
lcd_putsAtt ( 2*FW, 2*FH, val_unknown, APSIZE);
lcd_putcAtt ( 19*FW, 1*FH, sbuf[2], 0); // satellites in view
lcd_puts_P ( 1*FW, 4*FH, PSTR("Course over ground") );
lcd_putsAtt ( 2*FW, 5*FH, VALSTR(1), APSIZE); // course over ground
}
示例6: gvarMenuItem
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
#endif
{
uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS);
// TRACE("gvarMenuItem(val=%d min=%d max=%d)", value, min, max);
if (invers && event == EVT_KEY_LONG(KEY_ENTER)) {
s_editMode = !s_editMode;
#if defined(CPUARM)
if (attr & PREC1)
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
#else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
#endif
eeDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {
if (attr & LEFT)
attr -= LEFT; /* because of ZCHAR */
else
x -= 2*FW+FWNUM;
#if defined(CPUARM)
attr &= ~PREC1;
#endif
int8_t idx = (int16_t) GV_INDEX_CALC_DELTA(value, delta);
if (invers) {
CHECK_INCDEC_MODELVAR(event, idx, -MAX_GVARS, MAX_GVARS-1);
}
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
idx = -idx;
lcd_putcAtt(x-6, y, '-', attr);
}
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx, delta);
idx++;
}
putsStrIdx(x, y, STR_GV, idx, attr);
}
else {
lcd_outdezAtt(x, y, value, attr);
#if defined(CPUARM)
if (invers) value = checkIncDec(event, value, min, max, EE_MODEL | editflags);
#else
if (invers) value = checkIncDec(event, value, min, max, EE_MODEL);
#endif
}
return value;
}
示例7: menuStatisticsView
void menuStatisticsView(uint8_t event)
{
TITLE(STR_MENUSTAT);
switch(event)
{
case EVT_KEY_FIRST(KEY_UP):
chainMenu(menuStatisticsDebug);
return;
#if defined(CPUARM)
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
sessionTimer = 0;
break;
#endif
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
return;
}
lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0);
putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0);
#if defined(CPUARM)
putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
#endif
#if defined(THRTRACE)
uint8_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
const uint8_t x=5;
const uint8_t y=60;
lcd_hline(x-3,y,MAXTRACE+3+3);
lcd_vline(x,y-32,32+3);
for (uint8_t i=0; i<MAXTRACE; i+=6) {
lcd_vline(x+i+6,y-1,3);
}
for (uint8_t i=1; i<=MAXTRACE; i++) {
lcd_vline(x+i, y-s_traceBuf[traceRd], s_traceBuf[traceRd]);
traceRd++;
if (traceRd>=MAXTRACE) traceRd = 0;
if (traceRd==s_traceWr) break;
}
#endif
}
示例8: menuTraceBuffer
void menuTraceBuffer(uint8_t event)
{
switch(event)
{
case EVT_KEY_LONG(KEY_ENTER):
dumpTraceBuffer();
killEvents(event);
break;
}
SIMPLE_SUBMENU("Trace Buffer " VERS_STR, TRACE_BUFFER_LEN);
/* RTC time */
struct gtm t;
gettime(&t);
putsTime(LCD_W+1, 0, t, TIMEBLINK);
uint8_t y = 0;
uint8_t k = 0;
int8_t sub = m_posVert;
lcd_putc(0, FH, '#');
lcd_puts(4*FW, FH, "Time");
lcd_puts(14*FW, FH, "Event");
lcd_puts(20*FW, FH, "Data");
for (uint8_t i=0; i<LCD_LINES-2; i++) {
y = 1 + (i+2)*FH;
k = i+s_pgOfs;
//item
lcd_outdezAtt(0, y, k, LEFT | (sub==k ? INVERS : 0));
const struct TraceElement * te = getTraceElement(k);
if (te) {
//time
putstime_t tme = te->time % SECS_PER_DAY;
putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT);
//event
lcd_outdezNAtt(14*FW, y, te->event, LEADING0|LEFT, 3);
//data
lcd_putsn (20*FW, y, "0x", 2);
lcd_outhex4(22*FW-2, y, (uint16_t)(te->data >> 16));
lcd_outhex4(25*FW, y, (uint16_t)(te->data & 0xFFFF));
}
}
}
示例9: gvarMenuItem
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event)
{
uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS);
// TRACE("gvarMenuItem(val=%d min=%d max=%d)", value, min, max);
if (invers && event == EVT_KEY_LONG(KEY_ENTER)) {
s_editMode = !s_editMode;
if (attr & PREC1)
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
eeDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {
if (attr & LEFT)
attr -= LEFT; /* because of ZCHAR */
else
x -= 2*FW+FWNUM;
attr &= ~PREC1;
int8_t idx = (int16_t) GV_INDEX_CALC_DELTA(value, delta);
if (idx >= 0) ++idx; // transform form idx=0=GV1 to idx=1=GV1 in order to handle double keys invert
if (invers) {
CHECK_INCDEC_MODELVAR_CHECK(event, idx, -MAX_GVARS, MAX_GVARS, noZero);
if (idx == 0) idx = 1; // handle reset to zero, map to GV1
}
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
idx = -idx;
lcd_putcAtt(x-6, y, '-', attr);
}
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);
}
putsStrIdx(x, y, STR_GV, idx, attr);
}
else {
lcd_outdezAtt(x, y, value, attr);
if (invers) value = checkIncDec(event, value, min, max, EE_MODEL | editflags);
}
return value;
}
示例10: menuFlashFile
int menuFlashFile(uint32_t index, uint8_t event)
{
FRESULT fr;
lcd_putsLeft(4*FH, "\012Hold [ENT] to start writing");
if (Valid == 0) {
// Validate file here
if ((fr = openBinaryFile(index))) {
Valid = 2;
}
else {
if ((fr = f_close(&FlashFile))) {
Valid = 2;
}
else {
Valid = 1;
}
if (!isValidBufferStart(Block_buffer)) {
Valid = 2;
}
}
}
if (Valid == 2) {
if (memoryType == MEM_FLASH)
lcd_putsLeft(4*FH, "\011Not a valid firmware file! ");
else
lcd_putsLeft(4*FH, "\011Not a valid EEPROM file! ");
if (event == EVT_KEY_BREAK(BOOT_KEY_EXIT) || event == EVT_KEY_BREAK(BOOT_KEY_MENU)) {
return 0;
}
return -1;
}
if (event == EVT_KEY_LONG(BOOT_KEY_MENU)) {
fr = openBinaryFile(index);
return (fr == FR_OK && isValidBufferStart(Block_buffer));
}
else if (event == EVT_KEY_FIRST(BOOT_KEY_EXIT)) {
return 0;
}
return -1;
}
示例11: menuGeneralTrainer
void menuGeneralTrainer(uint8_t event)
{
uint8_t y;
bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 1 : 7), {0, 2, 2, 2, 2, 0/*, 0*/});
if (slave) {
lcd_puts(7*FW, 4*FH, STR_SLAVE);
}
else {
uint8_t attr;
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
lcd_puts(3*FW, MENU_HEADER_HEIGHT+1, STR_MODESRC);
y = MENU_HEADER_HEIGHT + 1 + FH;
for (uint8_t i=1; i<=NUM_STICKS; i++) {
uint8_t chan = channel_order(i);
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
putsMixerSource(0, y, MIXSRC_Rud-1+chan, (menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0);
for (uint8_t j=0; j<3; j++) {
attr = ((menuVerticalPosition==i && menuHorizontalPosition==j) ? blink : 0);
switch(j) {
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:
lcd_outdezAtt(11*FW, y, td->studWeight, attr);
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->studWeight, -125, 125);
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;
}
attr = (menuVerticalPosition==5) ? blink : 0;
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_MULTIPLIER);
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, MENU_HEADER_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
attr = (menuVerticalPosition==6) ? INVERS : 0;
if (attr) s_editMode = 0;
lcd_putsAtt(0*FW, MENU_HEADER_HEIGHT+1+6*FH, STR_CAL, attr);
for (uint8_t i=0; i<4; i++) {
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
#if defined (PPM_UNIT_PERCENT_PREC1)
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
#else
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5, 0);
#endif
}
if (attr) {
if (event==EVT_KEY_LONG(KEY_ENTER)){
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
eeDirty(EE_GENERAL);
AUDIO_WARNING1();
}
}
}
}
示例12: menuMainView
void menuMainView(uint8_t event)
{
STICK_SCROLL_DISABLE();
uint8_t view = g_eeGeneral.view;
uint8_t view_base = view & 0x0f;
switch(event) {
case EVT_ENTRY:
killEvents(KEY_EXIT);
killEvents(KEY_UP);
killEvents(KEY_DOWN);
break;
/* TODO if timer2 is OFF, it's possible to use this timer2 as in er9x...
case EVT_KEY_BREAK(KEY_MENU):
if (view_base == VIEW_TIMER2) {
Timer2_running = !Timer2_running;
AUDIO_KEYPAD_UP();
}
break;
*/
case EVT_KEY_BREAK(KEY_RIGHT):
case EVT_KEY_BREAK(KEY_LEFT):
if (view_base <= VIEW_INPUTS) {
#if defined(PCBSKY9X)
if (view_base == VIEW_INPUTS)
g_eeGeneral.view ^= ALTERNATE_VIEW;
else
g_eeGeneral.view = (g_eeGeneral.view + (4*ALTERNATE_VIEW) + ((event==EVT_KEY_BREAK(KEY_LEFT)) ? -ALTERNATE_VIEW : ALTERNATE_VIEW)) % (4*ALTERNATE_VIEW);
#else
g_eeGeneral.view ^= ALTERNATE_VIEW;
#endif
eeDirty(EE_GENERAL);
AUDIO_KEYPAD_UP();
}
break;
#if defined(NAVIGATION_MENUS)
case EVT_KEY_CONTEXT_MENU:
killEvents(event);
#if defined(CPUARM)
if (modelHasNotes()) {
MENU_ADD_ITEM(STR_VIEW_NOTES);
}
#endif
#if defined(CPUARM)
MENU_ADD_ITEM(STR_RESET_SUBMENU);
#else
MENU_ADD_ITEM(STR_RESET_TIMER1);
MENU_ADD_ITEM(STR_RESET_TIMER2);
#if defined(FRSKY)
MENU_ADD_ITEM(STR_RESET_TELEMETRY);
#endif
MENU_ADD_ITEM(STR_RESET_FLIGHT);
#endif
MENU_ADD_ITEM(STR_STATISTICS);
#if defined(CPUARM)
MENU_ADD_ITEM(STR_ABOUT_US);
#endif
menuHandler = onMainViewMenu;
break;
#endif
#if MENUS_LOCK != 2 /*no menus*/
case EVT_KEY_LONG(KEY_MENU):// go to last menu
pushMenu(lastPopMenu());
killEvents(event);
break;
CASE_EVT_ROTARY_BREAK
case EVT_KEY_MODEL_MENU:
pushMenu(menuModelSelect);
killEvents(event);
break;
CASE_EVT_ROTARY_LONG
case EVT_KEY_GENERAL_MENU:
pushMenu(menuGeneralSetup);
killEvents(event);
break;
#endif
case EVT_KEY_BREAK(KEY_UP):
case EVT_KEY_BREAK(KEY_DOWN):
g_eeGeneral.view = (event == EVT_KEY_BREAK(KEY_UP) ? (view_base == VIEW_COUNT-1 ? 0 : view_base+1) : (view_base == 0 ? VIEW_COUNT-1 : view_base-1));
eeDirty(EE_GENERAL);
AUDIO_KEYPAD_UP();
break;
case EVT_KEY_STATISTICS:
chainMenu(menuStatisticsView);
killEvents(event);
break;
//.........这里部分代码省略.........
示例13: menuModelTelemetry
void menuModelTelemetry(uint8_t event)
{
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
uint8_t sub = m_posVert - 1;
switch (event) {
case EVT_KEY_BREAK(KEY_DOWN):
case EVT_KEY_BREAK(KEY_UP):
case EVT_KEY_BREAK(KEY_LEFT):
case EVT_KEY_BREAK(KEY_RIGHT):
if (s_editMode>0 && sub<=ITEM_TELEMETRY_RSSI_ALARM2)
frskySendAlarms(); // update FrSky module when edit mode exited
break;
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
uint8_t k = i + s_pgOfs;
#if defined(CPUARM)
for (int j=0; j<=k; j++) {
if (mstate_tab[j+1] == HIDDEN_ROW)
k++;
}
#endif
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
uint8_t attr = (sub == k ? blink : 0);
#if !defined(CPUARM)
uint8_t ch = TELEMETRY_CURRENT_EDIT_CHANNEL(k);
FrSkyChannelData & channel = g_model.frsky.channels[ch];
uint8_t dest = TELEM_A1-1+ch;
#endif
#if defined(CPUARM)
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
int index = k-ITEM_TELEMETRY_SENSOR1;
lcd_outdezAtt(INDENT_WIDTH, y, index+1, LEFT|attr);
lcd_putcAtt(lcdLastPos, y, ':', attr);
lcd_putsnAtt(3*FW, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
if (telemetryItems[index].isFresh()) {
lcd_putc(16*FW, y, '*');
}
TelemetryItem & telemetryItem = telemetryItems[index];
if (telemetryItem.isAvailable()) {
bool isOld = telemetryItem.isOld();
lcdNextPos = TELEM_COL2;
if (isOld) lcd_putc(lcdNextPos, y, '[');
putsTelemetryChannelValue(lcdNextPos, y, index, getValue(MIXSRC_FIRST_TELEM+3*index), LEFT);
if (isOld) lcd_putc(lcdLastPos, y, ']');
}
else {
lcd_putsAtt(TELEM_COL2, y, "---", 0); // TODO shortcut
}
if (attr) {
s_editMode = 0;
s_currIdx = index;
if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
MENU_ADD_ITEM(STR_EDIT);
MENU_ADD_ITEM(STR_COPY);
MENU_ADD_ITEM(STR_DELETE);
menuHandler = onSensorMenu;
}
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
pushMenu(menuModelSensor);
}
}
}
else
#endif
switch (k) {
#if defined(CPUARM)
case ITEM_TELEMETRY_PROTOCOL_TYPE:
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, CASE_PCBSKY9X(PROTOCOL_FRSKY_D_SECONDARY) attr, event);
break;
#endif
#if defined(CPUARM)
case ITEM_TELEMETRY_SENSORS_LABEL:
lcd_putsLeft(y, STR_TELEMETRY_SENSORS);
break;
case ITEM_TELEMETRY_NEWSENSOR:
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
int res = availableTelemetryIndex();
if (res >= 0) {
s_currIdx = res;
pushMenu(menuModelSensor);
}
else {
POPUP_WARNING(STR_TELEMETRYFULL);
}
}
break;
//.........这里部分代码省略.........
示例14: menuCustomFunctions
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
int8_t sub = menuVerticalPosition - 1;
#if !defined(CPUM64) || defined(AUTOSWITCH)
uint8_t eeFlags = EE_MODEL;
#endif
for (uint8_t i=0; i<LCD_LINES-1; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
uint8_t k = i+menuVerticalOffset;
CustomFunctionData *cfn = &functions[k];
uint8_t func = CFN_FUNC(cfn);
for (uint8_t j=0; j<5; j++) {
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
switch (j) {
case 0:
lcdPutsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
break;
case 1:
if (CFN_SWITCH(cfn)) {
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_2ND_COLUMN, y, STR_VFSWFUNC, func, attr);
if (active) {
CHECK_INCDEC_MODELVAR_ZERO(event, CFN_FUNC(cfn), FUNC_MAX-1);
if (checkIncDec_Ret) CFN_RESET(cfn);
}
}
else {
j = 4; // skip other fields
if (sub==k && menuHorizontalPosition > 0) {
REPEAT_LAST_CURSOR_MOVE();
}
}
break;
case 2:
{
int8_t maxParam = NUM_CHNOUT-1;
#if defined(OVERRIDE_CHANNEL_FUNCTION)
if (func == FUNC_OVERRIDE_CHANNEL) {
putsChn(lcdNextPos, y, CFN_CH_INDEX(cfn)+1, attr);
}
else
#endif
if (func == FUNC_TRAINER) {
maxParam = 4;
putsMixerSource(lcdNextPos, y, MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
}
#if defined(GVARS)
else if (func == FUNC_ADJUST_GVAR) {
maxParam = MAX_GVARS-1;
lcdDrawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_GVAR_INDEX(cfn), maxParam);
break;
}
#endif
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();
}
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_CH_INDEX(cfn), maxParam);
break;
}
case 3:
{
INCDEC_DECLARE_VARS(eeFlags);
int16_t val_displayed = CFN_PARAM(cfn);
int8_t val_min = 0;
uint8_t val_max = 255;
if (func == FUNC_RESET) {
val_max = FUNC_RESET_PARAM_LAST;
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_VFSWRESET, CFN_PARAM(cfn), attr);
}
#if defined(OVERRIDE_CHANNEL_FUNCTION)
else if (func == FUNC_OVERRIDE_CHANNEL) {
val_displayed = (int8_t)CFN_PARAM(cfn);
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
lcdDrawNumberAttUnit(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
}
#endif
#if defined(AUDIO)
else if (func == FUNC_PLAY_SOUND) {
val_max = AU_FRSKY_LAST-AU_FRSKY_FIRST-1;
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_FUNCSOUNDS, val_displayed, attr);
}
#endif
#if defined(HAPTIC)
else if (func == FUNC_HAPTIC) {
val_max = 3;
lcdDrawNumberAttUnit(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
}
#endif
#if defined(VOICE)
else if (func == FUNC_PLAY_TRACK) {
#if defined(GVARS)
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
//.........这里部分代码省略.........
示例15: EVT_KEY_BREAK
{ "MIXSRC_Ele", MIXSRC_Ele },
{ "MIXSRC_Thr", MIXSRC_Thr },
{ "MIXSRC_Ail", MIXSRC_Ail },
{ "MIXSRC_SA", MIXSRC_SA },
{ "MIXSRC_SB", MIXSRC_SB },
{ "MIXSRC_SC", MIXSRC_SC },
{ "MIXSRC_SD", MIXSRC_SD },
{ "MIXSRC_SE", MIXSRC_SE },
{ "MIXSRC_SF", MIXSRC_SF },
{ "MIXSRC_SG", MIXSRC_SG },
{ "MIXSRC_SH", MIXSRC_SH },
{ "MIXSRC_CH1", MIXSRC_CH1 },
{ "SWSRC_LAST", SWSRC_LAST_LOGICAL_SWITCH },
{ "EVT_MENU_BREAK", EVT_KEY_BREAK(KEY_MENU) },
{ "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE) },
{ "EVT_PAGE_LONG", EVT_KEY_LONG(KEY_PAGE) },
{ "EVT_ENTER_BREAK", EVT_KEY_BREAK(KEY_ENTER) },
{ "EVT_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
{ "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT) },
{ "EVT_PLUS_BREAK", EVT_KEY_BREAK(KEY_PLUS) },
{ "EVT_MINUS_BREAK", EVT_KEY_BREAK(KEY_MINUS) },
{ "EVT_PLUS_FIRST", EVT_KEY_FIRST(KEY_PLUS) },
{ "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) },
{ "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) },
{ "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) },
{ "FILL_WHITE", FILL_WHITE },
{ "GREY_DEFAULT", GREY_DEFAULT },
{ "SOLID", SOLID },
{ "DOTTED", DOTTED },
{ "FORCE", FORCE },
{ "ERASE", ERASE },