/* Advanced Standard Row1 Timer Timer Row2 Switch Switch Row3 Reset(perm)/ResetSwitch Reset(perm)/Start Row4 Start/Set-to Set-to */ static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; int COL1 = 30; int COL2 = 130; int selectable = 0; for (int j = 0; j < TIMERCOLUMNS; j++) { int row = y; int i = relrow * TIMERCOLUMNS + j; int timer_num = TIMERCOLUMNS*absrow+j; //Row 1 GUI_CreateLabelBox(&gui->timer[i], COL1, row, COL2-COL1, 18, &LABEL_FONT,timer_str_cb, NULL, (void *)(long)timer_num); GUI_CreateTextSelect(&gui->type[i], COL2, row, TEXTSELECT_96, NULL, set_timertype_cb, (void *)(long)timer_num); //Row 2 row+=20; GUI_CreateLabelBox(&gui->switchlbl[i], COL1, row, COL2-COL1, 18, &LABEL_FONT, switch_str_cb, NULL, (void *)(long)timer_num); GUI_CreateTextSource(&gui->src[i], COL2, row, TEXTSELECT_96, toggle_source_cb, set_source_cb, set_input_source_cb, (void *)(long)timer_num); //Row 3 row+=20; /* Reset Perm timer*/ GUI_CreateLabelBox(&gui->resetpermlbl[i], COL1, row, COL2-COL1, 18, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Reset")); GUI_CreateButton(&gui->resetperm[i], COL2, row, BUTTON_96x16, show_timerperm_cb, reset_timerperm_cb, (void *)(long)timer_num); if(Model.mixer_mode != MIXER_STANDARD) { /* or Reset switch */ GUI_CreateLabelBox(&gui->resetlbl[i], COL1, row, COL2-COL1, 18, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Reset sw")); GUI_CreateTextSource(&gui->resetsrc[i], COL2, row, TEXTSELECT_96, toggle_resetsrc_cb, set_resetsrc_cb, set_input_rstsrc_cb, (void *)(long)timer_num); row+=20; } //Row 4 GUI_CreateLabelBox(&gui->startlbl[i], COL1, row, COL2-COL1, 18, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Start")); GUI_CreateTextSelect(&gui->start[i], COL2, row, TEXTSELECT_96, NULL, set_start_cb, (void *)(long)timer_num); if(Model.mixer_mode == MIXER_STANDARD) row += 20; GUI_CreateButton(&gui->setperm[i], COL2, row, BUTTON_96x16, show_timerperm_cb, reset_timerperm_cb, (void *)(long)(timer_num | 0x80)); update_countdown(timer_num); int tmpselectable = (Model.timer[timer_num].type < TIMER_COUNTDOWN) ? 2 : 3; if (Model.mixer_mode == MIXER_ADVANCED) tmpselectable++; if(HAS_PERMANENT_TIMER && Model.timer[timer_num].type == TIMER_PERMANENT) tmpselectable = 4; selectable += tmpselectable; COL1 = 270; COL2 = 343; } return selectable; }
static void show_iconsel_page(int SelectedIcon) { struct ImageMap img; int toggleinput = MIXER_SRC(Model.pagecfg2.elem[tp->tglidx].src); PAGE_RemoveAllObjects(); PAGE_ShowHeader(INPUT_SourceNameAbbrevSwitch(tempstring, toggleinput)); GUI_CreateButton(&gui->revert, LCD_WIDTH-96-8, 4, BUTTON_96, revert_str_cb, revert_cb, NULL); // Show name of source for toggle icon // style the switch textbox struct LabelDesc outline = { .font = DEFAULT_FONT.font, .style = LABEL_TRANSPARENT, .font_color = DEFAULT_FONT.font_color, .fill_color = DEFAULT_FONT.fill_color, .outline_color = DEFAULT_FONT.outline_color }; GUI_CreateRect(&gui->toggleframe, 80+80*SelectedIcon, 39, 77, 33, &outline); GUI_CreateLabelBox(&gui->switchbox, 4, 47, 70, 22, &NORMALBOX_FONT, NULL, NULL, INPUT_SourceNameAbbrevSwitch(tempstring, Model.pagecfg2.elem[tp->tglidx].src)); int num_positions = INPUT_NumSwitchPos(toggleinput); if(num_positions < 2) num_positions = 2; GUI_CreateLabelBox(&gui->togglelabel[0], 94, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 0")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[0]); GUI_CreateImageOffset(&gui->toggleicon[0], 124, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 0 ? tglico_reset_cb : tglico_setpos_cb, (void *)0L); GUI_CreateLabelBox(&gui->togglelabel[1], 174, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 1")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[1]); GUI_CreateImageOffset(&gui->toggleicon[1], 204, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 1 ? tglico_reset_cb : tglico_setpos_cb, (void *)1L); if (num_positions == 3) { GUI_CreateLabelBox(&gui->togglelabel[2], 254, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 2")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[2]); GUI_CreateImageOffset(&gui->toggleicon[2], 284, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 2 ? tglico_reset_cb : tglico_setpos_cb, (void *)2L); } int count = get_toggle_icon_count(); int max_scroll = (count + NUM_SYMBOL_COLS - 1) / NUM_SYMBOL_COLS - (NUM_SYMBOL_ROWS - 1); if (max_scroll > 1) GUI_CreateScrollbar(&gui->scrollbar, LCD_WIDTH-16, 80, LCD_HEIGHT-80, max_scroll, NULL, scroll_cb, (void *)(long)SelectedIcon); show_icons(SelectedIcon, 0); } void PAGE_ToggleEditInit(int page) { tp->tglidx = page; memcpy(tp->tglicons, Model.pagecfg2.elem[tp->tglidx].extra, sizeof(tp->tglicons)); show_iconsel_page(0); }
static void _show_titlerow() { enum { TITLE_X = 40, BUTTON_X = LCD_WIDTH - 96 - 8, TITLE_WIDTH = BUTTON_X - TITLE_X, }; PAGE_ShowHeader(NULL); GUI_CreateLabelBox(&gui->title, TITLE_X, 10, TITLE_WIDTH, 12, &TITLE_FONT, MIXPAGE_ChanNameProtoCB, NULL, (void *)(long)mp->channel); GUI_CreateButton(&gui->revert, BUTTON_X, 4, BUTTON_96, GUI_Localize, revert_cb, _tr_noop("Revert")); }
guiObject_t *GUI_CreateButtonPlateText(guiButton_t *button, u16 x, u16 y, u16 width, u16 height, const struct LabelDesc *desc, const char *(*strCallback)(struct guiObject *, const void *), u16 fontColor, void (*CallBack)(struct guiObject *obj, const void *data), const void *cb_data) { guiObject_t *obj = GUI_CreateButton(button, x, y, BUTTON_DEVO10, strCallback, fontColor, CallBack, cb_data); struct guiBox *box = &obj->box; button->desc = *desc; box->width = width; box->height = height; return obj; }
static void add_dlg_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; GUI_CreateDialog(&gui->dialog, ADD_DIALOG_X, ADD_DIALOG_Y, ADD_DIALOG_W, ADD_DIALOG_H, _tr("Page Config"), NULL, dialog_ok_cb, dtOk, ""); GUI_CreateLabelBox(&gui->dlglbl[0], ADD_LBL_X, ADD_DIALOG_Y + 30, ADD_TS_X - ADD_LBL_X, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Type")); GUI_CreateTextSelect(&gui->dlgts[0], ADD_TS_X, ADD_DIALOG_Y + 30, TEXTSELECT_128, NULL, newelem_cb, NULL); GUI_CreateButton(&gui->dlgbut[0], ADD_ADDBUT_X, ADD_DIALOG_Y + 30, BUTTON_64x16, add_dlgbut_str_cb, newelem_press_cb, (void *)1L); GUI_CreateLabelBox(&gui->dlglbl[1], ADD_LBL_X, ADD_DIALOG_Y + 60, ADD_BUT_X - ADD_LBL_X, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Template")); GUI_CreateButton(&gui->dlgbut[1], ADD_BUT_X, ADD_DIALOG_Y + 60, BUTTON_96x16, add_dlgbut_str_cb, add_dlgbut_cb, (void *)0L); int y = ADD_DIALOG_Y + 90; for (long i = 0; i < NUM_QUICKPAGES; i++) { GUI_CreateLabelBox(&gui->dlglbl[i+2], ADD_LBL_X, y, ADD_MENU_X - ADD_LBL_X, 0, &LABEL_FONT, menulabel_cb, NULL, (void *)i); GUI_CreateTextSelect(&gui->dlgts[i+2], ADD_MENU_X, y, TEXTSELECT_224, NULL, menusel_cb, (void *)i); y += 24; } GUI_SetSelected((guiObject_t *)&gui->dlgbut[0]); }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; struct Trim *trim = MIXER_GetAllTrims(); GUI_CreateButton(&gui->src[relrow], PCOL1, y, BUTTON_64x16, trimsource_name_cb, 0x0000, _edit_cb, (void *)((long)absrow)); GUI_CreateLabelBox(&gui->neg[relrow], PCOL2 + 6, y, PCOL3 - PCOL2, 24, &DEFAULT_FONT, negtrim_str, NULL, (void *)(long)absrow); GUI_CreateLabel(&gui->pos[relrow], PCOL3 + 6, y, NULL, DEFAULT_FONT, (void *)INPUT_ButtonName(trim[absrow].pos)); GUI_CreateTextSelect(&gui->step[relrow], PCOL4 + 6, y, TEXTSELECT_96, NULL, set_trimstep_cb, (void *)(long)(absrow + 0x000)); //0x000: Use Model.trims return 2; }
static void _show_page() { // Note for future maintenance: DO NOT use logical view to draw all the channel items at a time for this page: I just // gave it a try, it spent very long time to construct all the 30 items and could trigger watch-dog to reboot !!! static const int XOFFSET = ((LCD_WIDTH - 320) / 2); int init_y = LCD_HEIGHT == 240 ? 44 : 36; int i; if (mp->firstObj) { GUI_RemoveHierObjects(mp->firstObj); mp->firstObj = NULL; } struct Mixer *mix = MIXER_GetAllMixers(); for (i = 0; i < ENTRIES_PER_PAGE; i++) { guiObject_t *obj; u8 idx; int row = init_y + 24 * i; u8 ch = mp->top_channel + i; if (ch >= Model.num_channels) ch += (NUM_OUT_CHANNELS - Model.num_channels); if (ch < NUM_OUT_CHANNELS) { obj = GUI_CreateButton(&gui->name[i].but, XOFFSET+4, row, BUTTON_64x16, MIXPAGE_ChanNameProtoCB, 0x0000, limitselect_cb, (void *)((long)ch)); } else if(! _is_virt_cyclic(ch)) { obj = GUI_CreateButton(&gui->name[i].but, XOFFSET+4, row, BUTTON_64x16, MIXPAGE_ChanNameProtoCB, 0x0000, virtname_cb, (void *)(long)ch); } else { obj = GUI_CreateLabelBox(&gui->name[i].lbl, XOFFSET+4, row, 64, 16, &DEFAULT_FONT, MIXPAGE_ChanNameProtoCB, NULL, (void *)((long)ch)); } if (! mp->firstObj) mp->firstObj = obj; GUI_CreateButton(&gui->tmpl[i], XOFFSET+132, row, BUTTON_64x16, template_name_cb, 0x0000, templateselect_cb, (void *)((long)ch)); for (idx = 0; idx < NUM_MIXERS; idx++) if (mix[idx].src && mix[idx].dest == ch) break; if (idx != NUM_MIXERS) { enum TemplateType template = MIXER_GetTemplate(ch); GUI_CreateLabelBox(&gui->src[i], XOFFSET+68, row, 60, 16, &NARROW_FONT, show_source, NULL, &mix[idx].src); if (template == MIXERTEMPLATE_EXPO_DR) {
static int row_cb(int absrow, int relrow, int y, void *data) { int type = (long)data; long elemidx = elem_rel_to_abs(type, absrow); int X = LAYDLG_X + LAYDLG_SCROLLABLE_X - (type == ELEM_TOGGLE ? 68/2 : 0); int width = LAYDLG_MIN_WIDTH + (type == ELEM_TOGGLE ? 64 : 0) - 2 * LAYDLG_SCROLLABLE_X - 16; int del_x = X + 15 + 110; int num_objs = 2; if (type == ELEM_MODELICO) { GUI_CreateLabelBox(&gui->dlglbl[relrow], X, y, 115, LAYDLG_TEXT_HEIGHT, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Model")); } else { GUI_CreateLabelBox(&gui->dlglbl[relrow], X, y, 10, 16, &LABEL_FONT, label_cb, NULL, (void *)(long)(absrow)); GUI_CreateTextSelect(&gui->dlgts[relrow], X + 15, y, TEXTSELECT_96, NULL, dlgts_cb, (void *)elemidx); if (type == ELEM_TOGGLE) { GUI_CreateButton(&gui->dlgbut2[relrow], del_x, y, BUTTON_64x16, dlgbut_str_cb, toggle_press_cb, (void *)elemidx); //del_x = X + 15 + 168; num_objs++; } } GUI_CreateButton(&gui->dlgbut[relrow], X+width-64, y, BUTTON_64x16, dlgbut_str_cb, dlgbut_cb, (void *)elemidx); return num_objs; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; int idx = 0; unsigned i = 0; while(1) { menu_get_next_rowidx(&i); if (i >= PAGEID_LAST) break; if (idx == absrow) { GUI_CreateLabelBox(&gui->idx[relrow], LABELNUM_X, y, LABELNUM_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, idx_string_cb, NULL, (void *)(absrow+ 1L)); GUI_CreateButton(&gui->name[relrow], LABEL_X, y, BUTTON_96, menu_name_cb, 0x0000, menu_press_cb, (const void *)(long)i); //GUI_CreateLabelBox(&gui->name[relrow], LABEL_X, y, // LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, menu_name_cb, menu_press_cb, (const void *)(long)i); break; } idx++; i++; } return 1; }
void PAGE_ModelInit(int page) { (void)page; u8 row; mp->last_mixermode = Model.mixer_mode; mp->last_txpower = Model.tx_power; mp->file_state = 0; PAGE_SetModal(0); PAGE_ShowHeader(PAGE_GetName(PAGEID_MODEL)); enum { COL1 = (8 + ((LCD_WIDTH - 320) / 2)), COL2 = (COL1 + 128), COL3 = (COL1 + 228), ROW1 = (44 + ((LCD_HEIGHT - 240) / 2)), LABEL_WIDTH = (COL2 - COL1), }; row = ROW1; GUI_CreateLabelBox(&gui->filelbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("File")); GUI_CreateTextSelect(&gui->file, COL2, row, TEXTSELECT_96, file_press_cb, file_val_cb, NULL); #if HAS_STANDARD_GUI row+= 20; GUI_CreateLabelBox(&gui->guilbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Mixer GUI")); GUI_CreateTextSelect(&gui->guits, COL2, row, TEXTSELECT_96, NULL, _mixermode_cb, NULL); #endif row += 20; GUI_CreateLabelBox(&gui->namelbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Model name")); // use the same naming convention for devo8 and devo10 GUI_CreateButton(&gui->name, COL2, row, BUTTON_96x16, show_text_cb, _changename_cb, Model.name); GUI_CreateButton(&gui->icon, COL3, row, BUTTON_64x16, show_text_cb, changeicon_cb, _tr("Icon")); row += 20; GUI_CreateLabelBox(&gui->typelbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Model type")); GUI_CreateTextSelect(&gui->type, COL2, row, TEXTSELECT_96, type_press_cb, type_val_cb, NULL); row += 24; GUI_CreateLabelBox(&gui->ppmlbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("PPM In")); GUI_CreateTextSelect(&gui->ppm, COL2, row, TEXTSELECT_96, ppmin_press_cb, ppmin_select_cb, NULL); row += 20; GUI_CreateLabelBox(&gui->protolbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Protocol")); GUI_CreateTextSelect(&gui->proto, COL2, row, TEXTSELECT_96, proto_press_cb, protoselect_cb, NULL); row += 20; GUI_CreateLabelBox(&gui->numchlbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("# Channels")); GUI_CreateTextSelect(&gui->numch, COL2, row, TEXTSELECT_96, NULL, numchanselect_cb, NULL); row += 24; GUI_CreateLabelBox(&gui->pwrlbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Tx power")); GUI_CreateTextSelect(&gui->pwr, COL2, row, TEXTSELECT_96, NULL, powerselect_cb, NULL); row += 20; if(Model.fixed_id == 0) strlcpy(mp->fixed_id, _tr("None"), sizeof(mp->fixed_id)); else sprintf(mp->fixed_id, "%d", (int)Model.fixed_id); GUI_CreateLabelBox(&gui->fixedidlbl, COL1, row, LABEL_WIDTH, 18, &LABEL_FONT, NULL, NULL, _tr("Fixed ID")); GUI_CreateButton(&gui->fixedid, COL2, row, BUTTON_96x16, show_text_cb, fixedid_cb, mp->fixed_id); GUI_CreateButton(&gui->bind, COL3, row, BUTTON_64x16, show_bindtext_cb, bind_cb, NULL); configure_bind_button(); }
guiObject_t *GUI_CreateDialog(guiDialog_t *dialog, u16 x, u16 y, u16 width, u16 height, const char *title, const char *(*string_cb)(guiObject_t *obj, void *data), void (*CallBack)(u8 state, void *data), enum DialogType dgType, void *data) { struct guiHeader *obj = (guiObject_t *)dialog; struct guiBox *box ; CLEAR_OBJ(dialog); box = &obj->box; box->x = x; box->y = y; box->width = width; box->height = height; obj->Type = Dialog; OBJ_SET_TRANSPARENT(obj, 0); OBJ_SET_MODAL(obj, 1); connect_object(obj); dialog->string_cb = string_cb; dialog->title = title; dialog->CallBack = *CallBack; dialog->cbData = data; dialog->txtbox.x = x + 10; dialog->txtbox.y = 0; dialog->txtbox.width = 0; dialog->txtbox.height = 0; struct guiObject *but = NULL; int button_width = GUI_ButtonWidth(DIALOG_BUTTON); int button_height = GUI_ButtonHeight(DIALOG_BUTTON); switch (dgType) { case dtOk: case dtCancel: { but = GUI_CreateButton(&dialog->but1, x + (width - button_width) / 2, y + height - button_height - 1, DIALOG_BUTTON, dgType == dtOk ? dlgbut_strok_cb : dlgbut_strcancel_cb, 0x0000, dgType == dtOk ? dlgbut_pressok_cb : dlgbut_presscancel_cb, obj); } break; case dtOkCancel: { but = GUI_CreateButton(&dialog->but1, x + (width - button_width - button_width) / 2, y + height - button_height - 1, DIALOG_BUTTON, dlgbut_strok_cb, 0x0000, dlgbut_pressok_cb, obj); but = GUI_CreateButton(&dialog->but2, x + width/2, y + height - button_height - 1, DIALOG_BUTTON, dlgbut_strcancel_cb, 0x0000, dlgbut_presscancel_cb, obj); } break; case dtNone: break; } objDIALOG = obj; GUI_HandleModalButtons(1); objSELECTED = but; //bug fix: using objSELECTED for dialog is not safe in devo10 objModalButton = but; return obj; }
guiObject_t *PAGE_CreateOkButton(u16 x, u16 y, void (*CallBack)(guiObject_t *obj, const void *data)) { enter_cmd = CallBack; enter_data = (void *)1; return GUI_CreateButton(&gui->nextico, x, y, BUTTON_48, okcancelstr_cb, 0x0000, CallBack, (void *)1); }
guiObject_t *PAGE_CreateCancelButton(u16 x, u16 y, void (*CallBack)(guiObject_t *obj, const void *data)) { exit_cmd = CallBack; exit_data = (void *)0; return GUI_CreateButton(&gui->previco, x, y, BUTTON_96, okcancelstr_cb, 0x0000, CallBack, (void *)0); }
static void _show_page() { if (firstObj) { GUI_RemoveHierObjects(firstObj); firstObj = NULL; } #define COL1 16 #define COL2 (COL1+106) #if LCD_WIDTH == 480 #define COL3 (LCD_WIDTH-16-106-96) // border + label + button #define COL4 (LCD_WIDTH-16-96) // border + button #define BUTTON_WIDE BUTTON_96x16 #define BUTTON_TEST BUTTON_48x16 #define BUTTON_TOUCH BUTTON_TEST #define COL2TEST (COL2+48) #define ADDSPACE 0 #define ADDROW 0 #else #define COL3 COL1 #define COL4 COL2 #define BUTTON_WIDE BUTTON_96 #define BUTTON_TEST BUTTON_48 #define BUTTON_TOUCH BUTTON_WIDE #define COL2TEST (COL2+100) #define ADDSPACE 15 #define ADDROW 6 #endif guiObject_t *obj; u8 space = 19; int row = 40; int col1 = COL1; int col2 = COL2; if (page_num == 0 || LCD_WIDTH == 480) { obj = GUI_CreateLabelBox(&gui1->head1_1, col1, row, 0, 0, &SECTION_FONT, NULL, NULL, _tr("Generic settings")); if (firstObj == NULL) firstObj = obj; row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->langlbl, col1, row+ADDROW, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Language")); GUI_CreateButton(&gui1->lang, col2, row, BUTTON_WIDE, langstr_cb, 0x0000, lang_select_cb, NULL); row += space + ADDSPACE ; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->modelbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Stick mode")); GUI_CreateTextSelect(&gui1->mode, col2, row, TEXTSELECT_96, NULL, modeselect_cb, NULL); row += space + ADDSPACE; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->touchlbl, col1, row+ADDROW, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Touch screen")); GUI_CreateButton(&gui1->touchcalib, col2, row, BUTTON_WIDE, calibratestr_cb, 0x0000, press_cb, (void *)CALIB_TOUCH); row += space + ADDSPACE; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->sticklbl, col1, row+ADDROW, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Sticks")); GUI_CreateButton(&gui1->stickcalib, col2, row, BUTTON_WIDE, calibratestr_cb, 0x0000, press_cb, (void *)CALIB_STICK); #if HAS_RTC row += space + ADDSPACE; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->clocklbl, col1, row+ADDROW, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Clock")); GUI_CreateButton(&gui1->clock, col2, row, BUTTON_WIDE, clockstr_cb, 0x0000, press_cb, (void *)SET_CLOCK); row += space + ADDSPACE; #else row += space + (LCD_WIDTH == 320 ? 8 : 16); // for nicer look #endif //HAS_RTC if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } } if (page_num == 1 || LCD_WIDTH == 480) { obj = GUI_CreateLabelBox(&gui2->head2_1, col1, row, 0, 0, &SECTION_FONT, NULL, NULL, _tr("Buzzer settings")); if (firstObj == NULL) firstObj = obj; row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->power_alarmlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Power On alarm")); GUI_CreateTextSelect(&gui2->power_alarm, col2, row, TEXTSELECT_96, NULL, poweralarm_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->battalrmlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Battery alarm")); GUI_CreateTextSelect(&gui2->battalrm, col2, row, TEXTSELECT_96, NULL, batalarm_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->battalrmintvllbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Alarm intvl")); GUI_CreateTextSelect(&gui2->battalrmintvl, col2, row, TEXTSELECT_96, NULL, batalarmwarn_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->buzzlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Buzz volume")); GUI_CreateTextSelect(&gui2->buzz, col2, row, TEXTSELECT_96, NULL, _buzz_vol_cb, (void *)&Transmitter.volume); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->musicshutdbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Power-down alert")); GUI_CreateTextSelect(&gui2->music_shutdown, col2, row, TEXTSELECT_96, NULL, _music_shutdown_cb, (void *)&Transmitter.music_shutdown); row += space + 8; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->head2_2, col1, row, 0, 0, &SECTION_FONT, NULL, NULL, _tr("LCD settings")); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->backlightlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Backlight")); GUI_CreateTextSelect(&gui2->backlight, col2, row, TEXTSELECT_96, NULL, brightness_select_cb, NULL); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->dimtimelbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Dimmer time")); GUI_CreateTextSelect(&gui2->dimtime, col2, row, TEXTSELECT_96, NULL, auto_dimmer_time_cb, NULL); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->dimtgtlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Dimmer target")); GUI_CreateTextSelect(&gui2->dimtgt, col2, row, TEXTSELECT_96, NULL, common_select_cb, (void *)&Transmitter.auto_dimmer.backlight_dim_value); row += space + 8; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } } if (page_num == 2 || LCD_WIDTH == 480) { obj = GUI_CreateLabelBox(&gui3->head3_1, col1, row, 0, 0, &SECTION_FONT, NULL, NULL, _tr("Timer settings")); if (firstObj == NULL) firstObj = obj; row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->prealertlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Prealert time")); GUI_CreateTextSelect(&gui3->prealert, col2, row, TEXTSELECT_96,NULL, prealert_time_cb, (void *)0L); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->preintvllbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Prealert intvl")); GUI_CreateTextSelect(&gui3->preintvl, col2, row, TEXTSELECT_96, NULL, timer_interval_cb, &Transmitter.countdown_timer_settings.prealert_interval); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->timeuplbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL,_tr("Timeup intvl")); GUI_CreateTextSelect(&gui3->timeup, col2, row, TEXTSELECT_96, NULL, timer_interval_cb, &Transmitter.countdown_timer_settings.timeup_interval); row += space + 8; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->head3_2, col1, row, 0, 0, &SECTION_FONT, NULL, NULL, _tr("Telemetry settings")); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->templbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Temperature")); GUI_CreateTextSelect(&gui3->temp, col2, row, TEXTSELECT_96, NULL, units_cb, (void *)1L); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->lengthlbl, col1, row, 0, 0, &DEFAULT_FONT, NULL, NULL, _tr("Length")); GUI_CreateTextSelect(&gui3->length, col2, row, TEXTSELECT_96, NULL, units_cb, (void *)0L); } }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)relrow; (void)y; (void)data; int page_num = absrow; u8 space = 19; int row = 40; int col1 = COL1; int col2 = COL2; if (page_num == 0 || LCD_WIDTH == 480) { #if HAS_EXTENDED_AUDIO row -= (LCD_WIDTH == 320 ? 0 : 8); #endif GUI_CreateLabelBox(&gui1->head1_1, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Generic settings")); #if SUPPORT_MULTI_LANGUAGE row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->langlbl, col1, row+ADDROW, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Language")); GUI_CreateButton(&gui1->lang, col2, row, BUTTON_WIDE, langstr_cb, lang_select_cb, NULL); #endif row += space + ADDSPACE ; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->modelbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Stick mode")); GUI_CreateTextSelect(&gui1->mode, col2, row, TEXTSELECT_96, NULL, modeselect_cb, NULL); row += space + (ADDSPACE-1) / 2; if (HAS_TOUCH) { if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->touchlbl, col1, row+ADDROW, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Touch screen")); GUI_CreateButton(&gui1->touchcalib, col2, row, BUTTON_WIDE, calibratestr_cb, press_cb, (void *)CALIB_TOUCH); } row += space + ADDSPACE; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->sticklbl, col1, row+ADDROW, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Sticks")); GUI_CreateButton(&gui1->stickcalib, col2, row, BUTTON_WIDE, calibratestr_cb, press_cb, (void *)CALIB_STICK); #if HAS_RTC row += space + ADDSPACE; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui1->clocklbl, col1, row+ADDROW, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Clock")); GUI_CreateButton(&gui1->clock, col2, row, BUTTON_WIDE, clockstr_cb, press_cb, (void *)SET_CLOCK); row += space + ADDSPACE; #else row += space + (LCD_WIDTH == 320 ? 8 : 16); // for nicer look #endif //HAS_RTC if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } } if (page_num == 1 || LCD_WIDTH == 480) { #if HAS_EXTENDED_AUDIO row -= (LCD_WIDTH == 320 ? 8 : 4); GUI_CreateLabelBox(&gui2->head2_1, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Audio settings")); #else GUI_CreateLabelBox(&gui2->head2_1, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Buzzer settings")); #endif row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->power_alarmlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Power On alarm")); GUI_CreateTextSelect(&gui2->power_alarm, col2, row, TEXTSELECT_96, NULL, poweralarm_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->battalrmlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Battery alarm")); GUI_CreateTextSelect(&gui2->battalrm, col2, row, TEXTSELECT_96, NULL, batalarm_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->battalrmintvllbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Alarm interval")); GUI_CreateTextSelect(&gui2->battalrmintvl, col2, row, TEXTSELECT_96, NULL, batalarmwarn_select_cb, NULL); row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->buzzlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Buzz volume")); GUI_CreateTextSelect(&gui2->buzz, col2, row, TEXTSELECT_96, NULL, _buzz_vol_cb, (void *)&Transmitter.volume); #if HAS_EXTENDED_AUDIO row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->audiolbl, col1, row, 0, 0, &DEFAULT_FONT, GUI_Localize, NULL, _tr_noop("Audio volume")); GUI_CreateTextSelect(&gui2->audio, col2, row, TEXTSELECT_96, NULL, _audio_vol_cb, (void *)&Transmitter.audio_vol); #endif row += space; if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->musicshutdbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Power-down alert")); GUI_CreateTextSelect(&gui2->music_shutdown, col2, row, TEXTSELECT_96, NULL, _music_shutdown_cb, (void *)&Transmitter.music_shutdown); #if HAS_EXTENDED_AUDIO row += space; #else row += space + 8; #endif if (row+12 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->head2_2, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("LCD settings")); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->backlightlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Backlight")); GUI_CreateTextSelect(&gui2->backlight, col2, row, TEXTSELECT_96, NULL, backlight_select_cb, NULL); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->dimtimelbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Dimmer time")); GUI_CreateTextSelect(&gui2->dimtime, col2, row, TEXTSELECT_96, NULL, auto_dimmer_time_cb, NULL); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui2->dimtgtlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Dimmer target")); GUI_CreateTextSelect(&gui2->dimtgt, col2, row, TEXTSELECT_96, NULL, common_select_cb, (void *)&Transmitter.auto_dimmer.backlight_dim_value); row += space + 0; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } } if (page_num == 2 || LCD_WIDTH == 480) { GUI_CreateLabelBox(&gui3->head3_1, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Timer settings")); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->prealertlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Prealert time")); GUI_CreateTextSelect(&gui3->prealert, col2, row, TEXTSELECT_96,NULL, prealert_time_cb, (void *)0L); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->preintvllbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Prealert interval")); GUI_CreateTextSelect(&gui3->preintvl, col2, row, TEXTSELECT_96, NULL, timer_interval_cb, &Transmitter.countdown_timer_settings.prealert_interval); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->timeuplbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Timeup interval")); GUI_CreateTextSelect(&gui3->timeup, col2, row, TEXTSELECT_96, NULL, timer_interval_cb, &Transmitter.countdown_timer_settings.timeup_interval); row += space + 3; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->head3_2, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Telemetry settings")); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->templbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Temperature")); GUI_CreateTextSelect(&gui3->temp, col2, row, TEXTSELECT_96, NULL, units_cb, (void *)1L); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->lengthlbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Length")); GUI_CreateTextSelect(&gui3->length, col2, row, TEXTSELECT_96, NULL, units_cb, (void *)0L); row += space; if (row+8 >= LCD_HEIGHT) { row = 40; col1 = COL3; col2 = COL4; } GUI_CreateLabelBox(&gui3->telemivllbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Alert interval")); GUI_CreateTextSelect(&gui3->telemivl, col2, row, TEXTSELECT_96, NULL, telem_interval_cb, &Transmitter.telem_alert_interval); #if HAS_VIBRATINGMOTOR if(Transmitter.extra_hardware & VIBRATING_MOTOR) { row += space + 3; GUI_CreateLabelBox(&gui3->head3_3, col1, row, col2 + BUTTON_WIDTH - col1, 0, &SECTION_FONT, GUI_Localize, NULL, _tr_noop("Vibration settings")); row += space; GUI_CreateLabelBox(&gui3->viblbl, col1, row, col2 - col1, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Vibration:")); GUI_CreateTextSelect(&gui3->vib, col2, row, TEXTSELECT_96, _vibration_test_cb, _vibration_state_cb, (void *)&Transmitter.vibration_state); } #endif } return 0; }
void PAGE_ModelInit(int page) { (void)page; u8 row; mp->last_mixermode = Model.mixer_mode; mp->last_txpower = Model.tx_power; mp->file_state = 0; PAGE_SetModal(0); if (Model.mixer_mode == MIXER_STANDARD) PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_MODEL), MODELMENU_Show); else PAGE_ShowHeader(PAGE_GetName(PAGEID_MODEL)); #define COL1 (8 + ((LCD_WIDTH - 320) / 2)) #define COL2 (COL1 + 128) #define COL3 (COL1 + 228) #define ROW1 (40 + ((LCD_HEIGHT - 240) / 2)) row = ROW1; GUI_CreateLabel(&gui->filelbl, COL1, row, NULL, DEFAULT_FONT, _tr("File")); GUI_CreateTextSelect(&gui->file, COL2, row, TEXTSELECT_96, file_press_cb, file_val_cb, NULL); row+= 20; GUI_CreateLabel(&gui->guilbl, COL1, row, NULL, DEFAULT_FONT, _tr("Mixer GUI")); GUI_CreateTextSelect(&gui->guits, COL2, row, TEXTSELECT_96, NULL, _mixermode_cb, NULL); row += 20; GUI_CreateLabel(&gui->namelbl, COL1, row, NULL, DEFAULT_FONT, _tr("Model name")); // use the same naming convention for devo8 and devo10 GUI_CreateButton(&gui->name, COL2, row, BUTTON_96x16, show_text_cb, 0x0000, _changename_cb, Model.name); GUI_CreateButton(&gui->icon, COL3, row, BUTTON_64x16, show_text_cb, 0x0000, changeicon_cb, _tr("Icon")); row += 20; GUI_CreateLabel(&gui->typelbl, COL1, row, NULL, DEFAULT_FONT, _tr("Model type")); GUI_CreateTextSelect(&gui->type, COL2, row, TEXTSELECT_96, type_press_cb, type_val_cb, NULL); row += 24; GUI_CreateLabel(&gui->ppmlbl, COL1, row, NULL, DEFAULT_FONT, _tr("PPM In")); GUI_CreateTextSelect(&gui->ppm, COL2, row, TEXTSELECT_96, ppmin_press_cb, ppmin_select_cb, NULL); row += 20; GUI_CreateLabel(&gui->protolbl, COL1, row, NULL, DEFAULT_FONT, _tr("Protocol")); GUI_CreateTextSelect(&gui->proto, COL2, row, TEXTSELECT_96, proto_press_cb, protoselect_cb, NULL); row += 20; GUI_CreateLabel(&gui->numchlbl, COL1, row, NULL, DEFAULT_FONT, _tr("# Channels")); GUI_CreateTextSelect(&gui->numch, COL2, row, TEXTSELECT_96, NULL, numchanselect_cb, NULL); row += 24; GUI_CreateLabel(&gui->pwrlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Tx power")); GUI_CreateTextSelect(&gui->pwr, COL2, row, TEXTSELECT_96, NULL, powerselect_cb, NULL); row += 20; if(Model.fixed_id == 0) strncpy(mp->fixed_id, _tr("None"), sizeof(mp->fixed_id)); else sprintf(mp->fixed_id, "%d", (int)Model.fixed_id); GUI_CreateLabel(&gui->fixedidlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Fixed ID")); GUI_CreateButton(&gui->fixedid, COL2, row, BUTTON_96x16, show_text_cb, 0x0000, fixedid_cb, mp->fixed_id); GUI_CreateButton(&gui->bind, COL3, row, BUTTON_64x16, show_bindtext_cb, 0x0000, bind_cb, NULL); configure_bind_button(); }