Bug repair and better font

Speed-test
erikkaashoek 4 years ago
parent 2fb820207b
commit 6b44e6aac1

@ -228,6 +228,7 @@ caldata_recall(uint16_t id)
set_scale(setting.scale); set_scale(setting.scale);
set_reflevel(setting.reflevel); set_reflevel(setting.reflevel);
set_waterfall(); set_waterfall();
set_level_meter();
if (setting.show_stored) if (setting.show_stored)
enableTracesAtComplete(TRACE_STORED_FLAG); enableTracesAtComplete(TRACE_STORED_FLAG);
return 0; return 0;

@ -903,9 +903,9 @@ void ili9341_drawstringV(const char *str, int x, int y)
int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size) int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size)
{ {
uint16_t *buf = spi_buffer; uint16_t *buf = spi_buffer;
const uint8_t *char_buf = FONT_GET_DATA(ch); const uint8_t *char_buf = bFONT_GET_DATA(ch);
uint16_t w = FONT_GET_WIDTH(ch); uint16_t w = bFONT_GET_WIDTH(ch);
for (int c = 0; c < FONT_GET_HEIGHT; c++, char_buf++) { for (int c = 0; c < bFONT_GET_HEIGHT; c++, char_buf++) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
uint8_t bits = *char_buf; uint8_t bits = *char_buf;
for (int r = 0; r < w; r++, bits <<= 1) for (int r = 0; r < w; r++, bits <<= 1)
@ -913,7 +913,7 @@ int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size)
*buf++ = (0x80 & bits) ? foreground_color : background_color; *buf++ = (0x80 & bits) ? foreground_color : background_color;
} }
} }
ili9341_bulk(x, y, w * size, FONT_GET_HEIGHT * size); ili9341_bulk(x, y, w * size, bFONT_GET_HEIGHT * size);
return w*size; return w*size;
} }

