Skip to content

Commit 0f64af3

Browse files
committed
updates some display drivers and updates the touch calibration to handle the rotation better
1 parent f7d8cfb commit 0f64af3

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

api_drivers/common_api_drivers/display/hx8369/hx8369.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
BYTE_ORDER_RGB = display_driver_framework.BYTE_ORDER_RGB
1414
BYTE_ORDER_BGR = display_driver_framework.BYTE_ORDER_BGR
1515

16-
17-
_MADCTL_MH = const(0x04) # Refresh 0=Left to Right, 1=Right to Left
18-
_MADCTL_BGR = const(0x08) # BGR color order
19-
_MADCTL_ML = const(0x10) # Refresh 0=Top to Bottom, 1=Bottom to Top
2016
_MADCTL_MV = const(0x20) # 0=Normal, 1=Row/column exchange
2117
_MADCTL_MX = const(0x40) # 0=Left to Right, 1=Right to Left
2218
_MADCTL_MY = const(0x80) # 0=Top to Bottom, 1=Bottom to Top

api_drivers/common_api_drivers/display/ili9488/ili9488.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
BYTE_ORDER_RGB = display_driver_framework.BYTE_ORDER_RGB
1010
BYTE_ORDER_BGR = display_driver_framework.BYTE_ORDER_BGR
1111

12-
_MADCTL_MH = const(0x04) # Refresh 0=Left to Right, 1=Right to Left
13-
_MADCTL_BGR = const(0x08) # BGR color order
14-
_MADCTL_ML = const(0x10) # Refresh 0=Top to Bottom, 1=Bottom to Top
1512
_MADCTL_MV = const(0x20) # 0=Normal, 1=Row/column exchange
1613
_MADCTL_MX = const(0x40) # 0=Left to Right, 1=Right to Left
1714
_MADCTL_MY = const(0x80) # 0=Top to Bottom, 1=Bottom to Top
@@ -21,7 +18,7 @@ class ILI9488(display_driver_framework.DisplayDriver):
2118

2219
_ORIENTATION_TABLE = (
2320
_MADCTL_MX,
24-
_MADCTL_MV,
21+
_MADCTL_MV | _MADCTL_MY | _MADCTL_MX,
2522
_MADCTL_MY,
26-
_MADCTL_MX | _MADCTL_MY | _MADCTL_MV
23+
_MADCTL_MV
2724
)

api_drivers/common_api_drivers/display/st7789/st7789.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
BYTE_ORDER_RGB = display_driver_framework.BYTE_ORDER_RGB
1212
BYTE_ORDER_BGR = display_driver_framework.BYTE_ORDER_BGR
1313

14-
_MADCTL_MH = const(0x04) # Refresh 0=Left to Right, 1=Right to Left
15-
_MADCTL_BGR = const(0x08) # BGR color order
16-
_MADCTL_ML = const(0x10) # Refresh 0=Top to Bottom, 1=Bottom to Top
1714
_MADCTL_MV = const(0x20) # 0=Normal, 1=Row/column exchange
1815
_MADCTL_MX = const(0x40) # 0=Left to Right, 1=Right to Left
1916
_MADCTL_MY = const(0x80) # 0=Top to Bottom, 1=Bottom to Top
@@ -47,7 +44,7 @@ def __init__(
4744
rgb565_byte_swap=False,
4845
):
4946

50-
if color_space != lv.COLOR_FORMAT.RGB565:
47+
if color_space != lv.COLOR_FORMAT.RGB565: # NOQA
5148
rgb565_byte_swap = False
5249

5350
self._rgb565_byte_swap = rgb565_byte_swap
@@ -80,4 +77,3 @@ def __init__(
8077
_init_bus=True
8178
)
8279

83-

api_drivers/py_api_drivers/frozen/display/display_driver_framework.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
class DisplayDriver:
4141
_INVON = 0x21
4242
_INVOFF = 0x20
43+
4344
_ORIENTATION_TABLE = (
4445
_MADCTL_MX,
4546
_MADCTL_MV,

api_drivers/py_api_drivers/frozen/indev/pointer_framework.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class PointerDriver(_indev_base.IndevBase):
1111
def __init__(self, touch_cal=None, startup_rotation=lv.DISPLAY_ROTATION._0, debug=False): # NOQA
1212
self._last_x = -1
1313
self._last_y = -1
14+
1415
self._last_state = self.RELEASED
1516

1617
super().__init__(debug=debug)

api_drivers/py_api_drivers/frozen/indev/touch_calibration/touch_calibrate.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434

3535
def calibrate(indev, cal_data):
36-
indev.enable(False)
3736

3837
if not task_handler.TaskHandler.is_running():
3938
th_running = False
@@ -63,6 +62,15 @@ def calibrate(indev, cal_data):
6362
]
6463

6564
old_scrn = lv.screen_active()
65+
66+
disp = old_scrn.get_display()
67+
rotation = disp.get_rotation()
68+
69+
if rotation != lv.DISPLAY_ROTATION._0:
70+
disp.set_rotation(lv.DISPLAY_ROTATION._0)
71+
72+
indev.enable(False)
73+
6674
new_scrn = lv.obj()
6775
lv.screen_load(new_scrn)
6876

@@ -115,7 +123,6 @@ def calibrate(indev, cal_data):
115123

116124
print(' ', j + 1, 'of 8:', (x, y))
117125

118-
119126
print()
120127
print('averaged trimmed points')
121128
for i, points in enumerate(captured_points):
@@ -139,6 +146,10 @@ def calibrate(indev, cal_data):
139146
else:
140147
mirror_y = False
141148

149+
print('mirroring')
150+
print(' mirrored x:', mirror_x)
151+
print(' mirrored y:', mirror_y)
152+
142153
tp1, tp2, tp3 = captured_points
143154
sp1, sp2, sp3 = target_points
144155
print()
@@ -207,4 +218,7 @@ def calibrate(indev, cal_data):
207218

208219
indev.enable(True)
209220

221+
if rotation != lv.DISPLAY_ROTATION._0:
222+
disp.set_rotation(rotation)
223+
210224
return res

0 commit comments

Comments
 (0)