Skip to content

Commit

Permalink
Check for degamma enabled before apply on colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesper Grann Laursen committed Dec 14, 2021
1 parent f6e8ac3 commit 1eef7a7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/busylight.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Busylight.prototype.connect = function(options) {

var device = hidFinder.get(this.options);

if(this.debug)
console.log("Found device: %s", device);

if(!device || !device.path) {
this.connected = false;
this.connectAttempts++;
Expand Down Expand Up @@ -164,9 +167,12 @@ Busylight.prototype.send = function(p){

if(p && p.color !== undefined) {
p.color = p.color || this._defaults.color;
this.buffer[positions.red] = degamma(p.color[0]);
this.buffer[positions.green] = degamma(p.color[1]);
this.buffer[positions.blue] = degamma(p.color[2]);

if (this.degamma || this._defaults.degamma) p.color = p.color.map(degamma)

this.buffer[positions.red] = p.color[0];
this.buffer[positions.green] = p.color[1];
this.buffer[positions.blue] = p.color[2];
}

if(p && p.tone === false)
Expand Down

0 comments on commit 1eef7a7

Please sign in to comment.