From 8fa9e6922e28f636294a7b7cc5e878249b984117 Mon Sep 17 00:00:00 2001 From: caixypromise Date: Sat, 15 Mar 2025 19:40:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E7=BC=96=E8=AF=91es?= =?UTF-8?q?p32=E5=9B=BA=E4=BB=B6=E6=96=87=E6=A1=A3=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=90=AF=E5=8A=A8=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=BE=93=E5=85=A5=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?.=20=E8=AE=A8=E8=AE=BA=E5=92=8C=E8=A7=A3=E5=86=B3=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E6=9D=A5=E8=87=AA=E4=BA=8E[issue-#221](https://github?= =?UTF-8?q?.com/xinnan-tech/xiaozhi-esp32-server/issues/221#issuecomment-2?= =?UTF-8?q?713774903")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/firmware-build.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/firmware-build.md b/docs/firmware-build.md index b726826c9..79ef92f6c 100644 --- a/docs/firmware-build.md +++ b/docs/firmware-build.md @@ -34,6 +34,46 @@ config WEBSOCKET_URL 注意:你的地址是`ws://`开头,不是`wss://`开头,一定不要写错了。 +3. 取消设备激活限制:解决第一次启动设备需要输入验证码的问题。[#221](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/221) + +打开`xiaozhi-esp32/main/application.cc`,跳转到**第 141 行到 154 行** (行数可能随着xiaozhi-esp32源码更新有变动)。找到以下代码(或关键词搜索`ota_.HasActivationCode()`): + +```cpp +if (ota_.HasActivationCode()) { + // Activation code is valid + SetDeviceState(kDeviceStateActivating); + ShowActivationCode(); + + // Check again in 60 seconds or until the device is idle + for (int i = 0; i < 60; ++i) { + if (device_state_ == kDeviceStateIdle) { + break; + } + vTaskDelay(pdMS_TO_TICKS(1000)); + } + continue; +} +``` + +将其注释,或复制以下替换成以下内容。 + +```cpp +// if (ota_.HasActivationCode()) { +// // Activation code is valid +// SetDeviceState(kDeviceStateActivating); +// ShowActivationCode(); +// +// // Check again in 60 seconds or until the device is idle +// for (int i = 0; i < 60; ++i) { +// if (device_state_ == kDeviceStateIdle) { +// break; +// } +// vTaskDelay(pdMS_TO_TICKS(1000)); +// } +// continue; +// } +``` + 3. 设置编译参数 ```