Skip to content

Commit a98a448

Browse files
committed
Make X/Y case consistent with other globals.
1 parent 3b1b357 commit a98a448

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@
111111
* **tft_font_transparent** if not 0 draw fonts transparent
112112
* **tft_font_forceFixed** if not zero force drawing proportional fonts with fixed width
113113
* **tft_text_wrap** if not 0 wrap long text to the new line, else clip
114-
* **tft__fg** current foreground color for fonts
115-
* **tft__bg** current background for non transparent fonts
114+
* **tft_fg** current foreground color for fonts
115+
* **tft_bg** current background for non transparent fonts
116116
* **tft_dispWin** current display clip window
117-
* **tft__angleOffset** angle offset for arc, polygon and line by angle functions
117+
* **tft_angleOffset** angle offset for arc, polygon and line by angle functions
118118
* **tft_image_debug** print debug messages during image decode if set to 1
119119
* **tft_cfont** Currently used font structure
120-
* **TFT_X** X position of the next character after TFT_print() function
121-
* **TFT_Y** Y position of the next character after TFT_print() function
120+
* **tft_x** X position of the next character after TFT_print() function
121+
* **tft_y** Y position of the next character after TFT_print() function
122122
* **tft_tp_calx** touch screen X calibration constant
123123
* **tft_tp_caly** touch screen Y calibration constant
124124
* **tft_gray_scale** convert all colors to gray scale if set to 1

components/tft/tft.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ uint8_t tft_image_debug = 0;
7272

7373
float tft_angleOffset = DEFAULT_ANGLE_OFFSET;
7474

75-
int TFT_X = 0;
76-
int TFT_Y = 0;
75+
int tft_x = 0;
76+
int tft_y = 0;
7777

7878
uint32_t tft_tp_calx = 7472920;
7979
uint32_t tft_tp_caly = 122224794;
@@ -1750,8 +1750,8 @@ static void rotateChar(uint8_t c, int x, int y, int pos) {
17501750
}
17511751
disp_deselect();
17521752
// calculate x,y for the next char
1753-
TFT_X = (int)(x + ((pos+1) * tft_cfont.x_size * cos_radian));
1754-
TFT_Y = (int)(y + ((pos+1) * tft_cfont.x_size * sin_radian));
1753+
tft_x = (int)(x + ((pos+1) * tft_cfont.x_size * cos_radian));
1754+
tft_y = (int)(y + ((pos+1) * tft_cfont.x_size * sin_radian));
17551755
}
17561756

