Rdzleo 5eddd2aa72 feat: 新增按键驱动、休眠管理和电池监控功能,修复内存损坏和开机闪烁问题
 新增功能
- 按键驱动模块:GPIO中断+软件去抖,支持BOOT和KEY2按键事件回调
- 休眠管理器:10秒无操作自动休眠,触摸/按键唤醒,UI集成开关
- 电池电量监控:GPIO3 ADC实时检测,ScreenSet界面圆弧显示

🐛 Bug修复
- 修复FreeRTOS任务栈溢出导致内存损坏(battery任务栈2048→4096)
- 修复图片文件名损坏问题(改用静态缓冲区替代动态分配)
- 修复触摸中断引脚配置错误(GPIO4→GPIO5,匹配V1.0硬件)
- 修复开机闪烁问题(调整背光初始化时序,UI渲染后再点亮)

🎨 界面优化
- ScreenSet恢复为标准Screen切换方式(移除浮动面板架构)
- 亮度调节支持0%(完全关闭)和10-100%范围
- ScreenHome界面电量显示独立(不关联实时电量)
- 手势导航优化:下拉显示设置,上滑返回主界面

 性能优化
- 启动时间优化:从650ms缩短至170ms
- 内存管理优化:图片列表使用静态数组(10×32字节)
- 任务栈配置调优:battery 4096, button 3072, sleep_mgr 3072

📝 其他改进
- CMakeLists.txt添加新模块编译配置
- 添加硬件版本兼容性注释(GPIO引脚说明)
- 完善函数注释和错误日志输出
- sdkconfig配置更新

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 10:28:25 +08:00

33 lines
1.1 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.

#include "esp_lvgl_port.h"
#define PIN_NUM_SCL 18 //引脚18 SCL
#define PIN_NUM_SDA 17 //引脚17 SDA
#define I2C_MASTER_FREQ_HZ 100000
#define I2C_MASTER_NUM I2C_NUM_0 // I2C 主机编号 0
#define PIN_LCD_EN 1 //引脚1 使能
#define PIN_LCD_D0 11 //引脚11 数据0
#define PIN_LCD_D1 13 //引脚13 数据1
#define PIN_LCD_D2 14 //引脚14 数据2
#define PIN_LCD_D3 21 //引脚21 数据3
#define PIN_LCD_CLK 12 //引脚12 时钟
#define PIN_LCD_CS 47 //引脚47 片选
#define PIN_LCD_RST 7 //引脚7 复位
#define LCD_HIGH 360
#define LCD_WID 360
#define PIN_TP_RST 6 //引脚6 复位
#define PIN_TP_INT 5 //引脚4 中断
#define LCD_TAG "LCD"
#define SPI_LCD_HOST SPI2_HOST // SPI 主机编号 2
#define PIN_MOTOR_EN -1 // 电机使能
#define PIN_BAT_ADC 3 // 电池ADC检测引脚ADC1_CH2
// 注意V1.0原理图中 GPIO4=KEY2按键, GPIO5=TP_INT
// 如果触摸不工作,请检查 PIN_TP_INT 是否与硬件版本匹配
void test_display(esp_lcd_panel_handle_t panel_handle);
void test_gpio();