Add button height auto adaptation

Removed_REF_marker
DiSlord 5 years ago committed by erikkaashoek
parent 21a8798d26
commit 401d0aab86

@ -517,23 +517,19 @@ extern uint16_t graph_bottom;
// Menu Button // Menu Button
// Maximum menu buttons count // Maximum menu buttons count
#ifdef TINYSA4 #ifdef TINYSA4
#define MENU_BUTTON_MAX 12 #define MENU_BUTTON_MAX 16
#define MENU_BUTTON_HEIGHT (LCD_HEIGHT/ 9-1) #define MENU_BUTTON_MIN 9
#define MENU_BUTTON_HEIGHT_10 (LCD_HEIGHT/10-1)
#define MENU_BUTTON_HEIGHT_11 (LCD_HEIGHT/11-1)
#define MENU_BUTTON_HEIGHT_12 (LCD_HEIGHT/12-1)
#else #else
#define MENU_BUTTON_MAX 12 #define MENU_BUTTON_MAX 16
#define MENU_BUTTON_HEIGHT (LCD_HEIGHT/ 8-1) #define MENU_BUTTON_MIN 8
#define MENU_BUTTON_HEIGHT_10 (LCD_HEIGHT/10-1)
#define MENU_BUTTON_HEIGHT_11 (LCD_HEIGHT/11-1)
#define MENU_BUTTON_HEIGHT_12 (LCD_HEIGHT/12-1)
#endif #endif
#define MENU_BUTTON_WIDTH 80 #define MENU_BUTTON_WIDTH 80
#define MENU_BUTTON_BORDER 1 #define MENU_BUTTON_BORDER 1
#define KEYBOARD_BUTTON_BORDER 2 #define KEYBOARD_BUTTON_BORDER 2
#define FORM_BUTTON_BORDER 2 #define FORM_BUTTON_BORDER 2
#define MENU_BUTTON_HEIGHT_N(n) (LCD_HEIGHT/(n)-1)
// Define message box width // Define message box width
#define MESSAGE_BOX_WIDTH 180 #define MESSAGE_BOX_WIDTH 180

@ -64,7 +64,7 @@ static uint16_t last_button = 0b0000;
static uint32_t last_button_down_ticks; static uint32_t last_button_down_ticks;
static uint32_t last_button_repeat_ticks; static uint32_t last_button_repeat_ticks;
static uint16_t menu_button_height = MENU_BUTTON_HEIGHT; static uint16_t menu_button_height = MENU_BUTTON_HEIGHT_N(MENU_BUTTON_MIN);
volatile uint8_t operation_requested = OP_NONE; volatile uint8_t operation_requested = OP_NONE;
int8_t previous_marker = MARKER_INVALID; int8_t previous_marker = MARKER_INVALID;
@ -818,9 +818,9 @@ ensure_selection(void)
if (selection < 0) selection = -1; if (selection < 0) selection = -1;
if (selection >= i) selection = i-1; if (selection >= i) selection = i-1;
if (MT_MASK(menu[0].type) == MT_TITLE && selection == 0) selection = 1; if (MT_MASK(menu[0].type) == MT_TITLE && selection == 0) selection = 1;
if (i < MENU_BUTTON_MIN) i = MENU_BUTTON_MIN;
static const uint8_t button_h[] = {MENU_BUTTON_HEIGHT, MENU_BUTTON_HEIGHT_10, MENU_BUTTON_HEIGHT_11, MENU_BUTTON_HEIGHT_12}; if (i >= MENU_BUTTON_MAX) i = MENU_BUTTON_MAX;
menu_button_height = button_h[menu[i].data&3]; menu_button_height = MENU_BUTTON_HEIGHT_N(i);
} }
static void static void

@ -2098,7 +2098,7 @@ static const menuitem_t menu_rbw[] = {
{ MT_ADV_CALLBACK, 7, "%sHz", menu_rbw_acb}, { MT_ADV_CALLBACK, 7, "%sHz", menu_rbw_acb},
{ MT_ADV_CALLBACK, 8, "%sHz", menu_rbw_acb}, { MT_ADV_CALLBACK, 8, "%sHz", menu_rbw_acb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, MENU_BUTTON_HEIGHT_10, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
#else #else
{ MT_ADV_CALLBACK, 1, "%4dkHz", menu_rbw_acb}, { MT_ADV_CALLBACK, 1, "%4dkHz", menu_rbw_acb},
{ MT_ADV_CALLBACK, 2, "%4dkHz", menu_rbw_acb}, { MT_ADV_CALLBACK, 2, "%4dkHz", menu_rbw_acb},

Loading…
Cancel
Save

Powered by TurnKey Linux.