Commit ba0fb6bc authored by Rahix's avatar Rahix
Browse files

Merge 'Add led activity to ECG app'

See merge request card10/firmware!261
parents 1d21f7c1 bc7e3b92
Pipeline #3541 passed with stages
in 2 minutes and 23 seconds
import os
import display
import leds
import utime
import buttons
import max30001
......@@ -36,6 +37,10 @@ histogram_offset = 0
sensor = 0
disp = display.open()
leds.dim_top(1)
COLORS = [((23 + (15 * i)) % 360, 1.0, 1.0) for i in range(11)]
colors = COLORS
def callback_ecg(datasets):
global update_screen, history, filebuffer, write
......@@ -161,6 +166,14 @@ def toggle_pause():
histogram_offset = 0
def draw_leds(val):
global colors
# val should be in [0, 11]
for i in range(11):
leds.prep_hsv(10 - i, COLORS[10 - i] if i < val else (0, 0, 0))
leds.update()
def draw_histogram():
global disp, history, current_mode, bias, write, pause_screen, update_screen
......@@ -211,6 +224,7 @@ def draw_histogram():
old = value
x += 1
draw_leds((60 - int((max(history[-3:]) * scale + OFFSET) - 20)) * 11 / 60)
# draw text: mode/bias/write
if pause_histogram == True:
disp.print(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment