Merge pull request from evhan55/bug/gdxfor-tilt

Vernier gdxfor tilt values 0 when disconnected
This commit is contained in:
Evelyn Eastmond 2019-02-13 15:46:49 -05:00 committed by GitHub
commit 894828d54b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -775,6 +775,12 @@ class Scratch3GdxForBlocks {
}
getTilt (args) {
// Tilt values are calculated using acceleration due to gravity,
// so we need to return 0 when the peripheral is not connected.
if (!this._peripheral.isConnected()) {
return 0;
}
switch (args.TILT) {
case TiltAxisValues.FRONT:
return Math.round(this._peripheral.getTiltFrontBack(false));