Skip to content

Commit b8494b4

Browse files
updates for pylint
1 parent 946f55a commit b8494b4

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

Disco_Tie/code.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
Give your suit an sound-reactive upgrade with Circuit
55
Playground Bluefruit & Neopixels. Set color and animation
66
mode using the Bluefruit LE Connect app.
7-
7+
88
Author: Collin Cunningham for Adafruit Industries, 2019
99
"""
10+
# pylint: disable=global-statement
1011

1112
import time
1213
import array
@@ -78,25 +79,25 @@ def volume_color(volume):
7879
input_ceiling = input_floor + 500
7980
peak = 0
8081

81-
def wheel(pos):
82+
def wheel(wheel_pos):
8283
# Input a value 0 to 255 to get a color value.
8384
# The colours are a transition r - g - b - back to r.
84-
if pos < 0 or pos > 255:
85+
if wheel_pos < 0 or wheel_pos > 255:
8586
r = g = b = 0
86-
elif pos < 85:
87-
r = int(pos * 3)
88-
g = int(255 - pos*3)
87+
elif wheel_pos < 85:
88+
r = int(wheel_pos * 3)
89+
g = int(255 - wheel_pos*3)
8990
b = 0
90-
elif pos < 170:
91-
pos -= 85
92-
r = int(255 - pos*3)
91+
elif wheel_pos < 170:
92+
wheel_pos -= 85
93+
r = int(255 - wheel_pos*3)
9394
g = 0
94-
b = int(pos*3)
95+
b = int(wheel_pos*3)
9596
else:
96-
pos -= 170
97+
wheel_pos -= 170
9798
r = 0
98-
g = int(pos*3)
99-
b = int(255 - pos*3)
99+
g = int(wheel_pos*3)
100+
b = int(255 - wheel_pos*3)
100101
return (r, g, b)
101102

102103
def rainbow_cycle(wait):
@@ -114,7 +115,7 @@ def audio_meter():
114115

115116
# Compute scaled logarithmic reading in the range 0 to NUM_PIXELS
116117
c = log_scale(constrain(magnitude, input_floor, input_ceiling),
117-
input_floor, input_ceiling, 0, NUM_PIXELS)
118+
input_floor, input_ceiling, 0, NUM_PIXELS)
118119

119120
# Light up pixels that are below the scaled and interpolated magnitude.
120121
pixels.fill(0)
@@ -135,7 +136,7 @@ def audio_meter():
135136

136137
def larsen_set(index, color):
137138
if index < 0:
138-
return
139+
return
139140
else:
140141
pixels[index] = color
141142

@@ -144,9 +145,9 @@ def larsen(wait):
144145
global direction
145146

146147
color_dark = (int(user_color[0]/8), int(user_color[1]/8),
147-
int(user_color[2]/8))
148+
int(user_color[2]/8))
148149
color_med = (int(user_color[0]/2), int(user_color[1]/2),
149-
int(user_color[2]/2))
150+
int(user_color[2]/2))
150151

151152
larsen_set(pos - 2, color_dark)
152153
larsen_set(pos - 1, color_med)
@@ -182,7 +183,7 @@ def solid():
182183

183184
def map_value(value, in_min, in_max, out_min, out_max):
184185
return out_min + (out_max - out_min) * ((value - in_min)
185-
/ (in_max - in_min))
186+
/ (in_max - in_min))
186187

187188
def change_speed(val):
188189
global speed
@@ -234,4 +235,4 @@ def change_speed(val):
234235
elif mode == 2:
235236
larsen(map_value(speed, 10.0, 0.0, 0.01, 0.3))
236237
elif mode == 3:
237-
solid()
238+
solid()

0 commit comments

Comments
 (0)