diff --git a/nanovna.h b/nanovna.h index 6863bf6..4bb5a55 100644 --- a/nanovna.h +++ b/nanovna.h @@ -343,6 +343,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 da67660..65a3415 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 dc3418f..b987ec1 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -2357,15 +2357,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 >= BATTERY_START && 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) < BATTERY_START && item_space < ITEM_DOUBLE_SPACE) { + item_space++; // Increase item spacing goto 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