fix: swr string

This commit is contained in:
Dennis Real (DL9CAT) 2019-10-04 17:49:55 +02:00
parent 601e82991b
commit 6a26cda169
4 changed files with 9 additions and 43 deletions

View file

@ -336,41 +336,6 @@ ili9341_read_memory_continue(int len, uint16_t* out)
void
ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg)
{
uint16_t *buf = spi_buffer;
uint8_t bits;
int c, r;
ch = x5x7_map_char_table(ch);
for(c = 0; c < 7; c++)
{
bits = x5x7_bits[(ch * 7) + c];
for (r = 0; r < 5; r++)
{
*buf++ = (0x80 & bits) ? fg : bg;
bits <<= 1;
}
}
ili9341_bulk(x, y, 5, 7);
}
void
ili9341_drawstring_5x7(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
while (*str) {
ili9341_drawchar_5x7(*str, x, y, fg, bg);
x += 5;
str++;
}
}
void
ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size)
{

View file

@ -287,8 +287,6 @@ void ili9341_init(void);
void ili9341_test(int mode);
void ili9341_bulk(int x, int y, int w, int h);
void ili9341_fill(int x, int y, int w, int h, int color);
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);

13
plot.c
View file

@ -700,7 +700,7 @@ trace_get_info(int t, char *buf, uint16_t len)
break;
default:
n = chsnprintf(buf, len, "%s ", type);
string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/');
n += string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/');
break;
}
@ -1516,7 +1516,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
int t;
uint16_t slen, strwidthpx = 0;
if (n != 0)
if (n > 1)
return;
if (active_marker < 0)
@ -1542,8 +1542,8 @@ cell_draw_marker_info(int m, int n, int w, int h)
slen = trace_get_info(t, buf, sizeof buf);
trace_get_value_string(t, buf+slen, (sizeof(buf))-slen, measured[trace[t].channel][idx], frequencies[idx]);
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, config.trace_color[t], FALSE);
j++;
}
@ -1576,10 +1576,13 @@ cell_draw_marker_info(int m, int n, int w, int h)
xpos -= m * CELLWIDTH - CELLOFFSETX;
ypos += 8;
chsnprintf(buf, sizeof buf, "\001%d:", previous_marker+1);
chsnprintf(buf, sizeof buf, "%s%d:", S_DIAMOND, previous_marker+1);
strwidthpx = cell_drawstring_8x8(w, h, buf, xpos, ypos, 0xffff, FALSE);
xpos += strwidthpx + 4;
frequency_string(buf, sizeof buf, frequencies[idx] - frequencies[idx0]);
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE);
}
@ -1603,7 +1606,7 @@ frequency_string(char *buf, size_t len, int32_t freq)
(int)(freq / 1000),
(int)(freq % 1000));
} else {
chsnprintf(buf, len, "%d.%03d %03d MHz",
chsnprintf(buf, len, "%d.%03d%03d MHz",
(int)(freq / 1000000),
(int)((freq / 1000) % 1000),
(int)(freq % 1000));

2
ui.c
View file

@ -1262,7 +1262,7 @@ void
draw_numeric_area_frame(void)
{
ili9341_fill(0, 208, 320, 32, 0xffff);
ili9341_drawstring_5x7(keypad_mode_label[keypad_mode], 10, 220, 0x0000, 0xffff);
ili9341_drawstring_8x8_var(keypad_mode_label[keypad_mode], 10, 220, 0x0000, 0xffff);
ili9341_drawfont(KP_KEYPAD, &NF20x24, 300, 216, 0x0000, 0xffff);
}