Advanced Extension Points: Network Types, Wake Words, MCP and Asset Customization
Once basic board adaptation and chat work, the firmware offers several kinds of extension entry points. This page is navigation only: it says where each capability lives in the source and points to the detailed document, and it does not invent implementation plans without an upstream basis.
1. Network Types
main/boards/common/ provides base classes for different networks, and a concrete board inherits one of them:
| Base class | Purpose |
|---|---|
WifiBoard | Wi-Fi networking; for provisioning see First Boot and Network Configuration |
Ml307Board | 4G Cat.1 network through an ML307 module |
DualNetworkBoard | Switches between Wi-Fi and ML307; the network type is stored in Settings, and the default comes from the board constructor parameter |
EthernetBoard, RndisBoard, Nt26Board | Base classes for other network types; for usage, read the directories of the boards that use them |
Boards such as bread-compact-ml307 are the reference implementation of ML307 4G. For wiring, see the 4G module part of the Hardware Build Guide.
2. Wake Words and Audio Processing
- The wake word type is chosen by the Kconfig option
WAKE_WORD_TYPE: AFE wake word, WakeNet without AFE, MultiNet custom wake word, or disabled. For the options of each chip, see Chip Support and Storage Specs. - Custom wake words have two paths: compile options (
CUSTOM_WAKE_WORDand so on) or packing intoassets.bin, see the Custom Assets Guide. - With
SEND_WAKE_WORD_DATAenabled, the most recent two seconds or so of audio are sent to the server as the first message of the conversation after a wake-up (a PSRAM ring buffer, seemain/audio/README.md).
3. MCP Tools
The device registers tools in main/mcp_server.* so a large language model can control it; some tools are user-only (such as self.assets.set_download_url). For how to register tools and the list of built-in tools, see MCP IoT Control Usage, and for the protocol flow see the MCP Protocol. A board can add tools in its own initialization code, for example bread-compact-esp32 uses LampController as a lamp control demo.
4. Notifications, Font Supplements and Emoji
- Asynchronous Voice Notifications (notify): the cloud sends one-way voice notifications while the device is idle, with subtitles shown on a timeline.
- Dynamic Text Glyph Push Extension: when the device font lacks a character, the server pushes a bitmap glyph.
- Emoji Mood Display: the large language model expresses emotion through emoji and the device shows the matching expression.
5. Provisioning and Upgrade
- BluFi Provisioning Guide: configure Wi-Fi over Bluetooth.
- OTA version check, activation code and firmware upgrade are handled by
main/ota.*andApplication; see First Boot for the flow. - The assets partition can be upgraded independently of the firmware, see the Custom Assets Guide.
6. Power Management
Board defines three power-save levels, LOW_POWER, BALANCED and PERFORMANCE, implemented by the board-level SetPowerSaveLevel(); boards/common/ also provides helpers such as power_save_timer, sleep_timer and battery monitoring. Whether the device enters sleep is decided by Application::CanEnterSleepMode(). Concrete behavior differs from board to board, so read the source of your target board.
Related Documents
- Firmware Code Tour: directory layout, state machine and development rules
- Custom Board Guide: adding a new board
- Troubleshooting: build, flashing and runtime problems
Sources: main/boards/common/, main/Kconfig.projbuild, main/mcp_server.cc and main/audio/README.md of 78/xiaozhi-esp32 v2.5.2.