mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fix colour/color type and add set_letter for single char msg
This commit is contained in:
parent
a3e2365ab9
commit
f4971aff69
@ -110,8 +110,11 @@ Format: `R<axis>`
|
|||||||
If `msg.payload` is not recognised as any of the above commands, it is treated
|
If `msg.payload` is not recognised as any of the above commands, it is treated
|
||||||
as a text message to be scrolled across the screen.
|
as a text message to be scrolled across the screen.
|
||||||
|
|
||||||
|
If the text is a single character, it will be displayed without scrolling. To
|
||||||
|
scroll a single character, append a blank space after it - `"A "`.</p>
|
||||||
|
|
||||||
The following message properties can be used to customise the appearance:
|
The following message properties can be used to customise the appearance:
|
||||||
|
|
||||||
- `msg.colour` - the colour of the text, default: `white`
|
- `msg.color` - the colour of the text, default: `white`
|
||||||
- `msg.background` - the colour of the background, default: `off`
|
- `msg.background` - the colour of the background, default: `off`
|
||||||
- `msg.speed` - the scroll speed. A value in the range 1 (slower) to 5 (faster), default: `3`
|
- `msg.speed` - the scroll speed. A value in the range 1 (slower) to 5 (faster), default: `3`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pi-sense-hat",
|
"name" : "node-red-node-pi-sense-hat",
|
||||||
"version" : "0.0.4",
|
"version" : "0.0.5",
|
||||||
"description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT",
|
"description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT",
|
||||||
"repository" : {
|
"repository" : {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
|
@ -122,9 +122,11 @@ the horizontal or vertical axis respectively.</p>
|
|||||||
<p><b>Scroll a message</b></p>
|
<p><b>Scroll a message</b></p>
|
||||||
<p>If <code>msg.payload</code> is not recognised as any of the above commands,
|
<p>If <code>msg.payload</code> is not recognised as any of the above commands,
|
||||||
it is treated as a text message to be scrolled across the screen.</p>
|
it is treated as a text message to be scrolled across the screen.</p>
|
||||||
|
<p>If the text is a single character, it will be displayed without scrolling.
|
||||||
|
To scroll a single character, append a blank space after it - <code>"A "</code>.</p>
|
||||||
<p>The following message properties can be used to customise the appearance:</p>
|
<p>The following message properties can be used to customise the appearance:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>msg.colour</code> - the colour of the text, default: <code>white</code></li>
|
<li><code>msg.color</code> - the colour of the text, default: <code>white</code></li>
|
||||||
<li><code>msg.background</code> - the colour of the background, default: <code>off</code></li>
|
<li><code>msg.background</code> - the colour of the background, default: <code>off</code></li>
|
||||||
<li><code>msg.speed</code> - the scroll speed. A value in the range 1 (slower) to 5 (faster), default: <code>3</code></li>
|
<li><code>msg.speed</code> - the scroll speed. A value in the range 1 (slower) to 5 (faster), default: <code>3</code></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -232,7 +232,7 @@ module.exports = function(RED) {
|
|||||||
HAT.close(this,done);
|
HAT.close(this,done);
|
||||||
});
|
});
|
||||||
var handleTextMessage = function(line,msg) {
|
var handleTextMessage = function(line,msg) {
|
||||||
var textCol = colours.getRGB(msg.color);
|
var textCol = colours.getRGB(msg.color||msg.colour);
|
||||||
var backCol = colours.getRGB(msg.background);
|
var backCol = colours.getRGB(msg.background);
|
||||||
var speed = null;
|
var speed = null;
|
||||||
if (!isNaN(msg.speed)) {
|
if (!isNaN(msg.speed)) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
# R[rot] - rotate by rot (0,90,180,270)
|
# R[rot] - rotate by rot (0,90,180,270)
|
||||||
# P[x,y,R,G,B]+ - set individual pixel(s) to a colour
|
# P[x,y,R,G,B]+ - set individual pixel(s) to a colour
|
||||||
# T[R,G,B[,R,G,B][,S]:]Message - scroll a message (nb: if message contains ':' it must be prefixed with ':')
|
# T[R,G,B[,R,G,B][,S]:]Message - scroll a message (nb: if message contains ':' it must be prefixed with ':')
|
||||||
|
# if message is a single char, uses show_letter instead
|
||||||
# F[H|V] - flip horizontal|vertical
|
# F[H|V] - flip horizontal|vertical
|
||||||
# X[0|1] - high frequency reporting (accel/gyro/orientation/compass) off|on
|
# X[0|1] - high frequency reporting (accel/gyro/orientation/compass) off|on
|
||||||
# Y[0|1] - low frequency reporting (temperature/humidity/pressure) off|on
|
# Y[0|1] - low frequency reporting (temperature/humidity/pressure) off|on
|
||||||
@ -173,8 +174,11 @@ def process_command(data):
|
|||||||
tcol = (int(c[0]),int(c[1]),int(c[2]))
|
tcol = (int(c[0]),int(c[1]),int(c[2]))
|
||||||
bcol = (int(c[3]),int(c[4]),int(c[5]))
|
bcol = (int(c[3]),int(c[4]),int(c[5]))
|
||||||
speed = float(c[6])
|
speed = float(c[6])
|
||||||
|
if len(data) > 1:
|
||||||
scroll = ScrollThread(tcol,bcol,speed,data);
|
scroll = ScrollThread(tcol,bcol,speed,data);
|
||||||
scroll.start()
|
scroll.start()
|
||||||
|
else:
|
||||||
|
SH.show_letter(data,text_colour=tcol,back_colour=bcol)
|
||||||
elif data[0] == "F":
|
elif data[0] == "F":
|
||||||
if data[1] == "H":
|
if data[1] == "H":
|
||||||
SH.flip_h()
|
SH.flip_h()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user