Fixed easeTime parameter for static mode

This commit is contained in:
Mark van Renswoude 2017-05-20 10:15:24 +02:00
parent 242155a64c
commit 65e34bfdd1
3 changed files with 5 additions and 3 deletions

View File

@ -142,6 +142,7 @@ Sets all steps to the same brightness.
Parameters:<br> Parameters:<br>
**brightness** (word): value in range 0 (off) to 4095 (fully on). **brightness** (word): value in range 0 (off) to 4095 (fully on).
**easeTime** (word): the time in milliseconds to ease into the new brightness value (only applies if the mode was already set to static before).
### Custom ### Custom

View File

@ -9,7 +9,7 @@
struct StaticModeParameters struct StaticModeParameters
{ {
uint16_t brightness; uint16_t brightness;
uint32_t easeTime; uint16_t easeTime;
}; };
enum EaseState enum EaseState

View File

@ -95,7 +95,8 @@ function readModeData(mode, reader)
{ {
case protocol.Mode.Static: case protocol.Mode.Static:
return { return {
brightness: reader.nextInt16LE() brightness: reader.nextInt16LE(),
easeTime: reader.nextInt16LE()
}; };
case protocol.Mode.Custom: case protocol.Mode.Custom:
@ -157,7 +158,7 @@ function writeModeData(mode, data)
case protocol.Mode.Static: case protocol.Mode.Static:
var brightness = getBrightness(data.brightness); var brightness = getBrightness(data.brightness);
return new Buffer([protocol.Command.SetMode, mode, lsb(brightness), msb(brightness)]); return new Buffer([protocol.Command.SetMode, mode, lsb(brightness), msb(brightness), lsb(500), msb(500)]);
case protocol.Mode.Custom: case protocol.Mode.Custom:
var brightness = typeof(data.brightness) !== 'undefined' ? data.brightness.split(',') : []; var brightness = typeof(data.brightness) !== 'undefined' ? data.brightness.split(',') : [];