Rdzleo dbdd304905 代码初始化:
本项目为触摸版项目代码复制而来,基于此版本进行按键功能的适配!
2026-03-23 11:14:56 +08:00
..
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00

Supported Chips ESP32-S3 ESP32-P4 ESP32-C5

Service Console Example

中文版本

This example demonstrates how to run and test ESP-Brookesia service framework features through a console, providing an interactive command-line interface with command history support.

📑 Table of Contents

Features

  • 🎯 Service Management: View, call, and subscribe to various system services
  • 🤖 AI Agent: Support for Xiaozhi, Coze, OpenAI and other Agents with runtime switching
  • 🎵 Audio Playback: Play local and network audio resources
  • 😊 Expression Display: Support for emoji and animation display
  • 🔧 Debug Tools: Memory, thread, and time profilers
  • 🌐 RPC Support: Remote service calls and event subscriptions

🚩 Getting Started

Hardware Requirements

Basic Features: Development boards with ESP32-S3, ESP32-P4 or ESP32-C5 chip and Flash >= 8MB

Full Features (Audio, Emote, Agent): Requires esp_board_manager component, supporting the following boards:

Board Link
ESP-VoCat V1.0/V1.2 Documentation
ESP32-S3-BOX-3 GitHub
ESP32-S3-Korvo-2 Documentation
ESP32-P4-Function-EV-Board Documentation
ESP32-C5-Sensair-Shuttle Documentation

Development Environment

  • ESP-IDF v5.5.2 TAG (recommended) or release/v5.5 branch

Warning

Using VSCode extension to install ESP-IDF is not recommended as it may cause build failures. Please follow the ESP-IDF Programming Guide to set up the development environment.

🔨 Get Firmware

Option 1: Online Flashing

Use ESP Launchpad to flash pre-built firmware directly in your browser, no development environment required:

Try it with ESP Launchpad

After flashing, you can connect to the device with a serial tool such as MobaXterm (baud rate 115200, Flow Control None), and interact with the command line.

Note

Online flashing only supports preset boards. For other boards, please use Option 2.

Option 2: Build from Source

1. Select Board

For supported boards:

idf.py gen-bmgr-config -b <board> -c ./boards

Available <board> values:

  • esp_vocat_board_v1_0
  • esp_vocat_board_v1_2
  • esp_box_3
  • esp32_p4_function_ev
  • esp32_s3_korvo2_v3
  • esp_sensair_shuttle

For other boards:

idf.py set-target <target>

Note

To add custom boards, refer to esp_board_manager component documentation.

2. Configuration Options

Run idf.py menuconfig and configure in the Example Configuration menu:

Option Description
Console Console options (history storage, command line length, etc.)
Services Enable/disable services (NVS, SNTP, WiFi, Audio)
Agents AI Agent configuration (Xiaozhi, Coze, OpenAI, wake word)
Expressions Expression display configuration

3. Build and Flash

idf.py -p PORT build flash monitor

Press Ctrl-] to exit the serial monitor.

🚀 Quick Start

After firmware flashing, refer to the Quick Start Tutorial to start experiencing the service console example.

📖 Command Reference

Basic Commands

Command Description Example
svc_list List all services svc_list
svc_funcs <service> List service functions svc_funcs Wifi
svc_events <service> List service events svc_events Wifi
svc_call <service> <func> [params] Call service function svc_call Wifi GetConnectedAps
svc_subscribe <service> <event> Subscribe to event svc_subscribe Wifi GeneralEventHappened
svc_unsubscribe <service> <event> Unsubscribe svc_unsubscribe Wifi GeneralEventHappened
svc_stop <service> Stop service binding svc_stop Wifi

Service Documentation

Service Documentation Description
💾 NVS cmd_nvs.md Non-volatile storage
📶 WiFi cmd_wifi.md WiFi connection management
🕐 SNTP cmd_sntp.md Network time synchronization
🎵 Audio (*) cmd_audio.md Audio playback control
🤖 Agent (*) cmd_agent.md AI agent service
😊 Emote (*) cmd_emote.md Expression display

Note

Services marked with (*) require supported development boards to function properly.

Debug Commands

Command Description Example
debug_mem Print memory profiler info debug_mem
debug_thread [-p <sort>] [-s <sort>] [-d <ms>] Print thread profiler info debug_thread -p core -s cpu -d 1000
debug_time_report Print time profiler report debug_time_report
debug_time_clear Clear time profiler data debug_time_clear

Tip

For detailed debug command documentation, refer to Debug Commands.

RPC Commands

Command Description Example
svc_rpc_server <action> [-p <port>] [-s <services>] Manage RPC server svc_rpc_server start
svc_rpc_call <host> <srv> <func> [params] [-p <port>] [-t <timeout>] Call remote service function svc_rpc_call 192.168.1.100 Wifi TriggerScanStart
svc_rpc_subscribe <host> <srv> <event> [-p <port>] [-t <timeout>] Subscribe to remote event svc_rpc_subscribe 192.168.1.100 Wifi ScanApInfosUpdated
svc_rpc_unsubscribe <host> <srv> <event> [-p <port>] [-t <timeout>] Unsubscribe from remote event svc_rpc_unsubscribe 192.168.1.100 Wifi ScanApInfosUpdated

Tip

For detailed RPC command documentation, refer to RPC Commands.

🔍 Troubleshooting

VSCode Build Failure

Use command line to install ESP-IDF, refer to Development Environment.

Command Not Recognized

Ensure the example is properly built and flashed, and check if the serial connection is working.

Service Not Found

Run svc_list command to view all available services, ensure the required service is enabled in menuconfig.

RPC Connection Failed

Ensure devices are connected to the same WiFi network.

💬 Technical Support and Feedback

Please provide feedback through the following channels:

  • For technical questions, please visit the esp32.com forum
  • For feature requests or bug reports, please create a new GitHub issue

We will reply as soon as possible.