Dzbj_C3_Key/main/ui/screens/ui_ScreenHome.c
Rdzleo f9dc7d4861 feat: 触屏版迁移到按键版,两键实现全部交互功能
1. 按键驱动重构:GPIO中断+手动去抖 → iot_button组件(单击/双击/长按)
2. 新增key_nav按键导航管理器:上下文状态机 + Set界面焦点蓝色边框高亮
3. 移除所有触摸手势/点击事件(ScreenHome/ScreenImg/ScreenSet)
4. 应援灯颜色切换优化:DISPOFF→直接写GRAM→DISPON,消除分band刷新
5. 亮度调节按键化:BOOT +10% / KEY -10% / KEY长按退出
6. 休眠管理适配:按键唤醒统一由key_nav处理
7. 新增迁移总结文档 docs/touch-to-button-migration.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:57:14 +08:00

77 lines
2.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.6.0
// LVGL version: 8.3.11
// Project name: Lcd_Pro
#include "../ui.h"
lv_obj_t *ui_ScreenHome = NULL;lv_obj_t *ui_Label1 = NULL;lv_obj_t *ui_Image3 = NULL;lv_obj_t *ui_Arc1 = NULL;lv_obj_t *ui_LabelHome = NULL;
// 手势事件已移除界面导航由key_nav按键模块统一管理
// build funtions
void ui_ScreenHome_screen_init(void)
{
ui_ScreenHome = lv_obj_create(NULL);
lv_obj_clear_flag( ui_ScreenHome, LV_OBJ_FLAG_SCROLLABLE ); /// Flags
lv_obj_set_style_bg_color(ui_ScreenHome, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_ScreenHome, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
ui_Label1 = lv_label_create(ui_ScreenHome);
lv_obj_set_width( ui_Label1, LV_SIZE_CONTENT); /// 20
lv_obj_set_height( ui_Label1, LV_SIZE_CONTENT); /// 20
lv_obj_set_x( ui_Label1, 5 );
lv_obj_set_y( ui_Label1, -2 );
lv_obj_set_align( ui_Label1, LV_ALIGN_CENTER );
lv_label_set_text(ui_Label1,"70%");
lv_obj_set_style_text_color(ui_Label1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_text_opa(ui_Label1, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui_Label1, LV_TEXT_ALIGN_AUTO, LV_PART_MAIN| LV_STATE_DEFAULT);
ui_Image3 = lv_img_create(ui_ScreenHome);
lv_img_set_src(ui_Image3, &ui_img_s8_png);
lv_obj_set_width( ui_Image3, LV_SIZE_CONTENT); /// 1
lv_obj_set_height( ui_Image3, LV_SIZE_CONTENT); /// 1
lv_obj_set_x( ui_Image3, 2 );
lv_obj_set_y( ui_Image3, 32 );
lv_obj_set_align( ui_Image3, LV_ALIGN_CENTER );
lv_obj_add_flag( ui_Image3, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags
lv_obj_clear_flag( ui_Image3, LV_OBJ_FLAG_SCROLLABLE ); /// Flags
ui_Arc1 = lv_arc_create(ui_ScreenHome);
lv_obj_set_width( ui_Arc1, 150);
lv_obj_set_height( ui_Arc1, 150);
lv_obj_set_x( ui_Arc1, -1 );
lv_obj_set_y( ui_Arc1, 1 );
lv_obj_set_align( ui_Arc1, LV_ALIGN_CENTER );
lv_arc_set_value(ui_Arc1, 50);
ui_LabelHome = lv_label_create(ui_ScreenHome);
lv_obj_set_width( ui_LabelHome, LV_SIZE_CONTENT); /// 1
lv_obj_set_height( ui_LabelHome, LV_SIZE_CONTENT); /// 1
lv_obj_set_x( ui_LabelHome, 3 );
lv_obj_set_y( ui_LabelHome, 95 );
lv_obj_set_align( ui_LabelHome, LV_ALIGN_CENTER );
lv_label_set_text(ui_LabelHome,"Home");
lv_obj_set_style_text_color(ui_LabelHome, lv_color_hex(0x03F7F2), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_text_opa(ui_LabelHome, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_LabelHome, &lv_font_montserrat_26, LV_PART_MAIN| LV_STATE_DEFAULT);
// 手势事件回调已移除不再注册ui_event_ScreenHome
}
void ui_ScreenHome_screen_destroy(void)
{
if (ui_ScreenHome) lv_obj_del(ui_ScreenHome);
// NULL screen variables
ui_ScreenHome= NULL;
ui_Label1= NULL;
ui_Image3= NULL;
ui_Arc1= NULL;
ui_LabelHome= NULL;
}