Use 3x wide font (10x14) for big numbers

Small fixes in big number draw
pull/52/head
DiSlord Live 3 years ago
parent d9f1514b26
commit 103b4c89ed

@ -875,21 +875,21 @@ 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 x_max)
{
uint16_t *buf = spi_buffer;
const uint8_t *char_buf = bFONT_GET_DATA(ch);
uint16_t w = bFONT_GET_WIDTH(ch);
const uint16_t *char_buf = (uint16_t *)wFONT_GET_DATA(ch);
uint16_t w = wFONT_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 c = 0; c < wFONT_GET_HEIGHT; c++, char_buf++) {
for (int i = 0; i < size; i++) {
uint8_t bits = *char_buf;
uint16_t bits = *char_buf;bits=(bits>>8)|(bits<<8);
for (int r = 0; r < w; r++, bits <<= 1)
for (int j = 0; j < size; j++)
*buf++ = (0x80 & bits) ? foreground_color : background_color;
*buf++ = (0x8000 & bits) ? foreground_color : background_color;
}
}
ili9341_bulk(x, y, w * size, bFONT_GET_HEIGHT * size);
ili9341_bulk(x, y, w * size, wFONT_GET_HEIGHT * size);
return w*size;
}

@ -2111,15 +2111,13 @@ static void update_level_meter(void){
ili9341_set_foreground(LCD_FG_COLOR);
int x_max = area_width+OFFSETX;
#ifdef TINYSA4
#define BIG_SIZE 5
#else
#define BIG_SIZE 3
#else
#define BIG_SIZE 2
#endif
int w = ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+1,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop??????
ili9341_fill(OFFSETX, graph_bottom+BIG_SIZE*11+1, x_max - OFFSETX, CHART_BOTTOM - (graph_bottom+BIG_SIZE*11+1) + 1);
int w = ili9341_drawstring_size(level_text, OFFSETX + 3, graph_bottom + 3,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop??????
if (w < x_max)
ili9341_fill(w, graph_bottom+1, x_max - w, CHART_BOTTOM - graph_bottom+1);
ili9341_fill(w, graph_bottom+3, x_max - w, BIG_SIZE * wFONT_GET_HEIGHT);
}
void
@ -2132,7 +2130,7 @@ set_level_meter(void)
area_height = AREA_HEIGHT_NORMAL;
if (setting.level_meter){
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom + 1);
}
request_to_redraw_grid();
}

@ -6185,6 +6185,10 @@ leave_ui_mode()
// ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, area_height, MENU_BUTTON_WIDTH, menu_button_height*MENU_BUTTON_MAX - area_height);
if (setting.waterfall)
set_waterfall();
#ifdef __LEVEL_METER__
if (setting.level_meter)
ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, area_height, MENU_BUTTON_WIDTH, menu_button_height*MENU_BUTTON_MAX - area_height);
#endif
redraw_request|=REDRAW_AREA | REDRAW_FREQUENCY | REDRAW_CAL_STATUS | REDRAW_BATTERY;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.