Example #1
0
void proto_press_cb(guiObject_t *obj, void *data)
{
    (void)data;
    (void)obj;
    if(PROTOCOL_GetOptions()) {
        PAGE_PushByID(PAGEID_PROTOCFG, 0);
    }
}
Example #2
0
void proto_press_cb(guiObject_t *obj, void *data)
{
    (void)data;
    (void)obj;
    if(PROTOCOL_GetOptions()) {
        PAGE_RemoveAllObjects();
        MODELPROTO_Config();
    }
}
Example #3
0
void PAGE_ModelProtoInit(int page)
{
    (void)page;
    PAGE_ShowHeader(PROTOCOL_Name());
    proto_strs = PROTOCOL_GetOptions();
    int row = ROW1;
    int pos = 0;
    long idx = 0;
    while(idx < NUM_PROTO_OPTS) {
        if(proto_strs[pos] == NULL)
            break;
        GUI_CreateLabelBox(&gui->protolbl[idx], COL1, row, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, proto_strs[pos]);
        GUI_CreateTextSelect(&gui->proto[idx], COL2, row, TEXTSELECT_96, NULL, proto_opt_cb, (void *)idx);
        while(proto_strs[++pos])
            ;
        pos++;
        idx++;
        row += 24;
    }
}
Example #4
0
void MODELPROTO_Config()
{
    PAGE_SetModal(1);
    show_titlerow(ProtocolNames[Model.protocol]);
    proto_strs = PROTOCOL_GetOptions();
    int row = ROW1;
    int pos = 0;
    long idx = 0;
    while(idx < NUM_PROTO_OPTS) {
        if(proto_strs[pos] == NULL)
            break;
        GUI_CreateLabel(&gui->protolbl[idx], COL1, row, NULL, DEFAULT_FONT, _tr(proto_strs[pos]));
        GUI_CreateTextSelect(&gui->proto[idx], COL2, row, TEXTSELECT_96, NULL, proto_opt_cb, (void *)idx);
        while(proto_strs[++pos])
            ;
        pos++;
        idx++;
        row += 24;
    }
}
Example #5
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;
}
Example #6
0
void PAGE_ModelProtoInit(int page)
{
    (void) page;
    show_titlerow(ProtocolNames[Model.protocol]);

    proto_strs = PROTOCOL_GetOptions();
    int idx = 0;
    int pos = 0;
    while(idx < NUM_PROTO_OPTS) {
        if(proto_strs[pos] == NULL)
            break;
        while(proto_strs[++pos])
            ;
        pos++;
        idx++;
    }

    GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT,
                         LINE_SPACE, idx, row2_cb, NULL, NULL, NULL);
    GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0));
}