mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-08-28 05:24:08 +00:00
fix(esp): keep map tile IO from starving display
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user