ESP32-C3烧入示例程序后,小爱同学无法控制
本帖最后由 uint8_t 于 2022-2-25 09:17 编辑# ESP32-C3烧入示例程序后,小爱同学无法控制
板子使用的是乐鑫官方的**ESP32-C3-DevKitM-1**,烧入的示例程序为**MIOT_OUTLET**,然后小爱同学一直提示您控制的设备出问题了。
我在程序里加了一个文字组件,用小爱同学控制时,APP里面也不会改变状态,请问这是ESP32-C3的问题吗?
用ESP8266的时候没有出现过这种情况,期待各位大佬的解答,感谢感谢!!!
通过小爱同学语音控制时,串口输出的**调试信息**为:
```
收←◆ Got: {"fromDevice":"ServerSender","data":{"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}}
_messageId: 621828be78ad36fe
data: {"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}
fromDevice: MIOT
form MIOT
MIOT parse data: {"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}
MIOT Query codes: 0
MIOT Query All
response to MIOT: {"pState":"off"}
isJson: {"data":{"pState":"off","messageId":"621828be78ad36fe"},"fromDevice":"3F481B8FS5GBQ863V4KLA6CH","toDevice":"ServerReceiver","deviceType":"vAssistant"}
MQTT MIOT Publish...
Freeheap: 189280
BLINKER_RRPC_PUB_TOPIC_MQTT: /device/3F481B8FS5GBQ863V4KLA6CH/s
{"data":{"pState":"off","messageId":"621828be78ad36fe"},"fromDevice":"3F481B8FS5GBQ863V4KLA6CH","toDevice":"ServerReceiver","deviceType":"vAssistant"}
...OK!
Freeheap: 187956
收←◆ Got: {"fromDevice":"ServerSender","data":{"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}}
_messageId: 621828bf78ad36ff
data: {"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}
fromDevice: MIOT
form MIOT
MIOT parse data: {"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}
need set power state: true
收←◆ MQTT Ping!
Freeheap: 190540
收←◆ num: 0, get Text: {"get":"state"}, length: 15
isAvail_MQTT: 1
available: 1
checkAvail: 1
parse data: {"get":"state"}
defined BLINKER_ARDUINOJSON
autoManager begin: 0 0
data_rtKeyCount: 0
autoFormatData key: state, json: "state":"online"
new.
timer codes: 000
autoFormatData key: timer, json: "timer":"000"
add.
autoFormatData key: version, json: "version":"0.1.0"
add.
print: {"state":"online","timer":"000","version":"0.1.0"}
Proto print...
Freeheap: 188552
WS response:
{"state":"online","timer":"000","version":"0.1.0"}
Success...
Freeheap: 187776
heartBeat isParsed 1
checkNum count: 1
_fresh need flush
isParsed
flush
```
完整的代码如下
```
#define BLINKER_WIFI
#define BLINKER_MIOT_OUTLET
#include <Blinker.h>
char auth[] = "176dbe060fce";
char ssid[] = "song_second";
char pswd[] = "20110722";
// 新建组件对象
BlinkerText Text1("tex-30b");//注意:要和APP组件’数据键名’一致
bool oState = false;
void miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
//digitalWrite(LED_BUILTIN, HIGH);
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
//digitalWrite(LED_BUILTIN, LOW);
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
oState = false;
}
Text1.print(oState ? "灯状态: 开启" : "灯状态: 关闭");
}
void miotQuery(int32_t queryCode)
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("MIOT Query All");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
BLINKER_LOG("MIOT Query Power State");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
}
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
BLINKER_DEBUG.debugAll();
//pinMode(LED_BUILTIN, OUTPUT);
//digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
BlinkerMIOT.attachPowerState(miotPowerState);
BlinkerMIOT.attachQuery(miotQuery);
}
void loop()
{
Blinker.run();
}
``` 顶楼主,我也遇到相同的问题,使用的是合宙的ESP32C3开发板,烧入例程后小爱同学一直提示该设备出现问题,调试报错信息和你的一样,更换8266(ESP-12E)后正常使用小爱同学控制,没有出现问题 等我抽空排查一下 三水 发表于 2022-2-25 10:03
等我抽空排查一下
好的,感谢感谢 三水 发表于 2022-2-25 10:03
等我抽空排查一下
感谢感谢,麻烦版主了 三水 发表于 2022-2-25 10:03
等我抽空排查一下
版主,麻烦请问结果如何? Kano 发表于 2022-3-4 02:12
版主,麻烦请问结果如何?
抱歉太忙了,我今晚测试一下。 测试了一下,应该是arduinojson在esp32c3下适配的问题。其他板子可以正常使用小爱同学。待我修改下。 https://github.com/blinker-iot/blinker-library/archive/refs/heads/dev_3.0.zip
下载最新库测试,我测试ESP32C3已可以正常使用 三水 发表于 2022-3-9 21:31
https://github.com/blinker-iot/blinker-library/archive/refs/heads/dev_3.0.zip
下载最新库测试,我测试 ...
感谢感谢,可以了,之前测试的库是直接在GitHub上releases下的,版本是"version": "0.3.9",
现在下的这个"version": "0.3.90220309",就可以用了,麻烦您了。
页:
[1]