コード例 #1
0
ファイル: main.c プロジェクト: theseankelly/deviation
void medium_priority_cb()
{
#ifdef TIMING_DEBUG
    debug_timing(3, 0);
#endif
    MIXER_CalcChannels();
#ifdef TIMING_DEBUG
    debug_timing(3, 1);
#endif
}
コード例 #2
0
static void okcancel_cb(guiObject_t *obj, const void *data)
{
    int msg = (long)data;
    (void)obj;
    if (msg == LOAD_MODEL + 1) {
        /* Load Model */
        if (mp->selected != CONFIG_GetCurrentModel()) { // don't do that if model didn't change
            CONFIG_SaveModelIfNeeded();
            PROTOCOL_DeInit();
            CONFIG_ReadModel(mp->selected);
            CONFIG_SaveTxIfNeeded();  //Save here to ensure in case of crash we restart on the right model
            /* Need to recalculate channels to see if we're in a safe state */
            MIXER_Init();
            MIXER_CalcChannels();
            PROTOCOL_Init(0);
        }
    } else if (msg == SAVE_MODEL + 1) {
        /* Save Model */
        CONFIG_WriteModel(mp->selected);
        CONFIG_ReadModel(mp->selected);  //Reload the model after saving to switch (for future saves)
    } else if (msg == LOAD_TEMPLATE + 1) {
        /* Load Template */
        get_idx_filename(tempstring, "template", ".ini", mp->selected-1, "");
        CONFIG_ReadTemplate(tempstring);
    } else if (msg == LOAD_ICON + 1) {
        if (mp->selected == 1)
            Model.icon[0] = 0;
        else
            strcpy(Model.icon, mp->iconstr);
    } else if (msg == LOAD_LAYOUT + 1) {
        /* Load Layout */
        if (mp->selected > mp->file_state) {
            sprintf(tempstring, "models/model%d.ini", mp->selected - mp->file_state);
        } else {
            get_idx_filename(tempstring, "layout", ".ini", mp->selected-1, "layout/");
        }
        CONFIG_ReadLayout(tempstring);
    }
    PAGE_SetModal(0);
    PAGE_RemoveAllObjects();
    mp->return_page(-1);  // -1 for devo10 means return to the focus of previous page, which is important so that users don't need to scroll down from the 1st item
}