mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
fixes for noe-pixel to check more thoroughly for new libs
while supporting old ones also.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-pi-unicorn-hat",
|
||||
"version" : "0.0.15",
|
||||
"version" : "0.0.16",
|
||||
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
|
||||
"dependencies" : {
|
||||
"pngjs": "2.2.*"
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
var fs = require('fs');
|
||||
|
||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel')) {
|
||||
console.warn("WARNING : Can't find unicorn.py python library");
|
||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/unicornhat.py')) {
|
||||
console.warn("WARNING : Can't find required python library");
|
||||
console.warn("WARNING : Please install using the following command");
|
||||
console.warn("WARNING : Note: this uses root...");
|
||||
console.warn("WARNING : curl -sS get.pimoroni.com/unicornhat | bash\n");
|
||||
//process.exit(1);
|
||||
}
|
||||
else {
|
||||
console.log("Unicorn Hat Python library found OK.\n")
|
||||
console.log("Python library found OK.\n")
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ module.exports = function(RED) {
|
||||
var fs = require('fs');
|
||||
var PNG = require('pngjs').PNG;
|
||||
var spawn = require('child_process').spawn;
|
||||
var execSync = require('child_process').execSync;
|
||||
|
||||
var hatCommand = __dirname+'/unihat';
|
||||
|
||||
@@ -12,9 +13,9 @@ module.exports = function(RED) {
|
||||
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
|
||||
}
|
||||
|
||||
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/neopixel')) {
|
||||
RED.log.warn("Can't find Unicorn HAT python libraries");
|
||||
throw "Warning : Can't find Unicorn HAT python libraries";
|
||||
if (execSync('python -c "import neopixel"').toString() !== "") {
|
||||
RED.log.warn("Can't find neopixel python library");
|
||||
throw "Warning : Can't find neopixel python library";
|
||||
}
|
||||
|
||||
if ( !(1 & parseInt ((fs.statSync(hatCommand).mode & parseInt ("777", 8)).toString (8)[0]) )) {
|
||||
|
Reference in New Issue
Block a user