Add delta symbol for delta markers

Add different marker icon size, and use cell_blit_bitmap for draw it
Change # symbol for big font
pull/4/head
DiSlord 5 years ago
parent 7dd31965f0
commit 8e0b201fc2

@ -244,18 +244,18 @@ const uint8_t x10x14_bits[(127-wFONT_START_CHAR)*wFONT_GET_HEIGHT*2] =
// Char '#', width = 11 // Char '#', width = 11
_BMP16(0b0000000000000000|CW_11), // | | _BMP16(0b0000000000000000|CW_11), // | |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b1111111111000000), // |********** | _BMP16(0b1111111111000000), // |********** |
_BMP16(0b0010000100000000), // | * * |
_BMP16(0b0010000100000000), // | * * |
_BMP16(0b0010000100000000), // | * * |
_BMP16(0b1111111111000000), // |********** | _BMP16(0b1111111111000000), // |********** |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0010000100000000), // | * * | _BMP16(0b1111111111000000), // |********** |
_BMP16(0b0000000000000000), // | | _BMP16(0b1111111111000000), // |********** |
_BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0011001100000000), // | ** ** |
_BMP16(0b0000000000000000), // | | _BMP16(0b0000000000000000), // | |
// Char '$', width = 10 // Char '$', width = 10

@ -329,6 +329,8 @@ extern uint16_t _grid_y;
extern int16_t area_width; extern int16_t area_width;
extern int16_t area_height; extern int16_t area_height;
// Define marker size (can be 0 or 1)
#define _MARKER_SIZE_ 0
// font // font
extern const uint8_t x5x7_bits []; extern const uint8_t x5x7_bits [];
extern const uint8_t x7x11b_bits []; extern const uint8_t x7x11b_bits [];
@ -377,7 +379,7 @@ extern const uint8_t numfont16x22[];
#define KP_GET_Y(posy) ((posy)*KP_HEIGHT + 12 ) #define KP_GET_Y(posy) ((posy)*KP_HEIGHT + 12 )
#endif #endif
#define S_DELTA "\029" // 0x17 #define S_DELTA "\027" // 0x17
#define S_SARROW "\030" // 0x18 #define S_SARROW "\030" // 0x18
#define S_INFINITY "\031" // 0x19 #define S_INFINITY "\031" // 0x19
#define S_LARROW "\032" // 0x1A #define S_LARROW "\032" // 0x1A

291
plot.c

