diff --git a/docs/protocol.md b/docs/protocol.md index ffd7339..2827f1f 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -142,6 +142,7 @@ Sets all steps to the same brightness. Parameters:
**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 diff --git a/src/modes/static.h b/src/modes/static.h index 8db5895..5ee9472 100644 --- a/src/modes/static.h +++ b/src/modes/static.h @@ -9,7 +9,7 @@ struct StaticModeParameters { uint16_t brightness; - uint32_t easeTime; + uint16_t easeTime; }; enum EaseState diff --git a/web/client.js b/web/client.js index 41177a2..5762db1 100644 --- a/web/client.js +++ b/web/client.js @@ -95,7 +95,8 @@ function readModeData(mode, reader) { case protocol.Mode.Static: return { - brightness: reader.nextInt16LE() + brightness: reader.nextInt16LE(), + easeTime: reader.nextInt16LE() }; case protocol.Mode.Custom: @@ -157,7 +158,7 @@ function writeModeData(mode, data) case protocol.Mode.Static: 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: var brightness = typeof(data.brightness) !== 'undefined' ? data.brightness.split(',') : [];