diff --git a/libs/core/buttons.ts b/libs/core/buttons.ts index 993d319f..e29af19c 100644 --- a/libs/core/buttons.ts +++ b/libs/core/buttons.ts @@ -66,6 +66,7 @@ namespace brick { //% hidden _update(curr: boolean) { + if (curr === null) return if (this._isPressed == curr) return this._isPressed = curr if (curr) { diff --git a/libs/core/input.ts b/libs/core/input.ts index 440dfbe8..e67bc1a2 100644 --- a/libs/core/input.ts +++ b/libs/core/input.ts @@ -68,7 +68,7 @@ namespace sensors.internal { if (info.sensor) return info.sensor._query() return 0 }, (prev, curr) => { - if (info.sensor && curr !== null) info.sensor._update(prev, curr) + if (info.sensor && curr != null) info.sensor._update(prev, curr) }) }