static unsigned _action_cb(u32 button, unsigned flags, void *data) { if (CHAN_ButtonIsPressed(button, BUT_RIGHT) || CHAN_ButtonIsPressed(button, BUT_LEFT)) { if (flags & BUTTON_RELEASE) { _navigate_pages(CHAN_ButtonIsPressed(button, BUT_RIGHT) ? 1 : -1); } return 1; } return default_button_action_cb(button, flags, data); }
static unsigned _action_cb(u32 button, unsigned flags, void *data) { if (current_page != telemetry_off && (CHAN_ButtonIsPressed(button, BUT_RIGHT) || CHAN_ButtonIsPressed(button, BUT_LEFT))) { if (flags & BUTTON_RELEASE) { _navigate_pages(CHAN_ButtonIsPressed(button, BUT_RIGHT) ? 1 : -1); } return 1; } if (flags & BUTTON_PRESS && (CHAN_ButtonIsPressed(button, BUT_ENTER) || CHAN_ButtonIsPressed(button, BUT_EXIT))) { TELEMETRY_MuteAlarm(); } return default_button_action_cb(button, flags, data); }
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; }
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; }