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