17571757
//----------------------
@@ -1931,10 +1931,10 @@ void TFT_print(char *st, int x, int y) {
19311931

19321932
if ((x < LASTX) || (tft_font_rotate == 0)) TFT_OFFSET = 0;
19331933

1934-
if ((x >= LASTX) && (x < LASTY)) x = TFT_X + (x-LASTX);
1934+
if ((x >= LASTX) && (x < LASTY)) x = tft_x + (x-LASTX);
19351935
else if (x > CENTER) x += tft_dispWin.x1;
19361936

1937-
if (y >= LASTY) y = TFT_Y + (y-LASTY);
1937+
if (y >= LASTY) y = tft_y + (y-LASTY);
19381938
else if (y > CENTER) y += tft_dispWin.y1;
19391939

19401940
// ** Get number of characters in string to print
@@ -1958,8 +1958,8 @@ void TFT_print(char *st, int x, int y) {
19581958
if (y < tft_dispWin.y1) y = tft_dispWin.y1;
19591959
if ((x > tft_dispWin.x2) || (y > tft_dispWin.y2)) return;
19601960

1961-
TFT_X = x;
1962-
TFT_Y = y;
1961+
tft_x = x;
1962+
tft_y = y;
19631963

19641964
// ** Adjust y position
19651965
tmph = tft_cfont.y_size; // font height
@@ -1973,22 +1973,22 @@ void TFT_print(char *st, int x, int y) {
19731973
}
19741974
else TFT_OFFSET = 0; // fixed font; offset not needed
19751975

1976-
if ((TFT_Y + tmph - 1) > tft_dispWin.y2) return;
1976+
if ((tft_y + tmph - 1) > tft_dispWin.y2) return;
19771977

19781978
int offset = TFT_OFFSET;
19791979

19801980
for (i=0; i<stl; i++) {
19811981
ch = st[i]; // get string character
19821982

19831983
if (ch == 0x0D) { // === '\r', erase to eol ====
1984-
if ((!tft_font_transparent) && (tft_font_rotate==0)) _fillRect(TFT_X, TFT_Y, tft_dispWin.x2+1-TFT_X, tmph, tft_bg);
1984+
if ((!tft_font_transparent) && (tft_font_rotate==0)) _fillRect(tft_x, tft_y, tft_dispWin.x2+1-tft_x, tmph, tft_bg);
19851985
}
19861986

19871987
else if (ch == 0x0A) { // ==== '\n', new line ====
19881988
if (tft_cfont.bitmap == 1) {
1989-
TFT_Y += tmph + tft_font_line_space;
1990-
if (TFT_Y > (tft_dispWin.y2-tmph)) break;
1991-
TFT_X = tft_dispWin.x1;
1989+
tft_y += tmph + tft_font_line_space;
1990+
if (tft_y > (tft_dispWin.y2-tmph)) break;
1991+
tft_x = tft_dispWin.x1;
19921992
}
19931993
}
19941994

@@ -2000,17 +2000,17 @@ void TFT_print(char *st, int x, int y) {
20002000
}
20012001

20022002
// check if character can be displayed in the current line
2003-
if ((TFT_X+tmpw) > (tft_dispWin.x2)) {
2003+
if ((tft_x+tmpw) > (tft_dispWin.x2)) {
20042004
if (tft_text_wrap == 0) break;
2005-
TFT_Y += tmph + tft_font_line_space;
2006-
if (TFT_Y > (tft_dispWin.y2-tmph)) break;
2007-
TFT_X = tft_dispWin.x1;
2005+
tft_y += tmph + tft_font_line_space;
2006+
if (tft_y > (tft_dispWin.y2-tmph)) break;
2007+
tft_x = tft_dispWin.x1;
20082008
}
20092009

20102010
// Let's print the character
20112011
if (tft_cfont.x_size == 0) {
20122012
// == proportional font
2013-
if (tft_font_rotate == 0) TFT_X += printProportionalChar(TFT_X, TFT_Y) + 1;
2013+
if (tft_font_rotate == 0) tft_x += printProportionalChar(tft_x, tft_y) + 1;
20142014
else {
20152015
// rotated proportional font
20162016
offset += rotatePropChar(x, y, offset);
@@ -2022,15 +2022,15 @@ void TFT_print(char *st, int x, int y) {
20222022
// == fixed font
20232023
if ((ch < tft_cfont.offset) || ((ch-tft_cfont.offset) > tft_cfont.numchars)) ch = tft_cfont.offset;
20242024
if (tft_font_rotate == 0) {
2025-
printChar(ch, TFT_X, TFT_Y);
2026-
TFT_X += tmpw;
2025+
printChar(ch, tft_x, tft_y);
2026+
tft_x += tmpw;
20272027
}
20282028
else rotateChar(ch, x, y, i);
20292029
}
20302030
else if (tft_cfont.bitmap == 2) {
20312031
// == 7-segment font ==
2032-
_draw7seg(TFT_X, TFT_Y, ch, tft_cfont.y_size, tft_cfont.x_size, tft_fg);
2033-
TFT_X += (tmpw + 2);
2032+
_draw7seg(tft_x, tft_y, ch, tft_cfont.y_size, tft_cfont.x_size, tft_fg);
2033+
tft_x += (tmpw + 2);
20342034
}
20352035
}
20362036
}

components/tft/tft.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ extern uint8_t tft_image_debug; // print debug messages during image decode i
5353

5454
extern Font tft_cfont; // Current font structure
5555

56-
extern int TFT_X; // X position of the next character after TFT_print() function
57-
extern int TFT_Y; // Y position of the next character after TFT_print() function
56+
extern int tft_x; // X position of the next character after TFT_print() function
57+
extern int tft_y; // Y position of the next character after TFT_print() function
5858

5959
extern uint32_t tft_tp_calx; // touch screen X calibration constant
6060
extern uint32_t tft_tp_caly; // touch screen Y calibration constant

0 commit comments

Comments
 (0)