Subversion Repositories HomeAutomation

Rev

Rev 1765 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1765 Rev 1899
Line 1... Line 1...
1
 
1
 
2
Display_ModuleNames    = [ "HD44789" ];
2
Display_ModuleNames    = [ "HD44789" ];
3
Display_Height         = function() { return [ 0, 1, 2, 3  ]; };
3
Display_Height         = function() { return [ 0, 1, 2, 3  ]; };
4
Display_Width          = function() { return [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]; };
4
Display_Width          = function() { return [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]; };
5
Display_Backlight      = function() { return [ 0, 50, 100, 150, 200, 255 ]; };
5
Display_Backlight      = function() { return [ 0, 50, 100, 150, 200, 255 ]; };
-
 
6
Display_Autolight      = function() { return [ "ON", "OFF" ]; };
6
Display_Aliases        = function() { return Module_GetAliasNames(Display_ModuleNames); };
7
Display_Aliases        = function() { return Module_GetAliasNames(Display_ModuleNames); };
7
Display_AvailableIds   = function() { return Module_GetAvailableIds(Display_ModuleNames); };
8
Display_AvailableIds   = function() { return Module_GetAvailableIds(Display_ModuleNames); };
8
 
9
 
9
function Display_Clear(alias_name)
10
function Display_Clear(alias_name)
10
{
11
{
Line 80... Line 81...
80
    }
81
    }
81
   
82
   
82
    return true;
83
    return true;
83
}
84
}
84
Console_RegisterCommand(Display_SetBacklight, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Display_Aliases(), Display_Backlight()); });
85
Console_RegisterCommand(Display_SetBacklight, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Display_Aliases(), Display_Backlight()); });
-
 
86
 
-
 
87
function Display_SetBacklightAuto(alias_name, strength, autolight)
-
 
88
{
-
 
89
    if (arguments.length < 2)
-
 
90
    {
-
 
91
        Log("\033[31mNot enough parameters given.\033[0m\n");
-
 
92
        return false;
-
 
93
    }
-
 
94
   
-
 
95
    var aliases_data = Module_ResolveAlias(alias_name, Display_ModuleNames);
-
 
96
    var found = false;
-
 
97
   
-
 
98
    for (var name in aliases_data)
-
 
99
    {
-
 
100
        var variables = {
-
 
101
        "Strength" : strength,
-
 
102
        "AutoLight" : autolight
-
 
103
        };
-
 
104
       
-
 
105
        if (Module_SendMessage(aliases_data[name]["module_name"], aliases_data[name]["module_id"], "LCD_Backlight", variables))
-
 
106
        {
-
 
107
            //Log("\033[32mCommand sent successfully to " + name + ".\033[0m\n");
-
 
108
        }
-
 
109
        else
-
 
110
        {
-
 
111
            Log("\033[31mFailed to send command to " + name + ".\033[0m\n");
-
 
112
        }
-
 
113
       
-
 
114
        found = true;
-
 
115
    }
-
 
116
   
-
 
117
    if (!found)
-
 
118
    {
-
 
119
        Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n");
-
 
120
        return false;
-
 
121
    }
-
 
122
   
-
 
123
    return true;
-
 
124
}
-
 
125
Console_RegisterCommand(Display_SetBacklightAuto, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Display_Aliases(), Display_Backlight(),Display_Autolight()); });
-
 
126
 
85
 
127
 
86
 
128
 
87
function Display_Print(alias_name, x, y, text)
129
function Display_Print(alias_name, x, y, text)
88
{
130
{
89
    if (arguments.length < 4)
131
    if (arguments.length < 4)