always shake when button is pressed (#2161)
This commit is contained in:
parent
1eec659894
commit
12ddb5c72e
@ -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,11 +278,9 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the X axis value of the latest update from the accelerometer.
|
* Reads the X axis value of the latest update from the accelerometer.
|
||||||
|
Loading…
Reference in New Issue
Block a user