Add dim command

This commit is contained in:
Nick O'Leary
2016-03-04 22:23:43 +00:00
parent f4971aff69
commit 9301ab6c97
5 changed files with 22 additions and 3 deletions

View File

@@ -232,8 +232,8 @@ module.exports = function(RED) {
HAT.close(this,done);
});
var handleTextMessage = function(line,msg) {
var textCol = colours.getRGB(msg.color||msg.colour);
var backCol = colours.getRGB(msg.background);
var textCol = colours.getRGB(msg.color||msg.colour)||"255,255,255";
var backCol = colours.getRGB(msg.background)||"0,0,0";
var speed = null;
if (!isNaN(msg.speed)) {
speed = msg.speed;
@@ -245,6 +245,7 @@ module.exports = function(RED) {
command += ","+backCol;
}
}
if (speed) {
var s = parseInt(speed);
if (s >= 1 && s <= 5) {
@@ -325,6 +326,8 @@ module.exports = function(RED) {
command = line.toUpperCase();
} else if (/^F(H|V)$/i.test(line)) {
command = line.toUpperCase();
} else if (/^D(0|1)$/i.test(line)) {
command = line.toUpperCase();
} else {
command = handleTextMessage(line,msg);
}