fix(esp): keep map tile IO from starving display

This commit is contained in:
liu weikai
2026-06-17 01:11:55 +08:00
parent 8bd7488251
commit 7e8a76f1f6
3 changed files with 118 additions and 16 deletions
+25 -3
View File
@@ -1,10 +1,13 @@
#include "ui/startup_shell.h"
#include <cstdint>
#include <cstdio>
#include <ctime>
#include "lvgl.h"
#include "platform/ui/screen_runtime.h"
#include "platform/ui/time_runtime.h"
#include "sys/clock.h"
#include "ui/app_runtime.h"
#include "ui/localization.h"
#include "ui/menu/menu_layout.h"
@@ -23,6 +26,9 @@ namespace
ui::menu::MenuModel s_ux_menu_model;
constexpr uint8_t kBootPresentFrameCount = 4;
constexpr uint32_t kBootPresentFrameDelayMs = 16;
bool resolve_display_time(struct tm* out_tm)
{
if (!out_tm)
@@ -54,11 +60,19 @@ bool resolve_display_time(struct tm* out_tm)
void present_boot_overlay_now()
{
if (lv_obj_t* top = lv_layer_top())
for (uint8_t frame = 0; frame < kBootPresentFrameCount; ++frame)
{
lv_obj_invalidate(top);
if (lv_obj_t* top = lv_layer_top())
{
lv_obj_invalidate(top);
}
lv_timer_handler();
lv_refr_now(nullptr);
if (frame + 1U < kBootPresentFrameCount)
{
sys::sleep_ms(kBootPresentFrameDelayMs);
}
}
lv_timer_handler();
}
} // namespace
@@ -140,12 +154,18 @@ platform::ui::screen::Hooks buildScreenSleepHooks(const Hooks& hooks)
void setBootLogLine(const char* line)
{
std::printf("[BOOT][UI] log line=%s\n", line ? line : "");
std::fflush(stdout);
ui::boot::set_log_line(line);
present_boot_overlay_now();
}
void beginBootUi(bool waking_from_sleep, const char* initial_line)
{
std::printf("[BOOT][UI] show waking=%d line=%s\n",
waking_from_sleep ? 1 : 0,
initial_line ? initial_line : "");
std::fflush(stdout);
if (!waking_from_sleep)
{
ui::boot::show();
@@ -188,6 +208,8 @@ void initializeShell(const Hooks& hooks)
void finalizeStartup(bool waking_from_sleep)
{
std::printf("[BOOT][UI] ready waking=%d\n", waking_from_sleep ? 1 : 0);
std::fflush(stdout);
if (waking_from_sleep)
{
platform::ui::screen::update_user_activity();