Skip to content

Commit

Permalink
Board: populate this.io.RESOLUTION from defaults and io.RESOLUTION
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Jul 17, 2019
1 parent 2e982d5 commit d0c778c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ function Board(opts) {
this.transport = this.io.transport || null;
this.port = this.io.name;
this.pins = Board.Pins(this);
this.RESOLUTION = this.io.RESOLUTION || { ADC: 1023, DAC: null, PWM: 255 };
this.RESOLUTION = Object.assign({ ADC: 1023, DAC: null, PWM: 255 }, this.io.RESOLUTION || {});

} else {

if (this.port && opts.port) {
Expand Down Expand Up @@ -456,7 +457,7 @@ function finalizeAndBroadcast(data, type, io) {

// Older versions of Firmata and some IO plugins
// may not have set RESOLUTION.
this.RESOLUTION = io.RESOLUTION || { ADC: 1023, DAC: null, PWM: 255 };
this.RESOLUTION = Object.assign({ ADC: 1023, DAC: null, PWM: 255 }, io.RESOLUTION || {});

}

Expand Down

0 comments on commit d0c778c

Please sign in to comment.