mirror of https://github.com/arendst/Tasmota.git
LVGL make lv_touch_3_buttons more responsive (#20728)
* LVGL make lv_touch_3_buttons more responsive * Changed instead of Fixed
This commit is contained in:
parent
036723ddb5
commit
1d1d785f51
|
@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Berry class `int64` made immutable
|
- Berry class `int64` made immutable
|
||||||
|
- LVGL make lv_touch_3_buttons more responsive
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
# Touches are simulated as actual touch screen:
|
# Touches are simulated as actual touch screen:
|
||||||
# x: is spread at coordinates: 1/6, 1/2, 5/6
|
# x: is spread at coordinates: 1/6, 1/2, 5/6
|
||||||
# y: 10 pixels from botton
|
# y: 10 pixels from botton
|
||||||
|
#
|
||||||
|
# New version: use fast_loop for a more responsive interface
|
||||||
|
|
||||||
class lv_touch_3_buttons
|
class lv_touch_3_buttons
|
||||||
var gpios # (array) physical GPIO numbers for each button, -1 in not assigned
|
var gpios # (array) physical GPIO numbers for each button, -1 in not assigned
|
||||||
|
@ -49,12 +51,12 @@ class lv_touch_3_buttons
|
||||||
self.x_coords = [ hres / 6, hres / 2, hres * 5 / 6]
|
self.x_coords = [ hres / 6, hres / 2, hres * 5 / 6]
|
||||||
self.y_coords = [ vres - 10, vres - 10, vres - 10]
|
self.y_coords = [ vres - 10, vres - 10, vres - 10]
|
||||||
|
|
||||||
# add self to drivers
|
# add self to fast_loop
|
||||||
tasmota.add_driver(self)
|
tasmota.add_fast_loop(/-> self.fast_loop())
|
||||||
end
|
end
|
||||||
|
|
||||||
# scan every 50ms
|
# scan every 50ms
|
||||||
def every_50ms()
|
def fast_loop()
|
||||||
import display
|
import display
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
|
@ -89,5 +91,4 @@ return lv_touch_3_buttons(gpio.pin(gpio.GPIO_INPUT, 0), gpio.pin(gpio.GPIO_INPUT
|
||||||
|
|
||||||
#-
|
#-
|
||||||
lv_btn3 = lv_touch_3_buttons(gpio.pin(gpio.GPIO_INPUT, 0), gpio.pin(gpio.GPIO_INPUT, 1), gpio.pin(gpio.GPIO_INPUT, 2), lv_touch_3_buttons.ACTIVE_LOW)
|
lv_btn3 = lv_touch_3_buttons(gpio.pin(gpio.GPIO_INPUT, 0), gpio.pin(gpio.GPIO_INPUT, 1), gpio.pin(gpio.GPIO_INPUT, 2), lv_touch_3_buttons.ACTIVE_LOW)
|
||||||
tasmota.add_driver(lv_btn3)
|
|
||||||
-#
|
-#
|
||||||
|
|
Loading…
Reference in New Issue