Skip to content

Commit c9a703a

Browse files
authored
fixing pylint issues
pylint didn't like using comments to turn on/off the different rotations. I've switched it to a variable with if statements.
1 parent cd85c73 commit c9a703a

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

examples/touchscreen_orientation.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22
import adafruit_touchscreen
33

44
# Allign the touchscreen so that the top left corner reads as x=0, y=0
5-
# Uncoment the display setup code for the opropriate touchscreen orientation.
5+
# Change rotation variable to display setup code for the opropriate touchscreen orientation.
66

7-
'''
8-
# -------Rotate 0:
9-
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
10-
board.TOUCH_YD, board.TOUCH_YU,
11-
calibration=((5200, 59000), (5800, 57000)),
12-
size=(320, 240))
13-
'''
7+
rotation = 270
148

15-
'''
16-
# -------Rotate 90:
17-
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_YU, board.TOUCH_YD,
18-
board.TOUCH_XL, board.TOUCH_XR,
19-
calibration=((5200, 59000), (5800, 57000)),
20-
size=(240, 320))
21-
'''
9+
if rotation == 0:
10+
# -------Rotate 0:
11+
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
12+
board.TOUCH_YD, board.TOUCH_YU,
13+
calibration=((5200, 59000), (5800, 57000)),
14+
size=(320, 240))
2215

23-
'''
24-
# ------Rotate 180:
25-
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XR, board.TOUCH_XL,
26-
board.TOUCH_YU, board.TOUCH_YD,
27-
calibration=((5200, 59000), (5800, 57000)),
28-
size=(320, 240))
29-
'''
16+
if rotation == 90:
17+
# -------Rotate 90:
18+
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_YU, board.TOUCH_YD,
19+
board.TOUCH_XL, board.TOUCH_XR,
20+
calibration=((5200, 59000), (5800, 57000)),
21+
size=(240, 320))
3022

31-
# ------Rotate 270:
32-
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_YD, board.TOUCH_YU,
33-
board.TOUCH_XR, board.TOUCH_XL,
34-
calibration=((5200, 59000), (5800, 57000)),
35-
size=(240, 320))
23+
if rotation == 180:
24+
# ------Rotate 180:
25+
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XR, board.TOUCH_XL,
26+
board.TOUCH_YU, board.TOUCH_YD,
27+
calibration=((5200, 59000), (5800, 57000)),
28+
size=(320, 240))
29+
30+
if rotation == 270:
31+
# ------Rotate 270:
32+
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_YD, board.TOUCH_YU,
33+
board.TOUCH_XR, board.TOUCH_XL,
34+
calibration=((5200, 59000), (5800, 57000)),
35+
size=(240, 320))
3636

3737
while True:
3838
p = ts.touch_point
3939
if p:
40-
print(p)
40+
print(p)

0 commit comments

Comments
 (0)