From 1eef7a70f492774b29ea766ce2bc9a8489662c81 Mon Sep 17 00:00:00 2001 From: Jesper Grann Laursen Date: Tue, 14 Dec 2021 09:33:23 +0100 Subject: [PATCH] Check for degamma enabled before apply on colors --- lib/busylight.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/busylight.js b/lib/busylight.js index 4538bb5..5cfa134 100644 --- a/lib/busylight.js +++ b/lib/busylight.js @@ -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++; @@ -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)