diff --git a/nanovna.h b/nanovna.h index 8fd6996..8170e38 100644 --- a/nanovna.h +++ b/nanovna.h @@ -480,6 +480,7 @@ extern uint16_t graph_bottom; #define GRIDY (CHART_BOTTOM / NGRIDY) #endif +#define SD_CARD_START (LCD_HEIGHT-40-20) #define BATTERY_START (LCD_HEIGHT-40) #define WIDTH (LCD_WIDTH - 1 - OFFSETX) diff --git a/plot.c b/plot.c index 87ce2f7..d04a09e 100644 --- a/plot.c +++ b/plot.c @@ -1636,6 +1636,35 @@ draw_frequencies(void) static void draw_battery_status(void) { +#ifdef __USE_SD_CARD__ +static const uint8_t sd_icon [] = { + _BMP16(0b1111111111111000), // + _BMP16(0b1000000000001000), // 1 + _BMP16(0b1000000000001000), // 2 + _BMP16(0b1000000000001000), // 3 + _BMP16(0b1001100111001000), // 4 + _BMP16(0b1010010100101000), // 5 + _BMP16(0b1001000100101000), // 6 + _BMP16(0b1000100100101000), // 7 + _BMP16(0b1010010100101000), // 8 + _BMP16(0b1001100111001000), // 9 + _BMP16(0b0100000000001000), //10 + _BMP16(0b0100000000001000), //11 + _BMP16(0b1100000000001000), //12 + _BMP16(0b1000000000001000), //13 + _BMP16(0b0101010101011000), //14 + _BMP16(0b0111111111111000) // + }; + if (SD_Inserted()){ + ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN); + ili9341_blitBitmap(4, SD_CARD_START, 16, 16, sd_icon); +// ili9341_drawstring("-SD-", x, SD_CARD_START); + } + else{ + ili9341_set_background(LCD_BG_COLOR); + ili9341_fill(4, SD_CARD_START, 16, 16); + } +#endif int16_t vbat = adc_vbat_read(); if (vbat <= 0) return; diff --git a/ui.c b/ui.c index 9623a0e..8f3efd2 100644 --- a/ui.c +++ b/ui.c @@ -2918,7 +2918,7 @@ made_screenshot(int touch_x, int touch_y) { int y, i; UINT size; - if (touch_y < HEIGHT || touch_x < FREQUENCIES_XPOS2-100 || touch_x > FREQUENCIES_XPOS2) + if (touch_y < SD_CARD_START || touch_y > SD_CARD_START + 20 || touch_x > OFFSETX) return FALSE; touch_wait_release(); // uint32_t time = chVTGetSystemTimeX(); @@ -3053,6 +3053,10 @@ void ui_process_touch(void) touch_position(&touch_x, &touch_y); switch (ui_mode) { case UI_NORMAL: +#ifdef __USE_SD_CARD__ + if (made_screenshot(touch_x, touch_y)) + break; +#endif if (touch_quick_menu(touch_x, touch_y)) break; // Try drag marker @@ -3060,10 +3064,6 @@ void ui_process_touch(void) break; if (touch_marker_select(touch_x, touch_y)) break; -#ifdef __USE_SD_CARD__ - if (made_screenshot(touch_x, touch_y)) - break; -#endif // Try select lever mode (top and bottom screen) if (touch_lever_mode_select(touch_x, touch_y)) { // touch_wait_release(); diff --git a/ui_sa.c b/ui_sa.c index 1c8690c..87c6c51 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -212,25 +212,6 @@ const uint8_t right_icons [] = _BMP16(0b0000000000000000), }; -const uint8_t sd_icon [] = { -_BMP16(0b1111111111111100), // -_BMP16(0b1000000000000100), // 1 -_BMP16(0b1000000000000100), // 2 -_BMP16(0b1000110011100100), // 5 -_BMP16(0b1001001010010100), // 6 -_BMP16(0b1000100010010100), // 7 -_BMP16(0b1000010010010100), // 8 -_BMP16(0b1001001010010100), // 9 -_BMP16(0b1000110011100100), //10 -_BMP16(0b0100000000000100), // 3 -_BMP16(0b0100000000000100), // 4 -_BMP16(0b1100000000000100), //11 -_BMP16(0b1000000000000100), //12 -_BMP16(0b1000000000000100), //13 -_BMP16(0b0101010101010100), //14 -_BMP16(0b0111111111111100) // -}; - #define KP_X(x) (48*(x) + 2 + (LCD_WIDTH-BUTTON_WIDTH-192)) #define KP_Y(y) (48*(y) + 2) @@ -3433,15 +3414,7 @@ redraw_cal_status: strncpy(buf,&VERSION[8], BLEN-1); #endif ili9341_drawstring(buf, x, y); -#ifdef __USE_SD_CARD__ - y += YSTEP + YSTEP/2 ; - if (SD_Inserted()){ - ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN); - ili9341_blitBitmap(x+4, y, FORM_ICON_HEIGHT, FORM_ICON_HEIGHT, sd_icon); -// ili9341_drawstring("-SD-", x, y); - } - y+=12; -#endif + if (y >= BATTERY_START && item_space > 0) { item_space--; // Reduce item spacing goto redraw_cal_status;