1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

detect Pi updates for LEDborg, mcp3008 and neopixel

This commit is contained in:
Dave Conway-Jones 2016-11-02 10:02:07 +00:00
parent d9c551c026
commit d52f9dcd30
6 changed files with 18 additions and 10 deletions

View File

@ -24,9 +24,11 @@ module.exports = function(RED) {
var gpioCommand = __dirname+'/nrgpio'; var gpioCommand = __dirname+'/nrgpio';
if (!fs.existsSync("/dev/ttyAMA0")) { // unlikely if not on a Pi try {
//util.log("Info : Ignoring Raspberry LEDborg specific node."); var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString();
throw "Info : Ignoring Raspberry LEDborg specific node."; if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); }
} catch(err) {
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
} }
if (!fs.existsSync("/usr/share/doc/python-rpi.gpio")) { if (!fs.existsSync("/usr/share/doc/python-rpi.gpio")) {

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-ledborg", "name" : "node-red-node-ledborg",
"version" : "0.0.15", "version" : "0.0.16",
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.", "description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
"dependencies" : { "dependencies" : {
}, },

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-pi-mcp3008", "name" : "node-red-node-pi-mcp3008",
"version" : "0.0.2", "version" : "0.0.3",
"description" : "A Node-RED node to read from the MCP3008 Analogue to Digital Converter", "description" : "A Node-RED node to read from the MCP3008 Analogue to Digital Converter",
"dependencies" : { "dependencies" : {
"mcp-spi-adc": "^0.0.1" "mcp-spi-adc": "^0.0.1"

View File

@ -18,8 +18,12 @@ module.exports = function(RED) {
"use strict"; "use strict";
var fs = require('fs'); var fs = require('fs');
// unlikely if not on a Pi // unlikely if not on a Pi
try { fs.statSync("/dev/ttyAMA0"); } try {
catch(err) { throw "Info : Ignoring Raspberry Pi specific node"; } var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString();
if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); }
} catch(err) {
throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
}
var mcpadc = require('mcp-spi-adc'); var mcpadc = require('mcp-spi-adc');
var mcp3008 = []; var mcp3008 = [];

View File

@ -22,8 +22,10 @@ module.exports = function(RED) {
var piCommand = __dirname+'/neopix'; var piCommand = __dirname+'/neopix';
if (!fs.existsSync("/dev/ttyAMA0")) { // unlikely if not on a Pi try {
//RED.log.info(RED._("rpi-gpio.errors.ignorenode")); var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString();
if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); }
} catch(err) {
throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); throw "Info : "+RED._("rpi-gpio.errors.ignorenode");
} }

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-pi-neopixel", "name" : "node-red-node-pi-neopixel",
"version" : "0.0.12", "version" : "0.0.13",
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.", "description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
"dependencies" : { "dependencies" : {
}, },