Correct moving average computation

This commit is contained in:
Aaron Fenyes 2019-09-29 00:42:07 +02:00
parent 696caac312
commit 2e03b2e1a9
1 changed files with 5 additions and 3 deletions

View File

@ -93,7 +93,9 @@ def set_light_hsv(e, color, hit_bridge):
# === interaction parameters ===
frame_rate = 2
# these frame rate and threshold settings are untested, but the exponential
# moving average update frequency suggests they should be just barely in bounds
frame_rate = 10
ema_weight = 2/(frame_rate+1)
inductance = 0.001
@ -109,7 +111,7 @@ charge = 12*[0]
current = 30*[0]
litness = 30*[float("inf")]
change_threshold = 0.05
change_threshold = 0.15
# === main loop ===
@ -151,7 +153,7 @@ def show_data(screen):
new_updates = 0
text = font.render('updates', True, (255, 255, 255))
screen.blit(text, (20, viewsize))
text = font.render(str(updates / (1 - 0.9)), True, (255, 255, 255))
text = font.render(str(frame_rate * updates), True, (255, 255, 255))
screen.blit(text, (120, viewsize))
# energy