mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	bump serialport dependency, add ja translation for baudrate message, fix linting, bump package
This commit is contained in:
		| @@ -41,19 +41,19 @@ module.exports = function(RED) { | ||||
|             node.port = serialPool.get(this.serialConfig); | ||||
|  | ||||
|             node.on("input",function(msg) { | ||||
| 				if (msg.hasOwnProperty("baudrate")) { | ||||
| 					var baud = parseInt(msg.baudrate); | ||||
| 					if (isNaN(baud)) { | ||||
|                 if (msg.hasOwnProperty("baudrate")) { | ||||
|                     var baud = parseInt(msg.baudrate); | ||||
|                     if (isNaN(baud)) { | ||||
|                         node.error(RED._("serial.errors.badbaudrate"),msg); | ||||
| 					} else { | ||||
| 						node.port.update({baudRate: baud},function(err,res) { | ||||
| 							if (err) { | ||||
| 								var errmsg = err.toString().replace("Serialport","Serialport "+node.port.serial.path); | ||||
| 								node.error(errmsg,msg); | ||||
| 							} | ||||
| 						}); | ||||
| 					} | ||||
| 				} | ||||
|                     } else { | ||||
|                         node.port.update({baudRate: baud},function(err,res) { | ||||
|                             if (err) { | ||||
|                                 var errmsg = err.toString().replace("Serialport","Serialport "+node.port.serial.path); | ||||
|                                 node.error(errmsg,msg); | ||||
|                             } | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|                 if (!msg.hasOwnProperty("payload")) { return; } // do nothing unless we have a payload | ||||
|                 var payload = node.port.encodePayload(msg.payload); | ||||
|                 node.port.write(payload,function(err,res) { | ||||
| @@ -135,18 +135,18 @@ module.exports = function(RED) { | ||||
|             // Serial Out | ||||
|             node.on("input",function(msg) { | ||||
|                 if (msg.hasOwnProperty("baudrate")) { | ||||
| 					var baud = parseInt(msg.baudrate); | ||||
| 					if (isNaN(baud)) { | ||||
| 						node.error(RED._("serial.errors.badbaudrate"),msg); | ||||
| 					} else { | ||||
| 						node.port.update({baudRate: baud},function(err,res) { | ||||
| 							if (err) { | ||||
| 								var errmsg = err.toString().replace("Serialport","Serialport "+node.port.serial.path); | ||||
| 								node.error(errmsg,msg); | ||||
| 							} | ||||
| 						}); | ||||
| 					} | ||||
| 				} | ||||
|                     var baud = parseInt(msg.baudrate); | ||||
|                     if (isNaN(baud)) { | ||||
|                         node.error(RED._("serial.errors.badbaudrate"),msg); | ||||
|                     } else { | ||||
|                         node.port.update({baudRate: baud},function(err,res) { | ||||
|                             if (err) { | ||||
|                                 var errmsg = err.toString().replace("Serialport","Serialport "+node.port.serial.path); | ||||
|                                 node.error(errmsg,msg); | ||||
|                             } | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|                 if (!msg.hasOwnProperty("payload")) { return; } // do nothing unless we have a payload | ||||
|                 if (msg.hasOwnProperty("count") && (typeof msg.count === "number") && (node.serialConfig.out === "count")) { | ||||
|                     node.serialConfig.newline = msg.count; | ||||
| @@ -275,7 +275,7 @@ module.exports = function(RED) { | ||||
|                             return payload; | ||||
|                         }, | ||||
|                         write: function(m,cb) { this.serial.write(m,cb); }, | ||||
| 			update: function(m,cb) { this.serial.update(m,cb); }, | ||||
|                         update: function(m,cb) { this.serial.update(m,cb); }, | ||||
|                         enqueue: function(msg,sender,cb) { | ||||
|                             var payload = this.encodePayload(msg.payload); | ||||
|                             var qobj = { | ||||
|   | ||||
| @@ -67,7 +67,7 @@ | ||||
|             "disconnected": "serial port __port__ disconnected", | ||||
|             "closed": "serial port __port__ closed", | ||||
|             "list": "Failed to list ports. Please enter manually.", | ||||
|             "badbaudrate": "Baudrate is not valid" | ||||
|             "badbaudrate": "Baudrate is invalid" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -52,7 +52,7 @@ | ||||
|             "disconnected": "serial port __port__ disconnected", | ||||
|             "closed": "serial port __port__ closed", | ||||
|             "list": "ポートのリスト化に失敗しました。手動で入力してください。", | ||||
|             "badbaudrate": "Baudrate is not valid" | ||||
|             "badbaudrate": "ボーレートが不正です" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| { | ||||
|     "name"          : "node-red-node-serialport", | ||||
|     "version"       : "0.10.3", | ||||
|     "version"       : "0.11.0", | ||||
|     "description"   : "Node-RED nodes to talk to serial ports", | ||||
|     "dependencies"  : { | ||||
|         "serialport"   : "^8.0.8" | ||||
|         "serialport"   : "^9.0.1" | ||||
|     }, | ||||
|     "repository" : { | ||||
|         "type":"git", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user