wangzhibo
2026-09-11 659c470eba542383987aad227b7f918100f131fa
xiaozhi-esp32-2.2.6/main/boards/common/wifi_board.cc
@@ -10,6 +10,7 @@
#include <freertos/task.h>
#include <esp_network.h>
#include <esp_log.h>
#include <string>
#include <utility>
#include <font_awesome.h>
@@ -55,7 +56,16 @@
    // Initialize WiFi manager
    WifiManagerConfig config;
    config.ssid_prefix = "Xiaozhi";
    config.language = Lang::CODE;
    // Captive portal languageMap keys use BCP-47 hyphens (zh-CN). Android/WeChat
    // often report zh_CN; passing the underscore form leaves the <select> on the
    // first option and can crash loadAPList() via translations[lang].scanning.
    std::string language = Lang::CODE ? Lang::CODE : "zh-CN";
    for (char& ch : language) {
        if (ch == '_') {
            ch = '-';
        }
    }
    config.language = language;
    wifi_manager.Initialize(config);
    // Set unified event callback - forward to NetworkEvent with SSID data
@@ -186,6 +196,7 @@
    auto& wifi_manager = WifiManager::GetInstance();
    wifi_manager.StartConfigAp();
    ESP_LOGI(TAG, "WiFi config portal at %s", wifi_manager.GetApWebUrl().c_str());
    // Show config prompt after a short delay
    Application::GetInstance().Schedule([&wifi_manager]() {