translator, wb_editors
4544
правки
Matveevrj (обсуждение | вклад) (Новая страница: «Since changing the brightness requires a time-consuming action, we use a timer. We also control the state of the input with the button and stop the action when the button is released.») |
Matveevrj (обсуждение | вклад) |
||
Строка 349: | Строка 349: | ||
/* --------------------------------------- */ | /* --------------------------------------- */ | ||
/* 3. Long Press Counter: Increase brightness */ | /* 3. Long Press Counter: Increase brightness */ | ||
/* --------------------------------------- */ | /* --------------------------------------- */ | ||
defineRule({ | defineRule({ | ||
whenChanged: "wb-mcm8_20/Input 1 Long Press Counter", | whenChanged: "wb-mcm8_20/Input 1 Long Press Counter", | ||
Строка 363: | Строка 360: | ||
} | } | ||
}); | }); | ||
// A rule that will increase the brightness on a timer | // A rule that will increase the brightness on a timer | ||
defineRule({ | defineRule({ | ||
Строка 371: | Строка 366: | ||
then: function () { | then: function () { | ||
var i = dev["wb-mdm3_58/Channel 1"]; | var i = dev["wb-mdm3_58/Channel 1"]; | ||
if (i < 100 && dev["wb-mcm8_20/Input 1"]) { | |||
if (i < 100 && dev["wb-mcm8_20/Input 1"]) { | |||
i++ | i++ | ||
dev["wb-mdm3_58/Channel 1"] = i | dev["wb-mdm3_58/Channel 1"] = i | ||
Строка 382: | Строка 375: | ||
} | } | ||
}); | }); | ||
/* -------------------------------------------- */ | /* -------------------------------------------- */ | ||
/* 4. Shortlong Press Counter: Decrease brightness */ | /* 4. Shortlong Press Counter: Decrease brightness */ | ||
/* -------------------------------------------- */ | /* -------------------------------------------- */ | ||
defineRule({ | defineRule({ | ||
whenChanged: "wb-mcm8_20/Input 1 Shortlong Press Counter", | whenChanged: "wb-mcm8_20/Input 1 Shortlong Press Counter", | ||
Строка 399: | Строка 388: | ||
} | } | ||
}); | }); | ||
// A rule that will decrease the brightness on a timer | // A rule that will decrease the brightness on a timer | ||
defineRule({ | defineRule({ | ||
Строка 407: | Строка 394: | ||
then: function () { | then: function () { | ||
var i = dev["wb-mdm3_58/Channel 1"]; | var i = dev["wb-mdm3_58/Channel 1"]; | ||
if (i > 0 && dev["wb-mcm8_20/Input 1"]) { | |||
if (i > 0 && dev["wb-mcm8_20/Input 1"]) { | |||
i-- | i-- | ||
dev["wb-mdm3_58/Channel 1"] = i | dev["wb-mdm3_58/Channel 1"] = i | ||
Строка 418: | Строка 403: | ||
} | } | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="ru" dir="ltr" class="mw-content-ltr"> | <div lang="ru" dir="ltr" class="mw-content-ltr"> |