Skip to content

Commit

Permalink
[interactor] further fix candles in scenes
Browse files Browse the repository at this point in the history
Make sure that the appropriate width is provided.

Ideally the scene itself records the width, but I  have decided to not
spend that time right now.
  • Loading branch information
delfick committed Aug 15, 2021
1 parent d418ba0 commit 89a9288
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions apps/interactor/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Changelog
=========

.. _release-interactor-0-9-1:

0.9.1 - TBD
* Further fix applying scenes to candles

.. _release-interactor-0-9-0:

0.9.0 - 15 August 2021
Expand Down
9 changes: 7 additions & 2 deletions apps/interactor/interactor/database/models/scene_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self):
range_spec(0, 360),
range_spec(0, 1),
range_spec(0, 1),
range_spec(2500, 9000, spec=sb.integer_spec()),
range_spec(1500, 9000, spec=sb.integer_spec()),
]

def normalise_filled(self, meta, val):
Expand Down Expand Up @@ -166,12 +166,17 @@ def chain_msgs(self, overrides):
duration = self.determine_duration(overrides)
for i, lst in enumerate(self.chain):
colors = self.colors_from_hsbks(lst, overrides)

width = 8
if len(colors) == 30:
width = 5

yield TileMessages.Set64(
tile_index=i,
length=1,
x=0,
y=0,
width=8,
width=width,
duration=duration,
colors=colors,
res_required=False,
Expand Down
8 changes: 4 additions & 4 deletions apps/interactor/tests/database/models/test_scene_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ def overrides():
with assertRaises(BadSpecValue, "Number must be between min and max", minimum=0, maximum=1):
spec.normalise(meta, [360, 1, 1.1, 3500])

it "complains if kelvin is outside 2500 and 9000", meta:
it "complains if kelvin is outside 1500 and 9000", meta:
spec = scene_spec.hsbk()

with assertRaises(
BadSpecValue, "Number must be between min and max", minimum=2500, maximum=9000
BadSpecValue, "Number must be between min and max", minimum=1500, maximum=9000
):
spec.normalise(meta, [1, 0, 0, 2499])
spec.normalise(meta, [1, 0, 0, 1000])

with assertRaises(
BadSpecValue, "Number must be between min and max", minimum=2500, maximum=9000
BadSpecValue, "Number must be between min and max", minimum=1500, maximum=9000
):
spec.normalise(meta, [360, 1, 1, 9001])

Expand Down

0 comments on commit 89a9288

Please sign in to comment.