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

40 lines
1.2 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.

#pragma once
#include "lvgl.h"
#include <stdbool.h>
#include <stdint.h>
// 当前界面/模式上下文
typedef enum {
NAV_CTX_HOME, // Home界面
NAV_CTX_IMG, // Img界面正常浏览
NAV_CTX_IMG_DELETE, // Img界面删除模式
NAV_CTX_SET, // Set界面焦点导航
NAV_CTX_SET_BRIGHTNESS, // Set界面亮度调节模式
NAV_CTX_FLASHLIGHT, // 应援灯全屏模式
} nav_context_t;
// Set界面焦点索引
typedef enum {
SET_FOCUS_NONE = -1, // 无选中
SET_FOCUS_LOW_POWER = 0,// 节能
SET_FOCUS_FLASHLIGHT, // 应援灯
SET_FOCUS_DELETE, // 删除
SET_FOCUS_BRIGHTNESS, // 亮度
SET_FOCUS_COUNT, // 焦点总数(用于循环)
} set_focus_item_t;
// 初始化按键导航管理器在button_init之后调用
void key_nav_init(void);
// 获取当前导航上下文
nav_context_t key_nav_get_context(void);
// 设置导航上下文(界面切换时调用)
void key_nav_set_context(nav_context_t ctx);
// 获取Set界面当前焦点
set_focus_item_t key_nav_get_set_focus(void);
// 重置Set界面焦点进入/离开Set时调用
void key_nav_reset_set_focus(void);