always shake when button is pressed (#2161)

This commit is contained in:
Joey Wunderlich 2019-06-07 17:20:08 -07:00 committed by GitHub
parent 1eec659894
commit 12ddb5c72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -267,7 +267,7 @@ namespace pxsim {
++this.sigma; ++this.sigma;
} }
if (this.sigma >= DAL.MICROBIT_ACCELEROMETER_GESTURE_DAMPING) { if (this.currentGesture !== this.lastGesture && this.sigma >= DAL.MICROBIT_ACCELEROMETER_GESTURE_DAMPING) {
this.enqueueCurrentGesture(); this.enqueueCurrentGesture();
} }
} }
@ -278,10 +278,8 @@ namespace pxsim {
} }
private enqueueCurrentGesture() { private enqueueCurrentGesture() {
if (this.currentGesture != this.lastGesture) { this.lastGesture = this.currentGesture;
this.lastGesture = this.currentGesture; board().bus.queue(DAL.MICROBIT_ID_GESTURE, this.lastGesture);
board().bus.queue(DAL.MICROBIT_ID_GESTURE, this.lastGesture);
}
} }
/** /**