1
0
forked from dyf/APP

修复6155蓝牙上报数据灯光状态不跟随变化的问题。

This commit is contained in:
liub
2025-12-19 13:37:14 +08:00
parent bf615de600
commit 425b7b9cfd
4 changed files with 91 additions and 59 deletions

View File

@ -415,37 +415,42 @@ class BleReceive {
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
try {
let staticLevelByte = bytes[2];
let getName = function(type) {
let getName = function(type,) {
let name = "";
switch (type) {
case 0x02:
// name = '弱光';
name=1;
break;
case 0x04:
name = '工作光';
break;
case 0x01:
// name = '强光';
name=0;
break;
case 0x03:
// name = '爆闪';
name=2;
case 0x02:
// name = '弱光';
name=1;
break;
case 0x00:
case 0x03:
// name = '爆闪';
name=2;
break;
case 0x04:
name = 0;//泛光
break;
case 0x0A:
name = 1;//强光&泛光
break;
default:
// name = '关闭';
name=3;
name=null;
break;
}
return name;
}
let staticLevelText = getName(staticLevelByte);
let staticLevelText = getName(bytes[2]);
// 解析照明档位
let lightingLevelByte = bytes[3];
let lightingLevelText = getName(lightingLevelByte);
// 解析照明档位
let lightingLevelText = getName(bytes[3]);
// 解析剩余电量
@ -470,8 +475,9 @@ class BleReceive {
let mm = Math.max(0, Math.min(100, bytes[7]));
lightingTime = HH + "小时" + mm + "分钟";
let formData = {};
formData.mode = staticLevelText;
formData.fuMode = lightingLevelText;
formData.mode = (bytes[2]===0x00 || bytes[2]===0x0B)?'fu':'main';
formData.light=formData.mode=='fu'?lightingLevelText:staticLevelText;
formData.battary = batteryLevel;
formData.statu = warn;
formData.xuhang = lightingTime;