Skip to content

Commit 075280f

Browse files
committed
added intensity reporting
1 parent 1315d17 commit 075280f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

SipNPyuff/code.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
start_polarity = 0
3838
prev_pressure = 0
3939
PRINT_FLOOR = 5
40+
peak_level = 0
4041
if CONSOLE:
4142
print("CONSOLE?")
4243
if DEBUG and CONSOLE:
@@ -64,17 +65,26 @@
6465
print("PUFF")
6566
if start_polarity == -1:
6667
print("SIP")
67-
68+
if start_polarity != 0:
69+
if level > peak_level:
70+
peak_level = level
6871
if (level == 0) and (start_polarity != 0):
6972
duration = time.monotonic() - puff_start
7073
if CONSOLE:
7174
print("END", end=" ")
75+
76+
if peak_level == 1:
77+
print("SOFT", end=" ")
78+
if peak_level == 2:
79+
print("HARD", end=" ")
80+
7281
if start_polarity == 1:
73-
print("PUFF", "")
82+
print("PUFF")
7483
if start_polarity == -1:
75-
print("SIP", "")
84+
print("SIP")
7685
print("Duration:", duration)
7786
start_polarity = 0
87+
peak_level = 0
7888
prev_level = level
7989
prev_pressure = current_pressure
8090
time.sleep(0.01)

0 commit comments

Comments
 (0)