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 -4
View File
@@ -1,9 +1,12 @@
#include "ui/startup_ui_shell.h"
#include <cstdint>
#include <cstdio>
#include <ctime>
#include "lvgl.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"
@@ -20,13 +23,24 @@ namespace
bool s_shell_initialized = false;
ui::menu::MenuModel s_ux_menu_model;
constexpr uint8_t kBootPresentFrameCount = 4;
constexpr uint32_t kBootPresentFrameDelayMs = 16;
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();
}
bool resolve_display_time(struct tm* out_tm)
@@ -101,6 +115,10 @@ void unlock_ui(const Hooks& hooks)
bool beginBootUi(const Hooks& hooks, 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)
{
return true;
@@ -110,6 +128,8 @@ bool beginBootUi(const Hooks& hooks, bool waking_from_sleep, const char* initial
return false;
}
ui::boot::show();
std::printf("[BOOT][UI] log line=%s\n", initial_line ? initial_line : "");
std::fflush(stdout);
ui::boot::set_log_line(initial_line);
present_boot_overlay_now();
unlock_ui(hooks);
@@ -155,7 +175,8 @@ bool initializeMenuSkeleton(const Hooks& hooks)
bool finalizeStartup(const Hooks& hooks, bool waking_from_sleep)
{
(void)waking_from_sleep;
std::printf("[BOOT][UI] ready waking=%d\n", waking_from_sleep ? 1 : 0);
std::fflush(stdout);
if (!lock_ui(hooks))
{
return false;