diff --git a/index/index.js b/index/index.js
index 1407447..9b83709 100644
--- a/index/index.js
+++ b/index/index.js
@@ -80,8 +80,8 @@ Page({
console.log("advertisData: ",hexStr)
// 连接指定设备
// if(device.deviceId=="03:02:02:07:65:98"){
- if(device.deviceId=="03:02:02:07:5F:AF"){
- // if(device.deviceId=="03:02:02:07:64:B4"){
+ // if(device.deviceId=="03:02:02:07:5F:AF"){
+ if(device.deviceId=="03:02:02:07:64:B4"){
this.connectToDevice(device.deviceId);
}
});
@@ -335,7 +335,7 @@ Page({
sendHealthCommand(){
// 指令依次是:心率,血氧、血压、体温、睡眠、步数
// 0x55,0x66,0x56,0x65,0x53,0x52
- const commands = [0x53];
+ const commands = [0x55];
// 递归发送命令并加上 5 秒延迟
function sendNextCommand(index = 0) {
if (index >= commands.length) return; // 所有命令发送完毕,结束
@@ -389,7 +389,15 @@ Page({
},
-
+ /**
+ * 清除历史数据
+ */
+ removeHistoryData(){
+ let basicPacket = DataPacket.removeHistoryData();
+ let hex = this.uint8ArrayToHex(basicPacket);
+ console.log('绑定时清除历史数据:', hex);
+ SendCommandUtil.sendPackage(this.data.deviceId,basicPacket);
+ },
/**
* 佩戴管理设置
*/
diff --git a/index/index.wxml b/index/index.wxml
index fbbed66..bd48c8b 100644
--- a/index/index.wxml
+++ b/index/index.wxml
@@ -8,5 +8,6 @@
+
\ No newline at end of file
diff --git a/utils/DataPacket.js b/utils/DataPacket.js
index 06a2772..dc1fa08 100644
--- a/utils/DataPacket.js
+++ b/utils/DataPacket.js
@@ -448,6 +448,20 @@ const DataPacket = {
return fullPackage;
},
+ /**
+ * 清空历史数据
+ */
+ removeHistoryData(){
+ const packet = new Uint8Array(16);
+ packet[0] = 0x61;
+ packet[1] = 0x00;
+ packet.fill(0x00, 2, 15);
+ // 计算并设置 CRC 校验字节
+ const crc = calculateCRC(packet.subarray(0, 15));
+ packet[15] = crc;
+ return packet;
+ }
+
}