From b9ccf4f782b721ee5ab01ec6c33a91fd1abe8d15 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 16:20:20 -0800 Subject: [PATCH 01/34] new app called stethoscope --- apps/stetho/stetho-icon.js | 1 + apps/stetho/stetho.js | 74 +++++++++++++++++++++++++++++++++++++ apps/stetho/stetho.json | 5 +++ apps/stetho/stetho.png | Bin 0 -> 2520 bytes 4 files changed, 80 insertions(+) create mode 100644 apps/stetho/stetho-icon.js create mode 100644 apps/stetho/stetho.js create mode 100644 apps/stetho/stetho.json create mode 100644 apps/stetho/stetho.png diff --git a/apps/stetho/stetho-icon.js b/apps/stetho/stetho-icon.js new file mode 100644 index 0000000000..6057036c44 --- /dev/null +++ b/apps/stetho/stetho-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+64A/AAOzxNknVl1oLHnVexOzFrtlnU6i06Eg2JrwMBGAIxaLgYuBF5IMBAARiaKAYhK1pfDAAWJFy2tLoNkxOtQAJQIBYWtAYIwBZ4xeQFwR7RMoJgW2brBsqqTMAQvVRwLaUMARftrAvVX4bZTwdYwYvWryQTRwRFTSAZgBDSOtwdeLyxKDMCITBwReR2ez1oCBMAZ7QLwK9SE4NlsmJxIpCVYRgO1uCUSVlnQACFIIYBMCC9T2dkFwYACLQROCM4ZeKXqOJnUWAAItBmhhBMAggLLwOCXqKNBFoYACMAiABMBOtLyfXrwuGF4iBMLwWnFyAvBFwwvGcIQwGLwQKHX5ouFmiJBF4RgKLyoWBL47vCcYwIF05eU6+zxKRBLwodFGAgACFwLsSEAgwDrwuHWwYwBwenGoKNBF6owDrAuIGAYrCvgzBFy7jDryqLGAV8viTCFy7CBwZeBIB1804tYAAQvQSIJdZF6l8F9unF/4vPwYvtwQv/04vc1ovBD5gvv0+h0/RF7uCF5fR0+gF7vRwd8EBaOB0KOcEIV8SBReBRzxRDMBReC04udMAYwIL0QkDGAWt6IAC07sfGA+gE4IAD0JdBF8YwEAAhmCF0TnEFoS7iAE4=")) \ No newline at end of file diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js new file mode 100644 index 0000000000..84658e85f3 --- /dev/null +++ b/apps/stetho/stetho.js @@ -0,0 +1,74 @@ +Bangle.setLCDPower(1); +Bangle.setLCDTimeout(0); +Bangle.ioWr(0x80,0) +x=0; +var min=0,max=0; +var wasHigh = 0, wasLow = 0; +var lastHigh = getTime(); +var hrmList = []; +var hrm; + +function readHRM() { + var a = analogRead(D29); + var h = getTime(); + min=Math.min(min*0.97+a*0.03,a); + max=Math.max(max*0.97+a*0.03,a); + y = E.clip(170 - (a*960*4),100,230); + if (x==0) { + g.clearRect(0,100,239,239); + g.moveTo(-100,0); + } + /*g.setColor(0,1,0); + var z = 170 - (min*960*4); g.fillRect(x,z,x,z); + var z = 170 - (max*960*4); g.fillRect(x,z,x,z);*/ + g.setColor(1,1,1); + g.lineTo(x,y); + if ((max-min)>0.005) { + if (4*a > (min+3*max)) { // high + g.setColor(1,0,0); + g.fillRect(x,230,x,239); + g.setColor(1,1,1); + if (!wasHigh && wasLow) { + var currentHrm = 60/(h-lastHigh); + lastHigh = h; + if (currentHrm<250) { + while (hrmList.length>12) hrmList.shift(); + hrmList.push(currentHrm); + // median filter + var t = hrmList.slice(); // copy + t.sort(); + // average the middle 3 + var mid = t.length>>1; + if (mid+2239)x=0; +} + +setInterval(readHRM,50); diff --git a/apps/stetho/stetho.json b/apps/stetho/stetho.json new file mode 100644 index 0000000000..239fffb684 --- /dev/null +++ b/apps/stetho/stetho.json @@ -0,0 +1,5 @@ +{ + "name":"Stethoscope","type":"app", + "icon":"*stetho", + "src":"-stetho" +} diff --git a/apps/stetho/stetho.png b/apps/stetho/stetho.png new file mode 100644 index 0000000000000000000000000000000000000000..c0f183d963dca185ae78be7a784bbe61e3b8eb84 GIT binary patch literal 2520 zcmV;}2`Bc6P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D32jM4K~z{r%~(lq z9LE*zrFx%c&%&7@DGgVVl4UK_#aUn=7ayEc00X)Cn*X6+66D~M5g-Nv=MW>d5ZKls zvYkkxXes1yof*!)_4HEJRh2j7NFk*rIi#T=9|~k+>UGywufDf*i=1=e{|T2N1UG~c zKk%YQRsZv?-d2~~nbbd8o>F-X*?RY@qMNtSub1s#EhI7)(iQQ@CKeYa z#JI54#oyO_VDq>hthWM>@Ed9Ew=2$v^Y&s=Jz@lAEid|Z*ZaeFt+k40%F;qoyF0C4 z&+0#$w+bl*jhMd@{3~5G+;mqKDb<;Puod7mvOe@s+l&5H3Z7L0N0Z)})@3ey^W1&#xR;+$e)mE4 z-jX>oJ%$SqY6bL@_0FfyJ696QN6XIpS4@y_5OKmd2**Ma{FP1$1C$gH)(a?jE};#% zZrAYdzi8}~g5Uf+_3;OpBeUbUz>y6IE4yS6@uigZZbr)*$Wo+?A?Hn$)@2>N&ISO# zn5vYsmB|D$6bVKlquePN664Qz{E^W~T!2u-cn~p01#kuk2p#GL2CVu9lM?`gq0OO@ zB8zELR=DU5;#GYCLcl-=)iS{k8KFasUjmc~fzMp$)@`1;;_kztW-?7l0>t-g2M$;z|PY4!) zQn1~@PpZKW6@RT3fNr2fKml4vskd{6A&EPUaJzxskd2ebfOoqa?d%4<4qYs0vsW~P z;zKir5cs1L(Dg?6*G>12&pMwzX@9oX`Fqj*cRlO}%+ck$)5ff$w0hA-HLUjuInPNz zc`#u6rLbDTNejJm%}hGzw2Cj^zkh#p`4WD_9`1X8e$o3|(Os_w#X8<;;k`By?~XP1cwZg3M4&UIbOt0V5lCr`7}0w7()L%@W0*}lskk3oDqRjfkne?wpYhbcKq%7P&Kn@WhJjems4rry&CQf zXly$Hgo1$8>tt^yjC{T@rx&hjigH#Y#ms$Q@~a&pMqFV6dO6@a3V5lBA-)349aFwO ztwW#Xdu*o?R$ByGpV9p<0c@g(cRNveFYGiT2&<(xf;4Bl>{-^ZbY>* zW`tjv(egw0oG#{bp`P?x8))kSM{$(+fkCP@0wv#Mep0E{euQsxuU;!-C8N= zS0~kkA%j<5?G=nYj~*Q0jTip@cGz!4LNpYrIHxVC&a3Y2(Wo!hc6wqiyl5;)UCKxkOh1SpMgWan~%6fkn?xf?wlXA%M}!;aZ-nK!ak9KePO&=d>_ zjUVVIaTXznEDaJdbbTSG5kKvV&MR;xu#k&HP?4mnZ-EfJ7}$mkkxx8^eR!)s=SvAx zb<(3e;JPkrCOG#pIExU}DLWzSvKYD)njRYeg=qxfO5vT~WzgK|mZVyjRMD9pQbfl= zmM-HSb=wrm_!%Bzn1@{!wkbq_>B#!TTOb5AA(=**G=l!TQ^8)B!l}h(NKg+MFs~Zn zCRG*5nnZ8KLl7v?bmnI?RT7%JxN`vSA@T3>&=LhL>h59Ep}H;GQwSMvfe=79q$~4U zF0b}0q`c;L526Ua?j&FXC)M2y-6Dp7cdjbdlp>AMt;XWKeTYITuN0OIP*P(vEI;+T zWjquUL>z@zHV)Fk9o8%2&RPf;i76$ysHqdf{_b)(|Dz}91`ccE8@KY*mxz#E&}VMx z6H^M(MM#6-n|?9uJ`ep`WaO3HduHmEuBB!1k|#C>Apmr!jbga>omYG63s`XSik(He zB@57twP|n=QJ)!;a{9KOzGoOyNIK=q#yA-FvoOfHwTVlQ2F)Ks2qox_R7sQ}cN2zm z$(~gvSB>ON-Izv0^<19M*n|KeUav_z8)5a4-+vL3HbY3T3u@-Jp1i49vx)+(Dzsxi ifeqjSg#H&0g#Q5B$@`OF9bdu#0000 Date: Sun, 19 Jan 2020 16:59:27 -0800 Subject: [PATCH 02/34] updating master list --- apps.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps.json b/apps.json index acfe363728..1d73738546 100644 --- a/apps.json +++ b/apps.json @@ -264,6 +264,18 @@ {"name":"*hrm","url":"heartrate-icon.js","evaluate":true} ] }, + { "id": "stetho", + "name": "Stethoscope", + "icon": "stetho.png", + "version":"0.01", + "description": "Hear your heart rate", + "tags": "health", + "storage": [ + {"name":"+stetho","url":"stetho.json"}, + {"name":"-stetho","url":"stetho.js"}, + {"name":"*stetho","url":"stetho-icon.js","evaluate":true} + ] + }, { "id": "swatch", "name": "Stopwatch", "icon": "stopwatch.png", From 4ab164b3737b96fbe39aeae2ab9119ed05f4bb84 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:10:10 -0800 Subject: [PATCH 03/34] audio test --- apps/stetho/stetho.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 84658e85f3..c3c9ccff9c 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -8,6 +8,16 @@ var lastHigh = getTime(); var hrmList = []; var hrm; +var SPEAKER_PIN = D18; +function freq(f) { + if (f===0) digitalWrite(SPEAKER_PIN, 0); + else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); + } + freq(1000); + freq(1500); + freq(0); + + function readHRM() { var a = analogRead(D29); var h = getTime(); From c99d1d2be8f48e6c40db8a29bfce2b9be4fe886f Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:12:21 -0800 Subject: [PATCH 04/34] audio test --- apps/stetho/stetho.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index c3c9ccff9c..ec7d4542de 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -13,12 +13,13 @@ function freq(f) { if (f===0) digitalWrite(SPEAKER_PIN, 0); else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); } - freq(1000); - freq(1500); - freq(0); - + + function readHRM() { + freq(1000); + freq(1500); + freq(0); var a = analogRead(D29); var h = getTime(); min=Math.min(min*0.97+a*0.03,a); From 36fe1ab0958ea1ae1e5527e399e2336938e1d1e2 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:20:12 -0800 Subject: [PATCH 05/34] audio test --- apps/stetho/stetho.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index ec7d4542de..66a5bf7aaa 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -17,9 +17,6 @@ function freq(f) { function readHRM() { - freq(1000); - freq(1500); - freq(0); var a = analogRead(D29); var h = getTime(); min=Math.min(min*0.97+a*0.03,a); @@ -29,11 +26,9 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - /*g.setColor(0,1,0); - var z = 170 - (min*960*4); g.fillRect(x,z,x,z); - var z = 170 - (max*960*4); g.fillRect(x,z,x,z);*/ g.setColor(1,1,1); g.lineTo(x,y); + freq(y + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From 1fe3ef5b25706d42da4928645ffd53ca7977c1bc Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:22:39 -0800 Subject: [PATCH 06/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 66a5bf7aaa..2d7bb645db 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -11,7 +11,7 @@ var hrm; var SPEAKER_PIN = D18; function freq(f) { if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); + else analogWrite(SPEAKER_PIN, 1.0, {freq: f}); } From da691f37952434d778439c8139b0c6882d34aee1 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:26:14 -0800 Subject: [PATCH 07/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 2d7bb645db..8b3c1d586b 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,7 +28,7 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - freq(y + 100.0); + freq((y * 1000) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From 992d5271ef73d61ba62b53eb7676e3dd80f1181a Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:27:46 -0800 Subject: [PATCH 08/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 8b3c1d586b..b9cdd15831 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,7 +28,7 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - freq((y * 1000) + 100.0); + freq((a * 1000.0) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From ff1374c7104449f10ba7f17b1c2226912b828bd8 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:34:54 -0800 Subject: [PATCH 09/34] audio test --- apps/stetho/stetho.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index b9cdd15831..8448422a80 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -11,7 +11,7 @@ var hrm; var SPEAKER_PIN = D18; function freq(f) { if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 1.0, {freq: f}); + else analogWrite(SPEAKER_PIN, 0.9, {freq: f}); } @@ -28,7 +28,9 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); + console.log("a ", a); freq((a * 1000.0) + 100.0); + console.log("freq ", (a * 1000.0) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From 9b721451bb52949b416d2837e2829e09fc94f684 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:38:09 -0800 Subject: [PATCH 10/34] audio test --- apps/stetho/stetho.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 8448422a80..bd943cab77 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,9 +28,9 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - console.log("a ", a); - freq((a * 1000.0) + 100.0); - console.log("freq ", (a * 1000.0) + 100.0); + console.log("a ", y); + freq((y * 1000.0) + 100.0); + console.log("freq ", (y * 1000.0) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From fc04aaf20036f26c9c13512cc907f459a36ce58a Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:40:42 -0800 Subject: [PATCH 11/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index bd943cab77..7ff68a832e 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -29,7 +29,7 @@ function readHRM() { g.setColor(1,1,1); g.lineTo(x,y); console.log("a ", y); - freq((y * 1000.0) + 100.0); + freq((abs(y) * 100000.0) + 100.0); console.log("freq ", (y * 1000.0) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high From 215871957b42ed8b6ea7532d8ffb2733f5199e77 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:44:15 -0800 Subject: [PATCH 12/34] audio test --- apps/stetho/stetho.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 7ff68a832e..7165435577 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -11,7 +11,7 @@ var hrm; var SPEAKER_PIN = D18; function freq(f) { if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 0.9, {freq: f}); + else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); } @@ -29,7 +29,7 @@ function readHRM() { g.setColor(1,1,1); g.lineTo(x,y); console.log("a ", y); - freq((abs(y) * 100000.0) + 100.0); + freq((Math.abs(y) * 10000.0) + 500.0); console.log("freq ", (y * 1000.0) + 100.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high From af4e0479487fff0ef18eeab11c69f5f6a9cbb6af Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:45:07 -0800 Subject: [PATCH 13/34] audio test --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 1d73738546..2696cff07e 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.01", + "version":"0.02", "description": "Hear your heart rate", "tags": "health", "storage": [ From 6d7acb091d5a79ca9f4940fca5837d269972bbfe Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:50:49 -0800 Subject: [PATCH 14/34] audio test --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 2696cff07e..4cefc8ee98 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.02", + "version":"0.011", "description": "Hear your heart rate", "tags": "health", "storage": [ From 24c6eaeea641aac26fecdddc516a2a0031d0e2e7 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:51:08 -0800 Subject: [PATCH 15/34] audio test --- apps/stetho/stetho.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 7165435577..caf8450fb7 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,9 +28,8 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - console.log("a ", y); - freq((Math.abs(y) * 10000.0) + 500.0); - console.log("freq ", (y * 1000.0) + 100.0); + freq((Math.abs(a) * 10000.0) + 500.0); + console.log("freq ", (a * 10000.0) + 500.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From b21e260a46a234ad8e81344ab50ebae6f083fd74 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:53:20 -0800 Subject: [PATCH 16/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 4cefc8ee98..7e0ec8c795 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.011", + "version":"0.012", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index caf8450fb7..6f21192ee5 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -29,7 +29,7 @@ function readHRM() { g.setColor(1,1,1); g.lineTo(x,y); freq((Math.abs(a) * 10000.0) + 500.0); - console.log("freq ", (a * 10000.0) + 500.0); + console.log("freq ", (a * 100.0) + 500.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From 3d79e9ed1f1366e35fe30ff6b73e7017b00224b8 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 17:55:32 -0800 Subject: [PATCH 17/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 7e0ec8c795..c83710a23f 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.012", + "version":"0.013", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 6f21192ee5..4b83f0f84c 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,7 +28,7 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - freq((Math.abs(a) * 10000.0) + 500.0); + freq((Math.abs(a) * 100.0) + 500.0); console.log("freq ", (a * 100.0) + 500.0); if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high From 61788e1749545368fe54ea51c84c30fedd067fcf Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:00:14 -0800 Subject: [PATCH 18/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index c83710a23f..42a3ed03de 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.013", + "version":"0.014", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 4b83f0f84c..664d320da5 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -28,8 +28,9 @@ function readHRM() { } g.setColor(1,1,1); g.lineTo(x,y); - freq((Math.abs(a) * 100.0) + 500.0); - console.log("freq ", (a * 100.0) + 500.0); + freq((parseFloat(y) * 1000.0) + 500.0); + console.log("frequency ", (y * 1000.0) + 500.0; + ; if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); @@ -78,4 +79,4 @@ function readHRM() { if (x>239)x=0; } -setInterval(readHRM,50); +setInterval(readHRM,100); From 4b2d7d853cdb0712b0fa777a01b9939fbbe8e76e Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:02:41 -0800 Subject: [PATCH 19/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 42a3ed03de..2e59aae950 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.014", + "version":"0.015", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 664d320da5..a4caa8e714 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -29,7 +29,7 @@ function readHRM() { g.setColor(1,1,1); g.lineTo(x,y); freq((parseFloat(y) * 1000.0) + 500.0); - console.log("frequency ", (y * 1000.0) + 500.0; + console.log("frequency " + (parseFloat(y) * 1000.0) + 500.0); ; if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high From 6bb8b9e5a07c58692eda55617a6796b4851564eb Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:05:55 -0800 Subject: [PATCH 20/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index 2e59aae950..e965669a12 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.015", + "version":"0.016", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index a4caa8e714..a57a94b8b6 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -29,8 +29,8 @@ function readHRM() { g.setColor(1,1,1); g.lineTo(x,y); freq((parseFloat(y) * 1000.0) + 500.0); - console.log("frequency " + (parseFloat(y) * 1000.0) + 500.0); - ; + console.log("frequency " + ((parseFloat(y) * 1000.0) + 500.0)); + if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); @@ -79,4 +79,4 @@ function readHRM() { if (x>239)x=0; } -setInterval(readHRM,100); +setInterval(readHRM,50); From 360100e22b2124539a31a77d0641af49635acd9f Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:11:36 -0800 Subject: [PATCH 21/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps.json b/apps.json index e965669a12..ebd2761219 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.016", + "version":"0.017", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index a57a94b8b6..376e98f1cc 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -7,14 +7,13 @@ var wasHigh = 0, wasLow = 0; var lastHigh = getTime(); var hrmList = []; var hrm; - var SPEAKER_PIN = D18; -function freq(f) { - if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); - } - +function freq(f) { + console.log("frequency : ", f); + if (f===0) digitalWrite(SPEAKER_PIN, 0); + else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); +} function readHRM() { var a = analogRead(D29); @@ -26,11 +25,10 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } + freq(parseFloat(a*960*4)); + g.setColor(1,1,1); g.lineTo(x,y); - freq((parseFloat(y) * 1000.0) + 500.0); - console.log("frequency " + ((parseFloat(y) * 1000.0) + 500.0)); - if ((max-min)>0.005) { if (4*a > (min+3*max)) { // high g.setColor(1,0,0); From ee3b2c60342246e92fa0de42343ff525c703be4f Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:31:42 -0800 Subject: [PATCH 22/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index ebd2761219..1dc8a4a7e7 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.017", + "version":"0.018", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 376e98f1cc..580b3eab3a 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,8 +25,8 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - freq(parseFloat(a*960*4)); - + freq(parseFloat(y+1.0)*1000); + g.setColor(1,1,1); g.lineTo(x,y); if ((max-min)>0.005) { From 4d5c8f5352be3bbe76014b4c0811a3a355372e83 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 18:34:37 -0800 Subject: [PATCH 23/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 1dc8a4a7e7..b849820e70 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.018", + "version":"0.019", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 580b3eab3a..0059fd43e9 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,8 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - freq(parseFloat(y+1.0)*1000); + let frequency = parseFloat(y+1.0) * 10000; + if(frequency > 0) freq(frequency); g.setColor(1,1,1); g.lineTo(x,y); From d749ba1a97d8e9177012764fffb2f7f53f9bbd74 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:26:06 -0800 Subject: [PATCH 24/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index b849820e70..75bebe919c 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.019", + "version":"0.0191", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 0059fd43e9..10891fb752 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -10,7 +10,7 @@ var hrm; var SPEAKER_PIN = D18; function freq(f) { - console.log("frequency : ", f); + console.log("frequency: ", f); if (f===0) digitalWrite(SPEAKER_PIN, 0); else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); } @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(y+1.0) * 10000; + let frequency = parseFloat((170 - (a*960*4)) + 500); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From 5f5b19e79c7de66339bf6b1bf82eaf156ccbe65a Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:29:38 -0800 Subject: [PATCH 25/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 10891fb752..594bebccb0 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat((170 - (a*960*4)) + 500); + let frequency = parseFloat(((170 - (a*960*4))*80) + 300); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From 239209ba7b67fa8052d61db1aefa96a4af661012 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:30:20 -0800 Subject: [PATCH 26/34] audio test --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 75bebe919c..652e71444c 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0191", + "version":"0.0192", "description": "Hear your heart rate", "tags": "health", "storage": [ From 0624498947dc8f6e3aa1f6a487ad10f30cf2deac Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:35:09 -0800 Subject: [PATCH 27/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index 652e71444c..71e26dd850 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0192", + "version":"0.0193", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 594bebccb0..52e3eea3b7 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -12,7 +12,7 @@ var SPEAKER_PIN = D18; function freq(f) { console.log("frequency: ", f); if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); + else analogWrite(SPEAKER_PIN, 0.9, {freq: f}); } function readHRM() { @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(((170 - (a*960*4))*80) + 300); + let frequency = parseFloat(((170 - (a*960*4))*100) + 200); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From e949bfb3be96a6a5947dd8360d68fcf09e3fb85c Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:39:58 -0800 Subject: [PATCH 28/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index 71e26dd850..56d674210a 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0193", + "version":"0.0194", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 52e3eea3b7..badd3f935b 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -12,7 +12,7 @@ var SPEAKER_PIN = D18; function freq(f) { console.log("frequency: ", f); if (f===0) digitalWrite(SPEAKER_PIN, 0); - else analogWrite(SPEAKER_PIN, 0.9, {freq: f}); + else analogWrite(SPEAKER_PIN, 0.5, {freq: f}); } function readHRM() { @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(((170 - (a*960*4))*100) + 200); + let frequency = parseFloat(((170 - (a*960*4))*60) + 200); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From 09f78d3cc69a858aa572ab1158ec1a798cb7ab75 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:42:00 -0800 Subject: [PATCH 29/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 56d674210a..f1bb273145 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0194", + "version":"0.0195", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index badd3f935b..80f856f5d0 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(((170 - (a*960*4))*60) + 200); + let frequency = parseFloat(((170 - (a*960*4))*20) + 400); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From 8e63bac700c46e9fd0803de972346cec3dc9af3f Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:43:47 -0800 Subject: [PATCH 30/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index f1bb273145..503778f7a1 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0195", + "version":"0.0196", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 80f856f5d0..10891fb752 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(((170 - (a*960*4))*20) + 400); + let frequency = parseFloat((170 - (a*960*4)) + 500); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From 62b6527535bcb1d72cd2787bb5f821adad625494 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:44:34 -0800 Subject: [PATCH 31/34] audio test --- apps/stetho/stetho.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 10891fb752..f37e145a8d 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat((170 - (a*960*4)) + 500); + let frequency = parseFloat(((170 - (a*960*4))*4.0) + 300); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From b741df9a5f670dbb9837992c56244cb5aea45312 Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:46:11 -0800 Subject: [PATCH 32/34] audio test --- apps.json | 2 +- apps/stetho/stetho.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 503778f7a1..ae2d6d09cf 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0196", + "version":"0.0197", "description": "Hear your heart rate", "tags": "health", "storage": [ diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index f37e145a8d..10891fb752 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -25,7 +25,7 @@ function readHRM() { g.clearRect(0,100,239,239); g.moveTo(-100,0); } - let frequency = parseFloat(((170 - (a*960*4))*4.0) + 300); + let frequency = parseFloat((170 - (a*960*4)) + 500); if(frequency > 0) freq(frequency); g.setColor(1,1,1); From c3b5b827654287ad04ef7205330e9f7c5130ecee Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 20:48:42 -0800 Subject: [PATCH 33/34] audio test --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index ae2d6d09cf..23cac7942d 100644 --- a/apps.json +++ b/apps.json @@ -267,7 +267,7 @@ { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version":"0.0197", + "version":"0.0198", "description": "Hear your heart rate", "tags": "health", "storage": [ From 9b12670d0712468c03a72a76d2d6f2e188ff2a6f Mon Sep 17 00:00:00 2001 From: Kristin Galvin Date: Sun, 19 Jan 2020 21:09:18 -0800 Subject: [PATCH 34/34] feat: stetho app adds sound to hrm --- apps/stetho/stetho.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/stetho/stetho.js b/apps/stetho/stetho.js index 10891fb752..ec0916f4e9 100644 --- a/apps/stetho/stetho.js +++ b/apps/stetho/stetho.js @@ -1,3 +1,4 @@ +// a variation on the hrm app Bangle.setLCDPower(1); Bangle.setLCDTimeout(0); Bangle.ioWr(0x80,0)