Ejemplo n.º 1
0
static const char *gyro_output_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    (void)data;
    u8 changed = 1;
    gyro_output = GUI_TextSelectHelper(gyro_output, GYROOUTPUT_GEAR , GYROOUTPUT_AUX2, dir, 2, 2, &changed);
    if (changed) {  // switch gyro output between the gear and the aux2
        // firstly: dynamically create mixes for target gyro channel
        int i;
        for (i = 0; i < GYROMIXER_COUNT; i ++) {
            if(! mp->mixer_ptr[i])
                break;
            mp->mixer[i] = *mp->mixer_ptr[i];
            mp->mixer[i].dest = gyro_output;
        }
        MIXER_SetTemplate(gyro_output, MIXERTEMPLATE_EXPO_DR);
        // secondly: clear mix for original gyro channel
        MIXER_SetTemplate(gyro_output == GYROOUTPUT_GEAR ? GYROOUTPUT_AUX2 : GYROOUTPUT_GEAR, MIXERTEMPLATE_NONE);
        // save mixers
        MIXER_SetMixers(mp->mixer, i);
        // reload mixers because order may change
        int count = STDMIX_GetMixers(mp->mixer_ptr, gyro_output, GYROMIXER_COUNT);
        convert_output_to_percentile();
        for (i = 0; i < count; i ++) {
            GUI_Redraw(&gui->gyro[i]);
        }
    }
    if (gyro_output == GYROOUTPUT_GEAR)
        snprintf(tempstring, sizeof(tempstring), "%s/%s5", _tr("GEAR"), _tr("Ch"));
    else
        snprintf(tempstring, sizeof(tempstring), "%s/%s7", _tr("AUX2"), _tr("Ch"));
    return tempstring;
}
Ejemplo n.º 2
0
void save_switch(int dest, FunctionSwitch switch_type, int thold_sw)
{
    struct Mixer mix[4];
    struct Mixer thold;
    int use_thold = 0;
    int i;
    int sw = INPUT_GetFirstSwitch(mapped_std_channels.switches[switch_type]);
    int count = MIXER_GetMixers(dest, mix, 4);
    if(! count)
        return;
    if(thold_sw && count > 2 && mix[1].sw != mix[count-1].sw) {
        //Pitch uses thold
        thold = mix[count-1];
        use_thold = 1;
    }
    mix[0].sw = 0;
    for(i = 1; i < INPUT_NumSwitchPos(sw); i++) {
        if(i >= count)
            mix[i] = mix[i-1];
        mix[i].sw = sw + i;
    }
    if (use_thold) {
        mix[i] = thold;
        mix[i].sw = 0x80 | thold_sw;
        i++;
    }
    MIXER_SetMixers(mix, i);
}
Ejemplo n.º 3
0
static void okcancel_cb(guiObject_t *obj, const void *data)
{
    (void)obj;
    if (data) {
        //Save mixer here
        MIXER_SetLimit(mp->channel, &mp->limit);
        MIXER_SetTemplate(mp->channel, mp->cur_template);
        MIXER_SetMixers(mp->mixer, mp->num_mixers);
    }
    PAGE_RemoveAllObjects();
    PAGE_MixerInit(mp->top_channel);
}