Open TecDroiD opened 6 months ago
The pointer drivers do not control the events behavior in LVGL directly. All it does is tell LVGL when there is touch and there is not touch and what the coordinates are when there is touch and the last known coordinates when there isn't touch. That is all it does nothing more. If there is an issue with the drag not working properly with respect to value changes tthen that is going to be an internal issue in LVGL.
I will investigate more and see if that is what is happening and I will open an issue on LVGL's repo if the behavior isn't right.
The values change while I am dragging the slider so that does work properly.
The funny thing is we made changes to the gt911 driver we probably shouldn't have.
When I run the code below to output the events for a slider
def on_value_changed(e):
code = e.get_code()
for key, value in lv.EVENT.__dict__.items():
if not key.isupper():
continue
if value == code:
break
else:
print('Unknown Event:', code)
return
print('event:', key)
slider.add_event_cb(on_value_changed, lv.EVENT.ALL, None)
This is the output I get. I want to note that I am not using the GT911 driver here, I am using the unix port with SDL driver.
event: REFR_EXT_DRAW_SIZE
event: SIZE_CHANGED
event: REFR_EXT_DRAW_SIZE
event: GET_SELF_SIZE
event: GET_SELF_SIZE
event: DRAW_MAIN_BEGIN
event: DRAW_TASK_ADDED
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: PRESSED <===========The CLICKED event should take place near the PRESSED event
event: FOCUSED
event: PRESSING
event: DRAW_MAIN_BEGIN
event: DRAW_TASK_ADDED
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: PRESSING
event: DRAW_MAIN_BEGIN
event: DRAW_TASK_ADDED
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: PRESSING
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: PRESSING
event: DRAW_MAIN_BEGIN
event: DRAW_TASK_ADDED
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: PRESSING
event: DRAW_MAIN_BEGIN
event: DRAW_TASK_ADDED
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: PRESSING
event: PRESSING
event: LONG_PRESSED_REPEAT
event: PRESSING
event: PRESSING
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: VALUE_CHANGED
event: RELEASED
event: CLICKED <=============== Happening after the RELEASE event. Not sure why..
event: DRAW_MAIN_BEGIN
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: DRAW_MAIN_BEGIN
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
event: REFR_EXT_DRAW_SIZE
event: REFR_EXT_DRAW_SIZE
event: DRAW_MAIN_BEGIN
event: DRAW_MAIN
event: DRAW_MAIN_END
event: DRAW_POST_BEGIN
event: DRAW_POST
event: DRAW_POST_END
The mouse is working properly but the CLICKED event is happening in the wrong place. It is happening after the RELEASED event takes place. I am thinking that "CLICKED" infers that PRESSED and RELEASED has occurred. That is what I am thinking.
at any rate the slider value changes with drag so not sure why it's not for you.
Running this code
def on_value_changed(_):
print('VALUE_CHANGED:', slider.get_value())
slider.add_event_cb(on_value_changed, lv.EVENT.VALUE_CHANGED, None)
I get this output when I drag the slider
VALUE_CHANGED: 4
VALUE_CHANGED: 5
VALUE_CHANGED: 6
VALUE_CHANGED: 7
VALUE_CHANGED: 8
VALUE_CHANGED: 9
VALUE_CHANGED: 10
VALUE_CHANGED: 11
VALUE_CHANGED: 12
VALUE_CHANGED: 13
VALUE_CHANGED: 14
VALUE_CHANGED: 15
VALUE_CHANGED: 16
VALUE_CHANGED: 17
VALUE_CHANGED: 18
VALUE_CHANGED: 19
VALUE_CHANGED: 20
VALUE_CHANGED: 21
VALUE_CHANGED: 22
okay, same here. Does your slider follow your finger or does it update only when you release the screen?
it follows my finger.
doesn't follow mine :( maybe it doesn't like my finger?
This is why I think that maybe the changes we made to the gt911 driver are incorrect.
do me a favor and use this for the loop code
import task_handler
th = task_handler.TaskHandler()
see if the behavior changes at all.
also when you use this as the event handler
def on_value_changed(_):
print('VALUE_CHANGED:', slider.get_value())
slider.add_event_cb(on_value_changed, lv.EVENT.VALUE_CHANGED, None)
do you get the incrementing values
okay, this is my code now. run() is called from within main.py after initializing display and touch driver.
import lvgl as lv
import display
import time
from micropython import const
import task_handler
ticktime = const(10)
def on_value_changed(e):
print('VALUE_CHANGED:', e.get_target_obj().get_value())
lv.init()
_display = display.create_display()
_touch = display.create_touch()
scrn = lv.obj()
slider = lv.slider(scrn)
slider.set_width(lv.DPI_DEF * 2)
slider.align_to(scrn, lv.ALIGN.CENTER, 0, 0)
slider.set_range(0, 100)
slider.add_event_cb(on_value_changed, lv.EVENT.VALUE_CHANGED, None)
lv.screen_load(scrn)
th = task_handler.TaskHandler()
Values increment when moving the finger over the slider. The slider itself does only change after i release it. Seems to me that display does only redraw after a release. Tried a button for fun.. This does also not appear as pressed when pressed..
what is this??
_display = display.create_display()
_touch = display.create_touch()
this is my display and touch initializer in display.py.. can show it but I don't believe that this helps here
any idea on this?
I don't have any idea why it is reacting that way. I am going to have to set up a test display that uses the same driver you are using to see if there is some kind of an issue with the driver possibly.
I am still working with the guys over at LVGL about the CLICKED event as there are some things that are not behaving as they should be. Will keep you posted as to what is going on.
I am not sure why your code is not showing the updated value. When I run it while I am pressing and dragging this is what I get for output.
The additional number is printing out calling slider.get_value()
from inside of the CB instead of collecting the object through the event. I wanted to see if maybe there was some kind of a difference. There isn't.
VALUE_CHANGED: 3
3
VALUE_CHANGED: 4
4
VALUE_CHANGED: 5
5
VALUE_CHANGED: 6
6
VALUE_CHANGED: 7
7
VALUE_CHANGED: 8
8
VALUE_CHANGED: 9
9
VALUE_CHANGED: 10
10
VALUE_CHANGED: 11
11
VALUE_CHANGED: 12
12
I need to see the output when running this code to know what is going on.
import lvgl as lv
def on_event(e):
code = e.get_code()
for item in dir(lv.EVENT):
item_code = getattr(lv.EVENT, item)
if item_code == code:
print(item)
break
else:
print(code)
slider = lv.slider(lv.screen_active())
slider.set_size(700, 75)
slider.center()
slider.add_event_cb(on_event, lv.EVENT.ALL, None)
import task_handler
th = task_handler.TaskHandler()
hey, here it comes:
ebooting...
�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403842ca
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0xf8c
load:0x403c9700,len:0xb3c
load:0x403cc700,len:0x2dd4
entry 0x403c989c
MicroPython v1.22.1-dirty on 2024-04-24; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3
Type "help()" for more information.
>>> import display
>>> display.create_display()
<RGBDisplay object at 3c253870>
>>> display.create_touch()
Touch Product id: bytearray(b'911\x00')
Touch Firmware version: 0x1060
Touch Vendor id: 0x0
Touch resolution: width=800, height=480
<GT911 object at 3c253b00>
>>> import slidertest
>>> REFR_EXT_DRAW_SIZE
SIZE_CHANGED
REFR_EXT_DRAW_SIZE
GET_SELF_SIZE
GET_SELF_SIZE
DRAW_MAIN_BEGIN
DRAW_TASK_ADDED
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
REFR_EXT_DRAW_SIZE
PRESSED
FOCUSED
PRESSING
PRESSING
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
REFR_EXT_DRAW_SIZE
RELEASED
SHORT_CLICKED
CLICKED
DRAW_MAIN_BEGIN
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
REFR_EXT_DRAW_SIZE
PRESSED
PRESSING
PRESSING
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
VALUE_CHANGED
PRESSING
REFR_EXT_DRAW_SIZE
RELEASED
SHORT_CLICKED
CLICKED
DRAW_MAIN_BEGIN
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
OK so it's working properly. You are getting a value changed as you move the slider.
So I guess I am a little bit confused as to what the issue is.....???
Tho as I do look at that it doesn't look quite right...
This is what I am seeing...
VALUE_CHANGED 3
PRESSING
PRESSING
DRAW_MAIN_BEGIN 36
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
VALUE_CHANGED 30
PRESSING
PRESSING
DRAW_MAIN_BEGIN 30
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
VALUE_CHANGED 34
PRESSING
DRAW_MAIN_BEGIN 34
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
LONG_PRESSED_REPEAT
PRESSING
VALUE_CHANGED 65
PRESSING
PRESSING
PRESSING
PRESSING
PRESSING
DRAW_MAIN_BEGIN 66
DRAW_MAIN
DRAW_MAIN_END
DRAW_POST_BEGIN
DRAW_POST
DRAW_POST_END
Where I am seeing more of the draws without having to release the button.
I did update the code for the indev drivers as I think I may have been inadvertently holding up LVGL from updating the display. Give the new code a try and see if it solves the issue.
I currently get an error compiling .. what I did:
$ git pull -r
...
$ python make.py esp32 submodules clean mpy_cross BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=rgb_display INDEV=gt911
setting up ESP-IDF v5.0.4
this might take a bit...
Detecting the Python interpreter
Checking "python3" ...
Python 3.11.2
"python3" has been detected
Checking Python compatibility
Installing ESP-IDF tools
Current system platform: linux-amd64
Selected targets are: esp32s3, esp32c3, esp32s2, esp32, esp32c2, esp32h2
Installing tools: xtensa-esp-elf-gdb, riscv32-esp-elf-gdb, xtensa-esp32-elf, xtensa-esp32s2-elf, xtensa-esp32s3-elf, riscv32-esp-elf, esp32ulp-elf, openocd-esp32, esp-rom-elfs
Skipping xtensa-esp-elf-gdb@11.2_20220823 (already installed)
Skipping riscv32-esp-elf-gdb@11.2_20220823 (already installed)
Skipping xtensa-esp32-elf@esp-2022r1-11.2.0 (already installed)
Skipping xtensa-esp32s2-elf@esp-2022r1-11.2.0 (already installed)
Skipping xtensa-esp32s3-elf@esp-2022r1-11.2.0 (already installed)
Skipping riscv32-esp-elf@esp-2022r1-11.2.0 (already installed)
Skipping esp32ulp-elf@2.35_20220830 (already installed)
Skipping openocd-esp32@v0.12.0-esp32-20230419 (already installed)
Skipping esp-rom-elfs@20220823 (already installed)
Installing Python environment and packages
Python 3.11.2
pip 24.0 from /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages/pip (python 3.11)
Requirement already satisfied: pip in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (24.0)
Requirement already satisfied: setuptools in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (69.5.1)
Looking in indexes: https://pypi.org/simple, https://dl.espressif.com/pypi
Ignoring importlib_metadata: markers 'python_version < "3.8"' don't match your environment
Ignoring windows-curses: markers 'sys_platform == "win32"' don't match your environment
Requirement already satisfied: setuptools in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 3)) (69.5.1)
Requirement already satisfied: packaging in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 4)) (24.0)
Requirement already satisfied: click in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 7)) (8.1.7)
Requirement already satisfied: pyserial in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 8)) (3.5)
Requirement already satisfied: future in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 9)) (0.18.2)
Requirement already satisfied: cryptography in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 10)) (36.0.2)
Requirement already satisfied: pyparsing in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 11)) (3.0.9)
Requirement already satisfied: pyelftools in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 12)) (0.27)
Requirement already satisfied: idf-component-manager in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.5.2)
Requirement already satisfied: esp-coredump in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 14)) (1.11.0)
Requirement already satisfied: esptool in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (4.7.0)
Requirement already satisfied: kconfiglib in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 18)) (14.1.0)
Requirement already satisfied: freertos_gdb in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from -r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 22)) (1.0.3)
Requirement already satisfied: cffi>=1.12 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from cryptography->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 10)) (1.16.0)
Requirement already satisfied: requests<3 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (2.31.0)
Requirement already satisfied: urllib3<2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.26.18)
Requirement already satisfied: requests-file<2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.5.1)
Requirement already satisfied: requests-toolbelt in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.0.0)
Requirement already satisfied: schema in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (0.7.5)
Requirement already satisfied: six in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.16.0)
Requirement already satisfied: tqdm<5 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (4.66.2)
Requirement already satisfied: colorama in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (0.4.6)
Requirement already satisfied: pyyaml>5.2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (6.0.1)
Requirement already satisfied: cachecontrol>0.12.6 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from cachecontrol[filecache]>0.12.6; python_version >= "3.6"->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (0.14.0)
Requirement already satisfied: contextlib2>0.6.0 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (21.6.0)
Requirement already satisfied: construct~=2.10 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esp-coredump->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 14)) (2.10.70)
Requirement already satisfied: pygdbmi>=0.9.0.2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esp-coredump->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 14)) (0.11.0.0)
Requirement already satisfied: bitstring>=3.1.6 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esptool->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (4.1.4)
Requirement already satisfied: ecdsa>=0.16.0 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esptool->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (0.18.0)
Requirement already satisfied: reedsolo<1.8,>=1.5.3 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esptool->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (1.7.0)
Requirement already satisfied: intelhex in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from esptool->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (2.3.0)
Requirement already satisfied: bitarray<3.0.0,>=2.8.0 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from bitstring>=3.1.6->esptool->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 15)) (2.9.2)
Requirement already satisfied: msgpack<2.0.0,>=0.5.2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from cachecontrol>0.12.6->cachecontrol[filecache]>0.12.6; python_version >= "3.6"->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (1.0.8)
Requirement already satisfied: filelock>=3.8.0 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from cachecontrol[filecache]>0.12.6; python_version >= "3.6"->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (3.13.3)
Requirement already satisfied: pycparser in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from cffi>=1.12->cryptography->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 10)) (2.22)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from requests<3->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from requests<3->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (3.6)
Requirement already satisfied: certifi>=2017.4.17 in /home/tecdroid/.espressif/python_env/idf5.0_py3.11_env/lib/python3.11/site-packages (from requests<3->idf-component-manager->-r /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt (line 13)) (2024.2.2)
Upgrading pip and setuptools...
Skipping the download of /home/tecdroid/.espressif/espidf.constraints.v5.0.txt because it was downloaded recently.
Installing Python packages
Constraint file: /home/tecdroid/.espressif/espidf.constraints.v5.0.txt
Requirement files:
- /home/tecdroid/git/lvgl_micropython/lib/esp-idf/tools/requirements/requirements.core.txt
All done! You can now run:
Exception in thread Thread-2 (process_output):
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/home/tecdroid/git/lvgl_micropython/builder/__init__.py", line 312, in process_output
line += out
TypeError: can only concatenate str (not "bytes") to str
it's been a while since I built last time.. maybe my environment isn't set correctly?
OYE!!! I forgot to fix that.
I ficed it in my local build environment I just forgot to fix it before I pushed the commit.
OK it should be good to go.
now the given source https://github.com/kdschlosser/lvgl_micropython/issues/34#issuecomment-2113277120 does not react on any touch
is that without the screen being rotated?
At least, I wouldn't know where it should be rotated. here's my display and touch driver initialization.. maybe you see more than I
I am going to be spending some time working on the touch to see what I messed up in it.
see if the touch is working again.
well. that made everything worse. Now the slider does not appear and task_handler.TaskHandler() freezes repl completely. Even CTRL-D does not work.
got any news?
Everything should be sorted out. Go ahead and give it a try again. I have been updating the touch a lot in the last couple of weeks so it should work properly now.
/home/tecdroid/git/lvgl_micropython/lib/micropython/ports/esp32/machine_sdcard.c:183:31: error: implicit declaration of function 'mp_obj_malloc_with_finaliser'; did you mean 'm_malloc_with_finaliser'? [-Werror=implicit-function-declaration]
183 | sdcard_card_obj_t *self = mp_obj_malloc_with_finaliser(sdcard_card_obj_t, &machine_sdcard_type);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| m_malloc_with_finaliser
/home/tecdroid/git/lvgl_micropython/lib/micropython/ports/esp32/machine_sdcard.c:183:60: error: expected expression before 'sdcard_card_obj_t'
183 | sdcard_card_obj_t *self = mp_obj_malloc_with_finaliser(sdcard_card_obj_t, &machine_sdcard_type);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
[1282/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1283/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1284/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1285/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1286/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1287/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1288/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1289/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1290/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1291/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1292/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1293/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3[1294/1885] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir/__/__/lv_mp.c.obj
ninja: build stopped: subcommand failed.
HINT: Please check that the function name is correct. Also it is possible that you've forgot to import mp_obj_malloc_with_finaliser library(s) in header file or add the necessary REQURIES component. Try to add missing libraries to your project header file or check idf_component_register(REQUIRES ...) section in your component CmakeList.txt file. For more information run 'idf.py docs -sp api-guides/build-system.html'.
Also, please check if the function has been removed, renamed or replaced by an alternative function - refer to the migration guide for more information.
ninja failed with exit code 1, output of the command is in the /home/tecdroid/git/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/log/idf_py_stderr_output_49228 and /home/tecdroid/git/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/log/idf_py_stdout_output_49228
-e See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [Makefile:66: all] Fehler 1
make: Verzeichnis „/home/tecdroid/git/lvgl_micropython/lib/micropython/ports/esp32“ wird verlassen
did I pull at an inconvenient time?
I am not sure why you are getting that error. It is compiling fine in the CI.. What is the build command you are using?
this one: python make.py esp32 submodules clean mpy_cross BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=rgb_display INDEV=gt911
maybe the micropython-version you use is something else than what is pushed here? could be good to link against stable tags of submodules
I did a git checkout v1.23. on lib/micropython and it compiled.. checking the build in a few minutes..
the MicroPython version has been updated to use 1.23.0. When you are cloning the repo are you initializing the submodules? If you are then don't. this is what you should be running for commands.
git clone https://github.com/kdschlosser/lvgl_micropython
cd lvgl_micropython
python make.py esp32 submodules clean mpy_cross BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=rgb_display INDEV=gt911
How much flash storage does your devkit have?? you might need to add --flash-size=4, 8, 16 or 32 and if you have octal flash (16 or 32 mb of flash) then you need to add --octal-flash as well.
the script takes care of all of the dependencies so you don't need to do anything other than clone the repo. do not initilize any submodules or anything like that. let the script do it's thing. I know I need to update the submodule versions and this I have not done yet. I was wanting to get the espidf version up to 5.2.x and that required getting micropython 1.23 up and running. Updating the submodules is more of a headache than altering a version in the python build script and I wanted to make sure everything was working properly before updating the submodules. The other reason is micropython 1.23.0 supports ESPIDF 5.0.4 and 5.2.x so by updating the submodule it kind of locks the user to only being able to use the version the submodule is set to. My plan was to add a command line switch so the user would be able to choose which one they want to use. The reason for this is the newer IDF versions tend to have a lot more bugs in them. so giving an option for an older version of the IDF would be ideal if the user comes across an issue, they have something to fall back on.
well.. it didn't work either. esp told me that the result is no proper image.. I'll try a clean clone
You need to read the output at the end of the build. It tell you that you need to run 2 commands. the first one erases the flash and the second one flashes the firmware. The firmware location is no longer in the lib/micropython/ports/esp32/build-*
folder. It is placed into the build
folder that gets created in the root directory of the cloned repo.
you should see something along the line if
To flash firmware:
Replace "(PORT)" with the serial port for your esp32
and run the commands.
/home/runner/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/runner/work/lvgl_micropython/lvgl_micropython/lib/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 erase_flash
/home/runner/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/runner/work/lvgl_micropython/lvgl_micropython/lib/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 --before default_reset --after no_reset --chip esp32s3 write_flash 0x0 /home/runner/work/lvgl_micropython/lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-8.bin
that gets printed out at the end of the build. You basically copy and past each of those commands changing (PORT)
to the serial port your esp32 is using. Depending on the devkit you are using you may have to change the 921600
in the second command to 460800
. It all depends on what USB bridge IC is being used.
did you change any function prototypes?
Connected to MicroPython at /dev/ttyUSB0
Use Ctrl-] or Ctrl-x to exit this shell
import simplesli
Touch Product id: bytearray(b'911\x00')
Touch Firmware version: 0x1060
Touch Vendor id: 0x0
Touch resolution: width=800, height=480
Uncaught exception in IRQ callback handler!
TypeError: function takes 3 positional arguments but 2 were given
>>> Uncaught exception in IRQ callback handler!
TypeError: function takes 3 positional arguments but 2 were given
Uncaught exception in IRQ callback handler!
TypeError: function takes 3 positional arguments but 2 were given
Uncaught exception in IRQ callback handler!
TypeError: function takes 3 positional arguments but 2 were given
Uncaught exception in IRQ callback handler!
TypeError: function takes 3 positional arguments but 2 were given
Uncaught exception in IRQ callback handler!
.....
here's my current test code:
import lvgl as lv
import display
def on_event(e):
code = e.get_code()
for item in dir(lv.EVENT):
item_code = getattr(lv.EVENT, item)
if item_code == code:
print(item)
break
else:
print(code)
_d = display.create_display()
_t = display.create_touch()
lv.init()
slider = lv.slider(lv.screen_active())
slider.set_size(700, 75)
slider.center()
slider.add_event_cb(on_event, lv.EVENT.ALL, None)
import task_handler
th = task_handler.TaskHandler()
I have to check and see what I have changed in the RGB bus driver.
OK I found the problem. It has been fixed, or at least it should be. I forgot I had done a lot of work to the RGB Bus driver to eliminate a synchronization issue that would occur if large portions of the screen had to be updated by LVGL. The time it was taking to render would cause a synchronization problem when flush ready was being called and what would happen is the buffer that was being transferred would end up getting modified by LVGL at the same time. I have been trying to correct that issue to keep things in sync without stalling the program at all. It has been causing me a hell of a lot of grief actually.
The problem with the RGB bus driver is multiple callbacks will occur when the buffer has been sent. It's not like the SPI or the I8080 where the buffer only gets transmitted the one time. With RGB it has to be sent over and over again and every time it gets sent that was causing multiple calls to flush ready to occur. So what would happen is flush ready would get called and then the buffer would start to transmit again. and while that is happening LVGL would be writing to the next buffer and prior to that buffer finishing being rendered to the one that was sending would call flush ready which would reset the marker for the buffer that is still being rendered to and it would be passed forward to be transferred while it was still being written to.
IDK if the changes I made are going to work. You are going to have to be my guinea pig with this to see if I got the problem sorted out.
okay, i could build and upload now but directly after initializing touch
def create_touch():
""" create the touch screen driver
"""
I2C_BUS = i2c.I2CBus(
scl=_CTP_SCL,
sda=_CTP_SDA,
freq=100000,
use_locks=False
)
return gt911.GT911(I2C_BUS)
I get a core panic:
>>> import display
>>> display.create_display()
<RGBDisplay object at 3c2639f0>
>>> try
... _t = display.create_touch()
>>> try:
... _t = display.create_touch()
... except e:
... print(e)
...
Touch Product id: bytearray(b'911\x00')
Touch Firmware version: 0x1060
Touch Vendor id: 0x0
Touch resolution: width=800, height=480
>>>
A fatal error occurred. The crash dump printed below may be used to help
determine what caused it. If you are not already running the most recent
version of MicroPython, consider upgrading. New versions often fix bugs.
To learn more about how to debug and/or report this crash visit the wiki
page at: https://github.com/micropython/micropython/wiki/ESP32-debugging
MPY version : v1.23.0-dirty on 2024-06-14
IDF version : v5.0.4
Machine : Generic ESP32S3 module with Octal-SPIRAM with ESP32S3
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4037a83b PS : 0x00060133 A0 : 0x820cdf9f A1 : 0x3fca2a60
A2 : 0x00060023 A3 : 0x00000000 A4 : 0x3fca2b20 A5 : 0x3fca2b24
A6 : 0x3fca2b00 A7 : 0x00000004 A8 : 0x803793b5 A9 : 0x3fca2a10
A10 : 0x00000001 A11 : 0x3c209560 A12 : 0x3c261de0 A13 : 0x3fca5410
A14 : 0x3fca2af0 A15 : 0x3fca2a50 SAR : 0x0000001f EXCCAUSE: 0x0000001c
EXCVADDR: 0x00060023 LBEG : 0x420f2d84 LEND : 0x420f2d8d LCOUNT : 0x00000000
Backtrace: 0x4037a838:0x3fca2a60 0x420cdf9c:0x3fca2b00 0x420d4d39:0x3fca2b60 0x42102aab:0x3fca2b80 0x42102afd:0x3fca2bc0 0x420d4d39:0x3fca2be0 0x42002a97:0x3fca2c00 0x4037550e:0x3fca2cc0 0x40378aad:0x3fca2d00 0x4037730d:0x3fca2d20 0x40377d4e:0x3fca2d40 0x0004001e:0x00000000 |<-CORRUPTED
ELF file SHA256: cda62c52221de2f9
Rebooting...
�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40384326
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0xf8c
load:0x403c9700,len:0xb3c
load:0x403cc700,len:0x2dd4
entry 0x403c989c
MicroPython v1.23.0-dirty on 2024-06-14; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3
Type "help()" for more information.
``
can you dump the backtrace data for me?
if you tell me how...
I got a test rig up and running. I am not getting the core dump at all so that is strange that you are, Not sure what is going on there, How much RAM and flash does your board have? I am wondering if something is not right in that department that is causing the core dump... I am going to revert the code back to the way it was originally with the display bus driver and I am going to put a stall using FreeRTOS. I really didn't want to do that but with how LVGL is coded there is no easy way around it. I made a change to LVGL that would exit the refresh if the buffer had not finished writing yet instead of it doing a spinning wheel with a while loop. I submitted a PR for the change and it didn't get added. I hate it when the code ends up coming to a halt to sit there and wait for a buffer to finish transmitting. I hate it even more when that is being done and it can be made so it doesn't need to do that.
sorry, back.. I tested on another display of similar type having the same error. Backtrace is identical.. Maybe it's more difference in the build environments?
It's not the build environment that is causing the problem.
I just made some changes to the RGB bus driver and the RGB display driver. If you can delete the clone you have and clone the repo again this way we know everything is all up to date and give it another go.
I did add a new feature which is the ability to overclock the SPIRAM and the SPIFLASH. If you are using a board that has octal SPIRAM and octal SPIFLASH the speed gets boosted from 80Mhz to 240Mhz... I still have to test it to see if it works and if it does it will be a substantial boost in the performance in terms of frame rate. The frequency the display runs at will need to be adjusted higher for the increased SPI speeds to be realized.
build doesn't work: /home/tecdroid/.espressif/python_env/idf5.2_py3.10_env/bin/python not found. Seems, there's only python 3.11 existing: ls ~/.espressif/python_env/ idf4.3_py3.11_env idf4.4_py3.11_env idf5.0_py3.11_env idf5.2_py3.11_env
Currently, my sliders only change their value when I release screen.
As far as I understand sliders, they send an LV_EVENT_VALUE_CHANGED on LV_EVENT_RELEASED but also when a drag is detected, so to my mind, pointer_framework should fire an LV_EVENT_DRAG_BEGIN when the coordinates change.. Something like abs(x_old - x_new) * abs(y_old - y_new) > threshhold...