Remove usage blit8BitWidthBitmap, blit16BitWidthBitmap and cell_drawchar

Now need use universal ili9341_blitBitmap and cell_blit_bitmap
Add definition for various font support
Now Font, Reference and Markers bitmaps draw by universal cell_blit_bitmap
Add big marker bitmaps
Reduce font bitmap count (comment not used)
Now all bitmaps better define by macros:
_BMP8
_BMP16
_BMP24
_BMP32
pull/130/head
DiSlord 5 years ago
parent e88aa40729
commit c8fea63042

@ -1,21 +1,41 @@
/*
* Font size 5x7 pixels
* most font glyph have width 5 pixels
* Copyright (c) 2019-2020, Dmitry (DiSlord) dislordlive@gmail.com
* All rights reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* The software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include <stdint.h>
#include "nanovna.h"
/*
* Check 1 byte of char bitmap data for get width
* Most font glyph have width 5 pixels
* Check 0 byte of char bitmap data for get width
*/
// Font definitions
#define FONT_GET_DATA(ch) (&x5x7_bits[ch*7])
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[ch*7]&7))
#if 0
// Font definitions for header
#define FONT_START_CHAR 0x17
#define FONT_MAX_WIDTH 7
#define FONT_WIDTH 5
#define FONT_GET_HEIGHT 7
#define FONT_STR_HEIGHT 8
#define FONT_GET_DATA(ch) ( &x5x7_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT])
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT]&7))
#endif
#define CHAR5x7_WIDTH_1px 0x07
#define CHAR5x7_WIDTH_2px 0x06
@ -26,10 +46,14 @@
#define CHAR5x7_WIDTH_7px 0x01
#define CHAR5x7_WIDTH_8px 0x00
/* Font character bitmap data. */
const uint8_t x5x7_bits[127*7] =
{
#if FONT_START_CHAR!=0x17
#error "Need set correct offset in x5x7_bits font"
#endif
// Font character bitmap data.
const uint8_t x5x7_bits[] =
{
#if 0
/* Character (0x00):
width=5
+--------+
@ -107,23 +131,23 @@ const uint8_t x5x7_bits[127*7] =
0b00100000,
/* Character (0x04):
width=6
width=5
+--------+
| |
| * |
| * |
| * * |
| * * |
|* * |
|***** |
| ** |
| *** |
| *** |
| *** |
| *** |
| *** |
| ** |
+--------+ */
0b00000000|CHAR5x7_WIDTH_6px,
0b00100000|CHAR5x7_WIDTH_5px,
0b00100000,
0b00100000,
0b11100000,
0b00100000,
0b00100000,
0b00100000,
0b01010000,
0b01010000,
0b10001000,
0b11111000,
/* Character (0x05):
width=5
@ -449,25 +473,6 @@ const uint8_t x5x7_bits[127*7] =
0b00100000,
/* Character (0x16):
width=5
+--------+
| ** |
| *** |
| *** |
| *** |
| *** |
| *** |
| ** |
+--------+ */
0b00100000|CHAR5x7_WIDTH_5px,
0b00100000,
0b00100000,
0b11100000,
0b00100000,
0b00100000,
0b00100000,
/* Character (0x17):
width=6
+--------+
| |
@ -485,6 +490,26 @@ const uint8_t x5x7_bits[127*7] =
0b11110000,
0b11000000,
0b00000000,
#endif
// FONT_START_CHAR = 0x17
/* Character (0x17):
width=6
+--------+
| |
| * |
| * |
| * * |
| * * |
|* * |
|***** |
+--------+ */
0b00000000|CHAR5x7_WIDTH_6px,
0b00100000,
0b00100000,
0b01010000,
0b01010000,
0b10001000,
0b11111000,
/* Character (0x18):
width=5

@ -593,20 +593,24 @@ void ili9341_set_rotation(uint8_t r)
send_command(ILI9341_MEMORY_ACCESS_CONTROL, 1, &r);
}
void blit8BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
const uint8_t *bitmap)
static uint8_t bit_align = 0;
void ili9341_blitBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
const uint8_t *b)
{
uint16_t *buf = spi_buffer;
uint8_t bits = 0;
for (uint16_t c = 0; c < height; c++) {
uint8_t bits = *bitmap++;
for (uint16_t r = 0; r < width; r++) {
if ((r&7) == 0) bits = *b++;
*buf++ = (0x80 & bits) ? foreground_color : background_color;
bits <<= 1;
}
if (bit_align) b+=bit_align;
}
ili9341_bulk(x, y, width, height);
}
#if 0
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
const uint16_t *bitmap)
{
@ -620,10 +624,11 @@ void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t heigh
}
ili9341_bulk(x, y, width, height);
}
#endif
void ili9341_drawchar(uint8_t ch, int x, int y)
{
blit8BitWidthBitmap(x, y, FONT_GET_WIDTH(ch), FONT_GET_HEIGHT, FONT_GET_DATA(ch));
ili9341_blitBitmap(x, y, FONT_GET_WIDTH(ch), FONT_GET_HEIGHT, FONT_GET_DATA(ch));
}
void ili9341_drawstring(const char *str, int x, int y)
@ -634,7 +639,7 @@ void ili9341_drawstring(const char *str, int x, int y)
if (ch == '\n') {x = x_pos; y+=FONT_STR_HEIGHT; continue;}
const uint8_t *char_buf = FONT_GET_DATA(ch);
uint16_t w = FONT_GET_WIDTH(ch);
blit8BitWidthBitmap(x, y, w, FONT_GET_HEIGHT, char_buf);
ili9341_blitBitmap(x, y, w, FONT_GET_HEIGHT, char_buf);
x += w;
}
}
@ -665,8 +670,7 @@ int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size)
void ili9341_drawfont(uint8_t ch, int x, int y)
{
blit16BitWidthBitmap(x, y, NUM_FONT_GET_WIDTH, NUM_FONT_GET_HEIGHT,
NUM_FONT_GET_DATA(ch));
ili9341_blitBitmap(x, y, NUM_FONT_GET_WIDTH, NUM_FONT_GET_HEIGHT, NUM_FONT_GET_DATA(ch));
}
void ili9341_drawstring_size(const char *str, int x, int y, uint8_t size)

@ -190,18 +190,43 @@ void tlv320aic3204_write_reg(uint8_t page, uint8_t reg, uint8_t data);
#define LCD_HEIGHT 240
// Used font settings
extern const uint8_t x5x7_bits [];
#define FONT_GET_DATA(ch) (&x5x7_bits[ch*7])
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[ch*7]&7))
#define FONT_MAX_WIDTH 7
#define FONT_WIDTH 5
#define FONT_GET_HEIGHT 7
#define FONT_STR_HEIGHT 8
extern const uint16_t numfont16x22[];
#define NUM_FONT_GET_DATA(ch) (&numfont16x22[ch*22])
#define _USE_FONT_ 0
#if _USE_FONT_ == 0
extern const uint8_t x5x7_bits[];
#define FONT_START_CHAR 0x17
#define FONT_MAX_WIDTH 7
#define FONT_WIDTH 5
#define FONT_GET_HEIGHT 7
#define FONT_STR_HEIGHT 8
#define FONT_GET_DATA(ch) ( &x5x7_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT])
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT]&7))
#elif _USE_FONT_ == 1
extern const uint8_t x7x11b_bits[];
#define FONT_START_CHAR 0x17
#define FONT_MAX_WIDTH 8
#define FONT_WIDTH 7
#define FONT_GET_HEIGHT 11
#define FONT_STR_HEIGHT 11
#define FONT_GET_DATA(ch) ( &x7x11b_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT])
#define FONT_GET_WIDTH(ch) (8-(x7x11b_bits[(ch-FONT_START_CHAR)*FONT_GET_HEIGHT]&7))
#elif _USE_FONT_ == 2
extern const uint8_t x10x14_bits[];
#define FONT_START_CHAR 0x17
#define FONT_MAX_WIDTH 12
#define FONT_GET_HEIGHT 14
#define FONT_STR_HEIGHT 16
#define FONT_GET_DATA(ch) ( &x10x14_bits[(ch-FONT_START_CHAR)*2*FONT_GET_HEIGHT ])
#define FONT_GET_WIDTH(ch) (14-(x10x14_bits[(ch-FONT_START_CHAR)*2*FONT_GET_HEIGHT+1]&0x7))
#endif
extern const uint8_t numfont16x22[];
#define NUM_FONT_GET_WIDTH 16
#define NUM_FONT_GET_HEIGHT 22
#define NUM_FONT_GET_DATA(ch) (&numfont16x22[ch*2*NUM_FONT_GET_HEIGHT])
// Offset of plot area (size of additional info at left side)
#define OFFSETX 10
@ -267,15 +292,15 @@ extern int16_t area_height;
#endif
// Additional chars in fonts
#define S_DELTA "\004"
#define S_DEGREE "\037"
#define S_SARROW "\030"
#define S_INFINITY "\031"
#define S_LARROW "\032"
#define S_RARROW "\033"
#define S_PI "\034"
#define S_MICRO "\035"
#define S_OHM "\036"
#define S_DELTA "\027" // hex 0x17
#define S_SARROW "\030" // hex 0x18
#define S_INFINITY "\031" // hex 0x19
#define S_LARROW "\032" // hex 0x1A
#define S_RARROW "\033" // hex 0x1B
#define S_PI "\034" // hex 0x1C
#define S_MICRO "\035" // hex 0x1D
#define S_OHM "\036" // hex 0x1E
#define S_DEGREE "\037" // hex 0x1F
// trace
#define MAX_TRACE_TYPE 13
@ -437,6 +462,12 @@ extern uint16_t background_color;
extern uint16_t spi_buffer[SPI_BUFFER_SIZE];
// Used for easy define big Bitmap as 0bXXXXXXXXX image
#define _BMP8(d) ((d)&0xFF)
#define _BMP16(d) (((d)>>8)&0xFF), ((d)&0xFF)
#define _BMP24(d) (((d)>>16)&0xFF), (((d)>>8)&0xFF), ((d)&0xFF)
#define _BMP32(d) (((d)>>24)&0xFF), (((d)>>16)&0xFF), (((d)>>8)&0xFF), ((d)&0xFF)
void ili9341_init(void);
void ili9341_test(int mode);
void ili9341_bulk(int x, int y, int w, int h);
@ -444,8 +475,7 @@ void ili9341_fill(int x, int y, int w, int h, uint16_t color);
void ili9341_set_foreground(uint16_t fg);
void ili9341_set_background(uint16_t fg);
void ili9341_clear_screen(void);
void blit8BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *bitmap);
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *bitmap);
void ili9341_blitBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *bitmap);
void ili9341_drawchar(uint8_t ch, int x, int y);
void ili9341_drawstring(const char *str, int x, int y);
void ili9341_drawstringV(const char *str, int x, int y);

File diff suppressed because it is too large Load Diff

316
plot.c

@ -921,6 +921,38 @@ search_index_range_x(int x1, int x2, index_t index[POINTS_COUNT], int *i0, int *
return TRUE;
}
static void
cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *bmp)
{
if (x <= -w)
return;
uint8_t bits = 0;
int c = h+y, r;
for (; y < c; y++) {
for (r = 0; r < w; r++) {
if ((r&7)==0) bits = *bmp++;
if (y >= 0 && x+r >= 0 && y < CELLHEIGHT && x+r < CELLWIDTH && (0x80 & bits))
cell_buffer[y*CELLWIDTH + x + r] = foreground_color;
bits <<= 1;
}
}
}
static void
cell_drawstring(char *str, int x, int y)
{
if (y <= -FONT_GET_HEIGHT || y >= CELLHEIGHT)
return;
while (*str) {
if (x >= CELLWIDTH)
return;
uint8_t ch = *str++;
uint16_t w = FONT_GET_WIDTH(ch);
cell_blit_bitmap(x, y, w, FONT_GET_HEIGHT, FONT_GET_DATA(ch));
x += w;
}
}
#define REFERENCE_WIDTH 6
#define REFERENCE_HEIGHT 5
#define REFERENCE_X_OFFSET 5
@ -928,102 +960,156 @@ search_index_range_x(int x1, int x2, index_t index[POINTS_COUNT], int *i0, int *
// Reference bitmap
static const uint8_t reference_bitmap[]={
0b11000000,
0b11110000,
0b11111100,
0b11110000,
0b11000000,
_BMP8(0b11000000),
_BMP8(0b11110000),
_BMP8(0b11111100),
_BMP8(0b11110000),
_BMP8(0b11000000),
};
static void
draw_refpos(int x, int y, int c)
{
int y0 = y, j;
for (j = 0; j < REFERENCE_HEIGHT; j++, y0++) {
if (y0 < 0 || y0 >= CELLHEIGHT) continue;
int x0 = x;
uint8_t bits = reference_bitmap[j];
while (bits) {
if (x0 >= 0 && x0 < CELLWIDTH)
cell_buffer[y0 * CELLWIDTH + x0] = (bits & 0x80) ? c : DEFAULT_BG_COLOR;
x0++;
bits <<= 1;
}
}
}
#define MARKER_WIDTH 7
#define MARKER_HEIGHT 10
#define X_MARKER_OFFSET 3
#define Y_MARKER_OFFSET 10
#if _USE_FONT_ == 0
#define MARKER_WIDTH 7
#define MARKER_HEIGHT 10
#define X_MARKER_OFFSET 3
#define Y_MARKER_OFFSET 10
#define MARKER_BITMAP(i) (&marker_bitmap[(i)*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
// Marker Back plate
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b11111110),
_BMP8(0b01111100),
_BMP8(0b00111000),
_BMP8(0b00010000),
// Marker 1
0b11111110,
0b11101110,
0b11001110,
0b11101110,
0b11101110,
0b11101110,
0b11000110,
0b01111100,
0b00111000,
0b00010000,
_BMP8(0b00000000),
_BMP8(0b00010000),
_BMP8(0b00110000),
_BMP8(0b00010000),
_BMP8(0b00010000),
_BMP8(0b00010000),
_BMP8(0b00111000),
_BMP8(0b00000000),
_BMP8(0b00000000),
_BMP8(0b00000000),
// Marker 2
0b11111110,
0b11000110,
0b10111010,
0b11111010,
0b11000110,
0b10111110,
0b10000010,
0b01111100,
0b00111000,
0b00010000,
_BMP8(0b00000000),
_BMP8(0b00111000),
_BMP8(0b01000100),
_BMP8(0b00000100),
_BMP8(0b00111000),
_BMP8(0b01000000),
_BMP8(0b01111100),
_BMP8(0b00000000),
_BMP8(0b00000000),
_BMP8(0b00000000),
// Marker 3
0b11111110,
0b11000110,
0b10111010,
0b11100110,
0b11111010,
0b10111010,
0b11000110,
0b01111100,
0b00111000,
0b00010000,
_BMP8(0b00000000),
_BMP8(0b00111000),
_BMP8(0b01000100),
_BMP8(0b00011000),
_BMP8(0b00000100),
_BMP8(0b01000100),
_BMP8(0b00111000),
_BMP8(0b00000000),
_BMP8(0b00000000),
_BMP8(0b00000000),
// Marker 4
0b11111110,
0b11110110,
0b11100110,
0b11010110,
0b10110110,
0b10110110,
0b10000010,
0b01110100,
0b00111000,
0b00010000,
_BMP8(0b00000000),
_BMP8(0b00001000),
_BMP8(0b00011000),
_BMP8(0b00101000),
_BMP8(0b01001000),
_BMP8(0b01001000),
_BMP8(0b01111100),
_BMP8(0b00001000),
_BMP8(0b00000000),
_BMP8(0b00000000),
};
static void
draw_marker(int x, int y, int c, int ch)
{
int y0 = y, j;
for (j = 0; j < MARKER_HEIGHT; j++, y0++) {
int x0 = x;
uint8_t bits = marker_bitmap[ch * MARKER_HEIGHT + j];
bool force_color = false;
while (bits) {
if (bits & 0x80) force_color = true;
if (x0 >= 0 && x0 < CELLWIDTH && y0 >= 0 && y0 < CELLHEIGHT) {
if (bits & 0x80)
cell_buffer[y0 * CELLWIDTH + x0] = c;
else if (force_color)
cell_buffer[y0 * CELLWIDTH + x0] = DEFAULT_BG_COLOR;
}
x0++;
bits <<= 1;
}
}
}
#elif _USE_FONT_ == 1
#define MARKER_WIDTH 10
#define MARKER_HEIGHT 13
#define X_MARKER_OFFSET 4
#define Y_MARKER_OFFSET 13
#define MARKER_BITMAP(i) (&marker_bitmap[(i)*2*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
// Marker Back plate
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b1111111110000000),
_BMP16(0b0111111100000000),
_BMP16(0b0011111000000000),
_BMP16(0b0001110000000000),
_BMP16(0b0000100000000000),
// Marker 1
_BMP16(0b0000000000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0001110000000000),
_BMP16(0b0010110000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0001111000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
// Marker 2
_BMP16(0b0000000000000000),
_BMP16(0b0001111000000000),
_BMP16(0b0011001100000000),
_BMP16(0b0011001100000000),
_BMP16(0b0000011000000000),
_BMP16(0b0000110000000000),
_BMP16(0b0001100000000000),
_BMP16(0b0011000000000000),
_BMP16(0b0011111100000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
// Marker 3
_BMP16(0b0000000000000000),
_BMP16(0b0011111000000000),
_BMP16(0b0110001100000000),
_BMP16(0b0110001100000000),
_BMP16(0b0000001100000000),
_BMP16(0b0000111000000000),
_BMP16(0b0000001100000000),
_BMP16(0b0110001100000000),
_BMP16(0b0110001100000000),
_BMP16(0b0011111000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
// Marker 4
_BMP16(0b0000000000000000),
_BMP16(0b0000011000000000),
_BMP16(0b0000111000000000),
_BMP16(0b0001111000000000),
_BMP16(0b0011011000000000),
_BMP16(0b0110011000000000),
_BMP16(0b0110011000000000),
_BMP16(0b0111111100000000),
_BMP16(0b0000011000000000),
_BMP16(0b0000011000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000000000000000),
};
#endif
static void
markmap_marker(int marker)
@ -1328,8 +1414,15 @@ draw_cell(int m, int n)
int y = CELL_Y(index) - y0 - Y_MARKER_OFFSET;
// Check marker icon on cell
if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT)
draw_marker(x, y, config.trace_color[t], i);
y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT){
// draw_marker(x, y, config.trace_color[t], i);
// Draw marker plate
ili9341_set_foreground(config.trace_color[t]);
cell_blit_bitmap(x, y, MARKER_WIDTH, MARKER_HEIGHT, MARKER_BITMAP(0));
// Draw marker number
ili9341_set_foreground(DEFAULT_BG_COLOR);
cell_blit_bitmap(x, y, MARKER_WIDTH, MARKER_HEIGHT, MARKER_BITMAP(i+1));
}
}
}
#endif
@ -1346,11 +1439,14 @@ draw_cell(int m, int n)
uint32_t trace_type = (1 << trace[t].type);
if (trace_type & ((1 << TRC_SMITH) | (1 << TRC_POLAR)))
continue;
int x = 0 - x0 + CELLOFFSETX - REFERENCE_X_OFFSET;
if (x + REFERENCE_WIDTH >= 0 && x - REFERENCE_WIDTH < CELLWIDTH) {
int y = HEIGHT - float2int((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET;
if (y + REFERENCE_HEIGHT >= 0 && y - REFERENCE_HEIGHT < CELLHEIGHT)
draw_refpos(x, y, config.trace_color[t]);
if (y + REFERENCE_HEIGHT >= 0 && y - REFERENCE_HEIGHT < CELLHEIGHT){
ili9341_set_foreground(config.trace_color[t]);
cell_blit_bitmap(x , y, REFERENCE_WIDTH, REFERENCE_HEIGHT, reference_bitmap);
}
}
}
// Need right clip cell render (25 system ticks for all screen calls)
@ -1443,42 +1539,6 @@ request_to_draw_cells_behind_numeric_input(void)
redraw_request |= REDRAW_CELLS;
}
static int
cell_drawchar(uint8_t ch, int x, int y)
{
uint8_t bits;
int c, r, ch_size;
const uint8_t *char_buf = FONT_GET_DATA(ch);
ch_size = FONT_GET_WIDTH(ch);
// if (y <= -FONT_GET_HEIGHT || y >= CELLHEIGHT || x <= -ch_size || x >= CELLWIDTH)
// return ch_size;
if (x <= -ch_size)
return ch_size;
for (c = 0; c < FONT_GET_HEIGHT; c++) {
bits = *char_buf++;
if ((y + c) < 0 || (y + c) >= CELLHEIGHT)
continue;
for (r = 0; r < ch_size; r++) {
if ((x+r) >= 0 && (x+r) < CELLWIDTH && (0x80 & bits))
cell_buffer[(y+c)*CELLWIDTH + (x+r)] = foreground_color;
bits <<= 1;
}
}
return ch_size;
}
static void
cell_drawstring(char *str, int x, int y)
{
if (y <= -FONT_GET_HEIGHT || y >= CELLHEIGHT)
return;
while (*str) {
if (x >= CELLWIDTH)
return;
x += cell_drawchar(*str++, x, y);
}
}
static void
cell_draw_marker_info(int x0, int y0)
{
@ -1701,7 +1761,7 @@ static void draw_battery_status(void)
string_buf[x++] = 0b10000001;
string_buf[x++] = 0b11111111;
// Draw battery
blit8BitWidthBitmap(1, 1, 8, x, string_buf);
ili9341_blitBitmap(1, 1, 8, x, string_buf);
}
void

110
ui.c

@ -646,7 +646,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_trace_acb)
if (trace[data].enabled){
b->bg = config.trace_color[data];
if (data == selection) b->fg = ~config.trace_color[data];
b->icon = BUTTON_ICON_CHECK;
if (uistat.current_trace == data)
b->icon = BUTTON_ICON_CHECK;
}
return;
}
@ -866,18 +867,17 @@ static UI_FUNCTION_CALLBACK(menu_marker_search_cb)
break;
case 2: /* search Left */
i = marker_search_left(markers[active_marker].index);
uistat.marker_tracking = false;
break;
case 3: /* search right */
i = marker_search_right(markers[active_marker].index);
uistat.marker_tracking = false;
break;
}
if (i != -1)
markers[active_marker].index = i;
draw_menu();
uistat.marker_tracking = false;
redraw_marker(active_marker);
select_lever_mode(LM_SEARCH);
draw_menu();
}
static UI_FUNCTION_ADV_CALLBACK(menu_marker_tracking_acb)
@ -960,14 +960,14 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_sel_acb)
static const char s1_file_header[] =
"!File created by NanoVNA\r\n"\
"# HZ S RI R 50\r\n";
"# Hz S RI R 50\r\n";
static const char s1_file_param[] =
"%10d % f % f\r\n";
static const char s2_file_header[] =
"!File created by NanoVNA\r\n"\
"# HZ S RI R 50\r\n";
"# Hz S RI R 50\r\n";
static const char s2_file_param[] =
"%10d % f % f % f % f 0 0 0 0\r\n";
@ -1647,54 +1647,54 @@ menu_item_modify_attribute(const menuitem_t *menu, int item, button_t *b)
#define ICON_WIDTH 16
#define ICON_HEIGHT 11
static const uint16_t check_box[] = {
0b0011111111110000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0010000000010000,
0b0011111111110000,
0b0011111111110000,
0b0010000000001000,
0b0010000000011000,
0b0010000000110000,
0b0010000001100000,
0b0010100011010000,
0b0010110110010000,
0b0010011100010000,
0b0010001000010000,
0b0010000000010000,
0b0011111111110000,
0b0000000000000000,
0b0000001111000000,
0b0000010000100000,
0b0000100000010000,
0b0001000000001000,
0b0001000000001000,
0b0001000000001000,
0b0001000000001000,
0b0000100000010000,
0b0000010000100000,
0b0000001111000000,
0b0000000000000000,
0b0000001111000000,
0b0000010000100000,
0b0000100110010000,
0b0001001111001000,
0b0001011111101000,
0b0001011111101000,
0b0001001111001000,
0b0000100110010000,
0b0000010000100000,
0b0000001111000000,
static const uint8_t check_box[] = {
_BMP16(0b0011111111110000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0011111111110000),
_BMP16(0b0011111111110000),
_BMP16(0b0010000000001000),
_BMP16(0b0010000000011000),
_BMP16(0b0010000000110000),
_BMP16(0b0010000001100000),
_BMP16(0b0010100011010000),
_BMP16(0b0010110110010000),
_BMP16(0b0010011100010000),
_BMP16(0b0010001000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0011111111110000),
_BMP16(0b0000000000000000),
_BMP16(0b0000011110000000),
_BMP16(0b0000100001000000),
_BMP16(0b0001000000100000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0010000000010000),
_BMP16(0b0001000000100000),
_BMP16(0b0000100001000000),
_BMP16(0b0000011110000000),
_BMP16(0b0000000000000000),
_BMP16(0b0000011110000000),
_BMP16(0b0000100001000000),
_BMP16(0b0001001100100000),
_BMP16(0b0010011110010000),
_BMP16(0b0010111111010000),
_BMP16(0b0010111111010000),
_BMP16(0b0010011110010000),
_BMP16(0b0001001100100000),
_BMP16(0b0000100001000000),
_BMP16(0b0000011110000000),
};
static void
@ -1731,7 +1731,7 @@ draw_menu_buttons(const menuitem_t *menu)
if (button.icon >=0){
blit16BitWidthBitmap(LCD_WIDTH-MENU_BUTTON_WIDTH+MENU_BUTTON_BORDER + 1, y+(MENU_BUTTON_HEIGHT-ICON_HEIGHT)/2, ICON_WIDTH, ICON_HEIGHT, &check_box[button.icon*ICON_HEIGHT]);
ili9341_blitBitmap(LCD_WIDTH-MENU_BUTTON_WIDTH+MENU_BUTTON_BORDER + 1, y+(MENU_BUTTON_HEIGHT-ICON_HEIGHT)/2, ICON_WIDTH, ICON_HEIGHT, &check_box[button.icon*2*ICON_HEIGHT]);
text_offs=LCD_WIDTH-MENU_BUTTON_WIDTH+MENU_BUTTON_BORDER+1+ICON_WIDTH;
}
int lines = menu_is_multiline(menu[i].label);

Loading…
Cancel
Save

Powered by TurnKey Linux.