Skip to content

Commit 3b7355f

Browse files
committed
Add boot splash screen and update assets
1 parent a7c5441 commit 3b7355f

File tree

9 files changed

+520
-1
lines changed

9 files changed

+520
-1
lines changed

README.md

74 Bytes

📋 Overview

logo

Outdoor activities often take place in environments where cellular networks are unreliable or completely unavailable. In these conditions, people still need to exchange short text messages, understand relative positions, and maintain basic orientation — without depending entirely on smartphones or complex infrastructure.

README_CN.md

74 Bytes

📋 项目介绍

logo

户外活动往往发生在蜂窝网络不稳定甚至完全缺失的环境中。
在这样的场景下,人们依然需要 发送简短的文本信息、了解彼此的位置关系,并保持基本的方向感,而不应完全依赖智能手机或复杂的基础设施。

docs/images/logo_big.png

151 KB
Loading

docs/skyplot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2) 样式与颜色 token(必须使用,统一风格)
2121
============================================================
2222
主色(Amber): #EBA341 (0xEBA341)
23-
主色深(AmberDark):#C98118
23+
主色深(AmberDark): #C98118
2424
背景(WarmBG): #F6E6C6
2525
面板底(PanelBG): #FAF0D8
2626
分隔线(Line): #E7C98F

images/logo.png

28.8 KB
Loading

src/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "display/DisplayConfig.h"
2020
#include "ui/app_screen.h"
2121
#include "ui/assets/images.h"
22+
#include "ui/ui_boot.h"
2223
#include "ui/ui_common.h"
2324
#include "ui/ui_status.h"
2425
#include "ui/ui_theme.h"
@@ -846,6 +847,11 @@ void setup()
846847
// Initialize system notification component
847848
ui::SystemNotification::init();
848849

850+
if (!waking_from_sleep)
851+
{
852+
ui::boot::show();
853+
}
854+
849855
// Initialize chat application context
850856
app::AppContext& app_ctx = app::AppContext::getInstance();
851857
bool use_mock = false; // Enable real LoRa adapter for logging and radio tests
@@ -1274,6 +1280,8 @@ void setup()
12741280
updateUserActivity();
12751281
log_d("Updated user activity after waking from sleep");
12761282
}
1283+
1284+
ui::boot::mark_ready();
12771285
}
12781286

12791287
// Forward declaration to check if USB mode is active

src/ui/assets/logo.c

Lines changed: 357 additions & 0 deletions
Large diffs are not rendered by default.

src/ui/ui_boot.cpp

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**
2+
* @file ui_boot.cpp
3+
* @brief Boot splash screen implementation.
4+
*/
5+
6+
#include "ui_boot.h"
7+
8+
namespace
9+
{
10+
11+
constexpr uint32_t kFadeMs = 900;
12+
constexpr uint32_t kMinShowMs = 3000;
13+
constexpr uint32_t kBootBgColor = 0xF6E6C6;
14+
15+
lv_obj_t* s_root = nullptr;
16+
lv_obj_t* s_logo = nullptr;
17+
lv_timer_t* s_gate_timer = nullptr;
18+
uint32_t s_start_ms = 0;
19+
bool s_ready = false;
20+
21+
extern "C"
22+
{
23+
extern const lv_image_dsc_t logo;
24+
}
25+
26+
void set_logo_opa(lv_obj_t* obj, int32_t v)
27+
{
28+
if (!obj) return;
29+
lv_obj_set_style_img_opa(obj, static_cast<lv_opa_t>(v), LV_PART_MAIN);
30+
}
31+
32+
void cleanup()
33+
{
34+
if (s_gate_timer)
35+
{
36+
lv_timer_del(s_gate_timer);
37+
s_gate_timer = nullptr;
38+
}
39+
40+
if (s_root)
41+
{
42+
lv_obj_del(s_root);
43+
s_root = nullptr;
44+
s_logo = nullptr;
45+
}
46+
47+
s_ready = false;
48+
s_start_ms = 0;
49+
}
50+
51+
void check_gate()
52+
{
53+
if (!s_root || !s_ready)
54+
{
55+
return;
56+
}
57+
58+
uint32_t elapsed = lv_tick_elaps(s_start_ms);
59+
if (elapsed < kMinShowMs)
60+
{
61+
return;
62+
}
63+
64+
cleanup();
65+
}
66+
67+
} // namespace
68+
69+
namespace ui::boot
70+
{
71+
72+
void show()
73+
{
74+
if (s_root)
75+
{
76+
return;
77+
}
78+
79+
lv_obj_t* parent = lv_layer_top();
80+
if (!parent)
81+
{
82+
return;
83+
}
84+
85+
s_ready = false;
86+
s_start_ms = lv_tick_get();
87+
88+
s_root = lv_obj_create(parent);
89+
lv_obj_set_style_bg_color(s_root, lv_color_hex(kBootBgColor), 0);
90+
lv_obj_set_style_bg_opa(s_root, LV_OPA_COVER, 0);
91+
lv_obj_set_style_border_width(s_root, 0, 0);
92+
lv_obj_set_style_radius(s_root, 0, 0);
93+
lv_obj_clear_flag(s_root, LV_OBJ_FLAG_SCROLLABLE);
94+
lv_obj_add_flag(s_root, LV_OBJ_FLAG_CLICKABLE);
95+
96+
lv_coord_t screen_w = lv_display_get_physical_horizontal_resolution(NULL);
97+
lv_coord_t screen_h = lv_display_get_physical_vertical_resolution(NULL);
98+
lv_obj_set_size(s_root, screen_w, screen_h);
99+
lv_obj_set_pos(s_root, 0, 0);
100+
101+
s_logo = lv_image_create(s_root);
102+
lv_image_set_src(s_logo, &logo);
103+
lv_obj_center(s_logo);
104+
lv_obj_set_style_img_opa(s_logo, LV_OPA_0, LV_PART_MAIN);
105+
106+
lv_obj_move_foreground(s_root);
107+
108+
lv_anim_t anim;
109+
lv_anim_init(&anim);
110+
lv_anim_set_var(&anim, s_logo);
111+
lv_anim_set_values(&anim, LV_OPA_0, LV_OPA_COVER);
112+
lv_anim_set_time(&anim, kFadeMs);
113+
lv_anim_set_exec_cb(&anim, (lv_anim_exec_xcb_t)set_logo_opa);
114+
lv_anim_start(&anim);
115+
116+
s_gate_timer = lv_timer_create(
117+
[](lv_timer_t*)
118+
{
119+
check_gate();
120+
},
121+
50, nullptr);
122+
lv_timer_set_repeat_count(s_gate_timer, -1);
123+
}
124+
125+
void mark_ready()
126+
{
127+
s_ready = true;
128+
check_gate();
129+
}
130+
131+
} // namespace ui::boot

src/ui/ui_boot.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @file ui_boot.h
3+
* @brief Boot splash screen helpers.
4+
*/
5+
6+
#ifndef UI_BOOT_H
7+
#define UI_BOOT_H
8+
9+
#include "lvgl.h"
10+
11+
namespace ui::boot
12+
{
13+
14+
// Show the boot splash overlay (background + logo fade-in).
15+
void show();
16+
17+
// Signal that background loading is complete.
18+
// Splash will hide after the minimum display time has elapsed.
19+
void mark_ready();
20+
21+
} // namespace ui::boot
22+
23+
#endif // UI_BOOT_H

0 commit comments

Comments
 (0)