@@ -4601,8 +4601,9 @@ public void receivedResponse(byte[] response) {
46014601 readResponses .get (header ).process (response );
46024602 } else if (responses .containsKey (maskedHeader )) {
46034603 final Response resp = responses .get (maskedHeader ).process (response );
4604- if (resp != null && responseProcessors .containsKey (resp .header )) {
4605- final RouteManager .MessageHandler handler = responseProcessors .get (resp .header );
4604+ ResponseHeader masked = resp .header .clearRead ();
4605+ if (resp != null && responseProcessors .containsKey (masked )) {
4606+ final RouteManager .MessageHandler handler = responseProcessors .get (masked );
46064607 conn .executeTask (new Runnable () {
46074608 @ Override
46084609 public void run () {
@@ -7244,7 +7245,7 @@ public SlowMotionConfigEditor setThreshold(float threshold) {
72447245 public void commit () {
72457246 if (count != null ) {
72467247 motionConfig [0 ]&= 0x3 ;
7247- motionConfig [0 ]|= (count << 2 ) ;
7248+ motionConfig [0 ]|= (count - 1 ) << 2 ;
72487249 }
72497250 if (threshold != null ) {
72507251 noMotionThs = threshold ;
@@ -7833,7 +7834,7 @@ public void commit() {
78337834
78347835 @ Override
78357836 public ThresholdDetectionConfigEditor configureThresholdDetection () {
7836- final byte THS_SCALE = 6 ;
7837+ final byte THS_SCALE = 16 ;
78377838
78387839 return new ThresholdDetectionConfigEditor () {
78397840 private byte [] config = new byte [2 ];
@@ -8103,7 +8104,7 @@ public void commit() {
81038104 motionConfig [0 ]&= 0x3 ;
81048105
81058106 if (duration >= 1000 && duration <= 16000 ) {
8106- motionConfig [0 ]|= (( byte ) (duration / 1000 - 1000 )) << 2 ;
8107+ motionConfig [0 ]|= (byte ) ((( duration - 1000 ) / 1000 ) << 2 ) ;
81078108 } else if (duration >= 20000 && duration <= 80000 ) {
81088109 motionConfig [0 ]|= (((byte ) (duration - 20000 ) / 4000 ) << 2 ) | 0x40 ;
81098110 } else if (duration >= 88000 && duration <= 336000 ) {
@@ -8347,11 +8348,11 @@ public void commit() {
83478348 lowHighConfig [2 ]|= (lowGMode .ordinal () << 2 );
83488349 }
83498350 if (lowHysteresis != null ) {
8350- bmi160LowHighConfig [2 ]&= 0xfc ;
8351- bmi160LowHighConfig [2 ]|= ((byte ) (lowHysteresis / LOW_HYSTERESIS_STEP ) & 0x3 );
8351+ lowHighConfig [2 ]&= 0xfc ;
8352+ lowHighConfig [2 ]|= ((byte ) (lowHysteresis / LOW_HYSTERESIS_STEP ) & 0x3 );
83528353 }
83538354 if (highDuration != null ) {
8354- bmi160LowHighConfig [3 ]= (byte ) ((highDuration / DURATION_STEP ) - 1 );
8355+ lowHighConfig [3 ]= (byte ) ((highDuration / DURATION_STEP ) - 1 );
83558356 }
83568357 if (newHighThreshold != null ) {
83578358 highThreshold = newHighThreshold ;
0 commit comments