void PAGE_SplashEvent() { static unsigned int time=0; #if HAS_EXTENDED_AUDIO static unsigned int time_startup_msg; #endif if(GUI_IsModal()) return; // u8 step = 5; if ( 0 == time ) { time = CLOCK_getms() + Transmitter.splash_delay * 100; #if HAS_EXTENDED_AUDIO time_startup_msg = CLOCK_getms() + 5 * 100; // Dealy 0.5 second to play startup audio #endif } #if HAS_EXTENDED_AUDIO if (time_startup_msg && (CLOCK_getms() > time_startup_msg) ) { AUDIO_SetVolume(); MUSIC_Play(MUSIC_STARTUP); time_startup_msg = 0; } #endif if ( CLOCK_getms() > time ) PAGE_ChangeByID(PAGEID_MAIN,0); /* if ( offset > 0 ) { offset -= step; GUI_ChangeImage(&gui->splash_image,SPLASH_FILE,offset,0); GUI_Redraw(&gui->splash_image); }*/ }
void PAGE_Change(int dir) { if ( modal || GUI_IsModal()) return; if (Model.mixer_mode != 0 || (cur_page >= sizeof(groups) / sizeof(struct page_group) - 1) || groups[cur_page].group & 0x80) { //Don't use left/right on model pages in standard mode return; } u8 nextpage = cur_page; if(dir > 0) { if (groups[nextpage+1].group == groups[cur_page].group) { nextpage++; } else { while(nextpage && groups[nextpage-1].group == groups[cur_page].group) nextpage--; } } else if (dir < 0) { if (nextpage && groups[nextpage-1].group == groups[cur_page].group) { nextpage--; } else { while(groups[nextpage+1].group == groups[cur_page].group) nextpage++; } } if (cur_page == nextpage) return; PAGE_Exit(); PAGE_ChangeByID(groups[nextpage].id); }
static unsigned _action_cb(u32 button, unsigned flags, void *data) { (void)data; (void)button; (void)flags; PAGE_ChangeByID(PAGEID_MAIN, 0); return 1; }
static void okcancel_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ChangeByID(PAGEID_TXCFG); }
void newelem_press_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; //PAGE_MainLayoutExit(); create_element(); current_selected = 0; PAGE_ChangeByID(PAGEID_MAINCFG, 0); }
static void okcancel_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; RTC_SetValue(RTC_GetSerial(Rtc.value[3], Rtc.value[4], Rtc.value[5]-RTC_STARTYEAR, Rtc.value[2], Rtc.value[1], Rtc.value[0])); PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ChangeByID(PAGEID_TXCFG); }
static u8 _action_cb(u32 button, u8 flags, void *data) { (void)data; if ((flags & BUTTON_PRESS) || (flags & BUTTON_LONGPRESS)) { if (CHAN_ButtonIsPressed(button, BUT_EXIT)) { PAGE_ChangeByID(PAGEID_MENU, PREVIOUS_ITEM); } } return 1; }
static unsigned _action_cb(u32 button, unsigned flags, void *data) { (void)data; if (flags & BUTTON_PRESS || (flags & BUTTON_LONGPRESS)) { if (CHAN_ButtonIsPressed(button, BUT_EXIT)) { PAGE_ChangeByID(PAGEID_MENU, PREVIOUS_ITEM); } else { // only one callback can handle a button press, so we don't handle BUT_ENTER here, let it handled by press cb return 0; } } return 1; }
static u8 _action_cb(u32 button, u8 flags, void *data) { (void)data; if (flags & BUTTON_PRESS) { if (CHAN_ButtonIsPressed(button, BUT_EXIT)) { labelDesc.font = DEFAULT_FONT.font; if (cp->return_val == 2) // indicating this page is entered from calibration page, so back to its parent page PAGE_ChangeByID(PAGEID_TXCFG, -1); else PAGE_ChangeByID(PAGEID_MENU, PREVIOUS_ITEM); } else if (CHAN_ButtonIsPressed(button, BUT_RIGHT)) { _navigate_pages(1); } else if (CHAN_ButtonIsPressed(button,BUT_LEFT)) { _navigate_pages(-1); } else { // only one callback can handle a button press, so we don't handle BUT_ENTER here, let it handled by press cb return 0; } } return 1; }
void PAGE_SplashInit(int page) { (void)page; if(Transmitter.splash_delay == 0) { PAGE_ChangeByID(PAGEID_MAIN, 0); return; } PAGE_RemoveAllObjects(); PAGE_SetActionCB(_action_cb); GUI_CreateLabelBox(&gui->splash_text, 3*ITEM_SPACE, 4*LINE_HEIGHT, 0, 0, &MODELNAME_FONT, NULL, NULL, _tr("Deviation")); GUI_CreateLabelBox(&gui->version, 0, 7*LINE_HEIGHT, 0, 0, &DEFAULT_FONT, NULL, NULL, DeviationVersion); }
void PAGE_SplashInit(int page) { (void)page; if(Transmitter.splash_delay == 0) { PAGE_ChangeByID(PAGEID_MAIN, 0); return; } PAGE_SetActionCB(_action_cb); u16 w, h; LCD_ImageDimensions(SPLASH_FILE, &w, &h); //GUI_CreateImageOffset(&gui->splash_image, 15, 10, w-offset, h-5, offset, 0, SPLASH_FILE, NULL, NULL); if( w < LCD_WIDTH - 1 && h < LCD_HEIGHT - LINE_HEIGHT - 3) GUI_CreateImageOffset(&gui->splash_image, (LCD_WIDTH-w)/2, (LCD_HEIGHT-h-LINE_HEIGHT)/2, w, h, 0, 0, SPLASH_FILE, NULL, NULL); GUI_CreateLabelBox(&gui->version, 0, LCD_HEIGHT - LINE_HEIGHT - 1 , LCD_WIDTH, LINE_HEIGHT, &TINY_FONT, NULL, NULL, DeviationVersion); }
void PAGE_Init() { cur_page = sizeof(pages) / sizeof(struct page) - 1; cur_section = 0; modal = 0; GUI_RemoveAllObjects(); enter_cmd = NULL; exit_cmd = NULL; BUTTON_RegisterCallback(&button_action, CHAN_ButtonMask(BUT_ENTER) | CHAN_ButtonMask(BUT_EXIT) | CHAN_ButtonMask(BUT_RIGHT) | CHAN_ButtonMask(BUT_LEFT), BUTTON_PRESS | BUTTON_LONGPRESS, page_change_cb, NULL); PAGE_ChangeByID(PAGEID_SPLASH); //PAGE_ChangeByID(PAGEID_MAIN); }
void PAGE_ChangeQuick(int dir) { int quick = 0; for (int i = 0; i < NUM_QUICKPAGES; i++) { if(Model.pagecfg2.quickpage[i] && Model.pagecfg2.quickpage[i] == cur_page) { quick = i+1; break; } } int increment = dir > 0 ? 1 : NUM_QUICKPAGES; while(1) { quick = (quick + increment) % 5; if (quick == 0 || (Model.pagecfg2.quickpage[quick-1] && PAGE_IsValid(Model.pagecfg2.quickpage[quick-1]))) { break; } } if (quick == 0) { PAGE_ChangeByID(PAGEID_MAIN); } else { PAGE_ChangeByID(Model.pagecfg2.quickpage[quick-1]); } }
void PAGE_SplashEvent() { static unsigned int time=0; if(GUI_IsModal()) return; // u8 step = 5; if ( 0 == time ) time = CLOCK_getms() + Transmitter.splash_delay * 100; if ( CLOCK_getms() > time ) PAGE_ChangeByID(PAGEID_MAIN,0); /* if ( offset > 0 ) { offset -= step; GUI_ChangeImage(&gui->splash_image,SPLASH_FILE,offset,0); GUI_Redraw(&gui->splash_image); }*/ }
static void press_cb(guiObject_t *obj, const void *data) { (void)obj; cp->enable = (long)data; #if HAS_RTC if (cp->enable == SET_CLOCK) { PAGE_ChangeByID(PAGEID_RTC); return; } #endif #if HAS_TOUCH if (cp->enable == CALIB_TOUCH) init_touch_calib(); else if (cp->enable == CALIB_STICK) #endif calibrate_state = CALI_CENTER; // bug fix: must reset state before calibrating }
static unsigned _action_cb(u32 button, unsigned flags, void *data) { u8 i; if ((flags & BUTTON_PRESS) && CHAN_ButtonIsPressed(button, BUT_ENTER)) { u8 page = (0 << 4) | MENUTYPE_MAINMENU; PAGE_ChangeByID(PAGEID_MENU, page); } else if ((flags & BUTTON_PRESS) && CHAN_ButtonIsPressed(button, BUT_RIGHT)) { for ( i=0; i< NUM_TIMERS; i++) TIMER_StartStop(i); } else if ((flags & BUTTON_PRESS) && CHAN_ButtonIsPressed(button, BUT_LEFT)) { for ( i=0; i< NUM_TIMERS; i++) TIMER_Reset(i); } else if (! PAGE_QuickPage(button, flags, data)) { MIXER_UpdateTrim(button, flags, data); } return 1; }
void PAGE_Init() { cur_page = 0; modal = 0; page_scrollable = NULL; GUI_RemoveAllObjects(); enter_cmd = NULL; exit_cmd = NULL; BUTTON_RegisterCallback(&button_action, CHAN_ButtonMask(BUT_ENTER) | CHAN_ButtonMask(BUT_EXIT) | CHAN_ButtonMask(BUT_LEFT) | CHAN_ButtonMask(BUT_RIGHT) | CHAN_ButtonMask(BUT_UP) | CHAN_ButtonMask(BUT_DOWN), BUTTON_PRESS | BUTTON_LONGPRESS | BUTTON_RELEASE | BUTTON_PRIORITY, page_change_cb, NULL); PAGE_ChangeByID(PAGEID_SPLASH, 0); //PAGE_ChangeByID(PAGEID_MAIN); }
void PAGE_SetSection(u8 section) { u8 p; u8 newpage = cur_page; if (section == SECTION_MODEL && Model.mixer_mode == MIXER_STANDARD) section = 0x80 | SECTION_MODEL; for(p = 0; groups[p].group != 255; p++) { if(groups[p].group == section) { newpage = p; break; } } if (newpage != cur_page) { cur_section = section; PAGE_ChangeByID(groups[newpage].id); } }
static unsigned _action_cb(u32 button, unsigned flags, void *data) { (void)data; if ((flags & BUTTON_PRESS) || (flags & BUTTON_LONGPRESS)) { if (CHAN_ButtonIsPressed(button, BUT_EXIT)) { labelDesc.font = DEFAULT_FONT.font; // set it back to 12x12 font PAGE_ChangeByID(PAGEID_MENU, PREVIOUS_ITEM); } else if (current_page != telemetry_off) { // this indicates whether telem is off or not supported if (CHAN_ButtonIsPressed(button, BUT_RIGHT)) { _navigate_pages(1); } else if (CHAN_ButtonIsPressed(button,BUT_LEFT)) { _navigate_pages(-1); } else { return 0; } } else { // only one callback can handle a button press, so we don't handle BUT_ENTER here, let it handled by press cb return 0; } } return 1; }
static void ico_select_cb(guiObject_t *obj, const void *data) { (void)obj; u16 pos = (long)data; PAGE_ChangeByID(menus[pos].id); }
static void goto_mainpage(guiObject_t *obj, const void *data) { (void)obj; (void)data; PAGE_ChangeByID(PAGEID_MAIN); }
void MODELMENU_Show(guiObject_t *obj, const void *data) { (void)obj; (void)data; PAGE_ChangeByID(PAGEID_MODELMENU); }