示例#1
0
static const char *protoselect_cb(guiObject_t *obj, int dir, void *data)
{
    (void)data;
    (void)obj;
    u8 changed;
    enum Protocols new_protocol;
    new_protocol = GUI_TextSelectHelper(Model.protocol, PROTOCOL_NONE, PROTOCOL_COUNT-1, dir, 1, 1, &changed);
    if (changed) {
        const u8 *oldmap = ProtocolChannelMap[Model.protocol];
    	// DeInit() the old protocol (Model.protocol unchanged)
        PROTOCOL_DeInit();
        // Load() the new protocol
        Model.protocol = new_protocol;
        PROTOCOL_Load(1);
        TELEMETRY_SetTypeByProtocol(Model.protocol);
        Model.num_channels = PROTOCOL_DefaultNumChannels();
        if (! PROTOCOL_HasPowerAmp(Model.protocol))
            Model.tx_power = TXPOWER_150mW;
        else
            Model.tx_power = mp->last_txpower;
        memset(Model.proto_opts, 0, sizeof(Model.proto_opts));
        guiObject_t *obj = _get_obj(ITEM_NUMCHAN, 0);
        if (obj)
            GUI_Redraw(obj);
        obj = _get_obj(ITEM_TXPOWER, 0);
        if (obj)
            GUI_Redraw(obj);
        if (Model.mixer_mode == MIXER_STANDARD)
            STDMIXER_SetChannelOrderByProtocol();
        else
            RemapChannelsForProtocol(oldmap);
        configure_bind_button();
    }
    GUI_TextSelectEnablePress((guiTextSelect_t *)obj, PROTOCOL_GetOptions() ? 1 : 0);
    if (Model.protocol == 0)
        return _tr("None");
    if(PROTOCOL_HasModule(Model.protocol))
        return ProtocolNames[Model.protocol];
    sprintf(tempstring, "*%s", ProtocolNames[Model.protocol]);
    return tempstring;
}
示例#2
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);
    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();
}
示例#3
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();
}