From fb7a7364a4d6d5b125a6b8b4e523b5f74570d8ba Mon Sep 17 00:00:00 2001 From: gagarinlg Date: Sun, 28 Nov 2021 21:06:54 +0100 Subject: [PATCH] just something to play with lvgl simu is working partially TX16S has worked, is now broken, due to changes to make simu work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit working means, lvgl shows something on the display and handles touch events to stop libopenui from interfering this is needed in libopenui: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 09cc3d3..cda095f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -79,7 +79,7 @@ void MainWindow::checkEvents() if (touchPanelEventOccured()) { short lastDeltaX = touchState.lastDeltaX; short lastDeltaY = touchState.lastDeltaY;; - touchState = touchPanelRead(); + //touchState = touchPanelRead(); touchState.lastDeltaX = lastDeltaX; touchState.lastDeltaY = lastDeltaY; } @@ -177,6 +177,7 @@ void MainWindow::invalidate(const rect_t & rect) bool MainWindow::refresh() { +return false; if (invalidatedRect.w) { if (invalidatedRect.x > 0 || invalidatedRect.y > 0 || invalidatedRect.w < LCD_W || invalidatedRect.h < LCD_H) { TRACE_WINDOWS("Refresh rect: left=%d top=%d width=%d height=%d", invalidatedRect.left(), invalidatedRect.top(), invalidatedRect.w, invalidatedRect.h); add eclipse projetc files and helper scripts some cleanup and fix simu NV14 simu and TX16s simu are working with lvgl no more magic numbers added files for a lvgl wrapper class for initialization moved lvgl initialization to LvglWrapper code cleanup started implementing a widget as a drawing target for libopenui with some additional changesin libopenui, the libopenui ui can be displayed on a lvgl canvas fix lvgl full screen canvas update personal project files add file with patch instructions for libopenui works on NV14 with a canvas as the drawingtarget for libopenui and direct touch handling by libopenui fix indentation enabled double buffering for LVGL using the LCD frame buffers transparancies are broken on TX16s simulator does not work untested on NV14 simu for NV14 and TX16S run and work mostly works mostly on NV14 and TX16S some pop ups (e.g. USB) flicker LUA full screen apps won't display anything touch handling still done by libopenui on TX16S lvgl widgets are rotated by 180° untested on all other radios fix using of commeted out function. No touch handling for LVGL right now rotate screens, so that libopenui and LVGL have the same screen rotation removed the need to rotate images and fonts when using LVGL currently the changes can be easily reverted deleted lvgl copy building with lvgl as unmodified submodule works move lv_conf to radio/src delete eclipse project files use specific branch for lvgl use libopenui lvgl branch remove now unneeded help.txt add missing file to colorlcd CMakelist fix image display problems in TX16S simulator just something to play with lvgl simu is working partially TX16S has worked, is now broken, due to changes to make simu work working means, lvgl shows something on the display and handles touch events to stop libopenui from interfering this is needed in libopenui: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 09cc3d3..cda095f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -79,7 +79,7 @@ void MainWindow::checkEvents() if (touchPanelEventOccured()) { short lastDeltaX = touchState.lastDeltaX; short lastDeltaY = touchState.lastDeltaY;; - touchState = touchPanelRead(); + //touchState = touchPanelRead(); touchState.lastDeltaX = lastDeltaX; touchState.lastDeltaY = lastDeltaY; } @@ -177,6 +177,7 @@ void MainWindow::invalidate(const rect_t & rect) bool MainWindow::refresh() { +return false; if (invalidatedRect.w) { if (invalidatedRect.x > 0 || invalidatedRect.y > 0 || invalidatedRect.w < LCD_W || invalidatedRect.h < LCD_H) { TRACE_WINDOWS("Refresh rect: left=%d top=%d width=%d height=%d", invalidatedRect.left(), invalidatedRect.top(), invalidatedRect.w, invalidatedRect.h); add eclipse projetc files and helper scripts some cleanup and fix simu NV14 simu and TX16s simu are working with lvgl no more magic numbers added files for a lvgl wrapper class for initialization moved lvgl initialization to LvglWrapper code cleanup started implementing a widget as a drawing target for libopenui with some additional changesin libopenui, the libopenui ui can be displayed on a lvgl canvas fix lvgl full screen canvas update personal project files add file with patch instructions for libopenui works on NV14 with a canvas as the drawingtarget for libopenui and direct touch handling by libopenui fix indentation enabled double buffering for LVGL using the LCD frame buffers transparancies are broken on TX16s simulator does not work untested on NV14 simu for NV14 and TX16S run and work mostly works mostly on NV14 and TX16S some pop ups (e.g. USB) flicker LUA full screen apps won't display anything touch handling still done by libopenui on TX16S lvgl widgets are rotated by 180° untested on all other radios fix using of commeted out function. No touch handling for LVGL right now rotate screens, so that libopenui and LVGL have the same screen rotation removed the need to rotate images and fonts when using LVGL currently the changes can be easily reverted deleted lvgl copy building with lvgl as unmodified submodule works move lv_conf to radio/src delete eclipse project files --- .gitmodules | 5 +- cmake.sh | 2 + help.txt | 68 ++ prepare.sh | 15 + radio/src/bitmaps/480x272/CMakeLists.txt | 4 +- radio/src/fonts/CMakeLists.txt | 2 +- radio/src/gui/colorlcd/CMakeLists.txt | 146 +++++ radio/src/gui/colorlcd/LvglWrapper.cpp | 332 ++++++++++ radio/src/gui/colorlcd/LvglWrapper.h | 53 ++ radio/src/gui/colorlcd/fonts.cpp | 2 +- radio/src/gui/colorlcd/fullscreen_dialog.cpp | 3 + radio/src/gui/colorlcd/libopenui.h | 3 + radio/src/gui/colorlcd/radio_sdmanager.cpp | 2 + radio/src/lv_conf.h | 619 +++++++++++++++++++ radio/src/main.cpp | 2 + radio/src/opentx.cpp | 4 + radio/src/targets/horus/lcd_driver.cpp | 26 +- radio/src/targets/nv14/lcd_driver.cpp | 10 +- radio/src/targets/simu/simulcd.cpp | 29 +- radio/src/thirdparty/lvgl | 1 + 20 files changed, 1313 insertions(+), 15 deletions(-) create mode 100755 cmake.sh create mode 100644 help.txt create mode 100755 prepare.sh create mode 100644 radio/src/gui/colorlcd/LvglWrapper.cpp create mode 100644 radio/src/gui/colorlcd/LvglWrapper.h create mode 100644 radio/src/lv_conf.h create mode 160000 radio/src/thirdparty/lvgl diff --git a/.gitmodules b/.gitmodules index 19f1da80d..a0d8f7288 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "libopenui"] path = radio/src/thirdparty/libopenui url = https://github.com/EdgeTX/libopenui.git - branch = master + branch = lvgl [submodule "radio/src/thirdparty/AccessDenied"] path = radio/src/thirdparty/AccessDenied url = https://github.com/raphaelcoeffic/AccessDenied.git @@ -12,3 +12,6 @@ path = radio/src/thirdparty/FreeRTOS url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git shallow = true +[submodule "radio/src/thirdparty/lvgl"] + path = radio/src/thirdparty/lvgl + url = https://github.com/lvgl/lvgl.git diff --git a/cmake.sh b/cmake.sh new file mode 100755 index 000000000..5b956fe71 --- /dev/null +++ b/cmake.sh @@ -0,0 +1,2 @@ +#!/bin/bash +cmake --target simu "$@" diff --git a/help.txt b/help.txt new file mode 100644 index 000000000..22803cb2d --- /dev/null +++ b/help.txt @@ -0,0 +1,68 @@ +additional libopenui patch: +diff --git a/src/bitmapbuffer.h b/src/bitmapbuffer.h +index 146c815..f5ce245 100644 +--- a/src/bitmapbuffer.h ++++ b/src/bitmapbuffer.h +@@ -36,7 +36,7 @@ constexpr uint8_t STASHED = 0x33; + #define APPLY_OFFSET() x += this->offsetX; y += this->offsetY + #define RESTORE_OFFSET() this->offsetX = offsetX, this->offsetY = offsetY + +-#if defined(LCD_VERTICAL_INVERT) ++#if defined(LCD_VERTICAL_INVERT) && 0 + #define MOVE_PIXEL_RIGHT(p, count) p -= count + #else + #define MOVE_PIXEL_RIGHT(p, count) p += count +@@ -156,7 +156,7 @@ class BitmapBufferBase + + inline const pixel_t * getPixelPtrAbs(coord_t x, coord_t y) const + { +-#if defined(LCD_VERTICAL_INVERT) ++#if defined(LCD_VERTICAL_INVERT) && 0 + x = _width - x - 1; + y = _height - y - 1; + #endif +@@ -401,7 +401,7 @@ class BitmapBuffer: public BitmapBufferBase + + inline const pixel_t * getPixelPtrAbs(coord_t x, coord_t y) const + { +-#if defined(LCD_VERTICAL_INVERT) ++#if defined(LCD_VERTICAL_INVERT) && 0 + x = _width - x - 1; + y = _height - y - 1; + #endif +@@ -410,7 +410,7 @@ class BitmapBuffer: public BitmapBufferBase + + inline pixel_t * getPixelPtrAbs(coord_t x, coord_t y) + { +-#if defined(LCD_VERTICAL_INVERT) ++#if defined(LCD_VERTICAL_INVERT) && 0 + x = _width - x - 1; + y = _height - y - 1; + #endif +diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp +index c256d0b..dede0c9 100644 +--- a/src/mainwindow.cpp ++++ b/src/mainwindow.cpp +@@ -179,9 +179,21 @@ void MainWindow::invalidate(const rect_t & rect) + invalidatedRect = rect; + } + } +- ++#include "lvgl/lvgl.h" ++extern lv_obj_t * canvas; ++extern BitmapBuffer lcdBackup; + bool MainWindow::refresh() + { ++ if (invalidatedRect.w) { ++ lcdBackup.setOffset(0, 0); ++ lcdBackup.setClippingRect(0,LCD_W,0, LCD_H); ++ fullPaint(&lcdBackup); ++ lv_canvas_copy_buf(canvas, lcdBackup.getData(), 0, 0, LCD_W, LCD_H); ++ lv_img_cache_invalidate_src(lcdBackup.getData()); ++ lv_obj_invalidate(canvas); ++ } ++ return false; ++ + if (invalidatedRect.w) { + if (invalidatedRect.x > 0 || invalidatedRect.y > 0 || invalidatedRect.w < LCD_W || invalidatedRect.h < LCD_H) { + TRACE_WINDOWS("Refresh rect: left=%d top=%d width=%d height=%d", invalidatedRect.left(), invalidatedRect.top(), invalidatedRect.w, invalidatedRect.h); diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 000000000..1c56562dd --- /dev/null +++ b/prepare.sh @@ -0,0 +1,15 @@ +#!/bin/bash +mkdir -p _Release +cd _Release + +cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=YES -DLUA=YES -DINTERNAL_GPS=NO -DCMAKE_BUILD_TYPE=Release ../ + +cd .. +mkdir -p _Debug +cd _Debug +cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=YES -DLUA=YES -DINTERNAL_GPS=NO -DCMAKE_BUILD_TYPE=Debug ../ + +cd .. +mkdir -p _NV14 +cd _NV14 +cmake -DPCB=NV14 -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=YES -DLUA=YES -DINTERNAL_GPS=NO -DCMAKE_BUILD_TYPE=Debug ../ diff --git a/radio/src/bitmaps/480x272/CMakeLists.txt b/radio/src/bitmaps/480x272/CMakeLists.txt index 77462cfe4..3c21c188c 100644 --- a/radio/src/bitmaps/480x272/CMakeLists.txt +++ b/radio/src/bitmaps/480x272/CMakeLists.txt @@ -11,8 +11,8 @@ else() if(PCBREV STREQUAL T18) # straight screen else() - set(BITMAP_ARGS ${BITMAP_ARGS} --reverse) - set(MASK_ARGS ${MASK_ARGS} --reverse) +# set(BITMAP_ARGS ${BITMAP_ARGS} --reverse) +# set(MASK_ARGS ${MASK_ARGS} --reverse) endif() endif() diff --git a/radio/src/fonts/CMakeLists.txt b/radio/src/fonts/CMakeLists.txt index e19032c8a..7f4b32e2c 100644 --- a/radio/src/fonts/CMakeLists.txt +++ b/radio/src/fonts/CMakeLists.txt @@ -19,7 +19,7 @@ else() endif() if(PCB STREQUAL X10) - set(FONT_ARGS ${FONT_ARGS} --reverse) +# set(FONT_ARGS ${FONT_ARGS} --reverse) endif() add_truetype_font_target(9 9 ${subset} none "${FONT_ARGS}") diff --git a/radio/src/gui/colorlcd/CMakeLists.txt b/radio/src/gui/colorlcd/CMakeLists.txt index d0db6bb6b..652f87a31 100644 --- a/radio/src/gui/colorlcd/CMakeLists.txt +++ b/radio/src/gui/colorlcd/CMakeLists.txt @@ -75,6 +75,7 @@ set(GUI_SRC menu_screen.cpp screen_setup.cpp switch_warn_dialog.cpp + LvglWrapper.cpp ) macro(add_gui_src src) @@ -134,6 +135,151 @@ foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC}) set(SRC ${SRC} thirdparty/libopenui/src/${LIBOPENUI_FILE}) endforeach() +set(LVGL_SOURCES + gpu/lv_gpu_stm32_dma2d.c + core/lv_group.c + core/lv_obj.c + core/lv_event.c + core/lv_indev.c + core/lv_obj_scroll.c + core/lv_obj_draw.c + core/lv_disp.c + core/lv_obj_style.c + core/lv_theme.c + core/lv_obj_style_gen.c + core/lv_refr.c + core/lv_indev_scroll.c + core/lv_obj_class.c + core/lv_obj_tree.c + core/lv_obj_pos.c + font/lv_font_montserrat_20.c + font/lv_font_unscii_8.c + font/lv_font_montserrat_48.c + font/lv_font_montserrat_28.c + font/lv_font_montserrat_26.c + font/lv_font_montserrat_38.c + font/lv_font_montserrat_18.c + font/lv_font_montserrat_8.c + font/lv_font_montserrat_44.c + font/lv_font_montserrat_40.c + font/lv_font_dejavu_16_persian_hebrew.c + font/lv_font_montserrat_32.c + font/lv_font_montserrat_46.c + font/lv_font_montserrat_14.c + font/lv_font_montserrat_12_subpx.c + font/lv_font_montserrat_34.c + font/lv_font_montserrat_16.c + font/lv_font_montserrat_42.c + font/lv_font_montserrat_12.c + font/lv_font_simsun_16_cjk.c + font/lv_font_montserrat_30.c + font/lv_font_montserrat_22.c + font/lv_font_montserrat_10.c + font/lv_font_fmt_txt.c + font/lv_font_montserrat_24.c + font/lv_font_loader.c + font/lv_font_montserrat_28_compressed.c + font/lv_font.c + font/lv_font_montserrat_36.c + font/lv_font_unscii_16.c + misc/lv_timer.c + misc/lv_txt.c + misc/lv_gc.c + misc/lv_style_gen.c + misc/lv_templ.c + misc/lv_color.c + misc/lv_fs.c + misc/lv_printf.c + misc/lv_style.c + misc/lv_log.c + misc/lv_area.c + misc/lv_math.c + misc/lv_tlsf.c + misc/lv_anim_timeline.c + misc/lv_ll.c + misc/lv_bidi.c + misc/lv_mem.c + misc/lv_utils.c + misc/lv_async.c + misc/lv_anim.c + misc/lv_txt_ap.c + draw/lv_draw_mask.c + draw/lv_img_cache.c + draw/lv_draw_blend.c + draw/lv_draw_line.c + draw/lv_img_buf.c + draw/lv_draw_rect.c + draw/lv_draw_label.c + draw/lv_draw_img.c + draw/lv_draw_arc.c + draw/lv_draw_triangle.c + draw/lv_img_decoder.c + hal/lv_hal_indev.c + hal/lv_hal_disp.c + hal/lv_hal_tick.c + extra/others/snapshot/lv_snapshot.c + extra/layouts/grid/lv_grid.c + extra/layouts/flex/lv_flex.c + extra/libs/bmp/lv_bmp.c + extra/libs/gif/lv_gif.c + extra/libs/gif/gifdec.c + extra/libs/freetype/lv_freetype.c + extra/libs/qrcode/lv_qrcode.c + extra/libs/qrcode/qrcodegen.c + extra/libs/sjpg/tjpgd.c + extra/libs/sjpg/lv_sjpg.c + extra/libs/fsdrv/lv_fs_win32.c + extra/libs/fsdrv/lv_fs_stdio.c + extra/libs/fsdrv/lv_fs_posix.c + extra/libs/fsdrv/lv_fs_fatfs.c + extra/libs/rlottie/lv_rlottie.c + extra/libs/png/lv_png.c + extra/libs/png/lodepng.c + extra/lv_extra.c + extra/widgets/imgbtn/lv_imgbtn.c + extra/widgets/win/lv_win.c + extra/widgets/colorwheel/lv_colorwheel.c + extra/widgets/list/lv_list.c + extra/widgets/chart/lv_chart.c + extra/widgets/calendar/lv_calendar_header_arrow.c + extra/widgets/calendar/lv_calendar.c + extra/widgets/calendar/lv_calendar_header_dropdown.c + extra/widgets/tileview/lv_tileview.c + extra/widgets/led/lv_led.c + extra/widgets/spinner/lv_spinner.c + extra/widgets/tabview/lv_tabview.c + extra/widgets/meter/lv_meter.c + extra/widgets/spinbox/lv_spinbox.c + extra/widgets/animimg/lv_animimg.c + extra/widgets/span/lv_span.c + extra/widgets/keyboard/lv_keyboard.c + extra/widgets/msgbox/lv_msgbox.c + extra/themes/basic/lv_theme_basic.c + extra/themes/default/lv_theme_default.c + extra/themes/mono/lv_theme_mono.c + widgets/lv_line.c + widgets/lv_dropdown.c + widgets/lv_objx_templ.c + widgets/lv_canvas.c + widgets/lv_switch.c + widgets/lv_btnmatrix.c + widgets/lv_bar.c + widgets/lv_roller.c + widgets/lv_img.c + widgets/lv_btn.c + widgets/lv_checkbox.c + widgets/lv_label.c + widgets/lv_table.c + widgets/lv_slider.c + widgets/lv_textarea.c + widgets/lv_arc.c +) + + +foreach(LVGL_FILE ${LVGL_SOURCES}) + set(SRC ${SRC} thirdparty/lvgl/src/${LVGL_FILE}) +endforeach() + add_gui_src(fullscreen_dialog.cpp) add_gui_src(message_dialog.cpp) add_gui_src(confirm_dialog.cpp) diff --git a/radio/src/gui/colorlcd/LvglWrapper.cpp b/radio/src/gui/colorlcd/LvglWrapper.cpp new file mode 100644 index 000000000..1f863ba04 --- /dev/null +++ b/radio/src/gui/colorlcd/LvglWrapper.cpp @@ -0,0 +1,332 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +#include "LvglWrapper.h" + +LvglWrapper* LvglWrapper::_instance = nullptr; + +static lv_disp_drv_t disp_drv; /*A variable to hold the drivers. Must be static or global.*/ +lv_disp_t * disp; + +static lv_disp_draw_buf_t disp_buf; +static lv_indev_drv_t indev_drv; + +void newLcdRefresh(uint16_t* buffer); +static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) +{ +#if 0 + uint16_t width = area->x2-area->x1+1; + uint16_t height = area->y2-area->y1+1; +#if defined (LCD_VERTICAL_INVERT) + uint16_t x = LCD_W - area->x2 -1; + uint16_t y = LCD_H - area->y2 -1; +#else + uint16_t x = area->x1; + uint16_t y = area->y1; +#endif + + lcdCopy(lcd->getData(), lcdFront->getData()); + DMACopyBitmap(lcd->getData(), LCD_W, LCD_H, x, y, (uint16_t*)color_p, width, height, 0, 0, width, height); + lv_disp_flush_ready(disp_drv); + newLcdRefresh(nullptr); +#else + newLcdRefresh((uint16_t*)color_p); + lv_disp_flush_ready(disp_drv); +#endif +} +#if 1 + /*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */ +static void btn_event_cb(lv_event_t * e) +{ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btn = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { + static uint8_t cnt = 0; + cnt++; + + /*Get the first child of the button which is the label and change its text*/ + lv_obj_t * label = lv_obj_get_child(btn, 0); + lv_label_set_text_fmt(label, "Button: %d", cnt); + } +} + + +void lv_example_get_started_1(void) +{ + lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/ + lv_obj_set_pos(btn, 10, 10); /*Set its position*/ + lv_obj_set_size(btn, 120, 50); /*Set its size*/ + lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/ + + lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/ + lv_label_set_text(label, "Button"); /*Set the labels text*/ + lv_obj_center(label); +} +void lv_example_label_1(void) +{ + lv_obj_t * label1 = lv_label_create(lv_scr_act()); + lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/ + lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/ + lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center " + "and wrap long text automatically."); + lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/ + lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40); + + + lv_obj_t * label2 = lv_label_create(lv_scr_act()); + lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/ + lv_obj_set_width(label2, 150); + lv_label_set_text(label2, "It is a circularly scrolling text. "); + lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40); +} + +extern "C" void my_input_read(lv_indev_drv_t * drv, lv_indev_data_t*data) +{ +#if defined(HARDWARE_TOUCH) + TouchState st = touchPanelRead(); + if(st.event == TE_NONE) + return; + if(st.event == TE_DOWN || st.event == TE_SLIDE) + { +#if defined (LCD_VERTICAL_INVERT) + data->point.x = LCD_W - st.x; + data->point.y = LCD_H - st.y; +#else + data->point.x = st.x; + data->point.y = st.y; +#endif + data->state = LV_INDEV_STATE_PRESSED; + } else { + data->state = LV_INDEV_STATE_RELEASED; + } +#endif +} + +static void slider_event_cb(lv_event_t * e); +static lv_obj_t * slider_label; + +/** + * A default slider with a label displaying the current value + */ +void lv_example_slider_1(void) +{ + /*Create a slider in the center of the display*/ + lv_obj_t * slider = lv_slider_create(lv_scr_act()); + lv_obj_center(slider); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_align(slider, LV_ALIGN_BOTTOM_LEFT, 10, -10); + + /*Create a label below the slider*/ + slider_label = lv_label_create(lv_scr_act()); + lv_label_set_text(slider_label, "0%"); + + lv_obj_align_to(slider_label, slider, LV_ALIGN_CENTER, 0, 0); +} + +static void slider_event_cb(lv_event_t * e) +{ + lv_obj_t * slider = lv_event_get_target(e); + char buf[8]; + lv_snprintf(buf, sizeof(buf), "%d%%", (int)lv_slider_get_value(slider)); + lv_label_set_text(slider_label, buf); + lv_obj_align_to(slider_label, slider, LV_ALIGN_CENTER, 0, 0); +} + +static void sw_event_cb(lv_event_t * e) +{ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * sw = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { + lv_obj_t * list = (lv_obj_t*)lv_event_get_user_data(e); + + if(lv_obj_has_state(sw, LV_STATE_CHECKED)) + lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLL_ONE); + else + lv_obj_clear_flag(list, LV_OBJ_FLAG_SCROLL_ONE); + } +} + +/** + * Show an example to scroll snap + */ +void lv_example_scroll_2(void) +{ + lv_obj_t * panel = lv_obj_create(lv_scr_act()); + lv_obj_set_size(panel, LCD_W/3, LCD_H/3); + lv_obj_set_scroll_snap_x(panel, LV_SCROLL_SNAP_CENTER); + lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_ROW); + lv_obj_align(panel, LV_ALIGN_BOTTOM_RIGHT, 0, 0); +// lv_obj_align(panel, LV_ALIGN_BOTTOM_RIGHT, 0, 20); + + unsigned int i; + for(i = 0; i < 10; i++) { + lv_obj_t * btn = lv_btn_create(panel); + lv_obj_set_size(btn, lv_pct(60), lv_pct(80)); + + lv_obj_t * label = lv_label_create(btn); + if(i == 3) { + lv_label_set_text_fmt(label, "Panel %u\nno snap", i); + lv_obj_clear_flag(btn, LV_OBJ_FLAG_SNAPPABLE); + } else { + lv_label_set_text_fmt(label, "Panel %u", i); + } + + lv_obj_center(label); + } + lv_obj_update_snap(panel, LV_ANIM_ON); + + /*Switch between "One scroll" and "Normal scroll" mode*/ + lv_obj_t * sw = lv_switch_create(lv_scr_act()); + lv_obj_align(sw, LV_ALIGN_TOP_RIGHT, -20, 10); + lv_obj_add_event_cb(sw, sw_event_cb, LV_EVENT_ALL, panel); + lv_obj_t * label = lv_label_create(lv_scr_act()); + lv_label_set_text(label, "One scroll"); + lv_obj_align_to(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); +} +#endif +/** + * Create a transparent canvas with Chroma keying and indexed color format (palette). + */ +#define CANVAS_WIDTH LCD_W +#define CANVAS_HEIGHT LCD_H +lv_obj_t * canvas=nullptr; +static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)] __SDRAM; +void lv_example_canvas_2(void) +{ + /*Create a button to better see the transparency*/ + //lv_btn_create(lv_scr_act()); + + /*Create a buffer for the canvas*/ + + /*Create a canvas and initialize its palette*/ + /*lv_obj_t * */canvas = lv_canvas_create(lv_scr_act()); + lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR); +#if 0 + lv_canvas_set_palette(canvas, 0, LV_COLOR_CHROMA_KEY); + lv_canvas_set_palette(canvas, 1, lv_palette_main(LV_PALETTE_RED)); + + /*Create colors with the indices of the palette*/ + lv_color_t c0; + lv_color_t c1; + + c0.full = 0; + c1.full = 1; + + /*Red background (There is no dedicated alpha channel in indexed images so LV_OPA_COVER is ignored)*/ + lv_canvas_fill_bg(canvas, c1, LV_OPA_COVER); + + /*Create hole on the canvas*/ + uint32_t x; + uint32_t y; + for( y = 10; y < 30; y++) { + for( x = 5; x < 20; x++) { + lv_canvas_set_px_color(canvas, x, y, c0); + } + } +#endif +} + +extern BitmapBuffer * lcdFront; +extern BitmapBuffer * lcd; +LvglWrapper::LvglWrapper() +{ + lv_init(); +// lv_disp_draw_buf_init(&disp_buf, lcdGetScratchBuffer(),NULL, LCD_W*LCD_H); + lv_disp_draw_buf_init(&disp_buf, lcdFront->getData(), lcd->getData(), LCD_W*LCD_H); + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/ + disp_drv.flush_cb = flushLcd; /*Set a flush callback to draw to the display*/ + disp_drv.hor_res = LCD_W; /*Set the horizontal resolution in pixels*/ + disp_drv.ver_res = LCD_H; /*Set the vertical resolution in pixels*/ + disp_drv.full_refresh = 0; + disp_drv.direct_mode = 0; +#if defined (LCD_VERTICAL_INVERT) + disp_drv.rotated = LV_DISP_ROT_180; +#endif + disp_drv.sw_rotate = 1; + + lv_indev_drv_init(&indev_drv); /*Basic initialization*/ + indev_drv.type =LV_INDEV_TYPE_POINTER; /*See below.*/ + indev_drv.read_cb = my_input_read; /*See below.*/ + /*Register the driver in LVGL and save the created input device object*/ + + + disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/ + lv_example_canvas_2(); + + +#if 0 + /*lv_indev_t * my_indev = */lv_indev_drv_register(&indev_drv); + lv_example_get_started_1(); + lv_example_label_1(); + lv_example_slider_1(); + lv_example_scroll_2(); +#endif +} + +void LvglWrapper::run() +{ + tmr10ms_t tick = get_tmr10ms(); + lv_tick_inc((tick - lastTick) * 10); + lastTick = tick; + lv_timer_handler(); +} + +#if 0 +extern const lv_obj_class_t GuiWidgetClass; + +extern "C" +void GuiWidgetConstructor(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj) +{} + +extern "C" +void GuiWidgetEvent(const struct _lv_obj_class_t * class_p, struct _lv_event_t * e) +{ + LV_UNUSED(class_p); + + lv_res_t res; + + /*Call the ancestor's event handler*/ + res = lv_obj_event_base(&GuiWidgetClass, e); + if(res != LV_RES_OK) return; + + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + switch(code) + { + case LV_EVENT_DRAW_MAIN: + break; + } +} +const lv_obj_class_t GuiWidgetClass = { + .base_class = nullptr, + .constructor_cb = GuiWidgetConstructor, + .event_cb = GuiWidgetEvent, + .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, + .instance_size = sizeof(GuiWidget) +}; +#endif diff --git a/radio/src/gui/colorlcd/LvglWrapper.h b/radio/src/gui/colorlcd/LvglWrapper.h new file mode 100644 index 000000000..928766d72 --- /dev/null +++ b/radio/src/gui/colorlcd/LvglWrapper.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _LVGLWRAPPER_H_ +#define _LVGLWRAPPER_H_ + +#include "opentx_types.h" +#include "lvgl/lvgl.h" +#if 0 +struct GuiWidget +{ + lv_obj_t obj; +}; +#endif + +class LvglWrapper { +public: + LvglWrapper(); + ~LvglWrapper() {} + + static LvglWrapper* instance() + { + if (!_instance) + _instance = new LvglWrapper(); + + return _instance; + } + void run(); + +private: + static LvglWrapper* _instance; + tmr10ms_t lastTick = 0; +}; + +#endif // _LVGLWRAPPER_H_ diff --git a/radio/src/gui/colorlcd/fonts.cpp b/radio/src/gui/colorlcd/fonts.cpp index a1a14cfbc..3f6aed05f 100644 --- a/radio/src/gui/colorlcd/fonts.cpp +++ b/radio/src/gui/colorlcd/fonts.cpp @@ -170,7 +170,7 @@ uint8_t * decompressFont(const uint8_t * font, unsigned len) ((uint16_t*)buf)[0] = (uint16_t)width; ((uint16_t*)buf)[1] = (uint16_t)height; -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 uint8_t* src = raw_font + font_size - 1; for(uint8_t* dst = buf + 4; src >= raw_font; --src, ++dst) { *dst = 0xFF - *src; diff --git a/radio/src/gui/colorlcd/fullscreen_dialog.cpp b/radio/src/gui/colorlcd/fullscreen_dialog.cpp index 72d3416b4..a1ece90a5 100644 --- a/radio/src/gui/colorlcd/fullscreen_dialog.cpp +++ b/radio/src/gui/colorlcd/fullscreen_dialog.cpp @@ -20,6 +20,7 @@ */ #include "fullscreen_dialog.h" +#include "LvglWrapper.h" #include "mainwindow.h" #include "opentx.h" #include "libopenui.h" @@ -183,6 +184,7 @@ void FullScreenDialog::runForever() RTOS_WAIT_MS(1); mainWin->run(false); + LvglWrapper::instance()->run(); } deleteLater(); @@ -204,6 +206,7 @@ void FullScreenDialog::runForeverNoPwrCheck() RTOS_WAIT_MS(1); mainWin->run(false); + LvglWrapper::instance()->run(); } deleteLater(); diff --git a/radio/src/gui/colorlcd/libopenui.h b/radio/src/gui/colorlcd/libopenui.h index c26d1ccf5..f72dfe94b 100644 --- a/radio/src/gui/colorlcd/libopenui.h +++ b/radio/src/gui/colorlcd/libopenui.h @@ -57,6 +57,7 @@ #include "coloredit.h" #include "draw_functions.h" #include "textedits.h" +#include "LvglWrapper.h" inline MessageDialog * createPopupInformation(const char * message) { @@ -74,6 +75,7 @@ inline void POPUP_INFORMATION(const char * message) while (popup->getParent()) { WDG_RESET(); MainWindow::instance()->run(false); + LvglWrapper::instance()->run(); } } @@ -86,6 +88,7 @@ inline void POPUP_WARNING(const char * message, const char * info = nullptr) while (popup->getParent()) { WDG_RESET(); MainWindow::instance()->run(false); + LvglWrapper::instance()->run(); } } diff --git a/radio/src/gui/colorlcd/radio_sdmanager.cpp b/radio/src/gui/colorlcd/radio_sdmanager.cpp index 14785cb59..7065123d5 100644 --- a/radio/src/gui/colorlcd/radio_sdmanager.cpp +++ b/radio/src/gui/colorlcd/radio_sdmanager.cpp @@ -22,6 +22,7 @@ #include "radio_sdmanager.h" #include "opentx.h" #include "libopenui.h" +#include "gui/colorlcd/LvglWrapper.h" #include "io/frsky_firmware_update.h" #include "io/multi_firmware_update.h" #include "io/bootloader_flash.h" @@ -163,6 +164,7 @@ class FlashDialog: public FullScreenDialog setMessage(message); progress.setValue(total > 0 ? count * 100 / total : 0); MainWindow::instance()->run(false); + LvglWrapper::instance()->run(); }); deleteLater(); } diff --git a/radio/src/lv_conf.h b/radio/src/lv_conf.h new file mode 100644 index 000000000..2a5e86935 --- /dev/null +++ b/radio/src/lv_conf.h @@ -0,0 +1,619 @@ +/** + * @file lv_conf.h + * Configuration file for v8.1.1-dev + */ + +/* + * Copy this file as `lv_conf.h` + * 1. simply next to the `lvgl` folder + * 2. or any other places and + * - define `LV_CONF_INCLUDE_SIMPLE` + * - add the path as include path + */ + +/* clang-format off */ +#if 1 /*Set it to "1" to enable content*/ + +#ifndef LV_CONF_H +#define LV_CONF_H + +#include + +/*==================== + COLOR SETTINGS + *====================*/ + +/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ +#define LV_COLOR_DEPTH 16 + +/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ +#define LV_COLOR_16_SWAP 0 + +/*Enable more complex drawing routines to manage screens transparency. + *Can be used if the UI is above another layer, e.g. an OSD menu or video player. + *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ +#define LV_COLOR_SCREEN_TRANSP 0 + +/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ +#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128) + +/*Images pixels with this color will not be drawn if they are chroma keyed)*/ +#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ + +/*========================= + MEMORY SETTINGS + *=========================*/ + +/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ +#define LV_MEM_CUSTOM 1 +#if LV_MEM_CUSTOM == 0 +/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ +# define LV_MEM_SIZE (8U * 1024U) /*[bytes]*/ + +/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ +# define LV_MEM_ADR 0 /*0: unused*/ +/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ +#if LV_MEM_ADR == 0 +//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ +//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ +#endif + +#else /*LV_MEM_CUSTOM*/ +# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +# define LV_MEM_CUSTOM_ALLOC malloc +# define LV_MEM_CUSTOM_FREE free +# define LV_MEM_CUSTOM_REALLOC realloc +#endif /*LV_MEM_CUSTOM*/ + +/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. + *You will see an error log message if there wasn't enough buffers. */ +#define LV_MEM_BUF_MAX_NUM 16 + +/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ +#define LV_MEMCPY_MEMSET_STD 0 + +/*==================== + HAL SETTINGS + *====================*/ + +/*Default display refresh period. LVG will redraw changed areas with this period time*/ +#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ + +/*Input device read period in milliseconds*/ +#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ + +/*Use a custom tick source that tells the elapsed time in milliseconds. + *It removes the need to manually update the tick with `lv_tick_inc()`)*/ +#define LV_TICK_CUSTOM 0 +#if LV_TICK_CUSTOM +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +#endif /*LV_TICK_CUSTOM*/ + +/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + *(Not so important, you can adjust it to modify default sizes and spaces)*/ +#define LV_DPI_DEF 130 /*[px/inch]*/ + +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + +/*------------- + * Drawing + *-----------*/ + +/*Enable complex draw engine. + *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ +#define LV_DRAW_COMPLEX 1 +#if LV_DRAW_COMPLEX != 0 + +/*Allow buffering some shadow calculation. + *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` + *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ +#define LV_SHADOW_CACHE_SIZE 0 + +/* Set number of maximally cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing + * radius * 4 bytes are used per circle (the most often used radiuses are saved) + * 0: to disable caching */ +#define LV_CIRCLE_CACHE_SIZE 4 + +#endif /*LV_DRAW_COMPLEX*/ + +/*Default image cache size. Image caching keeps the images opened. + *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) + *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. + *However the opened images might consume additional RAM. + *0: to disable caching*/ +#define LV_IMG_CACHE_DEF_SIZE 0 + +/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/ +#define LV_DISP_ROT_MAX_BUF (10*1024) + +/*------------- + * GPU + *-----------*/ + +/*Use STM32's DMA2D (aka Chrom Art) GPU*/ +#if defined(SIMU) + #define LV_USE_GPU_STM32_DMA2D 0 +#else //SIMU + #define LV_USE_GPU_STM32_DMA2D 1 +#endif + +/*Must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ +#define LV_GPU_DMA2D_CMSIS_INCLUDE "stm32f4xx.h" +#define DMA2D_NLR_PL_Pos 16 +#define DMA2D_NLR_NL_Pos 0 +#define DMA2D_CR_START_Msk DMA2D_CR_START +#define DMA2D_FGPFCCR_AM_Pos 16 +#define DMA2D_FGPFCCR_ALPHA_Pos 24 + +/*Use NXP's PXP GPU iMX RTxxx platforms*/ +#define LV_USE_GPU_NXP_PXP 0 +#if LV_USE_GPU_NXP_PXP +/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) + * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS + * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. + *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() + */ +#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 +#endif + +/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ +#define LV_USE_GPU_NXP_VG_LITE 0 + +/*Use exnternal renderer*/ +#define LV_USE_EXTERNAL_RENDERER 0 + +/*Use SDL renderer API. Requires LV_USE_EXTERNAL_RENDERER*/ +#define LV_USE_GPU_SDL 0 +#if LV_USE_GPU_SDL +# define LV_GPU_SDL_INCLUDE_PATH +#endif + +/*------------- + * Logging + *-----------*/ + +/*Enable the log module*/ +#define LV_USE_LOG 0 +#if LV_USE_LOG + +/*How important log should be added: + *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + *LV_LOG_LEVEL_INFO Log important events + *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + *LV_LOG_LEVEL_USER Only logs added by the user + *LV_LOG_LEVEL_NONE Do not log anything*/ +# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + +/*1: Print the log with 'printf'; + *0: User need to register a callback with `lv_log_register_print_cb()`*/ +# define LV_LOG_PRINTF 0 + +/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ +# define LV_LOG_TRACE_MEM 1 +# define LV_LOG_TRACE_TIMER 1 +# define LV_LOG_TRACE_INDEV 1 +# define LV_LOG_TRACE_DISP_REFR 1 +# define LV_LOG_TRACE_EVENT 1 +# define LV_LOG_TRACE_OBJ_CREATE 1 +# define LV_LOG_TRACE_LAYOUT 1 +# define LV_LOG_TRACE_ANIM 1 + +#endif /*LV_USE_LOG*/ + +/*------------- + * Asserts + *-----------*/ + +/*Enable asserts if an operation is failed or an invalid data is found. + *If LV_USE_LOG is enabled an error message will be printed on failure*/ +#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ +#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ + +/*Add a custom handler when assert happens e.g. to restart the MCU*/ +#define LV_ASSERT_HANDLER_INCLUDE +#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ + +/*------------- + * Others + *-----------*/ + +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#define LV_USE_PERF_MONITOR 0 +#if LV_USE_PERF_MONITOR +#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT +#endif + +/*1: Show the used memory and the memory fragmentation in the left bottom corner + * Requires LV_MEM_CUSTOM = 0*/ +#define LV_USE_MEM_MONITOR 0 +#if LV_USE_PERF_MONITOR +#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT +#endif + +/*1: Draw random colored rectangles over the redrawn areas*/ +#define LV_USE_REFR_DEBUG 0 + +/*Change the built in (v)snprintf functions*/ +#define LV_SPRINTF_CUSTOM 0 +#if LV_SPRINTF_CUSTOM +# define LV_SPRINTF_INCLUDE +# define lv_snprintf snprintf +# define lv_vsnprintf vsnprintf +#else /*LV_SPRINTF_CUSTOM*/ +# define LV_SPRINTF_USE_FLOAT 0 +#endif /*LV_SPRINTF_CUSTOM*/ + +#define LV_USE_USER_DATA 1 + +/*Garbage Collector settings + *Used if lvgl is bound to higher level language and the memory is managed by that language*/ +#define LV_ENABLE_GC 0 +#if LV_ENABLE_GC != 0 +# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +#endif /*LV_ENABLE_GC*/ + +/*===================== + * COMPILER SETTINGS + *====================*/ + +/*For big endian systems set to 1*/ +#define LV_BIG_ENDIAN_SYSTEM 0 + +/*Define a custom attribute to `lv_tick_inc` function*/ +#define LV_ATTRIBUTE_TICK_INC + +/*Define a custom attribute to `lv_timer_handler` function*/ +#define LV_ATTRIBUTE_TIMER_HANDLER + +/*Define a custom attribute to `lv_disp_flush_ready` function*/ +#define LV_ATTRIBUTE_FLUSH_READY + +/*Required alignment size for buffers*/ +#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 + +/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). + * E.g. __attribute__((aligned(4)))*/ +#define LV_ATTRIBUTE_MEM_ALIGN + +/*Attribute to mark large constant arrays for example font's bitmaps*/ +#define LV_ATTRIBUTE_LARGE_CONST + +/*Complier prefix for a big array declaration in RAM*/ +#define LV_ATTRIBUTE_LARGE_RAM_ARRAY + +/*Place performance critical functions into a faster memory (e.g RAM)*/ +#define LV_ATTRIBUTE_FAST_MEM + +/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ +#define LV_ATTRIBUTE_DMA + +/*Export integer constant to binding. This macro is used with constants in the form of LV_ that + *should also appear on LVGL binding API such as Micropython.*/ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ + +/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ +#define LV_USE_LARGE_COORD 0 + +/*================== + * FONT USAGE + *===================*/ + +/*Montserrat fonts with ASCII range and some symbols using bpp = 4 + *https://fonts.google.com/specimen/Montserrat*/ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_14 1 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 + +/*Demonstrate special features*/ +#define LV_FONT_MONTSERRAT_12_SUBPX 0 +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ + +/*Pixel perfect monospace fonts*/ +#define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 + +/*Optionally declare custom fonts here. + *You can use these fonts as default font too and they will be available globally. + *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ +#define LV_FONT_CUSTOM_DECLARE + +/*Always set a default font*/ +#define LV_FONT_DEFAULT &lv_font_montserrat_14 + +/*Enable handling large font and/or fonts with a lot of characters. + *The limit depends on the font size, font face and bpp. + *Compiler error will be triggered if a font needs it.*/ +#define LV_FONT_FMT_TXT_LARGE 0 + +/*Enables/disables support for compressed fonts.*/ +#define LV_USE_FONT_COMPRESSED 0 + +/*Enable subpixel rendering*/ +#define LV_USE_FONT_SUBPX 0 +#if LV_USE_FONT_SUBPX +/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ +#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ +#endif + +/*================= + * TEXT SETTINGS + *=================*/ + +/** + * Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + */ +#define LV_TXT_ENC LV_TXT_ENC_UTF8 + + /*Can break (wrap) texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_" + +/*If a word is at least this long, will break wherever "prettiest" + *To disable, set to a value <= 0*/ +#define LV_TXT_LINE_BREAK_LONG_LEN 0 + +/*Minimum number of characters in a long word to put on a line before a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 + +/*Minimum number of characters in a long word to put on a line after a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 + +/*The control character to use for signalling text recoloring.*/ +#define LV_TXT_COLOR_CMD "#" + +/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. + *The direction will be processed according to the Unicode Bidirectional Algorithm: + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#define LV_USE_BIDI 0 +#if LV_USE_BIDI +/*Set the default direction. Supported values: + *`LV_BASE_DIR_LTR` Left-to-Right + *`LV_BASE_DIR_RTL` Right-to-Left + *`LV_BASE_DIR_AUTO` detect texts base direction*/ +#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO +#endif + +/*Enable Arabic/Persian processing + *In these languages characters should be replaced with an other form based on their position in the text*/ +#define LV_USE_ARABIC_PERSIAN_CHARS 0 + +/*================== + * WIDGET USAGE + *================*/ + +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ + +#define LV_USE_ARC 1 + +#define LV_USE_ANIMIMG 1 + +#define LV_USE_BAR 1 + +#define LV_USE_BTN 1 + +#define LV_USE_BTNMATRIX 1 + +#define LV_USE_CANVAS 1 + +#define LV_USE_CHECKBOX 1 + +#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + +#define LV_USE_IMG 1 /*Requires: lv_label*/ + +#define LV_USE_LABEL 1 +#if LV_USE_LABEL +# define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ +# define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ +#endif + +#define LV_USE_LINE 1 + +#define LV_USE_ROLLER 1 /*Requires: lv_label*/ +#if LV_USE_ROLLER +# define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ +#endif + +#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ + +#define LV_USE_SWITCH 1 + +#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ +#if LV_USE_TEXTAREA != 0 +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +#define LV_USE_TABLE 1 + +/*================== + * EXTRA COMPONENTS + *==================*/ + +/*----------- + * Widgets + *----------*/ +#define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR +# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +# if LV_CALENDAR_WEEK_STARTS_MONDAY +# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} +# else +# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} +# endif + +# define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} +# define LV_USE_CALENDAR_HEADER_ARROW 1 +# define LV_USE_CALENDAR_HEADER_DROPDOWN 1 +#endif /*LV_USE_CALENDAR*/ + +#define LV_USE_CHART 1 + +#define LV_USE_COLORWHEEL 1 + +#define LV_USE_IMGBTN 1 + +#define LV_USE_KEYBOARD 1 + +#define LV_USE_LED 1 + +#define LV_USE_LIST 1 + +#define LV_USE_METER 1 + +#define LV_USE_MSGBOX 1 + +#define LV_USE_SPINBOX 1 + +#define LV_USE_SPINNER 1 + +#define LV_USE_TABVIEW 1 + +#define LV_USE_TILEVIEW 1 + +#define LV_USE_WIN 1 + +#define LV_USE_SPAN 1 +#if LV_USE_SPAN +/*A line text can contain maximum num of span descriptor */ +# define LV_SPAN_SNIPPET_STACK_SIZE 64 +#endif + +/*----------- + * Themes + *----------*/ + +/*A simple, impressive and very complete theme*/ +#define LV_USE_THEME_DEFAULT 1 +#if LV_USE_THEME_DEFAULT + +/*0: Light mode; 1: Dark mode*/ +# define LV_THEME_DEFAULT_DARK 0 + +/*1: Enable grow on press*/ +# define LV_THEME_DEFAULT_GROW 1 + +/*Default transition time in [ms]*/ +# define LV_THEME_DEFAULT_TRANSITION_TIME 80 +#endif /*LV_USE_THEME_DEFAULT*/ + +/*A very simple theme that is a good starting point for a custom theme*/ + #define LV_USE_THEME_BASIC 1 + +/*A theme designed for monochrome displays*/ +#define LV_USE_THEME_MONO 1 + +/*----------- + * Layouts + *----------*/ + +/*A layout similar to Flexbox in CSS.*/ +#define LV_USE_FLEX 1 + +/*A layout similar to Grid in CSS.*/ +#define LV_USE_GRID 1 + +/*--------------------- + * 3rd party libraries + *--------------------*/ + +/*File system interfaces for common APIs + *To enable set a driver letter for that API*/ +#define LV_USE_FS_STDIO '\0' /*Uses fopen, fread, etc*/ +//#define LV_FS_STDIO_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ + +#define LV_USE_FS_POSIX '\0' /*Uses open, read, etc*/ +//#define LV_FS_POSIX_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ + +#define LV_USE_FS_WIN32 '\0' /*Uses CreateFile, ReadFile, etc*/ +//#define LV_FS_WIN32_PATH "C:\\Users\\john\\" /*Set the working directory. If commented it will be ".\\" */ + +#define LV_USE_FS_FATFS '\0' /*Uses f_open, f_read, etc*/ + +/*PNG decoder library*/ +#define LV_USE_PNG 0 + +/*BMP decoder library*/ +#define LV_USE_BMP 0 + +/* JPG + split JPG decoder library. + * Split JPG is a custom format optimized for embedded systems. */ +#define LV_USE_SJPG 0 + +/*GIF decoder library*/ +#define LV_USE_GIF 0 + +/*QR code library*/ +#define LV_USE_QRCODE 0 + +/*FreeType library*/ +#define LV_USE_FREETYPE 0 +#if LV_USE_FREETYPE +/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ +# define LV_FREETYPE_CACHE_SIZE (16 * 1024) +#endif + +/*Rlottie library*/ +#define LV_USE_RLOTTIE 0 + +/*FFmpeg library for image decoding and playing videos + *Supports all major image formats so do not enable other image decoder with it*/ +#define LV_USE_FFMPEG 0 +#if LV_USE_FFMPEG +/*Dump input information to stderr*/ +#define LV_FFMPEG_AV_DUMP_FORMAT 0 +#endif + +/*----------- + * Others + *----------*/ + +/*1: Enable API to take snapshot for object*/ +#define LV_USE_SNAPSHOT 1 + + +/*================== +* EXAMPLES +*==================*/ + +/*Enable the examples to be built with the library*/ +#define LV_BUILD_EXAMPLES 0 + +/*--END OF LV_CONF_H--*/ + +#endif /*LV_CONF_H*/ + +#endif /*End of "Content enable"*/ diff --git a/radio/src/main.cpp b/radio/src/main.cpp index ba551d95e..f3a5f31e0 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -24,6 +24,7 @@ #if defined(LIBOPENUI) #include "libopenui.h" + #include "gui/colorlcd/LvglWrapper.h" #endif #if defined(CLI) @@ -386,6 +387,7 @@ void guiMain(event_t evt) mainWin->setTouchEnabled(!isFunctionActive(FUNCTION_DISABLE_TOUCH) && isBacklightEnabled()); #endif MainWindow::instance()->run(); + LvglWrapper::instance()->run(); bool screenshotRequested = (mainRequestFlags & (1u << REQUEST_SCREENSHOT)); if (screenshotRequested) { diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 443e0f189..2ea6364c0 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -30,6 +30,9 @@ #include "radio_calibration.h" #include "view_main.h" #include "view_text.h" +#include "lvgl/lvgl.h" + + #include "gui/colorlcd/LvglWrapper.h" #endif @@ -1768,6 +1771,7 @@ void opentxInit() #if defined(LIBOPENUI) // create ViewMain ViewMain::instance(); + LvglWrapper::instance(); #elif defined(GUI) // TODO add a function for this (duplicated) menuHandlers[0] = menuMainView; diff --git a/radio/src/targets/horus/lcd_driver.cpp b/radio/src/targets/horus/lcd_driver.cpp index 3520279a9..8373d532f 100644 --- a/radio/src/targets/horus/lcd_driver.cpp +++ b/radio/src/targets/horus/lcd_driver.cpp @@ -52,6 +52,7 @@ uint8_t currentLayer = LCD_FIRST_LAYER; BitmapBuffer lcdBuffer1(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_FIRST_FRAME_BUFFER); BitmapBuffer lcdBuffer2(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_SECOND_FRAME_BUFFER); +BitmapBuffer lcdBackup(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_BACKUP_FRAME_BUFFER); BitmapBuffer * lcdFront = &lcdBuffer1; BitmapBuffer * lcd = &lcdBuffer2; @@ -347,7 +348,7 @@ void lcdInit() void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); #endif @@ -380,7 +381,7 @@ void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, ui void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -424,7 +425,7 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -478,7 +479,7 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_ // same as DMACopyAlphaBitmap(), but with an 8 bit mask for each pixel (used by fonts) void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint8_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t bg_color) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -609,12 +610,16 @@ void lcdCopy(void * dest, void * src) void lcdStoreBackupBuffer() { +#if 0 lcdCopy(LCD_BACKUP_FRAME_BUFFER, lcd->getData()); +#endif } int lcdRestoreBackupBuffer() { +#if 0 lcdCopy(lcd->getData(), LCD_BACKUP_FRAME_BUFFER); +#endif return 1; } @@ -657,7 +662,18 @@ static void lcdSwitchLayers() while(_frameBufferAddressReloaded == 0); } +void newLcdRefresh(uint16_t * buffer) +{ +#if 0 + lcdSwitchLayers(); +#else + LTDC_Layer1->CFBAR = (uint32_t)buffer; + _frameBufferAddressReloaded = 0; + LTDC->SRCR = LTDC_SRCR_VBR; + while(_frameBufferAddressReloaded == 0); +#endif +} void lcdRefresh() { - lcdSwitchLayers(); + //lcdSwitchLayers(); } diff --git a/radio/src/targets/nv14/lcd_driver.cpp b/radio/src/targets/nv14/lcd_driver.cpp index fb0263d3e..e300f5aad 100644 --- a/radio/src/targets/nv14/lcd_driver.cpp +++ b/radio/src/targets/nv14/lcd_driver.cpp @@ -30,6 +30,7 @@ uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM; uint8_t LCD_SCRATCH_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM; uint8_t currentLayer = LCD_FIRST_LAYER; +BitmapBuffer lcdBackup(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_BACKUP_FRAME_BUFFER); BitmapBuffer lcdBuffer1(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_FIRST_FRAME_BUFFER); BitmapBuffer lcdBuffer2(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_SECOND_FRAME_BUFFER); @@ -1645,8 +1646,15 @@ static void lcdSwitchLayers() // TODO: replace through some smarter mechanism without busy wait while(_frameBufferAddressReloaded == 0); } +void newLcdRefresh(uint16_t *buffer) +{ + LTDC_Layer1->CFBAR = (intptr_t)buffer; + _frameBufferAddressReloaded = 0; + LTDC->SRCR = LTDC_SRCR_VBR; + while(_frameBufferAddressReloaded == 0); +} void lcdRefresh() { - lcdSwitchLayers(); +// lcdSwitchLayers(); } diff --git a/radio/src/targets/simu/simulcd.cpp b/radio/src/targets/simu/simulcd.cpp index 03259928e..5850e7400 100644 --- a/radio/src/targets/simu/simulcd.cpp +++ b/radio/src/targets/simu/simulcd.cpp @@ -59,7 +59,11 @@ void lcdRefresh() pixel_t displayBuf1[DISPLAY_BUFFER_SIZE]; pixel_t displayBuf2[DISPLAY_BUFFER_SIZE]; pixel_t scratchBuf[DISPLAY_BUFFER_SIZE]; +pixel_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE]; +BitmapBuffer lcdBackup(BMP_RGB565, LCD_W, LCD_H, LCD_BACKUP_FRAME_BUFFER); + +BitmapBuffer scratch(BMP_RGB565, LCD_W, LCD_H, scratchBuf); BitmapBuffer _lcd1(BMP_RGB565, LCD_W, LCD_H, displayBuf1); BitmapBuffer _lcd2(BMP_RGB565, LCD_W, LCD_H, displayBuf2); @@ -81,6 +85,23 @@ int lcdRestoreBackupBuffer() return 1; } +void newLcdRefresh(uint16_t *buffer) +{ + // Mark screen dirty for async refresh + simuLcdRefresh = true; + +#if defined(LCD_VERTICAL_INVERT) + auto src = buffer + DISPLAY_BUFFER_SIZE - 1; + auto dst = simuLcdBuf; + auto end = dst + DISPLAY_BUFFER_SIZE; + + while (dst != end) { + *(dst++) = *(src--); + } +#else + memcpy(simuLcdBuf, buffer, DISPLAY_BUFFER_SIZE * sizeof(pixel_t)); +#endif +} void lcdRefresh() { // Mark screen dirty for async refresh @@ -113,7 +134,7 @@ void lcdInit() void DMAFillRect(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); #endif @@ -130,7 +151,7 @@ void DMACopyBitmap(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -149,7 +170,7 @@ void DMACopyAlphaBitmap(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -184,7 +205,7 @@ void DMACopyAlphaMask(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t fg_color) { -#if defined(LCD_VERTICAL_INVERT) +#if defined(LCD_VERTICAL_INVERT) && 0 x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); diff --git a/radio/src/thirdparty/lvgl b/radio/src/thirdparty/lvgl new file mode 160000 index 000000000..d38eb1e68 --- /dev/null +++ b/radio/src/thirdparty/lvgl @@ -0,0 +1 @@ +Subproject commit d38eb1e689fa5a64c25e677275172d9c8a4ab2f0