فهرست منبع

1.添加智能心率模式

slambb 2 سال پیش
والد
کامیت
b446a765c8

+ 3 - 3
common/config.js

@@ -5,11 +5,11 @@ const endTime = "2021-03-01"
 //************* 默认的蓝牙设备刷新间隔 再config 设置 a:10ms,b:20ms*************
 const refreshRate = "a";
 //*******当前活动环境,需要和根据地址设置!!环境 dev,prd
-const active = "prd";
+const active = "dev";
 //线上地址,腾讯云服务器
-const host="https://www.9527fun.cn/api_prd"
+// const host="https://www.9527fun.cn/api_prd"
 //测试地址,阿里云服务器
-// const host = "https://www.9527fun.cn/api_dev"
+const host = "https://www.9527fun.cn/api_dev"
 //本地测试地址
 // const host = "http://192.168.0.100:9090/api_prd"
 

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.5.41",
-    "versionCode" : 23032202,
+    "versionName" : "2.5.43",
+    "versionCode" : 23050601,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 82 - 48
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -153,7 +153,7 @@
 
 				// console.log(_self.BLEConnectDevice);
 				//如果连接了蓝牙设备是手柄
-				if (_self.BLEConnectDevice && _self.BLEConnectDevice.deviceType == "BLEHandle") {
+				if (_self.BLEConnectDevice && ( _self.BLEConnectDevice.deviceType == "BLEHandle" || _self.BLEConnectDevice.deviceType == "BLEIntelligent")) {
 					//开启设备回调 3/4关闭
 					_self.onWriteBLEConnectionValue({
 						value: "4"
@@ -215,7 +215,7 @@
 		methods: {
 			...mapMutations(['addlocalCalorie', 'syncRequestEvent', 'onWriteBLEConnectionValue',
 				'gCreateFilterObj', 'gUpdateFilter', 'B_OpenRopeSkipping', 'B_CloseRopeSkipping',
-				'gStopSimulateBLEUpdate', 'gStartSimulateBLEUpdate', 'gUpdateSandbagAlgorithm',
+				'gStopSimulateBLEUpdate', 'gStartSimulateBLEUpdate', 'gIntelligentUpdateSandbagAlgorithm', 'gUpdateSandbagAlgorithm',
 				'gCreateSandbagAlgorithm', 'onConvertDeviceData', 'addSandbagHitCount', 'uploadUserData_hitCount',
 				'jumpIdenModule_onJump6AxisDataUpdate'
 			]),
@@ -322,8 +322,8 @@
 					 */
 					let calorieParams = {
 						hitUnit: 0,
-						runUnit:puchConfig.getRunCalorie(1),
-						jumpUnit:puchConfig.getJumpCalorie(1)
+						runUnit: puchConfig.getRunCalorie(1),
+						jumpUnit: puchConfig.getJumpCalorie(1)
 					};
 
 					if (this.BLEConnectDevice) {
@@ -350,7 +350,7 @@
 							ename: this.ConnectBindingDevice.ename,
 							name: this.ConnectBindingDevice.name
 						};
-						calorieParams.hitUnit=puchConfig.getBoxingCalorie(1);
+						calorieParams.hitUnit = puchConfig.getBoxingCalorie(1);
 					}
 					//到时候可能要区分是什么类型
 					let item = {
@@ -629,7 +629,8 @@
 
 					if (!this.BLEConnectDevice) return;
 					//用设备来区分,开启什么加速计;
-					if (this.BLEConnectDevice.deviceType == "BLEHandle") {
+					if (this.BLEConnectDevice.deviceType == "BLEHandle" || this.BLEConnectDevice.deviceType ==
+						"BLEIntelligent") {
 						//处理蓝牙设备情况下
 						//开启设备回调 3/4关闭
 						this.onWriteBLEConnectionValue({
@@ -700,7 +701,8 @@
 						return;
 					}
 
-					if (this.BLEConnectDevice && this.BLEConnectDevice.deviceType == "BLEHandle") {
+					if (this.BLEConnectDevice && (this.BLEConnectDevice.deviceType == "BLEHandle" || this
+							.BLEConnectDevice.deviceType == "BLEIntelligent")) {
 						//开启设备回调 3/4关闭
 						this.onWriteBLEConnectionValue({
 							value: "4"
@@ -858,10 +860,10 @@
 									ename: res.ename,
 									value: res.hit,
 									mass: 10, //质量
-									hitPower: res.hit ,//计算的力
+									hitPower: res.hit, //计算的力
 									//新增类型
-									sendType:"ConnectBindingDevice",
-									type:"none"
+									sendType: "ConnectBindingDevice",
+									type: "none"
 								}
 								this.sendMessage("onBoxingPostHit", temp);
 							}
@@ -886,33 +888,65 @@
 						bLimitRebound: false
 					})
 				} else if (this.BLEConnectDevice.usageMode == "hotman") {
-					//hotman 沙袋情景 todo
-					this.gUpdateSandbagAlgorithm({
-						data: data,
-						callback: (res) => {
-							// console.log(res);
-							if (res.type == 'hit') {
-								// console.log('gUpdateFilter callback:',res)
-								//记录打击次数
-								this.addSandbagHitCount({
-									count: 1
-								});
-								let temp = {
-									direction: res.direction,
-									angle: res.angle,
-									name: res.name,
-									ename: res.ename,
-									value: res.hit,
-									mass: 10, //质量
-									hitPower: res.hit ,//计算的力
-									//新增类型
-									sendType:"hotman",
-									type:"none"
+					
+					if(this.BLEConnectDevice.deviceType == "BLEIntelligent"){
+						//智能hotman 沙袋情景
+						this.gIntelligentUpdateSandbagAlgorithm({
+							data: data,
+							callback: (res) => {
+								// console.log(res);
+								if (res.type == 'hit') {
+									// console.log('gUpdateFilter callback:',res)
+									//记录打击次数
+									this.addSandbagHitCount({
+										count: 1
+									});
+									let temp = {
+										direction: res.direction,
+										angle: res.angle,
+										name: res.name,
+										ename: res.ename,
+										value: res.hit,
+										mass: 10, //质量
+										hitPower: res.hit, //计算的力
+										//新增类型
+										sendType: "hotman",
+										type: "none"
+									}
+									this.sendMessage("onBoxingPostHit", temp);
 								}
-								this.sendMessage("onBoxingPostHit", temp);
 							}
-						}
-					});
+						});
+					}else{
+						//hotman 沙袋情景 todo
+						this.gUpdateSandbagAlgorithm({
+							data: data,
+							callback: (res) => {
+								// console.log(res);
+								if (res.type == 'hit') {
+									// console.log('gUpdateFilter callback:',res)
+									//记录打击次数
+									this.addSandbagHitCount({
+										count: 1
+									});
+									let temp = {
+										direction: res.direction,
+										angle: res.angle,
+										name: res.name,
+										ename: res.ename,
+										value: res.hit,
+										mass: 10, //质量
+										hitPower: res.hit, //计算的力
+										//新增类型
+										sendType: "hotman",
+										type: "none"
+									}
+									this.sendMessage("onBoxingPostHit", temp);
+								}
+							}
+						});
+					}
+					
 				} else if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
 					//跳绳蓝牙反馈
 					this.onBLERopeUpdate(data);
@@ -982,10 +1016,10 @@
 					ename: ename,
 					value: direValue,
 					mass: this.mass, //质量
-					hitPower: power ,//计算的力
+					hitPower: power, //计算的力
 					//新增类型
-					sendType:"BindBoxingPost",
-					type:"none"
+					sendType: "BindBoxingPost",
+					type: "none"
 				}
 
 				this.sendMessage("onBoxingPostHit", temp);
@@ -1011,10 +1045,10 @@
 						ename: "hit",
 						value: e.acc,
 						mass: e.mass, //质量
-						hitPower: e.power ,//计算的力
+						hitPower: e.power, //计算的力
 						//新增类型
-						sendType:"EquipmentActionObj",
-						type:"none"
+						sendType: "EquipmentActionObj",
+						type: "none"
 					}
 					this.sendMessage("onBoxingPostHit", temp);
 				})
@@ -1034,10 +1068,10 @@
 						ename: "hit", //this.BLEConnectDevice.ename,
 						value: 10,
 						mass: 10, //质量
-						hitPower: 10 ,//计算的力
+						hitPower: 10, //计算的力
 						//新增类型
-						sendType:"ActionJumpObj",
-						type:"none"
+						sendType: "ActionJumpObj",
+						type: "none"
 					}
 					if (e.type == 'stateDataOfJump') {
 						// console.log("game stateDataOfJump");
@@ -1072,11 +1106,11 @@
 									ename: "hit", //this.BLEConnectDevice.ename,
 									value: 0, //
 									mass: 0, //质量
-									hitPower: 0 ,//计算的力
+									hitPower: 0, //计算的力
 									//新增类型
-									sendType:"RopeSkipping",
-									type:"none",
-									angle:res.tag, //返回一个 tag方向
+									sendType: "RopeSkipping",
+									type: "none",
+									angle: res.tag, //返回一个 tag方向
 								}
 								switch (res.tag) {
 									case 0:

+ 8 - 24
pages/personal-page/devices-hardware/devices-hardware.vue

@@ -198,35 +198,17 @@
 			}
 		},
 		onLoad(op) {
-			// if (op.deviceType) {
-			// 	console.log(op);
-			// 	this.option = op;
-			// }
-			//目前是固定这个值,去掉了一级页面
-			// this.option = {
-			// 	cname: "手柄盒子",
-			// 	deviceType: 'BLEHandle'
-			// };
-			// if (this.option.deviceType == 'BLEHandle') {
-			// 	this.BLEInfoList.forEach((item, index, selfarr) => {
-			// 		if (item.deviceType == 'BLEHandle' || item.deviceType == 'BLERope') {
-			// 			let item = Object.assign({}, selfarr[index]);
-			// 			this.devicesList.push(item);
-			// 		}
-			// 	})
-			// }
-			this.BLEInfoList.forEach((item, index, selfarr) => {
-				
+			this.BLEInfoList.forEach((item, index, selfarr) => {
 				// ios 暂时去除跳,因为算法还没转化Xcode
 				if (uni.getSystemInfoSync().platform == "ios") {
-					if ((item.deviceType == 'BLEHandle' && item.usageMode == 'hotman') ) {
+					if (((item.deviceType == 'BLEHandle' || item.deviceType == 'BLEIntelligent')  && item.usageMode == 'hotman') ) {
 						let item = Object.assign({}, selfarr[index], {
 							bOldDevice: false
 						});
 						this.devicesList.push(item);
 					}
 				}else{
-					if ((item.deviceType == 'BLEHandle' && item.usageMode == 'hotman') || item.deviceType ==
+					if (((item.deviceType == 'BLEHandle' || item.deviceType == 'BLEIntelligent') && item.usageMode == 'hotman') || item.deviceType ==
 						'BLERope') {
 						let item = Object.assign({}, selfarr[index], {
 							bOldDevice: false
@@ -271,7 +253,8 @@
 						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
 						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
 						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
-						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
+						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) ||
+						(eq.ename.indexOf("intelligent") > -1 && this.BLEConnectDevice.id == 4)) {
 						eq.bRatio = true;
 						this.currentItem = eq;
 
@@ -476,9 +459,10 @@
 						(eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
 						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
 						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
-						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
+						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) ||
+						(eq.ename.indexOf("intelligent") > -1 && this.BLEConnectDevice.id == 4)) {
 
-						if (eq.ename.indexOf("hotman") > -1) {
+						if (eq.ename.indexOf("hotman") > -1 || eq.ename.indexOf("intelligent") > -1) {
 							//拳击
 							this.switchList(2);
 						} else if (eq.ename.indexOf("rope") > -1) {

+ 24 - 9
pages/personal-page/personal/personal.vue

@@ -1062,7 +1062,7 @@
 				'gOnAddClientInfo', 'onWriteBLEConnectionValue',
 				'gCreateFilterObj', 'gUpdateFilter', 'B_GetBondedDevices', 'B_OpenBLESetting', 'B_OpenRopeSkipping',
 				'B_CloseRopeSkipping',
-				'gCreateSandbagAlgorithm', 'gUpdateSandbagAlgorithm', 'gStartSimulateBLEUpdate',
+				'gCreateSandbagAlgorithm', 'gUpdateSandbagAlgorithm','gIntelligentUpdateSandbagAlgorithm', 'gStartSimulateBLEUpdate',
 				'gStopSimulateBLEUpdate',
 				'getActionJumpTask',
 				'setActionJumpTask', 'getLevelList',
@@ -1387,7 +1387,8 @@
 					if ((eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
 						(eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
 						(eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
-						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
+						(eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) ||
+						(eq.ename.indexOf("intelligent") > -1 && this.BLEConnectDevice.id == 4)) {
 
 						eq.bRatio = true;
 						this.$store.state.cIndex = i;
@@ -1420,6 +1421,8 @@
 						// 		this.$refs.boxingPostRef.onSetMode('ropeMode');
 						// 	}, 500)
 						// }
+					} else if(eq.ename.indexOf("intelligent") > -1 && this.BLEConnectDevice.id == 4){
+						
 					}
 				}
 			},
@@ -1447,14 +1450,26 @@
 				if (!this.instructionState.bOpen) return;
 
 				if (this.BLEConnectDevice.usageMode == "hotman") {
-					this.gUpdateSandbagAlgorithm({
-						data: data,
-						callback: (res) => {
-							if (res.type == 'hit') {
-								this.$refs.actionHitRef.onBLEHitUpdate(res);
+					if(this.BLEConnectDevice.deviceType == "BLEIntelligent"){
+						this.gIntelligentUpdateSandbagAlgorithm({
+							data: data,
+							callback: (res) => {
+								if (res.type == 'hit') {
+									this.$refs.actionHitRef.onBLEHitUpdate(res);
+								}
 							}
-						}
-					});
+						});
+					}else{
+						this.gUpdateSandbagAlgorithm({
+							data: data,
+							callback: (res) => {
+								if (res.type == 'hit') {
+									this.$refs.actionHitRef.onBLEHitUpdate(res);
+								}
+							}
+						});
+					}
+					
 				} else if (this.BLEConnectDevice.usageMode == "general") {
 					//这个是普通打击模式
 					this.$refs.boxingPostRef.onBLEHandleUpdate(data);

BIN
static/devicesIcon/BLEIntelligent.jpg


+ 24 - 0
util/util-js/devices.js

@@ -97,6 +97,30 @@ const getDeviceList = function() {
 				/***********/
 				currentVersion: '1.2.0', //当前固件版本
 				latestVersion: '1.2.0' //服务器最新固件版本
+			},
+			{
+				id: 4,
+				cname: "智能沙袋模式",
+				ename: "intelligent",
+				icon: "/static/devicesIcon/BLEIntelligent.jpg",
+				mIcon: "/static/devicesIconSimple/BLEIntelligent.jpg",
+				bRatio: false,
+				usageMode: "hotman", //使用模式,在hotman情景下使用
+				describe: '闪光蓝牙设备的拳击模式情景下使用,快速打击模式',
+				limitType: 'noRebound', //不限制回弹版本
+				deviceType: 'BLEIntelligent', //使用设备,蓝牙手柄
+				deviceName: 'BGBox', // 使用设备名称:PBox-000000b BGBox_202012
+				limitDis: 100, //限制距离 米
+				/**
+				 * 主服务的 uuid Cofing
+				 */
+				primaryUUID: 'FFF0', //蓝牙主服务id
+				PRIMARY_SERVICE: '0000FFF0-0000-1000-8000-00805F9B34FB',
+				PRIMARY_WRITE: '0000FFF2-0000-1000-8000-00805F9B34FB',
+				PRIMARY_NOTIFY: '0000FFF1-0000-1000-8000-00805F9B34FB',
+				/***********/
+				currentVersion: '', //当前固件版本
+				latestVersion: '' //服务器最新固件版本
 			}
 		];
 

+ 38 - 1
util/util-js/store.js

@@ -2166,7 +2166,44 @@ const store = new Vuex.Store({
 			while (msGap < 0) {
 				msGap += 1000;
 			}
-			let [hit, dir] = state.sandbagAlgorithm.Update(ax, az, -gz, gx, msGap);
+			let [hit, dir] = state.sandbagAlgorithm.Update(ax, az, -gz, gx, msGap); //手柄方向
+			if (dir != undefined) {
+				let temp = state.sandbagAlgorithm.getTempValue(dir);
+				if (callback) {
+					callback(temp);
+				}
+
+				// let hitCount = temp.hitCount;
+			}
+		},
+		//灯带
+		gIntelligentUpdateSandbagAlgorithm(state, context) {
+
+			let {
+				data,
+				callback = null
+			} = context;
+
+			let {
+				ax,
+				ay,
+				az
+			} = data.acc;
+
+			let {
+				gx,
+				gy,
+				gz
+			} = data.gyro;
+			let {
+				ms
+			} = data;
+			let msGap = ms - state.deviceMs;
+			state.deviceMs = ms;
+			while (msGap < 0) {
+				msGap += 1000;
+			}
+			let [hit, dir] = state.sandbagAlgorithm.Update(ax, az, gz, -gx, msGap); //灯带方向
 			if (dir != undefined) {
 				let temp = state.sandbagAlgorithm.getTempValue(dir);
 				if (callback) {