Comparing version 0.1.4 to 0.1.5
@@ -23,3 +23,4 @@ var Color = require("color"), | ||
while(level >= 0.0){ | ||
LPD8806.fill(new Color(colors[i]).alpha(level)); | ||
LPD8806.setMasterBrightness(level); | ||
LPD8806.fill(new Color(colors[i])); | ||
if(level >= 0.99){ | ||
@@ -29,3 +30,3 @@ dir =- step; | ||
level += dir; | ||
sleep.usleep(4000); | ||
sleep.usleep(10000); | ||
} | ||
@@ -43,2 +44,3 @@ } | ||
LPD8806.update(); | ||
sleep.usleep(20000); | ||
_step += amt; | ||
@@ -45,0 +47,0 @@ var overflow = _step - 384; |
@@ -20,3 +20,3 @@ /* MIT license */ | ||
'chipSelect': SPI.CS.none, | ||
'maxSpeed': 12000000 | ||
'maxSpeed': 20000000 | ||
}, function(s){ | ||
@@ -44,8 +44,8 @@ s.open(); | ||
var __set_internal = function(pixel, color){ | ||
if(pixel < 0 || pixel > this.lastIndex){ | ||
throw 'dont go out of bounds'; | ||
} | ||
buffer[pixel][c_order[0]] = gamma[Math.floor(color.red() * color.alpha() * masterBrightness)]; | ||
buffer[pixel][c_order[1]] = gamma[Math.floor(color.green() * color.alpha() * masterBrightness)]; | ||
buffer[pixel][c_order[2]] = gamma[Math.floor(color.blue() * color.alpha() * masterBrightness)]; | ||
if(pixel < 0 || pixel > this.lastIndex){ | ||
throw 'dont go out of bounds'; | ||
} | ||
buffer[pixel][c_order[0]] = gamma[~~(color.red() * masterBrightness)]; | ||
buffer[pixel][c_order[1]] = gamma[~~(color.green() * masterBrightness)]; | ||
buffer[pixel][c_order[2]] = gamma[~~(color.blue() * masterBrightness)]; | ||
}; | ||
@@ -70,5 +70,5 @@ | ||
for(var n = 0; n < buffer.length; n++){ | ||
buffer[n][0] = gamma[Math.floor(((buffer[n][0] > 128) ? buffer[n][0]: 0) * masterBrightness)]; | ||
buffer[n][1] = gamma[Math.floor(((buffer[n][1] > 128) ? buffer[n][1]: 0) * masterBrightness)]; | ||
buffer[n][2] = gamma[Math.floor(((buffer[n][2] > 128) ? buffer[n][2]: 0) * masterBrightness)]; | ||
buffer[n][0] = gamma[~~(((buffer[n][0] > 128) ? buffer[n][0]: 0) * masterBrightness)]; | ||
buffer[n][1] = gamma[~~(((buffer[n][1] > 128) ? buffer[n][1]: 0) * masterBrightness)]; | ||
buffer[n][2] = gamma[~~(((buffer[n][2] > 128) ? buffer[n][2]: 0) * masterBrightness)]; | ||
} | ||
@@ -80,9 +80,12 @@ //Update the Stip after Updating the Buffer | ||
LPD8806.prototype.update = function(){ | ||
buffer.push(new Buffer([0x00, 0x00, 0x00])); | ||
buffer.push(new Buffer([0x00])); | ||
spi.write(Buffer.concat(buffer)); | ||
var _buffer = buffer.slice(0, buffer.length); | ||
_buffer.push(new Buffer([0x00, 0x00, 0x00])); | ||
_buffer.push(new Buffer([0x00])); | ||
spi.write(Buffer.concat(_buffer)); | ||
}; | ||
LPD8806.prototype.fill = function(color){ | ||
for(var pixel = 0; pixel < ledCount; pixel++){ | ||
var pixel = ledCount; | ||
while(pixel--){ | ||
__set_internal(pixel, color); | ||
@@ -95,3 +98,4 @@ } | ||
LPD8806.prototype.fillRGB = function(r, g, b){ | ||
for(var pixel = 0; pixel < ledCount; pixel++){ | ||
var pixel = ledCount; | ||
while(pixel--){ | ||
__set_internal(pixel, Color({r: r, g: g, b: b})); | ||
@@ -104,3 +108,4 @@ } | ||
LPD8806.prototype.fillHSV = function(h, s, v){ | ||
for(var pixel = 0; pixel < ledCount; pixel++){ | ||
var pixel = ledCount; | ||
while(pixel--){ | ||
__set_internal(pixel, Color({h: h, s: s, v:v})); | ||
@@ -113,3 +118,4 @@ } | ||
LPD8806.prototype.allOFF = function(){ | ||
for(var pixel = 0; pixel < ledCount; pixel++){ | ||
var pixel = ledCount; | ||
while(pixel--){ | ||
__set_internal(pixel, Color({r:0 , g: 0, b: 0})); | ||
@@ -116,0 +122,0 @@ } |
{ | ||
"name": "lpd8806", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -6,3 +6,3 @@ LPD8806-node | ||
npm install https://github.com/pmdroid/LPD8806-node/archive/0.1.4.tar.gz | ||
npm install lpd8806 | ||
@@ -9,0 +9,0 @@ var LPD8806 = require('LPD8806'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197
9786