From 90e51194709afa3168162f22b0f6c6d634067327 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 8 Dec 2020 10:19:43 +0100 Subject: [PATCH 1/2] Three stage item spacing --- ui_sa.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ui_sa.c b/ui_sa.c index 08c569f..5f06a48 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -2274,15 +2274,22 @@ int invoke_quick_menu(int y) } #define YSTEP 8 -int double_space = false; +enum { ITEM_NO_SPACE = 0, ITEM_NORMAL_SPACE= 1, ITEM_DOUBLE_SPACE = 2 }; + +int item_space = ITEM_NORMAL_SPACE; int add_quick_menu(char *buf, int x, int y, menuitem_t *menu) { ili9341_drawstring(buf, x, y); - if (double_space) - y += YSTEP + YSTEP; - else - y += YSTEP + YSTEP/2 ; + y += YSTEP; + switch (item_space) { + case ITEM_NORMAL_SPACE: + y += YSTEP/2 ; + break; + case ITEM_DOUBLE_SPACE: + y += YSTEP; + break; + } if (max_quick_menu LCD_HEIGHT*3 && double_space) { - double_space = false; + + if (y*4 >= LCD_HEIGHT*3 && item_space > ITEM_NO_SPACE) { + item_space--; // Reduce item spacing goto redraw_cal_status; } - if (y*3 < LCD_HEIGHT*2 && !double_space) { - double_space = true; + if ((y + (max_quick_menu+1) * YSTEP/2)* 4 < LCD_HEIGHT*3 && item_space < ITEM_DOUBLE_SPACE) { + item_space++; // Increase item spacing goto redraw_cal_status; } From 561547a48eb5f6fd7a1cda78254e6e58a25ead37 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 8 Dec 2020 10:59:54 +0100 Subject: [PATCH 2/2] More status panel space --- nanovna.h | 2 ++ plot.c | 8 ++++---- ui_sa.c | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nanovna.h b/nanovna.h index e920074..ab030b0 100644 --- a/nanovna.h +++ b/nanovna.h @@ -335,6 +335,8 @@ extern uint16_t graph_bottom; #define GRIDY (CHART_BOTTOM / NGRIDY) #endif +#define BATTERY_START (LCD_HEIGHT-40) + #define WIDTH (LCD_WIDTH - 1 - OFFSETX) #define HEIGHT (GRIDY*NGRIDY) diff --git a/plot.c b/plot.c index f3db3f2..df19c5b 100644 --- a/plot.c +++ b/plot.c @@ -2291,14 +2291,14 @@ draw_frequencies(void) #endif ili9341_set_foreground(LCD_FG_COLOR); ili9341_set_background(LCD_BG_COLOR); - ili9341_fill(0, FREQUENCIES_YPOS, LCD_WIDTH, FONT_GET_HEIGHT); + ili9341_fill(FREQUENCIES_XPOS1, FREQUENCIES_YPOS, LCD_WIDTH- FREQUENCIES_XPOS1, FONT_GET_HEIGHT); if (uistat.lever_mode == LM_CENTER) buf1[0] = S_SARROW[0]; if (uistat.lever_mode == LM_SPAN) buf2[0] = S_SARROW[0]; // int p2 = FREQUENCIES_XPOS2; // if (FREQ_IS_CW()) { - int p2 = LCD_WIDTH - FONT_MAX_WIDTH*strlen(buf2); + int p2 = LCD_WIDTH - FONT_WIDTH*strlen(buf2); // } ili9341_drawstring(buf2, p2, FREQUENCIES_YPOS); ili9341_drawstring(buf1, FREQUENCIES_XPOS1, FREQUENCIES_YPOS); @@ -2367,9 +2367,9 @@ static void draw_battery_status(void) string_buf[x++] = 0b10000001; string_buf[x++] = 0b11111111; // Draw battery - blit8BitWidthBitmap(7, LCD_HEIGHT-50, 8, x, string_buf); + blit8BitWidthBitmap(7, BATTERY_START, 8, x, string_buf); plot_printf((char*)string_buf, sizeof string_buf, "%.2fv", vbat/1000.0); - ili9341_drawstring((char*)string_buf, 1, LCD_HEIGHT-50+x+3); + ili9341_drawstring((char*)string_buf, 1, BATTERY_START+x+3); } void diff --git a/ui_sa.c b/ui_sa.c index 5f06a48..6468d70 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -2314,7 +2314,7 @@ redraw_cal_status: x = 0; y = OFFSETY; ili9341_set_background(LCD_BG_COLOR); - ili9341_fill(0, 0, OFFSETX, CHART_BOTTOM); + ili9341_fill(0, 0, OFFSETX, LCD_HEIGHT); max_quick_menu = 0; if (MODE_OUTPUT(setting.mode)) { // No cal status during output return; @@ -2591,11 +2591,11 @@ redraw_cal_status: ili9341_drawstring(buf, x, y); - if (y*4 >= LCD_HEIGHT*3 && item_space > ITEM_NO_SPACE) { + if (y >= BATTERY_START && item_space > ITEM_NO_SPACE) { item_space--; // Reduce item spacing goto redraw_cal_status; } - if ((y + (max_quick_menu+1) * YSTEP/2)* 4 < LCD_HEIGHT*3 && item_space < ITEM_DOUBLE_SPACE) { + if ((y + (max_quick_menu+1) * YSTEP/2) < BATTERY_START && item_space < ITEM_DOUBLE_SPACE) { item_space++; // Increase item spacing goto redraw_cal_status; } @@ -2603,7 +2603,7 @@ redraw_cal_status: // ili9341_set_background(LCD_BG_COLOR); if (!get_waterfall()) { // Do not draw bottom level if in waterfall mode // Bottom level - y = area_height - 8 + OFFSETY; + y = area_height + OFFSETY; if (rounding) plot_printf(buf, BLEN, "%4d", (int)(yMax - setting.scale * NGRIDY)); else