mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Various little tweaks - less console.log more util.log, add exra try/catch to serial, add wiring-pi url to Pi "error message".
This commit is contained in:
		| @@ -43,7 +43,7 @@ function Xml2jsNode(n) { | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
| 		catch(e) { console.log(e); } | ||||
|         catch(e) { util.log("[73-parsexml.js] "+e); } | ||||
|     }); | ||||
| } | ||||
| RED.nodes.registerType("xml2js",Xml2jsNode); | ||||
|   | ||||
| @@ -22,7 +22,7 @@ var fs =  require('fs'); | ||||
| if (!fs.existsSync("/usr/local/bin/gpio")) { | ||||
|     exec("cat /proc/cpuinfo | grep BCM27",function(err,stdout,stderr) { | ||||
|         if (stdout.indexOf('BCM27') > -1) { | ||||
| 			util.log('[36-rpi-gpio.js] Error: Cannot find Wiring-Pi "gpio" command'); | ||||
|             util.log('[36-rpi-gpio.js] Error: Cannot find Wiring-Pi "gpio" command. http://wiringpi.com/download-and-install/'); | ||||
|         } | ||||
|         // else not on a Pi so don't worry anyone with needless messages. | ||||
|     }); | ||||
|   | ||||
| @@ -15,11 +15,10 @@ | ||||
|  **/ | ||||
|  | ||||
| var RED = require("../../red/red"); | ||||
|  | ||||
| var settings = RED.settings; | ||||
| var events = require("events"); | ||||
| var util = require("util"); | ||||
| var serialp = require("serialport"); | ||||
| var settings = RED.settings; | ||||
|  | ||||
| // TODO: 'serialPool' should be encapsulated in SerialPortNode | ||||
|  | ||||
| @@ -58,9 +57,9 @@ function SerialOutNode(n) { | ||||
|         this.error("missing serial config"); | ||||
|     } | ||||
| } | ||||
|  | ||||
| RED.nodes.registerType("serial out",SerialOutNode); | ||||
|  | ||||
|  | ||||
| SerialOutNode.prototype.close = function() { | ||||
|     if (this.serialConfig) { | ||||
|         serialPool.close(this.serialConfig.serialport); | ||||
| @@ -90,9 +89,9 @@ function SerialInNode(n) { | ||||
|         this.error("missing serial config"); | ||||
|     } | ||||
| } | ||||
|  | ||||
| RED.nodes.registerType("serial in",SerialInNode); | ||||
|  | ||||
|  | ||||
| SerialInNode.prototype.close = function() { | ||||
|     if (this.serialConfig) { | ||||
|         try { | ||||
| @@ -121,6 +120,7 @@ var serialPool = function() { | ||||
|                     } | ||||
|                     newline = newline.replace("\\n","\n").replace("\\r","\r"); | ||||
|                     var setupSerial = function() { | ||||
|                         try { | ||||
|                             if (newline == "") { | ||||
|                                 obj.serial = new serialp.SerialPort(port,{ | ||||
|                                         baudrate: baud, | ||||
| @@ -163,6 +163,7 @@ var serialPool = function() { | ||||
|                                     obj._emitter.emit('data',d); | ||||
|                                 } | ||||
|                             }); | ||||
|                         } catch(err) { console.log("Booo!",err,"Booo!"); } | ||||
|                     } | ||||
|                     setupSerial(); | ||||
|                     return obj; | ||||
| @@ -178,8 +179,7 @@ var serialPool = function() { | ||||
|                     connections[port].close(function() { | ||||
|                             util.log("[serial] serial port closed"); | ||||
|                     }); | ||||
|                 } catch(err) { | ||||
|                 }; | ||||
|                 } catch(err) { }; | ||||
|             } | ||||
|             delete connections[port]; | ||||
|         } | ||||
|   | ||||
| @@ -330,7 +330,7 @@ a.brand img { | ||||
| } | ||||
| .node_highlighted { | ||||
|    stroke: #dd1616; | ||||
|    stroke-width: 2; | ||||
|    stroke-width: 3; | ||||
|    stroke-dasharray: 10, 4; | ||||
| } | ||||
| .node_hovered { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user