fix tilt sensor readout in wedo hub as well
This commit is contained in:
parent
c7a5efcc78
commit
00e6840c32
@ -419,14 +419,8 @@ export class WeDo2SmartHub extends Hub {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Consts.DeviceType.WEDO2_TILT: {
|
case Consts.DeviceType.WEDO2_TILT: {
|
||||||
this._lastTiltX = data[2];
|
this._lastTiltX = data.readInt8(2);
|
||||||
if (this._lastTiltX > 100) {
|
this._lastTiltY = data.readInt8(3);
|
||||||
this._lastTiltX = -(255 - this._lastTiltX);
|
|
||||||
}
|
|
||||||
this._lastTiltY = data[3];
|
|
||||||
if (this._lastTiltY > 100) {
|
|
||||||
this._lastTiltY = -(255 - this._lastTiltY);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Emits when a tilt sensor is activated.
|
* Emits when a tilt sensor is activated.
|
||||||
* @event WeDo2SmartHub#tilt
|
* @event WeDo2SmartHub#tilt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user