From 1d1d785f51e17a5a4f70ca6560e2dd1af59602f1 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:26:41 +0100 Subject: [PATCH] LVGL make lv_touch_3_buttons more responsive (#20728) * LVGL make lv_touch_3_buttons more responsive * Changed instead of Fixed --- CHANGELOG.md | 1 + tasmota/berry/drivers/lv_touch_3_buttons.be | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7cea1212..8e465c4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. ### Changed - Berry class `int64` made immutable +- LVGL make lv_touch_3_buttons more responsive ### Fixed diff --git a/tasmota/berry/drivers/lv_touch_3_buttons.be b/tasmota/berry/drivers/lv_touch_3_buttons.be index ef0711ea5..c58115bb0 100644 --- a/tasmota/berry/drivers/lv_touch_3_buttons.be +++ b/tasmota/berry/drivers/lv_touch_3_buttons.be @@ -6,6 +6,8 @@ # Touches are simulated as actual touch screen: # x: is spread at coordinates: 1/6, 1/2, 5/6 # y: 10 pixels from botton +# +# New version: use fast_loop for a more responsive interface class lv_touch_3_buttons 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.y_coords = [ vres - 10, vres - 10, vres - 10] - # add self to drivers - tasmota.add_driver(self) + # add self to fast_loop + tasmota.add_fast_loop(/-> self.fast_loop()) end # scan every 50ms - def every_50ms() + def fast_loop() import display 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) -tasmota.add_driver(lv_btn3) -#