ESP32-C3烧入示例程序后,小爱同学无法控制-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1089|回复: 9

[已处理] ESP32-C3烧入示例程序后,小爱同学无法控制

[复制链接]
发表于 2022-2-24 22:21 | 显示全部楼层 |阅读模式
本帖最后由 uint8_t 于 2022-2-25 09:17 编辑

[md]# ESP32-C3烧入示例程序后,小爱同学无法控制

板子使用的是乐鑫官方的**ESP32-C3-DevKitM-1**,烧入的示例程序为**MIOT_OUTLET**,然后小爱同学一直提示您控制的设备出问题了。

我在程序里加了一个文字组件,用小爱同学控制时,APP里面也不会改变状态,请问这是ESP32-C3的问题吗?
用ESP8266的时候没有出现过这种情况,期待各位大佬的解答,感谢感谢!!!

通过小爱同学语音控制时,串口输出的**调试信息**为:

```
[08:54:22.066]收←◆[205977] Got: {"fromDevice":"ServerSender","data":{"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}}
[205978] _messageId: 621828be78ad36fe
[205990] data: {"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}
[205990] fromDevice: MIOT
[206003] form MIOT
[206022] MIOT parse data: {"get":"state","from":"MIOT","messageId":"621828be78ad36fe"}
[206023] MIOT Query codes: 0
[206023] MIOT Query All
[206035] response to MIOT: {"pState":"off"}
[206036] isJson: {"data":{"pState":"off","messageId":"621828be78ad36fe"},"fromDevice":"3F481B8FS5GBQ863V4KLA6CH","toDevice":"ServerReceiver","deviceType":"vAssistant"}
[206048] MQTT MIOT Publish...
[206060] Freeheap: 189280
[206061] BLINKER_RRPC_PUB_TOPIC_MQTT: /device/3F481B8FS5GBQ863V4KLA6CH/s
[206062] {"data":{"pState":"off","messageId":"621828be78ad36fe"},"fromDevice":"3F481B8FS5GBQ863V4KLA6CH","toDevice":"ServerReceiver","deviceType":"vAssistant"}
[206087] ...OK!
[206087] Freeheap: 187956

[08:54:22.478]收←◆[206389] Got: {"fromDevice":"ServerSender","data":{"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}}
[206402] _messageId: 621828bf78ad36ff
[206402] data: {"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}
[206415] fromDevice: MIOT
[206415] form MIOT
[206435] MIOT parse data: {"set":{"pState":"true","pstate":"on"},"from":"MIOT","messageId":"621828bf78ad36ff"}
[206435] need set power state: true

[08:54:52.493]收←◆[236417] MQTT Ping!
[236417] Freeheap: 190540

[08:55:05.783]收←◆[249695] num: 0, get Text: {"get":"state"}, length: 15
[249695] isAvail_MQTT: 1
[249714] available: 1
[249715] checkAvail: 1
[249715] parse data: {"get":"state"}
[249715] defined BLINKER_ARDUINOJSON
[249715] autoManager begin: 0 0
[249728] data_rtKeyCount: 0
[249728] autoFormatData key: state, json: "state":"online"
[249728] new.
[249740] timer codes: 000
[249740] autoFormatData key: timer, json: "timer":"000"
[249741] add.
[249741] autoFormatData key: version, json: "version":"0.1.0"
[249753] add.
[249753] print: {"state":"online","timer":"000","version":"0.1.0"}
[249766] Proto print...
[249766] Freeheap: 188552
[249766] WS response:
[249766] {"state":"online","timer":"000","version":"0.1.0"}
[249778] Success...
[249780] Freeheap: 187776
[249780] heartBeat isParsed 1
[249780] checkNum count: 1
[249780] _fresh need flush
[249792] isParsed
[249793] 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();
}
```[/md]
发表于 2022-2-25 09:10 | 显示全部楼层
顶楼主,我也遇到相同的问题,使用的是合宙的ESP32C3开发板,烧入例程后小爱同学一直提示该设备出现问题,调试报错信息和你的一样,更换8266(ESP-12E)后正常使用小爱同学控制,没有出现问题
发表于 2022-2-25 10:03 | 显示全部楼层
等我抽空排查一下
 楼主| 发表于 2022-2-25 10:06 | 显示全部楼层
三水 发表于 2022-2-25 10:03
等我抽空排查一下

好的,感谢感谢
发表于 2022-2-28 16:10 | 显示全部楼层
三水 发表于 2022-2-25 10:03
等我抽空排查一下

感谢感谢,麻烦版主了
发表于 2022-3-4 02:12 | 显示全部楼层
三水 发表于 2022-2-25 10:03
等我抽空排查一下

版主,麻烦请问结果如何?
发表于 2022-3-9 10:52 | 显示全部楼层
Kano 发表于 2022-3-4 02:12
版主,麻烦请问结果如何?

抱歉太忙了,我今晚测试一下。
发表于 2022-3-9 20:12 | 显示全部楼层
测试了一下,应该是arduinojson在esp32c3下适配的问题。其他板子可以正常使用小爱同学。待我修改下。
发表于 2022-3-9 21:31 | 显示全部楼层
https://github.com/blinker-iot/b ... s/heads/dev_3.0.zip
下载最新库测试,我测试ESP32C3已可以正常使用
 楼主| 发表于 2022-3-9 22:11 | 显示全部楼层
三水 发表于 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",就可以用了,麻烦您了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 10:45 , Processed in 0.166417 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表