Rdzleo 14776acb0a feat: 完成 AI/吧唧双模式完全隔离重构 + 触摸坐标日志 + SPIFFS 预烧录
## 核心变更

### 1. 双模式完全隔离 (Phase 2+4)
- 拆分 InitializeButtons() 为 InitializeBadgeModeButtons() + InitializeAiModeButtons()
- 构造函数按 device_mode 分支:吧唧模式不创建 PowerSaveTimer/BackgroundTask
- 吧唧模式不注册音量/故事按键回调,避免调用 GetAudioCodec() 崩溃
- GPIO0 由 iot_button 统一处理,dzbj_button 仅注册 KEY2(GPIO4)
- SetDeviceState() 中 background_task_ 空指针保护

### 2. 吧唧模式 BOOT 按键崩溃修复
- 新增 dzbj_boot_click_handler()(C 函数,避免 lvgl.h 与 display.h 冲突)
- 移植 dzbj 的唤醒屏幕/退出手电筒/返回Home 完整逻辑

### 3. esp_timer 阻塞 LVGL 渲染修复
- iot_button 回调在 esp_timer 任务中执行,vTaskDelay 会阻塞 lv_tick_inc
- 改为 xTaskCreate 派发到独立 FreeRTOS 任务,避免冻结 LVGL 渲染

### 4. 触摸坐标日志 + SPIFFS 预烧录
- esp_lvgl_port_touch.c 添加触摸坐标打印
- CMakeLists.txt 添加 spiffs_create_partition_image 自动打包 spiffs_image/

### 5. dzbj 模块文件新增
- device_mode: NVS 设备模式管理 (AI=0/吧唧=1)
- dzbj_button: GPIO4 KEY2 中断 + BOOT 点击处理
- dzbj_ble: BLE GATT 图传服务 (0x0B00)
- dzbj_battery: ADC 电池电压监测
- sleep_mgr: 10s 超时熄屏低功耗管理
- pages: 图片浏览/GIF播放/PWM亮度
- fatfs: SPIFFS 文件管理

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:23:04 +08:00

38 lines
1.4 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 "esp_err.h"
#include <stdint.h>
#include <stdbool.h>
#include "lvgl.h"
#ifdef __cplusplus
extern "C" {
#endif
void app_test_display(); // 测试显示
void app_img_display(); // 显示图片
esp_err_t nvs_change_img(char *imgname); // 改变NVS中的图片路径
void app_img_change(const char *img_name); // 改变图片
void img_switch_task(void *pvParameters); // 图片切换任务
void img_loop_task(void *pvParameters); // 图片循环任务
// 图片管理函数
const char* get_current_image(void); // 获取当前图片文件名
bool delete_current_image(void); // 删除当前图片
void init_spiffs_image_list(void); // 初始化/扫描SPIFFS图片列表
void free_spiffs_image_list(void); // 重置图片列表
bool set_image_index_by_name(const char *name); // 根据文件名设置当前图片索引
const char* get_next_image(void); // 获取下一张图片
const char* get_prev_image(void); // 获取上一张图片
void update_ui_ImgBle(const char *img_name); // 更新ui_ImgBle控件的图片
void ble_image_navigate(const char *filename); // BLE接收后导航到ScreenImg显示
void ble_image_navigate_with_data(const char *filename, uint8_t *data, size_t data_size); // BLE接收后直通显示跳过SPIFFS重读
#if LV_USE_GIF
void pages_cleanup_gif(void); // 清理 GIF 控件资源
#endif
#ifdef __cplusplus
}
#endif