Skip to content

Commit

Permalink
Bug fixes for button
Browse files Browse the repository at this point in the history
Caught by tests
  • Loading branch information
dtex committed Jul 4, 2020
1 parent e98b2af commit 53b5213
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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: {
Expand Down Expand Up @@ -145,7 +145,6 @@ class Button extends Emitter {
intialize(options, callback) { }

processRead() {

if (this.isOpen) {
this.emit("open");
timer.clearTimeout(this.#state.interval);
Expand Down

0 comments on commit 53b5213

Please sign in to comment.