Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
slabua committed Mar 31, 2024
1 parent ab7b52e commit ee2035d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
6 changes: 3 additions & 3 deletions OLED/picomotodash_oled_ws10d.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
# x_off = 28099.99
# y_off = 30178.57
# z_off = 43987.61
headings = []
HEADING = 0
headings = []
labels = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"]

# Neopixel setup
Expand All @@ -69,9 +69,9 @@
neopixel_ring = pdmNEOPX(pin=PIN_NUM, n=NUM_LEDS)

# RPM setup
rpm_estimates = []
RPM_ESTIMATE = 0
PWM2RPM_FACTOR = 10
RPM_ESTIMATE = 0
rpm_estimates = []


def read_gps():
Expand Down
36 changes: 0 additions & 36 deletions OLED/picomotodash_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,3 @@ def normalise_avg(avg, headings, neopixel_ring=None):
neopixel_ring.set_np(0, (0, round(map_range(np_val, (180, 0), (0, 32))), 0))

return avg


# def moving_avg_backup(n):
# global headings

# if len(headings) >= n:
# headings.pop(0)

# headings.append(HEADING)

# # Check whether the array contains both positive and negative numbers
# has_positive = any(num > 270 for num in headings)
# has_negative = any(num < 90 for num in headings)

# avg = sum(headings) / len(headings)

# if avg > 180:
# np_val = 360 - avg
# else:
# np_val = avg

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

# tmp_headings = []
# for h in headings:
# if h > 270:
# h = h - 360
# tmp_headings.append(h)
# avg = ((sum(tmp_headings) / len(tmp_headings)) + 360) % 360

# return avg

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

# return avg

0 comments on commit ee2035d

Please sign in to comment.