This shows you the differences between two versions of the page.
|
si:laboratoare:2025:05 [2025/11/02 13:22] cosmin.chenaru [Exercitii] |
si:laboratoare:2025:05 [2025/11/03 19:31] (current) cosmin.chenaru cb_night_mode_event_handler |
||
|---|---|---|---|
| Line 109: | Line 109: | ||
| cp ~/Downloads/main.c.txt src/main.c | cp ~/Downloads/main.c.txt src/main.c | ||
| cmake --build build -j$(nproc) | cmake --build build -j$(nproc) | ||
| + | ./build/bin/lvglsim | ||
| </code> | </code> | ||
| - | {{:si:laboratoare:2025:2025-10-31_22-37-44.png?200|}} | + | {{:si:laboratoare:2025:2025-10-31_22-37-44.png?200|}} {{:si:laboratoare:2025:lvgl-hacktorwatch.png?400|}} |
| + | Recomandam sa rulati exercitiile 3, 4 si 5 pe simiulator, iar apoi pe ceas. | ||
| === 1. Rulati exemplul oferit ca suport pentru acest laborator pe ceas === | === 1. Rulati exemplul oferit ca suport pentru acest laborator pe ceas === | ||
| - | Folositi config-ul hacktorwatch:lvgl pentru acest laborator. In acest config aplicatia HacktorWatch (CONFIG_HACKTORWATCH_REV2) este activata in mod implicit. Compilati si incarcati noua imagine pe ceas, si deschideti aplicatia "hacktorwatch" din linie de comanda. | + | Folositi config-ul hacktorwatch:lvgl pentru acest laborator. In acest config aplicatia HacktorWatch (CONFIG_HACKTORWATCH_REV2) este activata in mod implicit. Compilati {{:si:laboratoare:2025:hacktorwatch_main.c.txt|suportul de laborator}} si incarcati noua imagine pe ceas, iar apoi deschideti aplicatia "hacktorwatch" din linie de comanda. |
| + | |||
| + | <code> | ||
| + | /tools/configure.sh -l hacktorwatch:lvgl | ||
| + | cp ~/Downloads/hacktorwatch_main.c.txt nuttx-apps/hacktorwatch-rev2/main/hacktorwatch_main.c | ||
| + | cd nuttx | ||
| + | make flash ESPTOOL_PORT=/dev/ttyACM0 ESPTOOL_BAUD=115200 ESPTOOL_BINDIR=../esp32s3-bins -j$(nproc) | ||
| + | </code> | ||
| === 2. Activati driver-ul de touchscreen CST816S === | === 2. Activati driver-ul de touchscreen CST816S === | ||
| Line 125: | Line 134: | ||
| * Activati LV_USE_NUTTX_TOUCHSCREEN pentru ca LVGL sa fie compilat cu suport de touchscreen | * Activati LV_USE_NUTTX_TOUCHSCREEN pentru ca LVGL sa fie compilat cu suport de touchscreen | ||
| + | |||
| + | * Din cauza unui bug, codul de touchscreen din LVGL citeste in continuu date de la driver-ul de touchscreen. Aplicati urmatoarea modificare in fisierul nuttx-apps/graphics/lvgl/lvgl/src/drivers/nuttx/lv_nuttx_touchscreen.c. Prin aceasta modificare, vom lasa codul de LVGL sa opreasca procesarea in momentul cand degetul este luat de pe touchscreen. <code> | ||
| + | --- ./graphics/lvgl/lvgl/src/drivers/nuttx/lv_nuttx_touchscreen.c 2024-10-24 21:45:11.000000000 +0300 | ||
| + | +++ ./graphics/lvgl/lvgl/src/drivers/nuttx/lv_nuttx_touchscreen.c 2025-08-10 20:04:58.486933763 +0300 | ||
| + | @@ -146,7 +146,11 @@ | ||
| + | /* Save last sample and let lvgl continue reading */ | ||
| + | touchscreen->last_sample = sample; | ||
| + | touchscreen->has_last_sample = true; | ||
| + | - data->continue_reading = true; | ||
| + | + | ||
| + | + if (sample.point[0].flags & TOUCH_DOWN) | ||
| + | + data->continue_reading = true; | ||
| + | + else | ||
| + | + data->continue_reading = false; | ||
| + | } | ||
| + | else { | ||
| + | /* No more sample available, clear last sample flag */ | ||
| + | </code> | ||
| + | |||
| === 3. Activati optiunea "Night Mode" === | === 3. Activati optiunea "Night Mode" === | ||
| Line 133: | Line 161: | ||
| lv_obj_add_state(cb_night_mode, 0); | lv_obj_add_state(cb_night_mode, 0); | ||
| lv_obj_align(cb_night_mode, LV_ALIGN_LEFT_MID, 0, -30); | lv_obj_align(cb_night_mode, LV_ALIGN_LEFT_MID, 0, -30); | ||
| - | + lv_obj_add_event_cb(cb_night_mode, NULL, LV_EVENT_ALL, NULL); | + | + lv_obj_add_event_cb(cb_night_mode, cb_night_mode_event_handler, LV_EVENT_ALL, NULL); |
| </code> | </code> | ||
| Line 173: | Line 201: | ||
| while (1) | while (1) | ||
| </code> | </code> | ||
| - | |||
| - | |||
| === 6. Mariti frecventa de afisaj a LCD-ului === | === 6. Mariti frecventa de afisaj a LCD-ului === | ||
| - | ToDo | + | In mod implicit, frecventa de lucra a protocolului de comunicare SPI folosit intre placa ESP32S3 si LCD este de 40Mhz. Observam o imbunatatire a rate de refresh a LCD-ului daca marim frecventa la 60Mhz |
| + | <code> | ||
| + | --- arch/xtensa/src/esp32s3/esp32s3_spi.c | ||
| + | +++ arch/xtensa/src/esp32s3/esp32s3_spi.c | ||
| + | @@ -90,7 +90,7 @@ | ||
| + | |||
| + | /* SPI default frequency (limited by clock divider) */ | ||
| + | |||
| + | -#define SPI_DEFAULT_FREQ (400000) | ||
| + | +#define SPI_DEFAULT_FREQ (600000) | ||
| + | |||
| + | /* SPI default width */ | ||
| + | </code> | ||
| ==== Resurse ==== | ==== Resurse ==== | ||
| * [[https://lvgl.io]] | * [[https://lvgl.io]] | ||
| * [[https://docs.lvgl.io/master/examples.html]] | * [[https://docs.lvgl.io/master/examples.html]] | ||