void PAGE_SwashInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); get_swash(); u8 w = 60; u8 x = 63; PAGE_ShowHeader(_tr("SwashType")); GUI_CreateTextSelectPlate(&gui->type, x-3, 0, w + 8, ITEM_HEIGHT, &DEFAULT_FONT, NULL, swash_val_cb, NULL); u8 row = ITEM_SPACE; GUI_CreateLabelBox(&gui->lbl[0], 0, row, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("ELE Mix")); GUI_CreateTextSelectPlate(&gui->mix[0], x, row, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)1); row += ITEM_SPACE; GUI_CreateLabelBox(&gui->lbl[1], 0, row, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("AIL Mix")); GUI_CreateTextSelectPlate(&gui->mix[1], x, row, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)0); row += ITEM_SPACE; GUI_CreateLabelBox(&gui->lbl[2], 0, row, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("PIT Mix")); GUI_CreateTextSelectPlate(&gui->mix[2], x, row, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)2); update_swashmixes(); GUI_Select1stSelectableObj(); }
static void _show_simple() { GUI_SelectionNotify(NULL); GUI_Select1stSelectableObj(); // bug fix: muset reset to 1st selectable item, otherwise ,the focus will be wrong mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, 2 * ITEM_SPACE, SIMPLE_LAST, simple_row_cb, simple_getobj_cb, NULL, NULL); // The following items are not draw in the logical view; GUI_CreateXYGraph(&gui->graph, 77, LCD_HEIGHT - RIGHT_VIEW_HEIGHT - 1, RIGHT_VIEW_HEIGHT, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, CHAN_MIN_VALUE * 5 / 4, CHAN_MAX_VALUE, CHAN_MAX_VALUE * 5 / 4, 0, 0, eval_mixer_cb, curpos_cb, touch_cb, &mp->mixer[0]); OBJ_SET_USED(&gui->bar, 0); }
static void _show_expo_dr() { GUI_SelectionNotify(notify_cb); GUI_Select1stSelectableObj(); sync_mixers(); mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, ITEM_SPACE, EXPO_LAST, expo_row_cb, simple_getobj_cb, expo_size_cb, NULL); GUI_CreateXYGraph(&gui->graph, 77, LCD_HEIGHT - RIGHT_VIEW_HEIGHT - 1, RIGHT_VIEW_HEIGHT, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, CHAN_MIN_VALUE * 5 / 4, CHAN_MAX_VALUE, CHAN_MAX_VALUE * 5 / 4, 0, 0, eval_mixer_cb, curpos_cb, NULL, NULL); mp->cur_mixer = &mp->mixer[0]; //Enable/Disable the relevant widgets }
void PAGE_ThroHoldInit(int page) { (void)page; PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ShowHeader(_tr("Throttle hold")); u8 y = HEADER_HEIGHT + HEADER_OFFSET; GUI_CreateLabelBox(&gui->enlbl, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Thr hold")); GUI_CreateTextSelectPlate(&gui->en, FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, throhold_cb, NULL); y += LINE_SPACE; GUI_CreateLabelBox(&gui->valuelbl, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Hold position")); GUI_CreateTextSelectPlate(&gui->value, FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, holdpostion_cb, NULL); GUI_Select1stSelectableObj(); }
void PAGE_GyroSenseInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); memset(mp, 0, sizeof(*mp)); int expected = INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_GYROSENSE]); int count = STDMIX_GetMixers(mp->mixer_ptr, mapped_std_channels.aux2, GYROMIXER_COUNT); if (! count) { count = STDMIX_GetMixers(mp->mixer_ptr, mapped_std_channels.gear, GYROMIXER_COUNT); } if (count != expected) { GUI_CreateLabelBox(&gui->msg, 0, 10, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, "Invalid model ini!");// must be invalid model ini return; } gyro_output = mp->mixer_ptr[0]->dest; convert_output_to_percentile(); PAGE_ShowHeader(_tr("Gyro sense")); u8 w = 65; u8 x = 63; u8 row = LINE_SPACE; GUI_CreateLabelBox(&gui->chanlbl, 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Channel")); GUI_CreateTextSelectPlate(&gui->chan, x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_output_cb, NULL); row += LINE_SPACE; w = 40; GUI_CreateLabelBox(&gui->gyrolbl[0], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)0); GUI_CreateTextSelectPlate(&gui->gyro[0], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)0); row += LINE_SPACE; GUI_CreateLabelBox(&gui->gyrolbl[1], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)1); GUI_CreateTextSelectPlate(&gui->gyro[1], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)1); if(INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_GYROSENSE]) == 3) { row += LINE_SPACE; GUI_CreateLabelBox(&gui->gyrolbl[2], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)2); GUI_CreateTextSelectPlate(&gui->gyro[2], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)2); } GUI_Select1stSelectableObj(); }
void PAGE_ThroHoldInit(int page) { if (page < 0 && current_selected > 0) // enter this page from childen page , so we need to get its previous mp->current_selected item page = current_selected; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); current_selected = 0; PAGE_ShowHeader(_tr("Throttle hold")); u8 y = ITEM_SPACE; GUI_CreateLabelBox(&gui->enlbl, 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Thr hold")); u8 w = 40; GUI_CreateTextSelectPlate(&gui->en, 75, y, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, throhold_cb, NULL); y += ITEM_SPACE; GUI_CreateLabelBox(&gui->valuelbl, 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Hold position")); GUI_CreateTextSelectPlate(&gui->value, 75, y, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, holdpostion_cb, NULL); GUI_Select1stSelectableObj(); }
static void _show_complex(int page_change) { GUI_SelectionNotify(NULL); mp->max_scroll = 2; int selection = 0; if (page_change) { selection = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected()); } mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, 2 * ITEM_SPACE, COMPLEX_LAST - COMMON_LAST, complex_row_cb, simple_getobj_cb, complex_size_cb, NULL); // The following items are not draw in the logical view; GUI_CreateBarGraph(&gui->bar, LEFT_VIEW_WIDTH +10, LCD_HEIGHT - RIGHT_VIEW_HEIGHT -1, 5, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, CHAN_MAX_VALUE, BAR_VERTICAL, eval_chan_cb, NULL); GUI_CreateXYGraph(&gui->graph, 77, LCD_HEIGHT - RIGHT_VIEW_HEIGHT -1, RIGHT_VIEW_HEIGHT, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, CHAN_MIN_VALUE * 5 / 4, CHAN_MAX_VALUE, CHAN_MAX_VALUE * 5 / 4, 0, 0, eval_mixer_cb, curpos_cb, touch_cb, mp->cur_mixer); if (page_change) { GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, selection)); } else { GUI_Select1stSelectableObj(); // bug fix: muset reset to 1st selectable item, otherwise ,the focus will be wrong } }
void PAGE_SwashInit(int page) { (void)page; PAGE_SetModal(0); PAGE_RemoveAllObjects(); get_swash(); PAGE_ShowHeaderWithSize(_tr("SwashType"), LABEL_WIDTH, HEADER_HEIGHT); GUI_CreateTextSelectPlate(&gui->type, FIELD_X, 0, FIELD_WIDTH, HEADER_WIDGET_HEIGHT, &TEXTSEL_FONT, NULL, swash_val_cb, NULL); // FIXME: need a special value for header button/textsels u8 y = HEADER_HEIGHT + 1; GUI_CreateLabelBox(&gui->lbl[0], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("ELE Mix")); GUI_CreateTextSelectPlate(&gui->mix[0], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)1); y += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[1], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("AIL Mix")); GUI_CreateTextSelectPlate(&gui->mix[1], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)0); y += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[2], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("PIT Mix")); GUI_CreateTextSelectPlate(&gui->mix[2], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)2); update_swashmixes(); GUI_Select1stSelectableObj(); }