Fixes Flake 8 Issues Animated NeoPixel Glow Fur Scarf
@@ -68,9 +68,9 @@ def wheel(pos):
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return (0, 0, 0)
- if (pos < 85):
+ if pos < 85:
return (int(pos * 3), int(255 - (pos*3)), 0)
- elif (pos < 170):
+ elif pos < 170:
pos -= 85
return (int(255 - pos * 3), 0, int(pos * 3))
else:
@@ -91,11 +91,10 @@ def remapRange(value, leftMin, leftMax, rightMin, rightMax):
def shortkeypress(color_palette):
color_palette += 1
- if (color_palette > 6):
+ if color_palette > 6:
color_palette = 1
- return (color_palette)
-
+ return color_palette
while True:
@@ -103,38 +102,38 @@ while True:
currkeystate = button.value
# button press, move to next pattern
- if ((prevkeystate == False) and (currkeystate == True)):
+ if (prevkeystate != True) and currkeystate:
ledmode = shortkeypress(ledmode)
# save button press state
prevkeystate = currkeystate
# Fire Colors [ HEAT ]
- if (ledmode == 1):
+ if ledmode == 1:
palette = heat_colors
# Forest
- elif (ledmode == 2):
+ elif ledmode == 2:
palette = forest
# Ocean
- elif (ledmode == 3):
+ elif ledmode == 3:
palette = ocean
# Purple Lovers
- elif (ledmode == 4):
+ elif ledmode == 4:
palette = purple
# All the colors!
- elif (ledmode == 5):
+ elif ledmode == 5:
palette = rainbow
# Rainbow stripes
- elif (ledmode == 6):
+ elif ledmode == 6:
palette = rainbow_stripe
# All the colors except the greens, washed out
- elif (ledmode == 7):
+ elif ledmode == 7:
palette = washed_out
for i in range(num_leds):
@@ -143,11 +142,11 @@ while True:
strip[i] = color.pack()
strip.show()
- if (fadeup):
+ if fadeup:
offset += steps
- if (offset >= 1):
+ if offset >= 1:
fadeup = False
else:
offset -= steps
- if (offset <= 0):
+ if offset <= 0:
fadeup = True
