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
2026-02-24 15:57:32 +08:00
2026-02-24 15:57:32 +08:00
2026-02-24 15:57:32 +08:00
dzbj @ 9223fd5a7d
2026-02-27 10:44:58 +08:00
2026-02-24 15:57:32 +08:00
2026-02-24 15:57:32 +08:00
2026-02-24 15:28:34 +08:00

XiaoZhi AI Chatbot

(中文 | English | 日本語)

Introduction

👉 Build your AI chat companion with ESP32+SenseVoice+Qwen72B!【bilibili】

👉 Equipping XiaoZhi with DeepSeek's smart brain【bilibili】

👉 Build your own AI companion, a beginner's guide【bilibili】

Project Purpose

This is an open-source project released under the MIT license, allowing anyone to use it freely, including for commercial purposes.

Through this project, we aim to help more people get started with AI hardware development and understand how to implement rapidly evolving large language models in actual hardware devices. Whether you're a student interested in AI or a developer exploring new technologies, this project offers valuable learning experiences.

Everyone is welcome to participate in the project's development and improvement. If you have any ideas or suggestions, please feel free to raise an Issue or join the chat group.

Learning & Discussion QQ Group: 376893254

Implemented Features

  • Wi-Fi / ML307 Cat.1 4G
  • BOOT button wake-up and interruption, supporting both click and long-press triggers
  • Offline voice wake-up ESP-SR
  • Streaming voice dialogue (WebSocket or UDP protocol)
  • Support for 5 languages: Mandarin, Cantonese, English, Japanese, Korean SenseVoice
  • Voice print recognition to identify who's calling AI's name 3D Speaker
  • Large model TTS (Volcano Engine or CosyVoice)
  • Large Language Models (Qwen, DeepSeek, Doubao)
  • Configurable prompts and voice tones (custom characters)
  • Short-term memory, self-summarizing after each conversation round
  • OLED / LCD display showing signal strength or conversation content
  • Support for LCD image expressions
  • Multi-language support (Chinese, English)

Hardware Section

Breadboard DIY Practice

See the Feishu document tutorial:

👉 XiaoZhi AI Chatbot Encyclopedia

Breadboard demonstration:

Breadboard Demo

Supported Open Source Hardware

Firmware Section

Flashing Without Development Environment

For beginners, it's recommended to first use the firmware that can be flashed without setting up a development environment.

The firmware connects to the official xiaozhi.me server by default. Currently, personal users can register an account to use the Qwen real-time model for free.

👉 Flash Firmware Guide (No IDF Environment)

Development Environment

  • Cursor or VSCode
  • Install ESP-IDF plugin, select SDK version 5.3 or above
  • Linux is preferred over Windows for faster compilation and fewer driver issues
  • Use Google C++ code style, ensure compliance when submitting code

Developer Documentation

AI Agent Configuration

If you already have a XiaoZhi AI chatbot device, you can configure it through the xiaozhi.me console.

👉 Backend Operation Tutorial (Old Interface)

Technical Principles and Private Deployment

👉 Detailed WebSocket Communication Protocol Documentation

For server deployment on personal computers, refer to another MIT-licensed project xiaozhi-esp32-server

Star History

Star History Chart
Description
Baji_Rtc_Toy 这是适配火山RTC通讯版本的电子吧唧项目,基于AI版的ESP32-S3-WROOM-1-N16R8开发板进行适配!
Readme MIT 214 MiB
Languages
C 63.9%
Jupyter Notebook 11.3%
C++ 11.1%
Python 7.2%
Assembly 3.3%
Other 3.1%