Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
slabua committed Mar 23, 2024
1 parent 2156eb8 commit 7883815
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions OLED/picomotodash_oled_ws10d.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def moving_avg(n):
np_val = avg

if has_positive and has_negative:
ring.set_np(0, (0, 0, 32))
neopixel_ring.set_np(0, (0, 0, 32))

tmp_headings = []
for h in headings:
Expand All @@ -89,15 +89,15 @@ def moving_avg(n):

return avg

ring.set_np(0, (0, round(map_range(np_val, (180, 0), (0, 32))), 0))
neopixel_ring.set_np(0, (0, round(map_range(np_val, (180, 0), (0, 32))), 0))

return avg


# Neopixel setup
PIN_NUM = 3
NUM_LEDS = 37
ring = pdmNEOPX(pin=PIN_NUM, n=NUM_LEDS)
neopixel_ring = pdmNEOPX(pin=PIN_NUM, n=NUM_LEDS)


# Utility functions
Expand Down Expand Up @@ -364,7 +364,7 @@ def draw_rpm():
display.text("R:" + f"{str(round(RPM_ESTIMATE)):>5}", 71, 54, 0)
display.text("R:" + f"{str(round(RPM_ESTIMATE)):>5}", 69, 52, 1)

ring.set_np_rpm(RPM_ESTIMATE)
neopixel_ring.set_np_rpm(RPM_ESTIMATE)


# GPIO setup
Expand Down

0 comments on commit 7883815

Please sign in to comment.