mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2025-05-17 15:20:29 +08:00
fix: 解决sensecap-watcher显示异常 (#348)
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
#include "display/lv_display.h"
|
||||
#include "misc/lv_event.h"
|
||||
#include "wifi_board.h"
|
||||
#include "sensecap_audio_codec.h"
|
||||
#include "display/lcd_display.h"
|
||||
@ -205,7 +207,7 @@ private:
|
||||
esp_lcd_panel_init(panel_);
|
||||
esp_lcd_panel_mirror(panel_, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y);
|
||||
esp_lcd_panel_disp_on_off(panel_, true);
|
||||
|
||||
|
||||
display_ = new SpiLcdDisplay(panel_io_, panel_,
|
||||
DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY,
|
||||
{
|
||||
@ -213,6 +215,23 @@ private:
|
||||
.icon_font = &font_awesome_30_4,
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
});
|
||||
|
||||
// 使每次刷新的行数是4的倍数,防止花屏
|
||||
lv_display_add_event_cb(lv_display_get_default(), [](lv_event_t *e) {
|
||||
lv_area_t *area = (lv_area_t *)lv_event_get_param(e);
|
||||
uint16_t x1 = area->x1;
|
||||
uint16_t x2 = area->x2;
|
||||
// round the start of area down to the nearest 4N number
|
||||
area->x1 = (x1 >> 2) << 2;
|
||||
// round the start of area down to the nearest 4N number
|
||||
area->x1 = (x1 >> 2) << 2;
|
||||
|
||||
// round the end of area up to the nearest 4M+3 number
|
||||
area->x2 = ((x2 >> 2) << 2) + 3;
|
||||
// round the end of area up to the nearest 4M+3 number
|
||||
area->x2 = ((x2 >> 2) << 2) + 3;
|
||||
}, LV_EVENT_INVALIDATE_AREA, NULL);
|
||||
|
||||
}
|
||||
|
||||
// 物联网初始化,添加对 AI 可见设备
|
||||
|
Reference in New Issue
Block a user