Beispiel #1
0
const char *MIXPAGE_ChanNameProtoCB(guiObject_t *obj, const void *data)
{
    (void)obj;
    u8 ch = (long)data;
    u8 proto_map_length = PROTO_MAP_LEN;
    char tmp1[30];

    /* See if we need to name the cyclic virtual channels */
    if (_is_virt_cyclic(ch)) {
        switch(ch - NUM_OUT_CHANNELS) {
            case 0: snprintf(tempstring, sizeof(tempstring), "%s-%s", _tr("CYC"), _tr("AIL")); return tempstring;
            case 1: snprintf(tempstring, sizeof(tempstring), "%s-%s", _tr("CYC"), _tr("ELE")); return tempstring;
            case 2: snprintf(tempstring, sizeof(tempstring), "%s-%s", _tr("CYC"), _tr("COL")); return tempstring;
        }
    }
    #if defined(_DEVO7E_256_TARGET_H_) || defined(_T8SG_TARGET_H_)
    #define SWITCH_NOSTOCK ((1 << INP_HOLD0) | (1 << INP_HOLD1) | \
                            (1 << INP_FMOD0) | (1 << INP_FMOD1))
    if ((Transmitter.ignore_src & SWITCH_NOSTOCK) == SWITCH_NOSTOCK)
        proto_map_length = PROTO_MAP_LEN - 1;
    #endif
    if (ch < proto_map_length && ProtocolChannelMap[Model.protocol]) {
        INPUT_SourceNameAbbrevSwitch(tmp1, ProtocolChannelMap[Model.protocol][ch]);
        sprintf(tempstring, "%s%d-%s",
            (Model.limits[ch].flags & CH_REVERSE) ? "!" : "",
            (int)(ch + 1), tmp1);
    } else {
        INPUT_SourceName(tmp1, ch + NUM_INPUTS + 1);
        sprintf(tempstring, "%s%s",
                (ch < Model.num_channels && Model.limits[ch].flags & CH_REVERSE) ? "!" : "",
                tmp1);
    }
    return tempstring;
}
Beispiel #2
0
static void _show_page()
{
    u8 h = 12;
    int i;
    PAGE_RemoveAllObjects();
    PAGE_ShowHeader(_tr("Mixer"));
    memset(gui, 0, sizeof(*gui));

    struct Mixer *mix = MIXER_GetAllMixers();
    u8 space = ITEM_HEIGHT + 1;
    u8 row = space;
    u8 w1 = 50;
    u8 w2 = LCD_WIDTH - w1 - ARROW_WIDTH - 4;
    for (i = 0; row < space * 5; i++) {
        u8 idx;
        labelDesc.style = LABEL_LEFT;
        u8 ch = mp->top_channel + i;
        if (ch >= Model.num_channels)
            ch += (NUM_OUT_CHANNELS - Model.num_channels);
        if (ch < NUM_OUT_CHANNELS) {
            GUI_CreateButtonPlateText(&gui->limit[i], 0, row, w1, h,&labelDesc, MIXPAGE_ChanNameProtoCB, 0,
                    limitselect_cb, (void *)((long)ch));
        } else if(! _is_virt_cyclic(ch)) {
            GUI_CreateButtonPlateText(&gui->limit[i], 0, row, w1, h,&labelDesc, MIXPAGE_ChanNameProtoCB, 0,
                    virtname_cb, (void *)((long)ch));
        } else {
            GUI_CreateLabelBox(&gui->name[i], 0, row, w1, h, &labelDesc,
                                   MIXPAGE_ChanNameProtoCB, NULL, (const void *)((long)ch));
        }

        labelDesc.style = LABEL_CENTER;
        GUI_CreateButtonPlateText(&gui->tmpl[i], w1 + 2, row, w2, h , &labelDesc, template_name_cb, 0,
                templateselect_cb, (void *)((long)ch));

        row += space; // bug fix: dynamically showing/hiding items won't work in devo10, it causes crash when changing template from none to simple/expo/complex
        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);
            labelDesc.style = LABEL_LEFTCENTER;
            GUI_CreateLabelBox(&gui->src[i], 0, row, w1, h, &labelDesc, show_source, NULL, &mix[idx].src);
            if (template == MIXERTEMPLATE_EXPO_DR) {
Beispiel #3
0
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) {
Beispiel #4
0
static int row_cb(int absrow, int relrow, int y, void *data)
{
    (void)data;
    u8 idx;
    struct Mixer *mix = MIXER_GetAllMixers();

    int selectable = 2;
    int channel = absrow;
    if (channel >= Model.num_channels)
        channel += (NUM_OUT_CHANNELS - Model.num_channels);
    if (channel < NUM_OUT_CHANNELS) {
        labelDesc.style = LABEL_LEFT;
        GUI_CreateButtonPlateText(&gui->limit[relrow], COL1_X, y, COL1_W, LINE_HEIGHT, &labelDesc, MIXPAGE_ChanNameProtoCB, 0,
                                  limitselect_cb, (void *)((long)channel));
    } else if(! _is_virt_cyclic(channel)) {
        GUI_CreateButtonPlateText(&gui->limit[relrow], COL1_X, y, COL1_W, LINE_HEIGHT, &labelDesc, MIXPAGE_ChanNameProtoCB, 0,
                                  virtname_cb, (void *)((long)channel));
    } else {
        GUI_CreateLabelBox(&gui->name[relrow], COL1_X, y, COL1_W, LINE_HEIGHT, &labelDesc,
                           MIXPAGE_ChanNameProtoCB, NULL, (const void *)((long)channel));
        selectable = 1;
    }
    labelDesc.style = LABEL_CENTER;
    GUI_CreateButtonPlateText(&gui->tmpl[relrow], COL2_X, y, COL2_W, LINE_HEIGHT , &labelDesc, template_name_cb, 0,
                              templateselect_cb, (void *)((long)channel));

    for (idx = 0; idx < NUM_MIXERS; idx++)
        if (mix[idx].src && mix[idx].dest == channel)
            break;
    if (idx != NUM_MIXERS) {
        // don't show source if curve type is fixed, works only for the first mix per channel
        if(CURVE_TYPE(&mix[idx].curve) != CURVE_FIXED) {
            labelDesc.style = LABEL_LEFT;
            GUI_CreateLabelBox(&gui->src[relrow], COL3_X, y, COL3_W , LINE_HEIGHT, &labelDesc, show_source, NULL, &mix[idx].src);
        }
    }
    return selectable;
}