Skip to content

Commit df26932

Browse files
committed
refactor(lvgl): Refactor LVGL display flush callback
1 parent 94729e2 commit df26932

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lib/lvgl/lv_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@
979979
#define LV_USE_SNAPSHOT 0
980980

981981
/** 1: Enable system monitor component */
982-
#define LV_USE_SYSMON 1
982+
#define LV_USE_SYSMON 0
983983
#if LV_USE_SYSMON
984984
/** Get the idle percentage. E.g. uint32_t my_get_idle(void); */
985985
#define LV_SYSMON_GET_IDLE lv_timer_get_idle

lib/lvgl/src/lvglSetup.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Maps mapView;
3535
*/
3636
void IRAM_ATTR displayFlush(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
3737
{
38-
uint32_t w = (area->x2 - area->x1 + 1);
39-
uint32_t h = (area->y2 - area->y1 + 1);
38+
const uint32_t w = area->x2 - area->x1 + 1;
39+
const uint32_t h = area->y2 - area->y1 + 1;
4040

41-
tft.setSwapBytes(true);
42-
tft.setAddrWindow(area->x1, area->y1, w, h);
43-
tft.pushImageDMA(area->x1, area->y1, area->x2 - area->x1 + 1, area->y2 - area->y1 + 1, (uint16_t*)px_map);
44-
tft.setSwapBytes(false);
41+
tft.setSwapBytes(true);
42+
tft.setAddrWindow(area->x1, area->y1, w, h);
43+
tft.pushImageDMA(area->x1, area->y1, w, h, reinterpret_cast<uint16_t*>(px_map));
44+
tft.setSwapBytes(false);
4545

46-
lv_display_flush_ready(disp);
46+
lv_display_flush_ready(disp);
4747
}
4848

4949
/**

platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ monitor_filters =
2424
esp32_exception_decoder
2525
extra_scripts = pre:prebuild.py
2626
build_flags =
27+
-O3
2728
-D LV_CONF_PATH="\"${PROJECT_DIR}/lib/lvgl/lv_conf.h\""
2829
-D CORE_DEBUG_LEVEL=5
2930
-D DISABLE_RADIO=1

0 commit comments

Comments
 (0)