Increased font size in menus

pull/86/head
Dennis Real 7 years ago
parent c848019f54
commit c7e7fdb6d4

@ -13,7 +13,7 @@ const uint8_t x5x7_bits [] =
{
/* Character (0x00):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+----------------+
+--------+
|**** |
|**** |
|**** |
@ -21,7 +21,7 @@ const uint8_t x5x7_bits [] =
|**** |
|**** |
| |
+----------------+ */
+--------+ */
0xf0,
0xf0,
0xf0,
@ -30,6 +30,45 @@ const uint8_t x5x7_bits [] =
0xf0,
0x00,
/* Character (0x01):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
| |
| * |
| *** |
|***** |
| *** |
| * |
| |
+--------+ */
0x00,
0x20,
0x70,
0xf8,
0x70,
0x20,
0x00,
/* Character (0x02):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
| * * |
|* * |
| * * |
|* * |
| * * |
|* * |
| |
+--------+ */
0x50,
0xa0,
0x50,
0xa0,
0x50,
0xa0,
0x00,
/* Character ():
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+--------+
@ -2094,12 +2133,12 @@ uint8_t x5x7_map_char_table(uint8_t ch)
if ( ch > 0x7e )
{
/* limit to largest character */
ch = 0x7e - 32 + 7;
ch = 0x7e - 32 + 9;
}
else if ( ch >= 32 )
{
/* normal character */
ch = ch - 32 + 7;
ch = ch - 32 + 9;
}
else
{

@ -0,0 +1,242 @@
#include <stdint.h>
const uint8_t x8x8_bits[][8]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* nul */
{0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00}, /* diamond */
{0x00,0x50,0xa0,0x50,0xa0,0x50,0xa0,0x00}, /* multiline marker */
{0x00,0x20,0x40,0xF8,0xF8,0x40,0x20,0x00}, /* left arrow */
{0x00,0x20,0x10,0xF8,0xF8,0x10,0x20,0x00}, /* right arrow */
{0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x00}, /* pi */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0x06}, /* micro */
{0x7C,0xC6,0xC6,0xC6,0x6C,0x6C,0xEE,0x00}, /* omega */
{0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00}, /* degree */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x20 ' ' */
{0x60,0xF0,0xF0,0x60,0x60,0x00,0x60,0x00}, /* 0x21 '!' */
{0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00}, /* 0x22 '"' */
{0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00}, /* 0x23 '#' */
{0x30,0x7C,0xC0,0x78,0x0C,0xF8,0x30,0x00}, /* 0x24 '$' */
{0x00,0xC6,0xCC,0x18,0x30,0x66,0xC6,0x00}, /* 0x25 '%' */
{0x38,0x6C,0x38,0x76,0xDC,0xCC,0x76,0x00}, /* 0x26 '&' */
{0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00}, /* 0x27 ''' */
{0x30,0x60,0xC0,0xC0,0xC0,0x60,0x30,0x00}, /* 0x28 '(' */
{0xC0,0x60,0x30,0x30,0x30,0x60,0xC0,0x00}, /* 0x29 ')' */
{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00}, /* 0x2A '*' */
{0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00}, /* 0x2B '+' */
{0x00,0x00,0x00,0x00,0x00,0xE0,0x60,0xC0}, /* 0x2C ',' */
{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00}, /* 0x2D '-' */
{0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00}, /* 0x2E '.' */
{0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00}, /* 0x2F '/' */
{0x78,0xCC,0xDC,0xFC,0xEC,0xCC,0x78,0x00}, /* 0x30 '0' */
{0x30,0xF0,0x30,0x30,0x30,0x30,0xFC,0x00}, /* 0x31 '1' */
{0x78,0xCC,0x0C,0x38,0x60,0xCC,0xFC,0x00}, /* 0x32 '2' */
{0x78,0xCC,0x0C,0x38,0x0C,0xCC,0x78,0x00}, /* 0x33 '3' */
{0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x00}, /* 0x34 '4' */
{0xFC,0xC0,0xF8,0x0C,0x0C,0xCC,0x78,0x00}, /* 0x35 '5' */
{0x38,0x60,0xC0,0xF8,0xCC,0xCC,0x78,0x00}, /* 0x36 '6' */
{0xFC,0xCC,0x0C,0x18,0x30,0x60,0x60,0x00}, /* 0x37 '7' */
{0x78,0xCC,0xCC,0x78,0xCC,0xCC,0x78,0x00}, /* 0x38 '8' */
{0x78,0xCC,0xCC,0x7C,0x0C,0x18,0x70,0x00}, /* 0x39 '9' */
{0x00,0x00,0xC0,0xC0,0x00,0xC0,0xC0,0x00}, /* 0x3A ':' */
{0x00,0x00,0x60,0x60,0x00,0xE0,0x60,0xC0}, /* 0x3B ';' */
{0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00}, /* 0x3C '<' */
{0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00}, /* 0x3D '=' */
{0xC0,0x60,0x30,0x18,0x30,0x60,0xC0,0x00}, /* 0x3E '>' */
{0x78,0xCC,0x0C,0x18,0x30,0x00,0x30,0x00}, /* 0x3F '?' */
{0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0x78,0x00}, /* 0x40 '@' */
{0x30,0x78,0xCC,0xCC,0xFC,0xCC,0xCC,0x00}, /* 0x41 'A' */
{0xFC,0x66,0x66,0x7C,0x66,0x66,0xFC,0x00}, /* 0x42 'B' */
{0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00}, /* 0x43 'C' */
{0xFC,0x6C,0x66,0x66,0x66,0x6C,0xFC,0x00}, /* 0x44 'D' */
{0xFE,0x62,0x68,0x78,0x68,0x62,0xFE,0x00}, /* 0x45 'E' */
{0xFE,0x62,0x68,0x78,0x68,0x60,0xF0,0x00}, /* 0x46 'F' */
{0x3C,0x66,0xC0,0xC0,0xCE,0x66,0x3E,0x00}, /* 0x47 'G' */
{0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00}, /* 0x48 'H' */
{0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x49 'I' */
{0x1E,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00}, /* 0x4A 'J' */
{0xE6,0x66,0x6C,0x78,0x6C,0x66,0xE6,0x00}, /* 0x4B 'K' */
{0xF0,0x60,0x60,0x60,0x62,0x66,0xFE,0x00}, /* 0x4C 'L' */
{0xC6,0xEE,0xFE,0xD6,0xC6,0xC6,0xC6,0x00}, /* 0x4D 'M' */
{0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0xC6,0x00}, /* 0x4E 'N' */
{0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x38,0x00}, /* 0x4F 'O' */
{0xFC,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}, /* 0x50 'P' */
{0x78,0xCC,0xCC,0xCC,0xDC,0x78,0x1C,0x00}, /* 0x51 'Q' */
{0xFC,0x66,0x66,0x7C,0x78,0x6C,0xE6,0x00}, /* 0x52 'R' */
{0x78,0xCC,0xE0,0x38,0x1C,0xCC,0x78,0x00}, /* 0x53 'S' */
{0xFC,0xB4,0x30,0x30,0x30,0x30,0x78,0x00}, /* 0x54 'T' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFC,0x00}, /* 0x55 'U' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x56 'V' */
{0xC6,0xC6,0xC6,0xD6,0xFE,0xEE,0xC6,0x00}, /* 0x57 'W' */
{0xC6,0xC6,0x6C,0x38,0x6C,0xC6,0xC6,0x00}, /* 0x58 'X' */
{0xCC,0xCC,0xCC,0x78,0x30,0x30,0x78,0x00}, /* 0x59 'Y' */
{0xFE,0xCC,0x98,0x30,0x62,0xC6,0xFE,0x00}, /* 0x5A 'Z' */
{0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF0,0x00}, /* 0x5B '[' */
{0xC0,0x60,0x30,0x18,0x0C,0x06,0x02,0x00}, /* 0x5C '\' */
{0xF0,0x30,0x30,0x30,0x30,0x30,0xF0,0x00}, /* 0x5D ']' */
{0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00}, /* 0x5E '^' */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF}, /* 0x5F '_' */
{0xC0,0xC0,0x60,0x00,0x00,0x00,0x00,0x00}, /* 0x60 '`' */
{0x00,0x00,0x78,0x0C,0x7C,0xCC,0x76,0x00}, /* 0x61 'a' */
{0xE0,0x60,0x7C,0x66,0x66,0x66,0xBC,0x00}, /* 0x62 'b' */
{0x00,0x00,0x78,0xCC,0xC0,0xCC,0x78,0x00}, /* 0x63 'c' */
{0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0x76,0x00}, /* 0x64 'd' */
{0x00,0x00,0x78,0xCC,0xFC,0xC0,0x78,0x00}, /* 0x65 'e' */
{0x38,0x6C,0x60,0xF0,0x60,0x60,0xF0,0x00}, /* 0x66 'f' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x67 'g' */
{0xE0,0x60,0x6C,0x76,0x66,0x66,0xE6,0x00}, /* 0x68 'h' */
{0x60,0x00,0xE0,0x60,0x60,0x60,0xF0,0x00}, /* 0x69 'i' */
{0x18,0x00,0x78,0x18,0x18,0x18,0xD8,0x70}, /* 0x6A 'j' */
{0xE0,0x60,0x66,0x6C,0x78,0x6C,0xE6,0x00}, /* 0x6B 'k' */
{0xE0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x6C 'l' */
{0x00,0x00,0xEC,0xFE,0xD6,0xC6,0xC6,0x00}, /* 0x6D 'm' */
{0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0x00}, /* 0x6E 'n' */
{0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x00}, /* 0x6F 'o' */
{0x00,0x00,0xDC,0x66,0x66,0x7C,0x60,0xF0}, /* 0x70 'p' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0x1E}, /* 0x71 'q' */
{0x00,0x00,0xD8,0x6C,0x6C,0x60,0xF0,0x00}, /* 0x72 'r' */
{0x00,0x00,0x7C,0xC0,0x78,0x0C,0xF8,0x00}, /* 0x73 's' */
{0x20,0x60,0xF8,0x60,0x60,0x68,0x30,0x00}, /* 0x74 't' */
{0x00,0x00,0xCC,0xCC,0xCC,0xCC,0x76,0x00}, /* 0x75 'u' */
{0x00,0x00,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x76 'v' */
{0x00,0x00,0xC6,0xC6,0xD6,0xFE,0x6C,0x00}, /* 0x77 'w' */
{0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00}, /* 0x78 'x' */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x79 'y' */
{0x00,0x00,0xFC,0x98,0x30,0x64,0xFC,0x00}, /* 0x7A 'z' */
{0x1C,0x30,0x30,0xE0,0x30,0x30,0x1C,0x00}, /* 0x7B '{' */
{0xC0,0xC0,0xC0,0x00,0xC0,0xC0,0xC0,0x00}, /* 0x7C '|' */
{0xE0,0x30,0x30,0x1C,0x30,0x30,0xE0,0x00}, /* 0x7D '}' */
{0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x7E '~' */
{0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00}, /* 0x7F '' */
};
const uint8_t x8x8_len[] = {
1, /* nul */
8, /* diamond */
5, /* multiline marker */
6, /* arrow left */
6, /* arrow right */
8, /* pi */
8, /* micro */
8, /* omega */
6, /* degree */
4, /* 0x20 ' ' */
5, /* 0x21 '!' */
6, /* 0x22 '"' */
8, /* 0x23 '#' */
7, /* 0x24 '$' */
8, /* 0x25 '%' */
8, /* 0x26 '&' */
4, /* 0x27 ''' */
5, /* 0x28 '(' */
5, /* 0x29 ')' */
9, /* 0x2A '*' */
7, /* 0x2B '+' */
4, /* 0x2C ',' */
7, /* 0x2D '-' */
3, /* 0x2E '.' */
8, /* 0x2F '/' */
7, /* 0x30 '0' */
7, /* 0x31 '1' */
7, /* 0x32 '2' */
7, /* 0x33 '3' */
8, /* 0x34 '4' */
7, /* 0x35 '5' */
7, /* 0x36 '6' */
7, /* 0x37 '7' */
7, /* 0x38 '8' */
7, /* 0x39 '9' */
3, /* 0x3A ':' */
4, /* 0x3B ';' */
6, /* 0x3C '<' */
7, /* 0x3D '=' */
6, /* 0x3E '>' */
7, /* 0x3F '?' */
8, /* 0x40 '@' */
7, /* 0x41 'A' */
8, /* 0x42 'B' */
8, /* 0x43 'C' */
8, /* 0x44 'D' */
8, /* 0x45 'E' */
8, /* 0x46 'F' */
8, /* 0x47 'G' */
7, /* 0x48 'H' */
5, /* 0x49 'I' */
8, /* 0x4A 'J' */
8, /* 0x4B 'K' */
8, /* 0x4C 'L' */
8, /* 0x4D 'M' */
8, /* 0x4E 'N' */
8, /* 0x4F 'O' */
8, /* 0x50 'P' */
7, /* 0x51 'Q' */
8, /* 0x52 'R' */
7, /* 0x53 'S' */
7, /* 0x54 'T' */
7, /* 0x55 'U' */
7, /* 0x56 'V' */
8, /* 0x57 'W' */
8, /* 0x58 'X' */
7, /* 0x59 'Y' */
8, /* 0x5A 'Z' */
5, /* 0x5B '[' */
8, /* 0x5C '\' */
5, /* 0x5D ']' */
8, /* 0x5E '^' */
9, /* 0x5F '_' */
4, /* 0x60 '`' */
8, /* 0x61 'a' */
8, /* 0x62 'b' */
7, /* 0x63 'c' */
8, /* 0x64 'd' */
7, /* 0x65 'e' */
7, /* 0x66 'f' */
8, /* 0x67 'g' */
8, /* 0x68 'h' */
5, /* 0x69 'i' */
6, /* 0x6A 'j' */
8, /* 0x6B 'k' */
5, /* 0x6C 'l' */
8, /* 0x6D 'm' */
7, /* 0x6E 'n' */
7, /* 0x6F 'o' */
8, /* 0x70 'p' */
8, /* 0x71 'q' */
7, /* 0x72 'r' */
7, /* 0x73 's' */
6, /* 0x74 't' */
8, /* 0x75 'u' */
7, /* 0x76 'v' */
8, /* 0x77 'w' */
8, /* 0x78 'x' */
7, /* 0x79 'y' */
7, /* 0x7A 'z' */
7, /* 0x7B '{' */
3, /* 0x7C '|' */
7, /* 0x7D '}' */
8, /* 0x7E '~' */
8, /* 0x7F '' */
};
uint8_t x8x8_map_char_table(uint8_t ch)
{
if ( ch > 0x7f )
{
/* limit to largest character */
ch = 0x7f - 32 + 9;
}
else if ( ch >= 32 )
{
/* normal character */
ch = ch - 32 + 9;
}
else
{
/* special character */
}
return ch;
}

@ -120,7 +120,7 @@ CSRC = $(STARTUPSRC) \
$(STREAMSSRC) \
$(SHELLSRC) \
usbcfg.c \
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c flash.c adc.c
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c Font8x8.c flash.c adc.c
# $(TESTSRC) \

@ -407,6 +407,63 @@ ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg,
}
}
unsigned char
ili9341_drawchar_8x8(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg)
{
uint16_t *buf = spi_buffer;
uint16_t bits;
int cline, r;
ch = x8x8_map_char_table(ch);
for(cline = 0; cline < 8; cline++)
{
bits = x8x8_bits[ch][cline];
for (r = 7; r >= 0; r--)
{
*buf++ = (0x80 & bits) ? fg : bg;
bits <<= 1;
}
//*buf++ = bg;
}
ili9341_bulk(x, y, 8, 8);
return x8x8_len[ch];
}
void
ili9341_drawstring_8x8(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
while (*str)
{
(void)ili9341_drawchar_8x8(*str, x, y, fg, bg);
x += 8;
str++;
}
}
void
ili9341_drawstring_8x8_var(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
unsigned char clength = 0;
while (*str)
{
clength = ili9341_drawchar_8x8(*str, x, y, fg, bg);
x += clength;
str++;
}
}
#define SWAP(x,y) do { int z=x; x = y; y = z; } while(0)
void

