Rev 1608 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1608 | Rev 1609 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | 4 | ||
| 5 | function test_press(event, id, channel, data, protocol) |
5 | function test_press(event, id, channel, data, protocol) |
| 6 | { |
6 | { |
| 7 | if (protocol == "NEC" && data == 3877174275) |
7 | if (protocol == "NEC" && data == 3877174275) |
| 8 | { |
8 | { |
| 9 |
|
9 | Dimmer230_StartFade(2, 0, 135, "Increase"); |
| 10 |
|
10 | Dimmer230_StartFade(1, 0, 135, "Increase"); |
| 11 | } |
11 | } |
| 12 | else if (protocol == "NEC" && data == 3860462595) |
12 | else if (protocol == "NEC" && data == 3860462595) |
| 13 | { |
13 | { |
| 14 |
|
14 | Dimmer230_StartFade(2, 0, 135, "Decrease"); |
| 15 |
|
15 | Dimmer230_StartFade(1, 0, 135, "Decrease"); |
| 16 | } |
16 | } |
| 17 | } |
17 | } |
| 18 | 18 | ||
| 19 | function test_release(event, id, channel, data, protocol) |
19 | function test_release(event, id, channel, data, protocol) |
| 20 | { |
20 | { |
| 21 | if (protocol == "NEC" && (data == 3877174275 || data == 3860462595)) |
21 | if (protocol == "NEC" && (data == 3877174275 || data == 3860462595)) |
| 22 | { |
22 | { |
| 23 |
|
23 | Dimmer230_StopFade(2, 0); |
| 24 | } |
24 | } |
| 25 | } |
25 | } |
| 26 | 26 | ||
| 27 | function test_status(event, id, available) |
27 | function test_status(event, id, available) |
| 28 | { |
28 | { |
| 29 | Log("status change!"); |
29 | Log("status change!"); |
| 30 | dimmer_module.AbsoluteFade(2, 0, 135, 0); |
- | |
| 31 | } |
30 | } |
| 32 | 31 | ||
| 33 | ir_module.Bind("onStatusChange", test_status); |
32 | ir_module.Bind("onStatusChange", test_status); |
| 34 | ir_module.Bind("onPressed", test_press); |
33 | ir_module.Bind("onPressed", test_press); |
| 35 | ir_module.Bind("onReleased", test_release); |
34 | ir_module.Bind("onReleased", test_release); |
| 36 | 35 | ||
| 37 | 36 | ||
| 38 | function dmin() |
37 | function dmin() |
| 39 | { |
38 | { |
| 40 |
|
39 | Dimmer230_AbsoluteFade(2, 0, 135, 0); |
| 41 |
|
40 | Dimmer230_AbsoluteFade(1, 0, 135, 0); |
| 42 | return "Faded to 0\n"; |
41 | return "Faded to 0\n"; |
| 43 | } |
42 | } |
| 44 | 43 | ||
| 45 | function dmax() |
44 | function dmax() |
| 46 | { |
45 | { |
| 47 |
|
46 | Dimmer230_AbsoluteFade(2, 0, 135, 255); |
| 48 |
|
47 | Dimmer230_AbsoluteFade(1, 0, 135, 255); |
| 49 | return "Faded to 255\n"; |
48 | return "Faded to 255\n"; |
| 50 | } |
49 | } |
| 51 | 50 | ||
| 52 | function dfade(level) |
51 | function dfade(level) |
| 53 | { |
52 | { |
| 54 |
|
53 | Dimmer230_AbsoluteFade(2, 0, 135, level); |
| 55 |
|
54 | Dimmer230_AbsoluteFade(1, 0, 135, level); |
| 56 | return "Faded to " + level + "\n"; |
55 | return "Faded to " + level + "\n"; |
| 57 | } |
56 | } |
| 58 | 57 | ||
| - | 58 | function dfade_complete(args) |
|
| - | 59 | { |
|
| - | 60 | var result = new Array(); |
|
| - | 61 | ||
| - | 62 | var arg_index = args.length - 1; |
|
| - | 63 | ||
| - | 64 | if (arg_index == 1) |
|
| - | 65 | { |
|
| - | 66 | result.push(0); |
|
| - | 67 | result.push(100); |
|
| - | 68 | result.push(200); |
|
| - | 69 | result.push(255); |
|
| - | 70 | } |
|
| - | 71 | ||
| - | 72 | return result; |
|
| - | 73 | } |
|
| - | 74 | ||
| 59 |
|
75 | RegisterConsoleCommand("dmax"); |
| 60 |
|
76 | RegisterConsoleCommand("dmin"); |
| 61 |
|
77 | RegisterConsoleCommand("dfade", dfade_complete); |