@ -1533,8 +1533,10 @@ static void trace_print_value_string( // Only used at one place
if (bold) format++; // Skip small prefix for bold output if (bold) format++; // Skip small prefix for bold output
#endif #endif
cell_printf(xpos, ypos, format, buf2, v, unit_string[unit_index], (mtype & M_NOISE?"/Hz":""), (mtype & M_AVER?"/T":"")); cell_printf(xpos, ypos, format, buf2, v, unit_string[unit_index], (mtype & M_NOISE?"/Hz":""), (mtype & M_AVER?"/T":""));
#ifdef __LEVEL_METER__
if (level_text[0] == 0) if (level_text[0] == 0)
plot_printf(level_text, sizeof(level_text), &format[3], v, unit_string[unit_index], (mtype & M_NOISE?"/Hz":""), (mtype & M_AVER?"/T":"")); plot_printf(level_text, sizeof(level_text), &format[3], v, " ", "" ,"");
#endif
} }
static void cell_draw_marker_info(int x0, int y0) static void cell_draw_marker_info(int x0, int y0)
@ -1561,11 +1563,21 @@ static void cell_draw_marker_info(int x0, int y0)
int ypos = 1 - y0; int ypos = 1 - y0;
cell_printf(xpos, ypos, FONT_b"%4.1fdBm/%3QHz", channel_power[c], bw); cell_printf(xpos, ypos, FONT_b"%4.1fdBm/%3QHz", channel_power[c], bw);
ypos = 14 - y0; ypos = 14 - y0;
if (setting.measurement==M_CP ) if (setting.measurement==M_CP ) {
cell_printf(xpos, ypos, FONT_b"%4.1f%%", 100.0 * channel_power_watt[c] /(channel_power_watt[0] + channel_power_watt[1] + channel_power_watt[2]) ); float v = 100.0 * channel_power_watt[c] /(channel_power_watt[0] + channel_power_watt[1] + channel_power_watt[2]);
else if (c == 1) cell_printf(xpos, ypos, FONT_b"%4.1f%%", v );
cell_printf(xpos, ypos, FONT_b"SNR: %4.1fdB", channel_power[1] - (channel_power[0] + channel_power[2])/2 ); #ifdef __LEVEL_METER__
if (c == 1)
plot_printf(level_text, sizeof(level_text), "%4.1f%%", v);
#endif
}
else if (c == 1) {
float v = channel_power[1] - (channel_power[0] + channel_power[2])/2;
cell_printf(xpos, ypos, FONT_b"SNR: %4.1fdB", v);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%4.1f", v);
#endif
}
} }
return; return;
} }
@ -1585,6 +1597,9 @@ static void cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0; int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0; int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_b"WIDTH: %8.3QHz", f); cell_printf(xpos, ypos, FONT_b"WIDTH: %8.3QHz", f);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%8.3Q", f);
#endif
// cell_drawstring(buf, xpos, ypos); // cell_drawstring(buf, xpos, ypos);
} else if (setting.measurement == M_AM){ } else if (setting.measurement == M_AM){
#ifdef AM_IN_VOLT #ifdef AM_IN_VOLT
@ -1609,6 +1624,9 @@ static void cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0; int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0; int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_b"DEPTH: %3d%%", depth); cell_printf(xpos, ypos, FONT_b"DEPTH: %3d%%", depth);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%3d%%", depth);
#endif
} else if (setting.measurement == M_FM){ } else if (setting.measurement == M_FM){
freq_t dev = markers[1].frequency + actual_rbw_x10*100.0; // Temp value to prevent calculation of negative deviation freq_t dev = markers[1].frequency + actual_rbw_x10*100.0; // Temp value to prevent calculation of negative deviation
if ( markers[2].frequency < dev) if ( markers[2].frequency < dev)
@ -1618,6 +1636,9 @@ static void cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0; int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0; int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_b"DEVIATION:%6.1QHz", dev); cell_printf(xpos, ypos, FONT_b"DEVIATION:%6.1QHz", dev);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%6.1Q", dev);
#endif
#ifdef TINYSA4 #ifdef TINYSA4
#define THD_SHIFT 7 #define THD_SHIFT 7
#else #else
@ -1650,6 +1671,9 @@ static void cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0; int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0; int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_b"#%d THD: %4.1f%%", h_count, thd); cell_printf(xpos, ypos, FONT_b"#%d THD: %4.1f%%", h_count, thd);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%4.1f%%", thd);
#endif
break; break;
} }
#ifdef __NOISE_FIGURE__ #ifdef __NOISE_FIGURE__
@ -1680,6 +1704,10 @@ static void cell_draw_marker_info(int x0, int y0)
else else
cell_printf(xpos, ypos, FONT_b"GAIN: %4.1fdB NF: %4.1f", nf_gain, measured_noise_figure); cell_printf(xpos, ypos, FONT_b"GAIN: %4.1fdB NF: %4.1f", nf_gain, measured_noise_figure);
} }
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%4.1f", measured_noise_figure);
#endif
break; break;
#endif #endif
} else } else
@ -1694,6 +1722,10 @@ static void cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0; int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0; int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_s"OIP3: %4.1fdB", ip); cell_printf(xpos, ypos, FONT_s"OIP3: %4.1fdB", ip);
#ifdef __LEVEL_METER__
plot_printf(level_text, sizeof(level_text), "%4.1f", ip);
#endif
ip = sr+ (sl - ir)/2; ip = sr+ (sl - ir)/2;
j = 3; j = 3;
@ -2028,16 +2060,16 @@ disable_waterfall(void)
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
static void update_level_meter(void){ static void update_level_meter(void){
int m = 0; if (level_text[0] == 0)
while (m < MARKERS_MAX){
if (markers[m].enabled)
break;
m++;
}
if (m == MARKERS_MAX)
return; return;
ili9341_set_background(LCD_BG_COLOR);
const int minimum_text_width = 6*5*7;
level_text[6] = 0;
if (area_width-minimum_text_width > 0)
ili9341_fill(OFFSETX+minimum_text_width, graph_bottom+1, area_width-minimum_text_width, CHART_BOTTOM - graph_bottom);
ili9341_set_foreground(LCD_FG_COLOR); ili9341_set_foreground(LCD_FG_COLOR);
ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+2,6); ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+2,4);
} }
void void

@ -2959,7 +2959,7 @@ static const menuitem_t menu_display[] = {
{ MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb}, { MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb},
{ MT_ADV_CALLBACK,1, "WATER\nFALL", menu_waterfall_acb}, { MT_ADV_CALLBACK,1, "WATER\nFALL", menu_waterfall_acb},
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
{ MT_ADV_CALLBACK,1, "LEVEL\nMETER", menu_level_meter_acb}, { MT_ADV_CALLBACK,1, "BIG\nNUMBER", menu_level_meter_acb},
#endif #endif
#ifdef __VBW__ #ifdef __VBW__
{ MT_SUBMENU, 0, "VBW", menu_vbw}, { MT_SUBMENU, 0, "VBW", menu_vbw},

Loading…
Cancel
Save

Powered by TurnKey Linux.