xuhongv / blufiesp32wechat Goto Github PK
View Code? Open in Web Editor NEW一款开源的蓝牙ble配网blufi乐鑫芯片esp32的开源微信小程序(持续维护,欢迎star)
一款开源的蓝牙ble配网blufi乐鑫芯片esp32的开源微信小程序(持续维护,欢迎star)
在xBlufi-wx-impl.js中,下面处理:
case 19: //自定义数据
let customData = [];
for (var i = 0; i <= result.length; i++) {
customData.push(String.fromCharCode(parseInt(result[i], 16)));
}
造成长度加1,最后一个数据无效,应该对应为:
for (var i = 0; i < result.length; i++) {
esp-idf4.2: example blufi demo
在华为matepro60手机 鸿蒙4.0系统上点击查找,调用scan方法无响应
TYPE_RECIEVE_CUSTON_DATA => TYPE_RECIEVE_CUSTOM_DATA
EVENT_START_DISCONORY => EVENT_START_DISCOVER
EVENT_NOFITY_SEND_CUSTON_DATA => EVENT_NOFITY_SEND_CUSTOM_DATA
writeCutomsData => writeCustomData
https://docs.ai-thinker.com/esp8266/smartconfig
网站说能配,实际配不了,会卡在初始化
首先感谢作者的开源贡献,当我在使用本项目的时候,发现一个问题:第一次进入进入配网没问题,如果第一次进入配网界面后没有配置或者配置失败返回主界面,那么第二次再次配网就会失败,必须杀掉小程序,才行。第二次配网也会导致esp32死机重启。经过排查,发现是onfire 第一次配网后,没有取消订阅,就会导致,后面点击配网多次触发回调。需要调用clear()清空。还有xBlufi.js中的un()取消订阅方法的参数应该是写错了,为事件名,而不是回调函数。使用过程中遇到的坑,提出一些改进意见,再次感谢作者的开源贡献
编译为发布模式,有些手机是可以连,有些不行。
不行的,有 “入网失败 subType:18,init security error”
调用了xBlufi.notifyInitBleEsp32({deviceId: that.connectedDeviceId});
后,esp报错
I (12083790) [BLUFI, 336]: event:25
E (12083791) BLUFI: BLUFI report error, error code 9
就是在交换加密方式这一步,过不了
如果编译为调试模式,那肯定是报错。
也可能跟微信的基础库有关,调试模式,改不了基础库。
master代码微信开发者工具跑项目报Identifier 'self' has already been declared
Error: module 'utils/blufi/xBlufi-wx-impl.js' is not defined, require args is 'xBlufi-wx-impl.js'
直接使用Blufi文件后,运行到手机上,已开启蓝牙情况下一直提示蓝牙未开启,使用5+api和uniapp的api检查结果也是蓝牙已开启
想传Uint8Array数组,这样写不成功,设备收不到。
xBlufi.notifySendCustomData({customData: bytes})
在function writeCustomData里,没看出该如何传递?
如果wifi密码输入错误,卡在配网界面没反应。
如果没有输入密码,直接退出上一页面,在重新进入,导致esp32崩溃
只想让配套的小程序连接,做配置。
应该在哪个环节做校验比较好?
sequenceControl = parseInt(sequenceControl) + 1;
if (sequenceControl>=256) sequenceControl=0;
sequenceControl>=256时,在aes加密中,会报错。好几个地方,都需要加上这句判断。
uni.createBLEConnection({
deviceId: options.deviceId,
success: function(res) {
let platform = uni.getSystemInfoSync().platform
if (platform=="android") {
uni.setBLEMTU({
deviceId: options.deviceId,
mtu: 128
});
}
myself.data.deviceId = options.deviceId;
xBlufi.notifyDeviceMsgEvent({
type: xBlufi.XBLUFI_TYPE.TYPE_CONNECTED,
result: true,
data: {
deviceId: options.deviceId,
name: options.name
}
});
},
fail: function(res) {
// {"type":"0","result":false,"data":{"errno":1509007,"errCode":-1,"errMsg":"createBLEConnection:fail:already connect"}}
if (res.errno!=1509007) {
myself.data.deviceId = null;
xBlufi.notifyDeviceMsgEvent({
type: xBlufi.XBLUFI_TYPE.TYPE_CONNECTED,
result: false,
data: res
});
}
}
});
fail有种情况是,已连成功,又报错,此时把deviceId = null,后导致判断错误。
我是在xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT时,加了一句
myself.data.deviceId = deviceId // 可能在其它地方,被置空了,以此为准
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.