1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
This commit is contained in:
Dave Conway-Jones 2020-06-15 23:16:59 +01:00
commit 6161df3380
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
6 changed files with 67 additions and 23 deletions

View File

@ -0,0 +1,9 @@
<script type="text/x-red" data-help-name="rpi-lcd">
<p>Raspberry Pi output to a HD44780 style LCD. Usually 1, 2, or 4 lines of characters.</p>
<p>Expects a <code>msg.payload</code> with a string in it.</p>
<p>Strings for the second line of the display must start <b>2:</b> - the third start <b>3:</b> - and the fourth <b>4:</b></p>
<p>To clear the display send the string <b>clr:</b></p>
<p>It is up to you to manage string lengths to suit the display.</p>
<p>Requires the RPi.GPIO python library version 0.5.8 (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>

View File

@ -0,0 +1,19 @@
{
"pilcd": {
"label": {
"pins": "Pins"
},
"tip": {
"tip": "<b>Tip</b>: Pins MUST be a comma separated list of the 6 GPIO connector pin numbers that are connected to the RS, E, D4, D5, D6 and D7 pins of the LCD."
},
"status": {
"not-available": "not available",
"na": "N/A : __value__"
},
"errors": {
"ignorenode": "Raspberry Pi specific node set inactive",
"libnotfound": "Cannot find Pi RPi.GPIO python library",
"needtobeexecutable": "__command__ needs to be executable"
}
}
}

View File

@ -0,0 +1,9 @@
<script type="text/x-red" data-help-name="rpi-lcd">
<p>Raspberry PiがHD44780スタイルのLCDへ、通常1、2、4行の文字列を表示します。</p>
<p>本ノードは、文字列型の<code>msg.payload</code>を受け付けます。</p>
<p>ディスプレイの2行目に文字列を表示するには、<b>2:</b>から始まる文字列にします。3行目の場合は<b>3:</b>、4行目の場合は<b>4:</b>です。</p>
<p>表示をクリアするには、文字列<b>clr:</b>を送信します。</p>
<p>ディスプレイに合わせて文字列の長さを調整するのは、あなた自身で行ってください。</p>
<p>このードを動作させるには、RPi.GPIO Pythonライブラリバージョン0.5.8(またはそれ以上)が必要です。</p>
<p><b>注釈:</b> 位置付けしやすい様に、コネクタP1の実際の物理ピン番号を使用しています。</p>
</script>

View File

@ -0,0 +1,19 @@
{
"pilcd": {
"label": {
"pins": "ピン"
},
"tip": {
"tip": "<b>注釈</b>: LCDのRS、E、D4、D5、D6、およびD7ピンに接続されている6つのGPIOコネクタのピン番号を、コンマで区切りでピンに入力する必要があります。"
},
"status": {
"not-available": "利用不可",
"na": "N/A : __value__"
},
"errors": {
"ignorenode": "Raspberry Pi固有のードを無視しました",
"libnotfound": "RPi.GPIO pythonライブラリを見つけられませんでした",
"needtobeexecutable": "__command__ は実行可能である必要があります"
}
}
}

View File

@ -1,26 +1,14 @@
<script type="text/x-red" data-template-name="rpi-lcd">
<div class="form-row">
<label for="node-input-pins"><i class="fa fa-circle"></i> Pins</label>
<label for="node-input-pins"><i class="fa fa-circle"></i> <span data-i18n="pilcd.label.pins"></label>
<input type="text" id="node-input-pins" placeholder="RS,E,D4,D5,D6,D7">
</div>
<br/>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-tips"><b>Tip</b>: Pins MUST be a comma separated list of the 6 GPIO
connector pin numbers that are connected to the RS, E, D4, D5, D6 and D7 pins of the LCD.</div>
</script>
<script type="text/x-red" data-help-name="rpi-lcd">
<p>Raspberry Pi output to a HD44780 style LCD. Usually 1, 2, or 4 lines of characters.</p>
<p>Expects a <code>msg.payload</code> with a string in it.</p>
<p>Strings for the second line of the display must start <b>2:</b> - the third start <b>3:</b> - and the fourth <b>4:</b></p>
<p>To clear the display send the string <b>clr:</b></p>
<p>It is up to you to manage string lengths to suit the display.</p>
<p>Requires the RPi.GPIO python library version 0.5.8 (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>
<div class="form-tips" data-i18n="[html]pilcd.tip.tip"></div>
</script>
<script type="text/javascript">

View File

@ -11,20 +11,20 @@ module.exports = function(RED) {
try {
var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString();
if (cpuinfo.indexOf(": BCM") === -1) {
RED.log.warn("rpi-lcd : "+RED._("node-red:rpi-gpio.errors.ignorenode"));
RED.log.warn("rpi-lcd : "+RED._("pilcd.errors.ignorenode"));
allOK = false;
}
else if (!fs.existsSync("/usr/share/doc/python-rpi.gpio")) {
RED.log.warn("rpi-lcd : "+RED._("node-red:rpi-gpio.errors.libnotfound"));
RED.log.warn("rpi-lcd : "+RED._("pilcd.errors.libnotfound"));
allOK = false;
}
else if (!(1 & parseInt ((fs.statSync(gpioCommand).mode & parseInt ("777", 8)).toString (8)[0]))) {
RED.log.warn("rpi-lcd : "+RED._("node-red:rpi-gpio.errors.needtobeexecutable",{command:gpioCommand}));
RED.log.warn("rpi-lcd : "+RED._("pilcd.errors.needtobeexecutable",{command:gpioCommand}));
allOK = false;
}
}
catch(err) {
RED.log.warn("rpi-lcd : "+RED._("node-red:rpi-gpio.errors.ignorenode"));
RED.log.warn("rpi-lcd : "+RED._("pilcd.errors.ignorenode"));
allOK = false;
}
@ -89,9 +89,9 @@ module.exports = function(RED) {
});
}
else {
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
node.on("input", function(msg) {
node.status({fill:"grey",shape:"dot",text:RED._("node-red:rpi-gpio.status.na",{value:msg.payload.toString()})});
node.status({fill:"grey",shape:"dot",text:"pilcd.status.not-available"});
node.on("input", function(msg){
node.status({fill:"grey",shape:"dot",text:RED._("pilcd.status.na",{value:msg.payload.toString()})});
});
}
}