diff --git a/lib/button/index.js b/lib/button/index.js index a8c02cd..cbdafa8 100644 --- a/lib/button/index.js +++ b/lib/button/index.js @@ -70,10 +70,10 @@ class Button extends Emitter { const Provider = await getProvider(options, "builtin/digital"); let mode = Provider.Input; - if (!options.isPullup) { + if (typeof options.isPullup !== "undefined") { mode = Provider.InputPullUp; } - if (!options.isPulldown) { + if (typeof options.isPulldown !== "undefined") { mode = Provider.InputPullDown; } @@ -99,12 +99,12 @@ class Button extends Emitter { }, downValue: { get: () => { - return 1 ^ this.isPullup ^ this.invert; + return 1 ^ this.#state.isPullup ^ this.invert; } }, upValue: { get: () => { - return 0 ^ this.isPullup ^ this.invert; + return 0 ^ this.#state.isPullup ^ this.invert; } }, holdtime: { @@ -145,7 +145,6 @@ class Button extends Emitter { intialize(options, callback) { } processRead() { - if (this.isOpen) { this.emit("open"); timer.clearTimeout(this.#state.interval);