mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' of git://github.com/node-red/node-red into multipart_stream
This commit is contained in:
@@ -193,6 +193,10 @@
|
||||
</select>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-row" id="node-set-freq">
|
||||
<label for="node-input-freq"> <span data-i18n="rpi-gpio.label.freq"></span></label>
|
||||
<input type="text" id="node-input-freq" placeholder="100">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
@@ -210,6 +214,7 @@
|
||||
<p>When using PWM mode - expects an input value of a number 0 - 100. It can be floating point.</p>
|
||||
<p>PWM mode can be used to drive a servo using input values between 10 and 20 only.
|
||||
The GPIO2 pin is best for this as it uses hardware to do the PWM.</p>
|
||||
<p>Setting high PWM frequency might occupy more CPU than expected (default is 100Hz)</p>
|
||||
<p>Requires the RPi.GPIO python library version 0.5.10 (or better) in order to work.</p>
|
||||
<p><b>Note:</b> we are using the actual physical pin numbers on connector P1 as they are easier to locate.</p>
|
||||
</script>
|
||||
@@ -224,6 +229,7 @@
|
||||
pin: { value:"",required:true,validate:RED.validators.number() },
|
||||
set: { value:"" },
|
||||
level: { value:"0" },
|
||||
freq: {value:""},
|
||||
out: { value:"out" }
|
||||
},
|
||||
inputs:1,
|
||||
@@ -297,11 +303,13 @@
|
||||
$('#node-input-set').prop('checked', false);
|
||||
$("#dig-tip").hide();
|
||||
$("#pwm-tip").show();
|
||||
$('#node-set-freq').show();
|
||||
}
|
||||
else {
|
||||
$('#node-set-tick').show();
|
||||
$("#dig-tip").show();
|
||||
$("#pwm-tip").hide();
|
||||
$('#node-set-freq').hide();
|
||||
}
|
||||
};
|
||||
$("#node-input-out").change(function () { hidestate(); });
|
||||
|
@@ -137,6 +137,7 @@ module.exports = function(RED) {
|
||||
this.pin = n.pin;
|
||||
this.set = n.set || false;
|
||||
this.level = n.level || 0;
|
||||
this.freq = n.freq || 100;
|
||||
this.out = n.out || "out";
|
||||
var node = this;
|
||||
if (!pinsInUse.hasOwnProperty(this.pin)) {
|
||||
@@ -173,7 +174,7 @@ module.exports = function(RED) {
|
||||
node.child = spawn(gpioCommand, [node.out,node.pin,node.level]);
|
||||
node.status({fill:"green",shape:"dot",text:node.level});
|
||||
} else {
|
||||
node.child = spawn(gpioCommand, [node.out,node.pin]);
|
||||
node.child = spawn(gpioCommand, [node.out,node.pin,node.freq]);
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.ok"});
|
||||
}
|
||||
node.running = true;
|
||||
|
@@ -35,8 +35,13 @@ if len(sys.argv) > 2:
|
||||
|
||||
if cmd == "pwm":
|
||||
#print "Initialised pin "+str(pin)+" to PWM"
|
||||
try:
|
||||
freq = int(sys.argv[3])
|
||||
except:
|
||||
freq = 100
|
||||
|
||||
GPIO.setup(pin,GPIO.OUT)
|
||||
p = GPIO.PWM(pin, 100)
|
||||
p = GPIO.PWM(pin, freq)
|
||||
p.start(0)
|
||||
|
||||
while True:
|
||||
|
@@ -35,7 +35,7 @@
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="mqtt in">
|
||||
<p>Connects to a broker and subscribes to the specified topic.</p>
|
||||
<p>Connects to a MQTT broker and subscribes to the specified topic.</p>
|
||||
<p>Outputs a message with the properties:</p>
|
||||
<ul>
|
||||
<li><code>msg.topic</code></li>
|
||||
@@ -107,6 +107,7 @@
|
||||
<p>Connects to a MQTT broker and publishes messages.</p>
|
||||
<p><code>msg.payload</code> is used as the payload of the published message.
|
||||
If it contains an Object it will be converted to JSON before being sent.
|
||||
If it contains a binary Buffer the message will be published as-is.
|
||||
</p>
|
||||
<p>The topic used can be configured in the node or, if left blank, can be set
|
||||
by <code>msg.topic</code>.</p>
|
||||
@@ -147,9 +148,9 @@
|
||||
<div id="mqtt-broker-tab-connection" style="display:none">
|
||||
<div class="form-row node-input-broker">
|
||||
<label for="node-config-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
||||
<input class="input-append-left" type="text" id="node-config-input-broker" placeholder="e.g. localhost" style="width: 40%;" >
|
||||
<label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> <span data-i18n="mqtt.label.port"></span></label>
|
||||
<input type="text" id="node-config-input-port" data-i18n="[placeholder]mqtt.label.port" style="width:45px">
|
||||
<input class="input-append-left" type="text" id="node-config-input-broker" placeholder="e.g. localhost" style="width:40%;" >
|
||||
<label for="node-config-input-port" style="margin-left:20px; width:35px; "> <span data-i18n="mqtt.label.port"></span></label>
|
||||
<input type="text" id="node-config-input-port" data-i18n="[placeholder]mqtt.label.port" style="width:55px">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<input type="checkbox" id="node-config-input-usetls" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
@@ -299,7 +300,7 @@
|
||||
id: "mqtt-broker-tab-will",
|
||||
label: this._("mqtt.tabs-label.will")
|
||||
});
|
||||
setTimeout(function() { tabs.resize()},0);
|
||||
setTimeout(function() { tabs.resize(); },0);
|
||||
if (typeof this.cleansession === 'undefined') {
|
||||
this.cleansession = true;
|
||||
$("#node-config-input-cleansession").prop("checked",true);
|
||||
|
@@ -66,16 +66,16 @@ module.exports = function(RED) {
|
||||
|
||||
// If the config node is missing certain options (it was probably deployed prior to an update to the node code),
|
||||
// select/generate sensible options for the new fields
|
||||
if (typeof this.usetls === 'undefined'){
|
||||
if (typeof this.usetls === 'undefined') {
|
||||
this.usetls = false;
|
||||
}
|
||||
if (typeof this.compatmode === 'undefined'){
|
||||
if (typeof this.compatmode === 'undefined') {
|
||||
this.compatmode = true;
|
||||
}
|
||||
if (typeof this.verifyservercert === 'undefined'){
|
||||
if (typeof this.verifyservercert === 'undefined') {
|
||||
this.verifyservercert = false;
|
||||
}
|
||||
if (typeof this.keepalive === 'undefined'){
|
||||
if (typeof this.keepalive === 'undefined') {
|
||||
this.keepalive = 60;
|
||||
} else if (typeof this.keepalive === 'string') {
|
||||
this.keepalive = Number(this.keepalive);
|
||||
@@ -110,7 +110,7 @@ module.exports = function(RED) {
|
||||
this.options.keepalive = this.keepalive;
|
||||
this.options.clean = this.cleansession;
|
||||
this.options.reconnectPeriod = RED.settings.mqttReconnectTime||5000;
|
||||
if (this.compatmode == "true" || this.compatmode === true){
|
||||
if (this.compatmode == "true" || this.compatmode === true) {
|
||||
this.options.protocolId = 'MQIsdp';
|
||||
this.options.protocolVersion = 3;
|
||||
}
|
||||
@@ -140,14 +140,14 @@ module.exports = function(RED) {
|
||||
var node = this;
|
||||
this.users = {};
|
||||
|
||||
this.register = function(mqttNode){
|
||||
this.register = function(mqttNode) {
|
||||
node.users[mqttNode.id] = mqttNode;
|
||||
if (Object.keys(node.users).length === 1) {
|
||||
node.connect();
|
||||
}
|
||||
};
|
||||
|
||||
this.deregister = function(mqttNode,done){
|
||||
this.deregister = function(mqttNode,done) {
|
||||
delete node.users[mqttNode.id];
|
||||
if (node.closing) {
|
||||
return done();
|
||||
@@ -266,7 +266,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (Object.keys(sub).length === 0) {
|
||||
delete node.subscriptions[topic];
|
||||
if (node.connected){
|
||||
if (node.connected) {
|
||||
node.client.unsubscribe(topic);
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ module.exports = function(RED) {
|
||||
qos: msg.qos || 0,
|
||||
retain: msg.retain || false
|
||||
};
|
||||
node.client.publish(msg.topic, msg.payload, options, function (err){return});
|
||||
node.client.publish(msg.topic, msg.payload, options, function(err) {return});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -298,7 +298,7 @@ module.exports = function(RED) {
|
||||
done();
|
||||
});
|
||||
this.client.end();
|
||||
} else if (this.connecting) {
|
||||
} else if (this.connecting || node.client.reconnecting) {
|
||||
node.client.end();
|
||||
done();
|
||||
} else {
|
||||
|
@@ -649,7 +649,8 @@
|
||||
"pikeyboard": "Pi Keyboard",
|
||||
"left": "Left",
|
||||
"right": "Right",
|
||||
"middle": "Middle"
|
||||
"middle": "Middle",
|
||||
"freq": "Frequency (Hz)"
|
||||
},
|
||||
"resistor": {
|
||||
"none": "none",
|
||||
@@ -671,7 +672,7 @@
|
||||
"pin": "<b>Pins in Use</b>: ",
|
||||
"in": "Tip: Only Digital Input is supported - input must be 0 or 1.",
|
||||
"dig": "Tip: For digital output - input must be 0 or 1.",
|
||||
"pwm": "Tip: For PWM output - input must be between 0 to 100."
|
||||
"pwm": "Tip: For PWM output - input must be between 0 to 100; setting high frequency might occupy more CPU than expected."
|
||||
},
|
||||
"types": {
|
||||
"digout": "digital output",
|
||||
|
Reference in New Issue
Block a user