Skip to content

Commit b9a956a

Browse files
committed
Accommodate the style checker
1 parent b0b8459 commit b9a956a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/circuitplayground_gravity_pulls_pixel.py renamed to examples/advanced/circuitplayground_gravity_pulls_pixel.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def compute_pixel_angles():
3333

3434
def degrees_between(a1, a2):
3535
smaller = min(a1, a2)
36-
larger = max(a1, a2)
36+
larger = max(a1, a2)
3737
return min(larger - smaller, 360 + smaller - larger)
3838

3939

@@ -65,10 +65,11 @@ def positive_degrees(angle):
6565

6666
while True:
6767
debug = cpx.switch # True is toward the left
68-
x, y = cpx.acceleration[:2] # Ignore z
69-
down_angle = positive_degrees(angle_in_degrees(x, y))
68+
accel_x, accel_y = cpx.acceleration[:2] # Ignore z
69+
down_angle = positive_degrees(angle_in_degrees(accel_x, accel_y))
7070
magnitude_limit = STANDARD_GRAVITY
71-
normalized_magnitude = min(math.sqrt(x * x + y * y), magnitude_limit) / magnitude_limit
71+
normalized_magnitude = min(math.sqrt(accel_x * accel_x + accel_y * accel_y),
72+
magnitude_limit) / magnitude_limit
7273

7374
pixels_lit = []
7475
for i, pixel_position in enumerate(pixel_positions):
@@ -80,5 +81,5 @@ def positive_degrees(angle):
8081
if debug:
8182
lit_formatted = ', '.join(('{}: {:>3d}'.format(p, i) for p, i in pixels_lit))
8283
print('x: {:>6.2f}, y: {:>6.2f}, angle: {:>6.2f}, mag: {:>3.2f}, pixels: [{}]'.format(
83-
x, y, down_angle, normalized_magnitude, lit_formatted))
84+
accel_x, accel_y, down_angle, normalized_magnitude, lit_formatted))
8485
time.sleep(0.5)

0 commit comments

Comments
 (0)