mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Write clearScreen and use it in code
More hard coded values fixes
This commit is contained in:
parent
b7934745ca
commit
d386b0823c
|
|
@ -487,6 +487,10 @@ void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void clearScreen(void){
|
||||||
|
ili9341_fill(0, 0, ILI9341_WIDTH, ILI9341_HEIGHT, background_color);
|
||||||
|
}
|
||||||
|
|
||||||
void setForegroundColor(uint16_t fg) {foreground_color = fg;}
|
void setForegroundColor(uint16_t fg) {foreground_color = fg;}
|
||||||
void setBackgroundColor(uint16_t bg) {background_color = bg;}
|
void setBackgroundColor(uint16_t bg) {background_color = bg;}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ 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_fill(int x, int y, int w, int h, int color);
|
||||||
void setForegroundColor(uint16_t fg);
|
void setForegroundColor(uint16_t fg);
|
||||||
void setBackgroundColor(uint16_t fg);
|
void setBackgroundColor(uint16_t fg);
|
||||||
|
void clearScreen(void);
|
||||||
void blit8BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *bitmap);
|
void blit8BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *bitmap);
|
||||||
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *bitmap);
|
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *bitmap);
|
||||||
void ili9341_drawchar(uint8_t ch, int x, int y);
|
void ili9341_drawchar(uint8_t ch, int x, int y);
|
||||||
|
|
|
||||||
17
ui.c
17
ui.c
|
|
@ -311,7 +311,7 @@ touch_cal_exec(void)
|
||||||
adc_stop(ADC1);
|
adc_stop(ADC1);
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
ili9341_fill(0, 0, 320, 240, DEFAULT_BG_COLOR);
|
clearScreen();
|
||||||
ili9341_line(0, 0, 0, 32);
|
ili9341_line(0, 0, 0, 32);
|
||||||
ili9341_line(0, 0, 32, 0);
|
ili9341_line(0, 0, 32, 0);
|
||||||
ili9341_drawstring("TOUCH UPPER LEFT", 10, 10);
|
ili9341_drawstring("TOUCH UPPER LEFT", 10, 10);
|
||||||
|
|
@ -320,7 +320,7 @@ touch_cal_exec(void)
|
||||||
x1 = last_touch_x;
|
x1 = last_touch_x;
|
||||||
y1 = last_touch_y;
|
y1 = last_touch_y;
|
||||||
|
|
||||||
ili9341_fill(0, 0, 320, 240, DEFAULT_BG_COLOR);
|
clearScreen();
|
||||||
ili9341_line(320-1, 240-1, 320-1, 240-32);
|
ili9341_line(320-1, 240-1, 320-1, 240-32);
|
||||||
ili9341_line(320-1, 240-1, 320-32, 240-1);
|
ili9341_line(320-1, 240-1, 320-32, 240-1);
|
||||||
ili9341_drawstring("TOUCH LOWER RIGHT", 230, 220);
|
ili9341_drawstring("TOUCH LOWER RIGHT", 230, 220);
|
||||||
|
|
@ -346,9 +346,9 @@ touch_draw_test(void)
|
||||||
|
|
||||||
adc_stop(ADC1);
|
adc_stop(ADC1);
|
||||||
|
|
||||||
ili9341_fill(0, 0, 320, 240, DEFAULT_BG_COLOR);
|
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
|
clearScreen();
|
||||||
ili9341_drawstring("TOUCH TEST: DRAG PANEL", OFFSETX, 233);
|
ili9341_drawstring("TOUCH TEST: DRAG PANEL", OFFSETX, 233);
|
||||||
|
|
||||||
touch_wait_pressed();
|
touch_wait_pressed();
|
||||||
|
|
@ -378,12 +378,11 @@ void
|
||||||
show_version(void)
|
show_version(void)
|
||||||
{
|
{
|
||||||
int x = 5, y = 5;
|
int x = 5, y = 5;
|
||||||
|
|
||||||
adc_stop(ADC1);
|
adc_stop(ADC1);
|
||||||
ili9341_fill(0, 0, 320, 240, DEFAULT_BG_COLOR);
|
|
||||||
|
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
|
|
||||||
|
clearScreen();
|
||||||
ili9341_drawstring_size(BOARD_NAME, x, y, 4);
|
ili9341_drawstring_size(BOARD_NAME, x, y, 4);
|
||||||
y += 25;
|
y += 25;
|
||||||
|
|
||||||
|
|
@ -417,7 +416,7 @@ enter_dfu(void)
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
// leave a last message
|
// leave a last message
|
||||||
ili9341_fill(0, 0, 320, 240, DEFAULT_BG_COLOR);
|
clearScreen();
|
||||||
ili9341_drawstring("DFU: Device Firmware Update Mode", x, y += 10);
|
ili9341_drawstring("DFU: Device Firmware Update Mode", x, y += 10);
|
||||||
ili9341_drawstring("To exit DFU mode, please reset device yourself.", x, y += 10);
|
ili9341_drawstring("To exit DFU mode, please reset device yourself.", x, y += 10);
|
||||||
|
|
||||||
|
|
@ -647,7 +646,7 @@ static void
|
||||||
choose_active_marker(void)
|
choose_active_marker(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < MARKERS_MAX; i++)
|
||||||
if (markers[i].enabled) {
|
if (markers[i].enabled) {
|
||||||
active_marker = i;
|
active_marker = i;
|
||||||
return;
|
return;
|
||||||
|
|
@ -1478,7 +1477,7 @@ erase_menu_buttons(void)
|
||||||
static void
|
static void
|
||||||
erase_numeric_input(void)
|
erase_numeric_input(void)
|
||||||
{
|
{
|
||||||
ili9341_fill(0, 240-32, 320, 32, DEFAULT_BG_COLOR);
|
ili9341_fill(0, 240-NUM_INPUT_HEIGHT, 320, NUM_INPUT_HEIGHT, DEFAULT_BG_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue