Example #1
0
void PAGE_TrimEditInit(int page)
{
    struct Trim *trim = MIXER_GetAllTrims();
    tp->index = page;
    tp->trim = trim[tp->index];

    PAGE_ShowHeader(_tr("Trim"));
    PAGE_CreateOkButton(LCD_WIDTH-56, 4, okcancel_cb);

    enum {
        COL1 = (64 + ((LCD_WIDTH - 320) / 2)),
        COL2 = (160 + ((LCD_WIDTH - 320) / 2)),
        ROW1 = (80 + ((LCD_HEIGHT - 240) / 2)),
        ROW2 = (ROW1 + 24),
        ROW3 = (ROW1 + 48),
        ROW4 = (ROW1 + 72),
        ROW5 = (ROW1 + 96),
    };
    //Row 1
    GUI_CreateLabel(&gui_ed->srclbl, COL1, ROW1, NULL, DEFAULT_FONT, _tr("Input"));
    GUI_CreateTextSource(&gui_ed->src, COL2, ROW1, TEXTSELECT_96, NULL, set_source_cb, set_input_source_cb, &tp->trim.src);
    //Row 2
    GUI_CreateLabel(&gui_ed->steplbl, COL1, ROW2, NULL, DEFAULT_FONT, _tr("Trim Step"));
    GUI_CreateTextSelect(&gui_ed->step, COL2, ROW2, TEXTSELECT_96, NULL,
                         set_trimstep_cb, (void *)(long)(tp->index + 0x100)); //0x100: Use tp->trim
    //Row 3
    GUI_CreateLabelBox(&gui_ed->neglbl, COL1, ROW3, COL2-COL1, ROW4-ROW3, &DEFAULT_FONT, NULL, NULL, _tr("Trim -"));
    GUI_CreateTextSelect(&gui_ed->neg, COL2, ROW3, TEXTSELECT_96, NULL, set_trim_cb, &tp->trim.neg);
    //Row 4
    GUI_CreateLabel(&gui_ed->poslbl, COL1, ROW4, NULL, DEFAULT_FONT, _tr("Trim +"));
    GUI_CreateTextSelect(&gui_ed->pos, COL2, ROW4, TEXTSELECT_96, NULL, set_trim_cb, &tp->trim.pos);
    //Row 5
    GUI_CreateLabelBox(&gui_ed->swlbl, COL1, ROW5, COL2-COL1, ROW5-ROW4, &DEFAULT_FONT, NULL, NULL, _tr("Switch"));
    GUI_CreateTextSource(&gui_ed->sw, COL2, ROW5, TEXTSELECT_96, NULL, set_switch_cb, set_input_switch_cb, &tp->trim.sw);
}
Example #2
0
/*            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;
}
Example #3
0
static void _show_limits()
{
    enum {
        COL1 = (8 + ((LCD_WIDTH - 320) / 2)),
        COL2 = (COL1 + 120),
        ROW1 = (40 + ((LCD_HEIGHT - 240) / 2)),
        LABEL_WIDTH = (COL2 - COL1),
    };
    int y = ROW1;
    int height = 20;
    //Row 1
    GUI_CreateLabelBox(&gui->reverselbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Reverse"));
    GUI_CreateTextSelect(&gui->reverse, COL2, y, TEXTSELECT_96, toggle_reverse_cb, reverse_cb, (void *)((long)mp->channel));
    y += height;
    //Row 2
    GUI_CreateLabelBox(&gui->failsafelbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Fail-safe"));
    GUI_CreateTextSelect(&gui->failsafe, COL2, y, TEXTSELECT_96, toggle_failsafe_cb, set_failsafe_cb, NULL);
    y += height;
    //Row 3
    GUI_CreateLabelBox(&gui->safetylbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Safety"));
    GUI_CreateTextSource(&gui->safety, COL2, y, TEXTSELECT_96, sourceselect_cb, set_source_cb, set_input_source_cb, &mp->limit->safetysw);
    y += height;
    //Row 4
    GUI_CreateLabelBox(&gui->safevallbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Safe Val"));
    GUI_CreateTextSelect(&gui->safeval, COL2, y, TEXTSELECT_96, NULL, set_safeval_cb, NULL);
    y += height;
    //Row 5
    GUI_CreateLabelBox(&gui->minlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Min Limit"));
    GUI_CreateTextSelect(&gui->min, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->min);
    y += height;
    //Row 6
    GUI_CreateLabelBox(&gui->maxlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Max Limit"));
    GUI_CreateTextSelect(&gui->max, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->max);
    y += height;
    //Row 5
    GUI_CreateLabelBox(&gui->scaleneglbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, scalestring_cb, NULL, (void *)0L);
    GUI_CreateTextSelect(&gui->scaleneg, COL2, y, TEXTSELECT_96, NULL, set_limitsscale_cb, &mp->limit->servoscale_neg);
    y += height;
    GUI_CreateLabelBox(&gui->scalelbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, scalestring_cb, NULL, (void *)1L);
    GUI_CreateTextSelect(&gui->scale, COL2, y, TEXTSELECT_96, NULL, set_limitsscale_cb, &mp->limit->servoscale);
    y += height;
    //Row 6
    GUI_CreateLabelBox(&gui->subtrimlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Subtrim"));
    GUI_CreateTextSelect(&gui->subtrim, COL2, y, TEXTSELECT_96, NULL, set_trimstep_cb, &mp->limit->subtrim);
    y += height;
    //Row 7
    GUI_CreateLabelBox(&gui->speedlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Speed"));
    GUI_CreateTextSelect(&gui->speed, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->speed);
}
Example #4
0
void PAGE_TrainConfigInit(int page)
{
    (void)page;
    int mode = PPMin_Mode();
    PAGE_ShowHeader(mode == PPM_IN_TRAIN1
                  ? _tr_noop("Trainer Cfg (Channel)")
                  : mode == PPM_IN_TRAIN2
                    ? _tr_noop("Trainer Cfg (Stick)")
                    : _tr_noop("PPMIn Cfg (Extend)"));
    int row = ROW1;
    if (PPMin_Mode() != PPM_IN_SOURCE) {
        GUI_CreateLabelBox(&gui->trainswlbl, COL1, row, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Trainer Sw"));
        GUI_CreateTextSource(&gui->trainsw, COL2, row, TEXTSELECT_96, sourceselect_cb, set_source_cb, set_input_source_cb, &Model.train_sw);
    } else {
        GUI_CreateLabelBox(&gui->numchlbl, COL1, row, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Num Channels"));
        GUI_CreateTextSelect(&gui->numch, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)0L);
    }
    row += 20;
    GUI_CreateLabelBox(&gui->centerpwlbl, COL1, row, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Center PW"));
    GUI_CreateTextSelect(&gui->centerpw, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)1L);
    row += 20;
    GUI_CreateLabelBox(&gui->deltapwlbl, COL1, row, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Delta PW"));
    GUI_CreateTextSelect(&gui->deltapw, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)2L);
    row += 20;
 
    if (PPMin_Mode() == PPM_IN_SOURCE)
        return;

    int num_rows= (MAX_PPM_IN_CHANNELS + 1) / 2;
    for (int i = 0; i < num_rows; i++) {
        long idx = i;
        row += 20;
        if (row > 300) // RBE: should be LCD_HEIGHT - 16(height box) ==> always < 300
            break;
        GUI_CreateLabelBox(&gui->ppmmaplbl[idx], COL1, row, COL3 - COL1, 16, &LABEL_FONT, input_chname_cb, NULL, (void *)idx);
        GUI_CreateTextSelect(&gui->ppmmap[idx], COL3, row, TEXTSELECT_96, NULL, set_chmap_cb, (void *)idx);
        idx += num_rows;
        if (idx >= MAX_PPM_IN_CHANNELS)
            break;
        GUI_CreateLabelBox(&gui->ppmmaplbl[idx], COL4, row, COL5 - COL4, 16, &LABEL_FONT, input_chname_cb, NULL, (void *)idx);
        GUI_CreateTextSelect(&gui->ppmmap[idx], COL5, row, TEXTSELECT_96, NULL, set_chmap_cb, (void *)idx);
    }
}
Example #5
0
void MODELTRAIN_Config()
{
    PAGE_SetModal(1);
    int mode = PPMin_Mode();
    show_titlerow(mode == PPM_IN_TRAIN1
                  ? _tr("Trainer Cfg (Channel)")
                  : mode == PPM_IN_TRAIN2
                    ? _tr("Trainer Cfg (Stick)")
                    : _tr("PPMIn Cfg (Extend)"));
    int row = ROW1;
    if (PPMin_Mode() != PPM_IN_SOURCE) {
        GUI_CreateLabel(&gui->trainswlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Trainer Sw"));
        GUI_CreateTextSource(&gui->trainsw, COL2, row, TEXTSELECT_96, sourceselect_cb, set_source_cb, set_input_source_cb, &Model.train_sw);
    } else {
        GUI_CreateLabel(&gui->numchlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Num Channels"));
        GUI_CreateTextSelect(&gui->numch, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)0L);
    }
    row += 20;
    GUI_CreateLabel(&gui->centerpwlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Center PW"));
    GUI_CreateTextSelect(&gui->centerpw, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)1L);
    row += 20;
    GUI_CreateLabel(&gui->deltapwlbl, COL1, row, NULL, DEFAULT_FONT, _tr("Delta PW"));
    GUI_CreateTextSelect(&gui->deltapw, COL2, row, TEXTSELECT_96, NULL, set_train_cb, (void *)2L);
    row += 20;
 
    if (PPMin_Mode() == PPM_IN_SOURCE)
        return;

    int num_rows= (MAX_PPM_IN_CHANNELS + 1) / 2;
    for (int i = 0; i < num_rows; i++) {
        long idx = i;
        row += 20;
        if (row > 300) // RBE: should be LCD_HEIGHT - 16(height box) ==> always < 300
            break;
        GUI_CreateLabelBox(&gui->ppmmaplbl[idx], COL1, row, 0, 16, &DEFAULT_FONT, input_chname_cb, NULL, (void *)idx);
        GUI_CreateTextSelect(&gui->ppmmap[idx], COL3, row, TEXTSELECT_96, NULL, set_chmap_cb, (void *)idx);
        idx += num_rows;
        if (idx >= MAX_PPM_IN_CHANNELS)
            break;
        GUI_CreateLabelBox(&gui->ppmmaplbl[idx], COL4, row, 0, 16, &DEFAULT_FONT, input_chname_cb, NULL, (void *)idx);
        GUI_CreateTextSelect(&gui->ppmmap[idx], COL5, row, TEXTSELECT_96, NULL, set_chmap_cb, (void *)idx);
    }
}