Skip to content

Commit

Permalink
Allow single element LED or color mix lists to create tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
rhempel committed Nov 10, 2015
1 parent bc08dac commit 82cb0cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions ev3dev/brickpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class Leds(object):
blue_one = Led(name='brickpi1:blue:ev3dev')
blue_two = Led(name='brickpi2:blue:ev3dev')

BLUE_ONE = ( blue_one )
BLUE_TWO = ( blue_two )
BLUE_ONE = ( blue_one, )
BLUE_TWO = ( blue_two, )

BLUE = ( 1 )
BLUE = ( 1, )

@staticmethod
def set_color(group, color, pct=1):
Expand Down
16 changes: 8 additions & 8 deletions ev3dev/ev3.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ class Leds(object):
green_left = Led(name='ev3-left1:green:ev3dev')
green_right = Led(name='ev3-right1:green:ev3dev')

LEFT = ( red_left, green_left )
RIGHT = ( red_right, green_right )

RED = ( 1, 0 )
GREEN = ( 0, 1 )
AMBER = ( 1, 1 )
ORANGE = ( 1, 0.5 )
YELLOW = ( 0.5, 1 )
LEFT = ( red_left, green_left, )
RIGHT = ( red_right, green_right, )

RED = ( 1, 0, )
GREEN = ( 0, 1, )
AMBER = ( 1, 1, )
ORANGE = ( 1, 0.5, )
YELLOW = ( 0.5, 1, )

@staticmethod
def set_color(group, color, pct=1):
Expand Down
8 changes: 4 additions & 4 deletions templates/led-colors.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ endfor %}
assign groupName = group.name | upcase | underscore_spaces %}{%
assign ledNames = '' %}{%
for name in group.entries %}{%
capture ledNames %}{{ ledNames }}, {{ name | downcase | underscore_spaces }}{%
capture ledNames %}{{ ledNames }}{{ name | downcase | underscore_spaces }}, {%
endcapture %}{%
endfor %}
{{ groupName }} = ( {{ ledNames | remove_first:', ' }} ){%
{{ groupName }} = ( {{ ledNames }}){%
endfor %}
{% for color in currentClass.colors %}{%
assign colorName = color.name | upcase | underscore_spaces %}{%
assign mixValues = '' %}{%
for value in color.value %}{%
capture mixValues %}{{ mixValues }}, {{ value }}{%
capture mixValues %}{{ mixValues }}{{ value }}, {%
endcapture %}{%
endfor %}
{{ colorName }} = ( {{ mixValues | remove_first:', ' }} ){%
{{ colorName }} = ( {{ mixValues }}){%
endfor %}

@staticmethod
Expand Down

0 comments on commit 82cb0cd

Please sign in to comment.