@@ -41,7 +41,7 @@ public class StepDcretor implements SensorEventListener {
41
41
//上次传感器的值
42
42
float gravityOld = 0 ;
43
43
//动态阈值需要动态的数据,这个值用于这些动态数据的阈值
44
- final float initialValue = (float ) 1.8 ;
44
+ final float initialValue = (float ) 1.7 ;
45
45
//初始阈值
46
46
float ThreadValue = (float ) 2.0 ;
47
47
@@ -257,10 +257,10 @@ public void DetectorNewStep(float values) {
257
257
if (DetectorPeak (values , gravityOld )) {
258
258
timeOfLastPeak = timeOfThisPeak ;
259
259
timeOfNow = System .currentTimeMillis ();
260
- if (timeOfNow - timeOfLastPeak >= 250
260
+ if (timeOfNow - timeOfLastPeak >= 200
261
261
&& (peakOfWave - valleyOfWave >= ThreadValue ) && timeOfNow - timeOfLastPeak <= 2000 ) {
262
262
timeOfThisPeak = timeOfNow ;
263
- /*
263
+ /*
264
264
* 更新界面的处理,不涉及到算法
265
265
* 一般在通知更新界面之前,增加下面处理,为了处理无效运动:
266
266
* 1.连续记录10才开始计步
@@ -270,7 +270,7 @@ public void DetectorNewStep(float values) {
270
270
271
271
preStep ();
272
272
}
273
- if (timeOfNow - timeOfLastPeak >= 250
273
+ if (timeOfNow - timeOfLastPeak >= 200
274
274
&& (peakOfWave - valleyOfWave >= initialValue )) {
275
275
timeOfThisPeak = timeOfNow ;
276
276
ThreadValue = Peak_Valley_Thread (peakOfWave - valleyOfWave );
@@ -303,7 +303,7 @@ public boolean DetectorPeak(float newValue, float oldValue) {
303
303
}
304
304
305
305
if (!isDirectionUp && lastStatus
306
- && (continueUpFormerCount >= 2 || oldValue >= 15 )) {
306
+ && (continueUpFormerCount >= 2 && oldValue >= 11.76 && oldValue < 19.6 )) {
307
307
peakOfWave = oldValue ;
308
308
return true ;
309
309
} else if (!lastStatus && isDirectionUp ) {
0 commit comments