基本信息- [x] 这个问题满足提问指南
- [x] 我阅读了开发文档
- [x] 我使用了最新的库及APP进行测试,但是问题仍然存在
- [x] 我搜索过类似问题的解决方法但是仍然无法解决
- [x] 有设备端的LOG信息
- [] 有编译报错信息
- [x] 我已填写基本信息
设备信息- 硬件: [Wemos D1 R32]
- 接入方式: [WIFI]
- package版本: [esp32-1.0.4]
- blinker库版本: [arduino 0.3.1]
- 开发环境: [Arduino]
- 操作系统: [Windows]
IDE 中的设置- Module: [ESP32 Dev Module]
- Flash Mode: [qio]
- Flash Size: [4MB]
- lwip Variant: [(不存在)]
- Reset Method: [(不存在)]
- Flash Frequency: [80Mhz]
- CPU Frequency: [240MHz]
- Upload Using: [SERIAL]
- Upload Speed: [921600]手机信息及APP信息
- (APP没有问题,暂时不填)
问题描述Blinker 无法连接服务器,日志中提示似乎是内存不足。 难道是BluetoothSerial占用了太多内存? 如果是这样,使用带psRAM的ESP32模块可以解决问题吗? 代码[mw_shl_code=arduino,true]#include "BluetoothSerial.h"
#define BLINKER_WIFI
#define BLINKER_ALIGENIE_LIGHT
#include <Blinker.h>
BluetoothSerial SerialBT;
bool connected;
uint8_t address[6] = {0xc9, 0xa0, 0x20, 0x47, 0xbe, 0x89};
const uint8_t off[24] = {0x01, 0xfe, 0x00, 0x00, 0x51, 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x07, 0x01, 0x03, 0x01, 0x02, 0x0e, 0x00};
const uint8_t on[24] = {0x01, 0xfe, 0x00, 0x00, 0x51, 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x07, 0x01, 0x03, 0x01, 0x01, 0x0e, 0x00};
const uint8_t col[24] = {0x01, 0xfe, 0x00, 0x00, 0x51, 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x07, 0x02, 0x03, 0x01, 0x01, 0x0e, 0x00};
void aligeniePowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
SerialBT.write(on, 24);
BlinkerAliGenie.powerState("on");
BlinkerAliGenie.print();
}
else if (state == BLINKER_CMD_OFF) {
SerialBT.write(off, 24);
BlinkerAliGenie.powerState("off");
BlinkerAliGenie.print();
}
}
void setup() {
Serial.begin(115200);
Serial1.begin(115200, SERIAL_8N1, 33, 32);
BLINKER_DEBUG.stream(Serial);
SerialBT.begin("ESP32test", true);
connected = SerialBT.connect(address);
if (connected) {
Serial.println("Connected Successfully!");
};
SerialBT.write(on, 24);
SerialBT.flush();
delay(100);
SerialBT.write(off, 24);
delay(300);
if (SerialBT.available()) {
SerialBT.flush();
Serial.println("Link OK");
} else {
Serial.println("Link ERROR");
delay(100000);
ESP.restart();
};
Blinker.begin("(api key是正确的)", "bu~zhun~ceng~wang(2.4G)", "(wifi密码是正确的)");
BlinkerAliGenie.attachPowerState(aligeniePowerState);
}
void loop() {
Blinker.run();
}[/mw_shl_code] LOG信息[I][BluetoothSerial.cpp:510] _init_bt(): device name set
[I][BluetoothSerial.cpp:225] esp_spp_cb(): ESP_SPP_INIT_EVT
[I][BluetoothSerial.cpp:722] connect(): master : remoteAddress
[I][BluetoothSerial.cpp:290] esp_spp_cb(): ESP_SPP_DISCOVERY_COMP_EVT
[I][BluetoothSerial.cpp:292] esp_spp_cb(): ESP_SPP_DISCOVERY_COMP_EVT: spp connect to remote
[I][BluetoothSerial.cpp:314] esp_spp_cb(): ESP_SPP_CL_INIT_EVT
[I][BluetoothSerial.cpp:298] esp_spp_cb(): ESP_SPP_OPEN_EVT
Connected Successfully!
Link OK
[5666]
[5666]
__ __ __
/\ \ /\ \ __ /\ \ v0.3.1
\ \ \___ \ \ \ /\_\ ___\ \ \/'\ __ _ __
\ \ '__`\\ \ \ \/\ \ /' _ `\ \ , < /'__`\/\`'__\
\ \ \L\ \\ \ \_\ \ \/\ \/\ \ \ \\`\ /\ __/\ \ \./
\ \_,__/ \ \__\\ \_\ \_\ \_\ \_\ \_\ \____\\ \_\
\/___/ \/__/ \/_/\/_/\/_/\/_/\/_/\/____/ \/_/
To better use blinker with your IoT project!
Download latest blinker library here!
=> https://github.com/blinker-iot/blinker-library
[5701] Connecting to bu~zhun~ceng~wang(2.4G)
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 - STA_START
[5780] ESP32_MQTT initialized...
[5780]
===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================
[I][EEPROM.cpp:117] begin(): Expanding EEPROM from 64 to 4096
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:381] _eventCallback(): STA IP: 10.10.10.208, MASK: 255.255.255.0, GW: 10.10.10.1
[8555] WiFi Connected.
[8555] IP Address:
[8555] 10.10.10.208
[W][HTTPClient.cpp:247] beginInternal(): unexpected protocol: https, expected http
[D][HTTPClient.cpp:276] beginInternal(): host: iotdev.clz.me port: 443 url: /api/v1/user/device/diy/auth?authKey=8f10cf06422e&aliType=light
[I][ssl_client.cpp:156] start_ssl_client(): WARNING: Use certificates for a more secure communication!
[E][ssl_client.cpp:33] _handle_error(): [start_ssl_client():199]: (-10368) X509 - Allocation of memory failed
[E][WiFiClientSecure.cpp:132] connect(): start_ssl_client: -10368
[D][HTTPClient.cpp:1018] connect(): failed connect to iotdev.clz.me:443
[W][HTTPClient.cpp:1318] returnError(): error(-1): connection refused
[10820] [HTTP] GET... failed, error: connection refused
[W][HTTPClient.cpp:1318] returnError(): error(-4): not connected
[D][HTTPClient.cpp:383] disconnect(): tcp is closed
[10835] ERROR: Maybe you have put in the wrong AuthKey!
[10840] ERROR: Or maybe your request is too frequently!
[10845] ERROR: Or maybe your network is disconnected
编译信息(编译时一切正常)
|