Example #1
0
unsigned page_change_cb(u32 buttons, unsigned flags, void *data)
{
    (void)data;
    if (PAGE_GetID() == PAGEID_TELEMMON) {
        if(CHAN_ButtonIsPressed(buttons, BUT_ENTER) || CHAN_ButtonIsPressed(buttons, BUT_EXIT))
            TELEMETRY_MuteAlarm();
        if(flags & BUTTON_LONGPRESS && CHAN_ButtonIsPressed(buttons, BUT_UP))
            TELEMETRY_ResetValues();
    }
    if (flags & BUTTON_LONGPRESS) {
        if (flags & BUTTON_REPEAT)
            return 0;
        if(quick_page_enabled) { // let the quickpage over other pages
            if(PAGE_QuickPage(buttons, flags, data))
                return 1;
        }        
        if(CHAN_ButtonIsPressed(buttons, BUT_ENTER) && enter_cmd) {
            void (*cmd)(guiObject_t *obj, const void *data) = enter_cmd;
            PAGE_RemoveAllObjects();
            cmd(NULL, enter_data);
            return 1;
        }
        if(CHAN_ButtonIsPressed(buttons, BUT_EXIT) && exit_cmd) {
            void (*cmd)(guiObject_t *obj, const void *data) = exit_cmd;
            PAGE_RemoveAllObjects();
            cmd(NULL, exit_data);
            return 1;
        }
        return 0;
    }
    if (ActionCB != NULL)
        return ActionCB(buttons, flags, data);
//    if(CHAN_ButtonIsPressed(buttons, BUT_RIGHT)) {
//        PAGE_Change(1);
//        return 1;
//    } else if(CHAN_ButtonIsPressed(buttons, BUT_LEFT)) {
//        PAGE_Change(-1);
//        return 1;
//    }
    return 0;
}
Example #2
0
void PAGE_ShowTelemetryAlarm()
{
    int cur_page = PAGE_GetID();
    if (cur_page != PAGEID_TELEMMON && cur_page != PAGEID_TELEMCFG)
        PAGE_Pop();
}