BIG Number bugs solved

Speed-test
erikkaashoek 4 years ago
parent 6b44e6aac1
commit d0fbe26d77

@ -900,11 +900,15 @@ void ili9341_drawstringV(const char *str, int x, int y)
ili9341_set_rotation(DISPLAY_ROTATION_0);
}
#ifdef __LEVEL_METER__
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, int x_max)
{
uint16_t *buf = spi_buffer;
const uint8_t *char_buf = bFONT_GET_DATA(ch);
uint16_t w = bFONT_GET_WIDTH(ch);
if (x > x_max)
return 0;
if (w*size + x > x_max)
w = (x_max - x)/size;
for (int c = 0; c < bFONT_GET_HEIGHT; c++, char_buf++) {
for (int i = 0; i < size; i++) {
uint8_t bits = *char_buf;
@ -917,10 +921,11 @@ int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size)
return w*size;
}
void ili9341_drawstring_size(const char *str, int x, int y, uint8_t size)
int ili9341_drawstring_size(const char *str, int x, int y, uint8_t size, int x_max)
{
while (*str)
x += ili9341_drawchar_size(*str++, x, y, size);
x += ili9341_drawchar_size(*str++, x, y, size, x_max);
return x;
}
#endif

@ -1008,8 +1008,8 @@ void ili9341_drawstring_7x13(const char *str, int x, int y);
void ili9341_drawstring_10x14(const char *str, int x, int y);
int lcd_printf(int16_t x, int16_t y, const char *fmt, ...);
void ili9341_drawstringV(const char *str, int x, int y);
int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size);
void ili9341_drawstring_size(const char *str, int x, int y, uint8_t size);
int ili9341_drawchar_size(uint8_t ch, int x, int y, uint8_t size, int x_max);
int ili9341_drawstring_size(const char *str, int x, int y, uint8_t size, int x_max);
void ili9341_drawfont(uint8_t ch, int x, int y);
void ili9341_read_memory(int x, int y, int w, int h, uint16_t* out);
void ili9341_line(int x0, int y0, int x1, int y1);

@ -1535,7 +1535,7 @@ static void trace_print_value_string( // Only used at one place
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)
plot_printf(level_text, sizeof(level_text), &format[3], v, " ", "" ,"");
plot_printf(level_text, sizeof(level_text), &format[3], v, "", "" ,"");
#endif
}
@ -2063,13 +2063,15 @@ static void update_level_meter(void){
if (level_text[0] == 0)
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);
// 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_drawstring_size(level_text,OFFSETX, graph_bottom+2,4);
int x_max = area_width+OFFSETX;
int w = ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+1,4, x_max) + OFFSETX;
if (w < x_max)
ili9341_fill(w, graph_bottom+1, x_max - w, CHART_BOTTOM - graph_bottom+1);
}
void

@ -1792,6 +1792,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_waterfall_acb){
return;
}
setting.waterfall++; if (setting.waterfall>W_BIG)setting.waterfall = W_OFF;
if (setting.waterfall != W_OFF)
setting.level_meter = false;
set_waterfall();
ui_mode_normal();
}
@ -1805,6 +1807,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_level_meter_acb){
return;
}
setting.level_meter = !setting.level_meter;
if (setting.level_meter)
setting.waterfall = W_OFF;
set_level_meter();
ui_mode_normal();
}

Loading…
Cancel
Save

Powered by TurnKey Linux.