@ -1379,12 +1379,12 @@ const struct {
uint16_t refpos;
float scale_unit;
} trace_info[] = {
{ "LOGMAG", 7, 10 },
{ "PHASE", 4, 90 },
{ "DELAY", 4, 1 },
{ "SMITH", 0, 1 },
{ "POLAR", 0, 1 },
{ "LINEAR", 0, 0.125 },
{ "LGMG", 7, 10 },
{ "PHA", 4, 90 },
{ "DEL", 4, 1 },
{ "SMI", 0, 1 },
{ "PLR", 0, 1 },
{ "LIN", 0, 0.125 },
{ "SWR", 0, 1 },
{ "REAL", 4, 0.25 },
{ "IMAG", 4, 0.25 },

@ -138,6 +138,8 @@ extern void tlv320aic3204_adc_filter_enable(int enable);
#define HEIGHT 233
#define CELLOFFSETX 5
#define CELLOFFSETX_8x8 8
#define AREA_WIDTH_NORMAL (WIDTH + CELLOFFSETX*2)
extern int area_width;
@ -147,17 +149,22 @@ extern int area_height;
// font
extern const uint8_t x5x7_bits [];
extern const uint8_t x5x7_bits[];
extern const uint8_t x8x8_bits[][8];
extern const uint8_t x8x8_len[];
extern const uint32_t numfont20x24[][24];
#define S_PI "\003"
#define S_MICRO "\004"
#define S_OHM "\005"
#define S_DEGREE "\006"
#define S_LARROW "\001"
#define S_RARROW "\002"
#define S_DIAMOND "\001"
#define S_MULTIL "\002"
#define S_PI "\005"
#define S_MICRO "\006"
#define S_OHM "\007"
#define S_DEGREE "\010"
#define S_LARROW "\003"
#define S_RARROW "\004"
extern uint8_t x5x7_map_char_table(uint8_t ch);
extern uint8_t x8x8_map_char_table(uint8_t ch);
@ -275,6 +282,9 @@ void ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_5x7(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
void ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
unsigned char ili9341_drawchar_8x8(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_8x8(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawstring_8x8_var(const char *str, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_drawfont(uint8_t ch, const font_t *font, int x, int y, uint16_t fg, uint16_t bg);
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t* out);
void ili9341_read_memory_continue(int len, uint16_t* out);

129
plot.c

@ -1369,29 +1369,133 @@ cell_drawstring_invert_5x7(int w, int h, char *str, int x, int y, uint16_t fg, i
unsigned char
cell_drawchar_8x8(int w, int h, uint8_t ch, int x, int y, uint16_t fg, uint8_t var, int invert)
{
uint8_t bits, charlen = 8;
int cline, r;
if (y <= -8 || y >= h || x <= -8 || x >= w)
return 0;
ch = x8x8_map_char_table(ch);
for (cline = 0; cline < 8; cline++)
{
if ((y + cline) < 0 || (y + cline) >= h)
continue;
bits = x8x8_bits[ch][cline];
if (invert)
bits = ~bits;
if ( var != FALSE )
{
charlen = x8x8_len[ch];
}
for (r = 0; r < charlen; r++)
{
if ( (x+r) >= 0 && (x+r) < w && (0x80 & bits) )
spi_buffer[(y+cline)*w + (x+r)] = fg;
bits <<= 1;
}
}
return x8x8_len[ch];
}
void
cell_drawstring_8x8(int w, int h, char *str, int x, int y, uint16_t fg)
{
while (*str)
{
cell_drawchar_8x8(w, h, *str, x, y, fg, FALSE, FALSE);
x += 8;
str++;
}
}
void
cell_drawstring_invert_8x8(int w, int h, char *str, int x, int y, uint16_t fg, int invert)
{
while (*str)
{
cell_drawchar_8x8(w, h, *str, x, y, fg, FALSE, invert);
x += 8;
str++;
}
}
void
cell_drawstring_8x8_var(int w, int h, char *str, int x, int y, uint16_t fg)
{
unsigned char clength = 0;
while (*str)
{
clength = cell_drawchar_8x8(w, h, *str, x, y, fg, TRUE, FALSE);
x += clength;
str++;
}
}
void
cell_drawstring_invert_8x8_var(int w, int h, char *str, int x, int y, uint16_t fg, int invert)
{
unsigned char clength = 0;
while (*str)
{
clength = cell_drawchar_8x8(w, h, *str, x, y, fg, TRUE, invert);
x += clength;
str++;
}
}
static void
cell_draw_marker_info(int m, int n, int w, int h)
{
char buf[24];
int t;
if (n != 0)
return;
if (active_marker < 0)
return;
int idx = markers[active_marker].index;
int j = 0;
for (t = 0; t < TRACES_MAX; t++) {
for (t = 0; t < TRACES_MAX; t++)
{
if (!trace[t].enabled)
continue;
int xpos = 1 + (j%2)*146;
int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX;
int ypos = 1 + (j/2)*8;
xpos -= m * CELLWIDTH - CELLOFFSETX;
ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel);
chsnprintf(buf, sizeof buf, "CH%d:", trace[t].channel);
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace);
xpos += 20;
trace_get_info(t, buf, sizeof buf);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
xpos += 64;
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel][idx], frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
@ -1400,26 +1504,31 @@ cell_draw_marker_info(int m, int n, int w, int h)
// draw marker frequency
int xpos = 192;
int ypos = 1 + (j/2)*7;
int ypos = 1 + (j/2)*8;
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "%d:", active_marker + 1);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
if ( (domain_mode & DOMAIN_MODE) == DOMAIN_FREQ )
{
frequency_string(buf, sizeof buf, frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
} else {
}
else
{
chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
}
// draw marker delta
if (previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) {
if ( previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled )
{
int idx0 = markers[previous_marker].index;
xpos = 192;
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos += 7;
ypos += 8;
chsnprintf(buf, sizeof buf, "\001%d:", previous_marker+1);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
@ -1428,6 +1537,8 @@ cell_draw_marker_info(int m, int n, int w, int h)
}
}
void
frequency_string(char *buf, size_t len, int32_t freq)
{

78
ui.c

@ -404,6 +404,11 @@ show_version(void)
ili9341_drawstring_5x7("Architecture: " PORT_ARCHITECTURE_NAME " Core Variant: " PORT_CORE_VARIANT_NAME, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_5x7("Port Info: " PORT_INFO, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_5x7("Platform: " PLATFORM_NAME, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8("Hello world" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("Hello world" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("ABCDEFGHIJKL MNOPQRSTUVWXYZ" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("abcdefghijkl mnopqrstuvwxyz" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
ili9341_drawstring_8x8_var("0123456790" S_PI S_MICRO S_OHM S_DEGREE S_LARROW S_RARROW, x, y += 10, 0xffff, 0x0000);
while (true) {
if (touch_check() == EVT_TOUCH_PRESSED)
@ -877,10 +882,10 @@ const menuitem_t menu_save[] = {
};
const menuitem_t menu_cal[] = {
{ MT_SUBMENU, "CALIBRATE", menu_calop },
{ MT_SUBMENU, S_RARROW" CALIBR", menu_calop },
{ MT_SUBMENU, "SAVE", menu_save },
{ MT_CALLBACK, "RESET", menu_cal2_cb },
{ MT_CALLBACK, "CORRECTION", menu_cal2_cb },
{ MT_CALLBACK, "Correct.", menu_cal2_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -899,8 +904,8 @@ const menuitem_t menu_format2[] = {
{ MT_CALLBACK, "LINEAR", menu_format2_cb },
{ MT_CALLBACK, "REAL", menu_format2_cb },
{ MT_CALLBACK, "IMAG", menu_format2_cb },
{ MT_CALLBACK, "RESISTANCE", menu_format2_cb },
{ MT_CALLBACK, "REACTANCE", menu_format2_cb },
{ MT_CALLBACK, "RESIST.", menu_format2_cb },
{ MT_CALLBACK, "REACT.", menu_format2_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -919,17 +924,17 @@ const menuitem_t menu_format[] = {
};
const menuitem_t menu_scale[] = {
{ MT_CALLBACK, "SCALE/DIV", menu_scale_cb },
{ MT_CALLBACK, "\2REFERENCE\0POSITION", menu_scale_cb },
{ MT_CALLBACK, "\2ELECTRICAL\0DELAY", menu_scale_cb },
{ MT_CALLBACK, "Scle/Div", menu_scale_cb },
{ MT_CALLBACK, "\2Rfrnce\0Position", menu_scale_cb },
{ MT_CALLBACK, "\2Electr.\0Delay", menu_scale_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_channel[] = {
{ MT_CALLBACK, "\2CH0\0REFLECT", menu_channel_cb },
{ MT_CALLBACK, "\2CH1\0THROUGH", menu_channel_cb },
{ MT_CALLBACK, "\2CH 0\0REFLECT", menu_channel_cb },
{ MT_CALLBACK, "\2CH 1\0THROUGH", menu_channel_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -943,12 +948,12 @@ const menuitem_t menu_transform_window[] = {
};
const menuitem_t menu_transform[] = {
{ MT_CALLBACK, "\2TRANSFORM\0ON", menu_transform_cb },
{ MT_CALLBACK, "\2LOW PASS\0IMPULSE", menu_transform_cb },
{ MT_CALLBACK, "\2LOW PASS\0STEP", menu_transform_cb },
{ MT_CALLBACK, "BANDPASS", menu_transform_cb },
{ MT_CALLBACK, "\2TRANSFO\0ON", menu_transform_cb },
{ MT_CALLBACK, "\2LOWPASS\0IMPULSE", menu_transform_cb },
{ MT_CALLBACK, "\2LOWPASS\0STEP", menu_transform_cb },
{ MT_CALLBACK, "BANDP.", menu_transform_cb },
{ MT_SUBMENU, "WINDOW", menu_transform_window },
{ MT_CALLBACK, "\2VELOCITY\0FACTOR", menu_transform_cb },
{ MT_CALLBACK, "\2Velocity\0FACTOR", menu_transform_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -958,7 +963,7 @@ const menuitem_t menu_display[] = {
{ MT_SUBMENU, "FORMAT", menu_format },
{ MT_SUBMENU, "SCALE", menu_scale },
{ MT_SUBMENU, "CHANNEL", menu_channel },
{ MT_SUBMENU, "TRANSFORM", menu_transform },
{ MT_SUBMENU, "TRNSFRM", menu_transform },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -995,27 +1000,27 @@ const menuitem_t menu_marker[] = {
};
const menuitem_t menu_recall[] = {
{ MT_CALLBACK, "RECALL 0", menu_recall_cb },
{ MT_CALLBACK, "RECALL 1", menu_recall_cb },
{ MT_CALLBACK, "RECALL 2", menu_recall_cb },
{ MT_CALLBACK, "RECALL 3", menu_recall_cb },
{ MT_CALLBACK, "RECALL 4", menu_recall_cb },
{ MT_CALLBACK, "RECALL0", menu_recall_cb },
{ MT_CALLBACK, "RECALL1", menu_recall_cb },
{ MT_CALLBACK, "RECALL2", menu_recall_cb },
{ MT_CALLBACK, "RECALL3", menu_recall_cb },
{ MT_CALLBACK, "RECALL4", menu_recall_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_dfu[] = {
{ MT_CALLBACK, "\2RESET AND\0ENTER DFU", menu_dfu_cb },
{ MT_CANCEL, S_LARROW"CANCEL", NULL },
{ MT_CALLBACK, "\2RESET+\0Ent DFU", menu_dfu_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_config[] = {
{ MT_CALLBACK, "TOUCH CAL", menu_config_cb },
{ MT_CALLBACK, "TOUCH TEST", menu_config_cb },
{ MT_CALLBACK, "\2TOUCH\0CAL", menu_config_cb },
{ MT_CALLBACK, "\2TOUCH\0TEST", menu_config_cb },
{ MT_CALLBACK, "SAVE", menu_config_cb },
{ MT_CALLBACK, "VERSION", menu_config_cb },
{ MT_SUBMENU, S_RARROW"DFU", menu_dfu },
{ MT_SUBMENU, " " S_RARROW " DFU", menu_dfu },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -1341,30 +1346,41 @@ void
draw_menu_buttons(const menuitem_t *menu)
{
int i = 0;
for (i = 0; i < 7; i++) {
for (i = 0; i < 7; i++)
{
const char *l1, *l2;
if (menu[i].type == MT_NONE)
break;
if (menu[i].type == MT_BLANK)
continue;
int y = 32*i;
uint16_t bg = config.menu_normal_color;
uint16_t fg = 0x0000;
// focus only in MENU mode but not in KEYPAD mode
if (ui_mode == UI_MENU && i == selection)
bg = config.menu_active_color;
ili9341_fill(320-60, y, 60, 30, bg);
menu_item_modify_attribute(menu, i, &fg, &bg);
if (menu_is_multiline(menu[i].label, &l1, &l2)) {
ili9341_drawstring_5x7(l1, 320-54, y+8, fg, bg);
ili9341_drawstring_5x7(l2, 320-54, y+15, fg, bg);
} else {
ili9341_drawstring_5x7(menu[i].label, 320-54, y+12, fg, bg);
if (menu_is_multiline(menu[i].label, &l1, &l2))
{
ili9341_drawstring_8x8_var(l1, 320-57, y+7, fg, bg);
ili9341_drawstring_8x8_var(l2, 320-57, y+16, fg, bg);
}
else
{
ili9341_drawstring_8x8_var(menu[i].label, 320-57, y+12, fg, bg);
}
}
}
void
menu_select_touch(int i)
{

Loading…
Cancel
Save

Powered by TurnKey Linux.