Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TFT_eSPI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
TFT_eSPI
Commits
d5f0812b
Commit
d5f0812b
authored
Apr 01, 2018
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix touch issue #114
Also had to mirror the coordinate transform.
parent
7f98aeb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Extensions/Touch.cpp
Extensions/Touch.cpp
+8
-8
No files found.
Extensions/Touch.cpp
View file @
d5f0812b
...
...
@@ -53,7 +53,7 @@ uint16_t TFT_eSPI::getTouchRawZ(void){
T_CS_L
;
// Z sample request
u
int16_t
tz
=
0xFFF
;
int16_t
tz
=
0xFFF
;
SPI
.
transfer
(
0xb1
);
tz
+=
SPI
.
transfer16
(
0xc1
)
>>
3
;
tz
-=
SPI
.
transfer16
(
0x91
)
>>
3
;
...
...
@@ -62,7 +62,7 @@ uint16_t TFT_eSPI::getTouchRawZ(void){
spi_end_touch
();
return
tz
;
return
(
uint16_t
)
tz
;
}
/***************************************************************************************
...
...
@@ -203,7 +203,7 @@ void TFT_eSPI::calibrateTouch(uint16_t *parameters, uint32_t color_fg, uint32_t
for
(
uint8_t
j
=
0
;
j
<
8
;
j
++
){
// Use a lower detect threshold as corners tend to be less sensitive
while
(
!
validTouch
(
&
x_tmp
,
&
y_tmp
,
Z_THRESHOLD
/
4
));
while
(
!
validTouch
(
&
x_tmp
,
&
y_tmp
,
Z_THRESHOLD
/
2
));
values
[
i
*
2
]
+=
x_tmp
;
values
[
i
*
2
+
1
]
+=
y_tmp
;
}
...
...
@@ -230,20 +230,20 @@ void TFT_eSPI::calibrateTouch(uint16_t *parameters, uint32_t color_fg, uint32_t
touchCalibration_y1
=
(
values
[
3
]
+
values
[
7
])
/
2
;
// calc max y
}
// in addition, the touch screen axis could be in the opposit direction of the TFT axis
touchCalibration_invert_x
=
fals
e
;
// in addition, the touch screen axis could be in the opposit
e
direction of the TFT axis
touchCalibration_invert_x
=
tru
e
;
if
(
touchCalibration_x0
>
touchCalibration_x1
){
values
[
0
]
=
touchCalibration_x0
;
touchCalibration_x0
=
touchCalibration_x1
;
touchCalibration_x1
=
values
[
0
];
touchCalibration_invert_x
=
tru
e
;
touchCalibration_invert_x
=
fals
e
;
}
touchCalibration_invert_y
=
fals
e
;
touchCalibration_invert_y
=
tru
e
;
if
(
touchCalibration_y0
>
touchCalibration_y1
){
values
[
0
]
=
touchCalibration_y0
;
touchCalibration_y0
=
touchCalibration_y1
;
touchCalibration_y1
=
values
[
0
];
touchCalibration_invert_y
=
tru
e
;
touchCalibration_invert_y
=
fals
e
;
}
// pre calculate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment