|
@@ -449,7 +449,19 @@ const store = new Vuex.Store({
|
|
|
showLight: '',
|
|
|
showLightArray: [],
|
|
|
lightCount: 0,
|
|
|
- readBLELight: '5B0E02141E141E141E00000000000000005D'
|
|
|
+ readBLELight: '5B0E02141E141E141E00000000000000005D',
|
|
|
+ //区分两个设备的参数
|
|
|
+ hotmanData: {
|
|
|
+ frameHitCapacity: 11,
|
|
|
+ slopeArr: [15, 20, 20, 40]
|
|
|
+ },
|
|
|
+ hotmanIntelligentData: {
|
|
|
+ frameHitCapacity: 11,
|
|
|
+ // slopeArr: [9, 13, 13, 25],
|
|
|
+ slopeArr: [7, 11, 11, 22]
|
|
|
+ },
|
|
|
+ bIgnore: true,
|
|
|
+ LastMS: 0
|
|
|
},
|
|
|
mutations: {
|
|
|
|
|
@@ -2124,7 +2136,7 @@ const store = new Vuex.Store({
|
|
|
gCreateSandbagAlgorithm(state) {
|
|
|
state.sandbagAlgorithm = null;
|
|
|
state.sandbagAlgorithmLastTime = new Date().getTime();
|
|
|
- state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm();
|
|
|
+ state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm(state.hotmanData);
|
|
|
console.log("gCreateSandbagAlgorithm");
|
|
|
|
|
|
},
|
|
@@ -2187,6 +2199,17 @@ const store = new Vuex.Store({
|
|
|
}
|
|
|
},
|
|
|
//灯带
|
|
|
+ /**
|
|
|
+ * 创建一个沙袋打击对象
|
|
|
+ * @param {Object} state
|
|
|
+ */
|
|
|
+ gIntelligentCreateSandbagAlgorithm(state) {
|
|
|
+ state.sandbagAlgorithm = null;
|
|
|
+ state.sandbagAlgorithmLastTime = new Date().getTime();
|
|
|
+ state.sandbagAlgorithm = new o0ProjectRelease.SandbagAlgorithm(state.hotmanIntelligentData);
|
|
|
+ console.log("gCreateSandbagAlgorithm");
|
|
|
+
|
|
|
+ },
|
|
|
gIntelligentUpdateSandbagAlgorithm(state, context) {
|
|
|
|
|
|
let {
|
|
@@ -2239,7 +2262,7 @@ const store = new Vuex.Store({
|
|
|
state.lightTimeout == null;
|
|
|
};
|
|
|
this.commit('B_WriteHexToBLECharacteristic', {
|
|
|
- value: BLERGB.getRandomThreeRGB()
|
|
|
+ value: BLERGB.getRandomThreeRGB()
|
|
|
});
|
|
|
state.lightTimeout = setTimeout(() => {
|
|
|
//关闭红绿蓝
|
|
@@ -2946,7 +2969,20 @@ const store = new Vuex.Store({
|
|
|
box["hex"] = resValue;
|
|
|
//更新数据给webview,在game-play-web||game-play-sub绑定
|
|
|
//后面更新数据都用此接口
|
|
|
- uni.$emit('updateBLEDeviceData', box);
|
|
|
+ // uni.$emit('updateBLEDeviceData', box);
|
|
|
+ //忽略偶数帧
|
|
|
+ if (state.bIgnore) {
|
|
|
+ state.LastMS++;
|
|
|
+ if (state.LastMS % 2 != 0){
|
|
|
+ uni.$emit('updateBLEDeviceData', box);
|
|
|
+ }
|
|
|
+ if (state.LastMS >= 1000){
|
|
|
+ state.LastMS = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.$emit('updateBLEDeviceData', box);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//todo 解析跳绳模式
|
|
@@ -3103,8 +3139,8 @@ const store = new Vuex.Store({
|
|
|
// 这里的value是ArrayBuffer类型
|
|
|
value: _sendData,
|
|
|
success: (res) => {
|
|
|
- console.log('writeBLECharacteristicValue success', res.errMsg, value,
|
|
|
- retryCount);
|
|
|
+ // console.log('writeBLECharacteristicValue success', res.errMsg, value,
|
|
|
+ // retryCount);
|
|
|
if (success) {
|
|
|
success(res);
|
|
|
}
|
|
@@ -3113,8 +3149,8 @@ const store = new Vuex.Store({
|
|
|
console.log(fail)
|
|
|
//重新写入
|
|
|
if (retryCount > 0) {
|
|
|
- console.log("writeBLECharacteristicValue Rewrite ===================>" +
|
|
|
- value + " == " + retryCount);
|
|
|
+ // console.log("writeBLECharacteristicValue Rewrite ===================>" +
|
|
|
+ // value + " == " + retryCount);
|
|
|
retryCount--;
|
|
|
setTimeout(() => {
|
|
|
this.commit("B_WriteBLECharacteristicValue", {
|
|
@@ -3155,8 +3191,8 @@ const store = new Vuex.Store({
|
|
|
characteristicId: state.writeCharacteristicId,
|
|
|
value: typedArray.buffer,
|
|
|
success: (res) => {
|
|
|
- console.log('B_WriteHexToBLECharacteristicSuccess', res.errMsg, value,
|
|
|
- retryCount);
|
|
|
+ // console.log('B_WriteHexToBLECharacteristicSuccess', res.errMsg, value,
|
|
|
+ // retryCount);
|
|
|
if (success) {
|
|
|
success(res);
|
|
|
}
|
|
@@ -4144,6 +4180,15 @@ const store = new Vuex.Store({
|
|
|
uni.setStorageSync('readBLELight', value);
|
|
|
state.readBLELight = value;
|
|
|
},
|
|
|
+ onGetHotmanIntelligentData(state) {
|
|
|
+ let _hotmanIntelligentData = uni.getStorageSync('hotmanIntelligentData');
|
|
|
+ if (_hotmanIntelligentData) {
|
|
|
+ state.hotmanIntelligentData = _hotmanIntelligentData;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSaveHotmanIntelligentData(state) {
|
|
|
+ uni.setStorageSync('hotmanIntelligentData', state.hotmanIntelligentData);
|
|
|
+ },
|
|
|
}
|
|
|
})
|
|
|
|