@ -34,6 +34,7 @@ static int waterfall = false;
#endif #endif
static void cell_draw_marker_info(int x0, int y0); static void cell_draw_marker_info(int x0, int y0);
static void cell_grid_line_info(int x0, int y0); static void cell_grid_line_info(int x0, int y0);
static void cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *bitmap);
static void draw_battery_status(void); static void draw_battery_status(void);
static void update_waterfall(void); static void update_waterfall(void);
void cell_draw_test_info(int x0, int y0); void cell_draw_test_info(int x0, int y0);
@ -854,21 +855,22 @@ static void trace_get_value_string(
float v; float v;
char buf2[16]; char buf2[16];
char buf3[8]; char buf3[8];
buf2[0]=' '; char *ptr2 = buf2;
uint32_t dfreq = 0; uint32_t dfreq = 0;
float rlevel = 0; float rlevel = 0;
int ii = i; int ii = i;
int unit_index = setting.unit; int unit_index = setting.unit;
if (mtype & M_DELTA) { if (mtype & M_DELTA) {
*ptr2++ = S_DELTA[0];
unit_index = setting.unit+5; unit_index = setting.unit+5;
if (ri > i) { if (ri > i) {
dfreq = frequencies[ri] - frequencies[i]; dfreq = frequencies[ri] - frequencies[i];
ii = ri - i; ii = ri - i;
buf2[0] = '-'; *ptr2++ = '-';
} else { } else {
dfreq = frequencies[i] - frequencies[ri]; dfreq = frequencies[i] - frequencies[ri];
ii = i - ri; ii = i - ri;
buf2[0] = '+'; *ptr2++ = '+';
} }
rlevel = value(coeff[ri]); rlevel = value(coeff[ri]);
} else { } else {
@ -877,38 +879,38 @@ static void trace_get_value_string(
if (FREQ_IS_CW()) { if (FREQ_IS_CW()) {
float t = ii*(setting.actual_sweep_time_us)/(sweep_points - 1); float t = ii*(setting.actual_sweep_time_us)/(sweep_points - 1);
#if 1 #if 1
plot_printf(&buf2[1], sizeof(buf2) -1, "%.3Fs" , t/ONE_SECOND_TIME); plot_printf(ptr2, sizeof(buf2) - 2, "%.3Fs" , t/ONE_SECOND_TIME);
#else #else
if (t>ONE_SECOND_TIME){ if (t>ONE_SECOND_TIME){
plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/ONE_SECOND_TIME); ptr2+=plot_printf(ptr2, sizeof(buf2) - 2, "%4f" , t/ONE_SECOND_TIME);
buf2[5] = 'S'; *ptr2++= 'S';
buf2[6]=0; *ptr2++=0;
} }
else if (t>1000.0) { else if (t>1000.0) {
plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/ONE_MS_TIME); ptr2+=plot_printf(ptr2, sizeof(buf2) - 2, "%4f" , t/ONE_MS_TIME);
buf2[5] = 'm'; *ptr2++= 'm';
buf2[6] = 'S'; *ptr2++= 'S';
buf2[7]=0; *ptr2++= 0;
} }
else { else {
plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t); ptr2+=plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t);
buf2[5] = 'u'; *ptr2++= 'u';
buf2[6] = 'S'; *ptr2++= 'S';
buf2[7]=0; *ptr2++= 0;
} }
#endif #endif
} else { } else {
#if 0 #if 0
uint32_t resolution = get_sweep_frequency(ST_SPAN); uint32_t resolution = get_sweep_frequency(ST_SPAN);
if (resolution <= 2000*POINTS_COUNT) if (resolution <= 2000*POINTS_COUNT)
plot_printf(&buf2[1], sizeof(buf2) -1, "%3.3f" , (dfreq + 500) / 1000000.0); plot_printf(ptr2, sizeof(buf2) - 2, "%3.3f" , (dfreq + 500) / 1000000.0);
else if (resolution <= 20000*POINTS_COUNT) else if (resolution <= 20000*POINTS_COUNT)
plot_printf(&buf2[1], sizeof(buf2) -1, "%3.2f" , (dfreq + 5000) / 1000000.0); plot_printf(ptr2, sizeof(buf2) - 2, "%3.2f" , (dfreq + 5000) / 1000000.0);
else else
plot_printf(&buf2[1], sizeof(buf2) -1, "%3.1f" , (dfreq + 50000) / 1000000.0); plot_printf(ptr2, sizeof(buf2) - 2, "%3.1f" , (dfreq + 50000) / 1000000.0);
} }
#else #else
plot_printf(&buf2[1], sizeof(buf2) -1, "%8.3qHz" , dfreq); plot_printf(ptr2, sizeof(buf2) - 2, "%8.3qHz" , dfreq);
} }
#endif #endif
v = value(coeff[i]); v = value(coeff[i]);
@ -1119,7 +1121,6 @@ search_index_range_x(int x1, int x2, index_t index[POINTS_COUNT], int *i0, int *
return TRUE; return TRUE;
} }
#if 0 // Not used as refpos is always at top of screen #if 0 // Not used as refpos is always at top of screen
#define REFERENCE_WIDTH 6 #define REFERENCE_WIDTH 6
#define REFERENCE_HEIGHT 5 #define REFERENCE_HEIGHT 5
#define REFERENCE_X_OFFSET 5 #define REFERENCE_X_OFFSET 5
@ -1127,103 +1128,156 @@ search_index_range_x(int x1, int x2, index_t index[POINTS_COUNT], int *i0, int *
// Reference bitmap // Reference bitmap
static const uint8_t reference_bitmap[]={ static const uint8_t reference_bitmap[]={
0b11000000, _BMP8(0b11000000),
0b11110000, _BMP8(0b11110000),
0b11111100, _BMP8(0b11111100),
0b11110000, _BMP8(0b11110000),
0b11000000, _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;
}
}
}
#endif #endif
#if _MARKER_SIZE_ == 0
#define MARKER_WIDTH 7 #define MARKER_WIDTH 7
#define MARKER_HEIGHT 10 #define MARKER_HEIGHT 10
#define X_MARKER_OFFSET 3 #define X_MARKER_OFFSET 3
#define Y_MARKER_OFFSET 10 #define Y_MARKER_OFFSET 10
#define MARKER_BITMAP(i) (&marker_bitmap[(i)*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={ 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 // Marker 1
0b11111110, _BMP8(0b00000000),
0b11101110, _BMP8(0b00010000),
0b11001110, _BMP8(0b00110000),
0b11101110, _BMP8(0b00010000),
0b11101110, _BMP8(0b00010000),
0b11101110, _BMP8(0b00010000),
0b11000110, _BMP8(0b00111000),
0b01111100, _BMP8(0b00000000),
0b00111000, _BMP8(0b00000000),
0b00010000, _BMP8(0b00000000),
// Marker 2 // Marker 2
0b11111110, _BMP8(0b00000000),
0b11000110, _BMP8(0b00111000),
0b10111010, _BMP8(0b01000100),
0b11111010, _BMP8(0b00000100),
0b11000110, _BMP8(0b00111000),
0b10111110, _BMP8(0b01000000),
0b10000010, _BMP8(0b01111100),
0b01111100, _BMP8(0b00000000),
0b00111000, _BMP8(0b00000000),
0b00010000, _BMP8(0b00000000),
// Marker 3 // Marker 3
0b11111110, _BMP8(0b00000000),
0b11000110, _BMP8(0b00111000),
0b10111010, _BMP8(0b01000100),
0b11100110, _BMP8(0b00011000),
0b11111010, _BMP8(0b00000100),
0b10111010, _BMP8(0b01000100),
0b11000110, _BMP8(0b00111000),
0b01111100, _BMP8(0b00000000),
0b00111000, _BMP8(0b00000000),
0b00010000, _BMP8(0b00000000),
// Marker 4 // Marker 4
0b11111110, _BMP8(0b00000000),
0b11110110, _BMP8(0b00001000),
0b11100110, _BMP8(0b00011000),
0b11010110, _BMP8(0b00101000),
0b10110110, _BMP8(0b01001000),
0b10110110, _BMP8(0b01001000),
0b10000010, _BMP8(0b01111100),
0b01110100, _BMP8(0b00001000),
0b00111000, _BMP8(0b00000000),
0b00010000, _BMP8(0b00000000),
}; };
static void #elif _MARKER_SIZE_ == 1
draw_marker(int x, int y, int c, int ch) #define MARKER_WIDTH 10
{ #define MARKER_HEIGHT 13
int y0 = y, j; #define X_MARKER_OFFSET 4
for (j = 0; j < MARKER_HEIGHT; j++, y0++) { #define Y_MARKER_OFFSET 13
int x0 = x; #define MARKER_BITMAP(i) (&marker_bitmap[(i)*2*MARKER_HEIGHT])
uint8_t bits = marker_bitmap[ch * MARKER_HEIGHT + j]; static const uint8_t marker_bitmap[]={
bool force_color = false; // Marker Back plate
while (bits) { _BMP16(0b1111111110000000),
if (bits & 0x80) force_color = true; _BMP16(0b1111111110000000),
if (x0 >= 0 && x0 < CELLWIDTH && y0 >= 0 && y0 < CELLHEIGHT) { _BMP16(0b1111111110000000),
if (bits & 0x80) _BMP16(0b1111111110000000),
cell_buffer[y0 * CELLWIDTH + x0] = c; _BMP16(0b1111111110000000),
else if (force_color) _BMP16(0b1111111110000000),
cell_buffer[y0 * CELLWIDTH + x0] = DEFAULT_BG_COLOR; _BMP16(0b1111111110000000),
} _BMP16(0b1111111110000000),
x0++; _BMP16(0b1111111110000000),
bits <<= 1; _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 static void
markmap_marker(int marker) markmap_marker(int marker)
@ -1555,18 +1609,15 @@ draw_cell(int m, int n)
int x = CELL_X(index) - x0 - X_MARKER_OFFSET; int x = CELL_X(index) - x0 - X_MARKER_OFFSET;
int y = CELL_Y(index) - y0 - Y_MARKER_OFFSET; int y = CELL_Y(index) - y0 - Y_MARKER_OFFSET;
// Check marker icon on cell // Check marker icon on cell
#if 1
if (x + MARKER_WIDTH >= 0 && x < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y < CELLHEIGHT)
draw_marker(x, y, marker_color(markers[i].mtype), i);
#else
if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH && if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT) y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT){
draw_marker(x, y, marker_color(markers[i].mtype), i); // Draw marker plate
#endif ili9341_set_foreground(config.trace_color[t]);
// draw_marker(x, y, config.trace_color[t], i); 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 #endif
@ -1590,8 +1641,10 @@ draw_cell(int m, int n)
int x = 0 - x0 + CELLOFFSETX - REFERENCE_X_OFFSET; int x = 0 - x0 + CELLOFFSETX - REFERENCE_X_OFFSET;
if (x + REFERENCE_WIDTH >= 0 && x - REFERENCE_WIDTH < CELLWIDTH) { if (x + REFERENCE_WIDTH >= 0 && x - REFERENCE_WIDTH < CELLWIDTH) {
int y = HEIGHT - float2int((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET; int y = HEIGHT - float2int((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET;
if (y + REFERENCE_HEIGHT >= 0 && y - REFERENCE_HEIGHT < CELLHEIGHT) if (y + REFERENCE_HEIGHT >= 0 && y - REFERENCE_HEIGHT < CELLHEIGHT){
draw_refpos(x, y, config.trace_color[t]); ili9341_set_foreground(config.trace_color[t]);
cell_blit_bitmap(x , y, REFERENCE_WIDTH, REFERENCE_HEIGHT, reference_bitmap);
}
} }
} }
#endif #endif
@ -1704,7 +1757,7 @@ request_to_draw_cells_behind_numeric_input(void)
} }
static void static void
cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *char_buf) cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *bitmap)
{ {
if (x <= -w) if (x <= -w)
return; return;
@ -1712,7 +1765,7 @@ cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *char_buf)
int c = h+y, r; int c = h+y, r;
for (; y < c; y++) { for (; y < c; y++) {
for (r = 0; r < w; r++) { for (r = 0; r < w; r++) {
if ((r&7)==0) bits = *char_buf++; if ((r&7)==0) bits = *bitmap++;
if (y >= 0 && x+r >= 0 && y < CELLHEIGHT && x+r < CELLWIDTH && (0x80 & bits)) if (y >= 0 && x+r >= 0 && y < CELLHEIGHT && x+r < CELLWIDTH && (0x80 & bits))
cell_buffer[y*CELLWIDTH + x + r] = foreground_color; cell_buffer[y*CELLWIDTH + x + r] = foreground_color;
bits <<= 1; bits <<= 1;

Loading…
Cancel
Save

Powered by TurnKey Linux.