| | |
| | | #include <freertos/task.h> |
| | | #include <esp_network.h> |
| | | #include <esp_log.h> |
| | | #include <string> |
| | | #include <utility> |
| | | |
| | | #include <font_awesome.h> |
| | |
| | | // 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 |
| | |
| | | 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]() { |