-
Ok, I've done something cleaner thanks to your comments :).
I'm now using therequire("graphics_utils")
, very efficient. I reduced the number of lines to 109 and I made the code a bit less repetitive thanks to some functions. It's definitively much faster. It's in Github.
I'm still up for advices or help. I checked the swipe and I don't get how the swipe would take me from the running run.js to karvonnen.js (or if I have to merge it in one app). Also the HR input and the settings menu are not done at all. Some improvements are needed on the new graphical layout, that's the most doable part for me.
Thanks again for your help and encouragement. -
Thank you @Ganblejs. Now that I've followed these instructions, I can make it work. I'm restarting the creative (but so tedious for beginners) process of coding.
-
-
Hello guys,
my app is on github, finally: https://github.com/f-teacher/karvonnen . Feel free to do what's needed to have it run. You can reuse and publish, just make it work, please ! -
-
Hi,
I updated the settings apps, and now I have various issues.- The Pattern launcher doesn't react anymore.
- the alarm timers don't work anymore.
Am I the only one ? Do you have suggestions (especially about the BTHRM) ?
A longer term issue is with the Hank world clock (that I like for displaying different time zones). Messages arrive on a layer underneath Hank's world clock. Which makes the whole thing look weird :).
- The Pattern launcher doesn't react anymore.
-
Thanks a bunch guys ! Waow, that's incredible what you can do with code. Basically, I can decypher 20% of Gordon's code, the rest is like 3d hieroglyphs.
fillArc() seems closer to my abilities, but still, quite a huge gap to fill (starting with figuring out how sin, cos, radians work...)
It took me 4 days to write this code and do the graphics, which lead to running late on major projects (studies, moving interstate,...). I need 2 weeks to catch up, at least.
If you feel like finishing that thing, feel free to use the concept and the code I posted (if there's anything worth keeping).
If it's just me, I will just use the heavy weight code whenever I have time, as I can't do any better.
Still, thanks ! Now I see what code wizardry can do ! -
The whole code doesn't fit in the post because of the pics. I'm going to attach the whole code to this post (I modified to .odt, so that there's no security issue with posting it). Still, the end of the code (after the pictures) is here:
g.setFont("Vector",20); //Subdivided zones for better readability of zones when calling the background images. //Changing HR zones will trigger the change of the background image and the HR to change zone. if (hr <= minhr) { console.log("HR too low"); } else if (hr <= hrr*0.6 + minhr) { g.drawImage(getzone1(),0,0,{scale:1.2});g.drawString("Z1", 32,78);g.drawString(minzone2, 62,20); } else if (hr <= hrr*0.64 + minhr) { g.drawImage(getzone2a(),0,0,{scale:1.2});g.drawString("Z2", 32,78);g.drawString(maxzone2, 62,20);g.drawString(minzone2, 62,136); } else if (hr <= hrr*0.67+minhr) { g.drawImage(getzone2b(),0,0,{scale:1.2});g.drawString("Z2", 32,78);g.drawString(maxzone2, 62,20);g.drawString(minzone2, 62,136); } else if (hr <= hrr * 0.7 + minhr) { g.drawImage(getzone2c(),0,0,{scale:1.2});g.drawString("Z2", 32,78);g.drawString(maxzone2, 62,20);g.drawString(minzone2, 62,136); } else if (hr <= hrr * 0.74 + minhr) { g.drawImage(getzone3a(),0,0,{scale:1.2});g.drawString("Z3", 32,78);g.drawString(maxzone3, 62,20);g.drawString(maxzone2, 62,136); } else if (hr <= hrr * 0.77 + minhr) { g.drawImage(getzone3b(),0,0,{scale:1.2});g.drawString("Z3", 32,78);g.drawString(maxzone3, 62,20);g.drawString(maxzone2, 62,136); } else if (hr <= hrr * 0.8 + minhr) { g.drawImage(getzone3c(),0,0,{scale:1.2});g.drawString("Z3", 32,78);g.drawString(maxzone3, 62,20);g.drawString(maxzone2, 62,136); } else if (hr <= hrr * 0.84 + minhr) { g.drawImage(getzone4a(),0,0,{scale:1.2});g.drawString("Z4", 32,78);g.drawString(maxzone4, 62,20);g.drawString(maxzone3, 62,136); } else if (hr <= hrr * 0.87 + minhr) { g.drawImage(getzone4b(),0,0,{scale:1.2});g.drawString("Z4", 32,78);g.drawString(maxzone4, 62,20);g.drawString(maxzone3, 62,136); } else if (hr <= hrr * 0.9 + minhr) { g.drawImage(getzone4c(),0,0,{scale:1.2});g.drawString("Z4", 32,78);g.drawString(maxzone4, 62,20);g.drawString(maxzone3, 62,136); } else if (hr <= hrr * 0.94 + minhr) { g.drawImage(getzone5a(),0,0,{scale:1.2});g.drawString("Z5", 32,78);g.drawString(maxzone5, 62,20);g.drawString(maxzone4, 62,136); } else if (hr <= hrr * 0.96 + minhr) { g.drawImage(getzone5b(),0,0,{scale:1.2});g.drawString("Z5", 32,78);g.drawString(maxzone5, 62,20);g.drawString(maxzone4, 62,136); } else if (hr <= hrr * 0.98 + minhr) { g.drawImage(getzone5c(),0,0,{scale:1.2});g.drawString("Z5", 32,78);g.drawString(maxzone5, 62,20);g.drawString(maxzone4, 62,136); } else if (hr >= maxhr - 2) { g.clear();g.drawImage(getzonealert(),0,0,{scale:1.2});g.setFont("Vector",38);g.drawString("ALERT", 20,53);g.drawString("HR limit", 18,84); }
-
Yop, I just had a few javascript classes and decided to write the app I'm waiting for :) ! Unfortunately, I have lots to learn.
I would like to implement my code as an extra feature of the run.app. It would be called run+
The missing features for which I need help are:- to have it running in the run.app as an extra screen, accessible by swipe right/swipe left.
- the hr input is not tied to hrm
- the minimum and maximum heart rate have to be set up in the settings menu (so that other people can use it).
Also, the refresh rate, for the HR (in the middle of the screen) has to be every second, but the refresh rate for the graphics could be every 4 seconds, to save memory.
Here's the thing://This app is an extra feature implementation for the Run.app of the bangle.js. It's called run+ //I plan to have it running in the run.app, as an extra screen, accessible by swipe right/swipe left. //The calculation of the Heart Rate Zones is based on the Karvonnen method. It requires to know maximum and minimum heart rates. More precise calculation methods require a lab. //Other methods are even more approximative. g.clear(); g.drawLine(44,58,88,40); g.drawLine(88,40,132,58); g.drawLine(44,116,88,134); g.drawLine(88,134,132,116); g.setFont("Vector",20); //To calculate Heart rate zones, we need to know the heart rate reserve (HRR) // HRR = maximum HR - Minimum HR. minhr is minimum hr, maxhr is maximum hr. //get the hrr (heart rate reserve). // I put random data here, but this has to come as a menu in the settings section so that users can change it. let minhr = 48; let maxhr = 187; function calculatehrr(minhr, maxhr) { return maxhr - minhr; } //test input for hrr (it works). let hrr = calculatehrr(minhr, maxhr); console.log(hrr); //Test input to verify the zones work. The following value for HR has to be deleted and replaced with the Heart Rate Monitor input. let hr = 176; var hr1 = hr; // These variables display next and previous HR zone //get the hrzones right. The calculation of the Heart rate zones here is based on the Karvonnen method //60-70% of HRR+minHR = zone2. //70-80% of HRR+minHR = zone3. //80-90% of HRR+minHR = zone4. //90-99% of HRR+minHR = zone5. //=>99% of HRR+minHR = serious risk of heart attack var minzone2 = hrr * 0.6 + minhr; var maxzone2 = hrr * 0.7 + minhr; var maxzone3 = hrr * 0.8 + minhr; var maxzone4 = hrr * 0.9 + minhr; var maxzone5 = hrr * 0.99 + minhr; // HR in the middle of the screen g.setFont("Vector",46); g.drawString(hr1, 72,66); //these functions call background images (>6kb each) that show HRzones graphically. Flash was too memory hungry, has to be uploaded in storage. function getzone1() { return require("heatshrink").decompress(atob("yOR4cA///gEB/8H0EAkEBsARCkAsZzMIhMkyVIL9kDGIVJwIDCAQI0pgguDAQI1EAQOAGkpoDAQeEAwqnlhArFAQOQGoxukiQrHzAJIyVAakwCCycCGpACBGrwoJMII1KyRqdFBDMChI1KpI1bFBAMDgI1LkhGCGr6uQUjiONgg1MUjEID4tAB441NQIwAQgQcEyAPIiQ1NUiw1Fe5IPFARNIGqlCDgcwdSikaGokgCp6nLXpIfNpgXSNxVAGtLgLGqrxVgLaaGrIABbTKIDXCQAFhJuHDKY1YgA1HjahPDIOTGjDAFAQUa3gWOagI1bUg0eyXwJh0ggY1bUgo1BpfAQR2AGrkAGotJm4mLoQTCGrsAGoskUZZrCa7gACgJXCuQmCNhUCJIVAGz0EGoMPEwVOGtqQBAQM9EwNJvg1tAAfMGoMnUZA1ogcyFIOcBpA1CpA1jgEMFIX4GpVgGskAnIpBp4LHhJrngEHsjaBnA1wgEZGoMm+A1Ipg1mgFyZwOcBIsBGoNJGs8O5IsB/A1wgExFgNPBIo1CkA2o0gsBvg1xjIsBk+ABAcEBAMkGtEAuQsB3wHDiA1sh3JkmTNglCGoIHEAEs5kmX+AIEkI1rg9k3vAA4cSgECiA1pgEe90AwgGCgVJNVQABgeAgKbDGoMkOYgAngMJkmYAwQ1ByY1rF4WSoAFBHYIFDNlQvBpA1EAoQAqF4NJkA7GAFY1Bkg7EGtsSGoOAgEEGoIEBAFcCGoOQGoanBAFkJkmTU4wArgLUBpCnFAF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HFa+27dtiVJkmAL9lbto1C0Q1ByQCBGlIyCAQW0GomSpA0mlo1F22JGoinmhYyEAQXRGoxujgQyFAQXaGo5uiiw1I7dEGpGSoA1eGQ4CCoA1JpMgGjkFGpCwGHA+QGrctGo3QCRJuGpA0ZgJoG2gULhJuGGr9oCxykehY1E7QXQNwqkXGorUKAA8ENwkgGqtbGomADKUCUjQ1E2jyVUglAGrGgXyykEGrA0WAAKkEGq1oGrCkFGt6kFpA1UeCgAGgSkDkAVPhY1eUgg1QwEtGr0Agg1Cj+AW50AGr8AiQ1C/wSOpECGr8AhI1B//4JB8LGr8AGoX/8A1NkizOACY1C/4mLGoTaBGsnwGpyhgGon/4A10/
- to have it running in the run.app as an extra screen, accessible by swipe right/swipe left.
-
-
-
I updated and ran a quick test with BTHRM, it worked, well done @halemmerich !
-
-
Disappointingly, I don't code at all @Ganblejs .
I may test run the app and offer suggestions and feedbacks. I think Gordon will want to keep the run app as is, simple and efficient, but will welcome a fork with advanced possibilities.
There are a few things ahead of us. Defining heart rate zones (I spoke about it here) .
Then organising a way to easily setup different runs. -
To answer the question in this thread,
Yes, I've seen these 2 apps. I can't use them at the same time as the Run app, and therefore I went for the "Heart rate alarm" app, which kind of partially did the job. I can set a lower and higher limit and it buzzes when limits are reached, and because it's a widget I could use the run app at the same time.
But it's not convenient at all: I can't setup intervals for, say, 5 minutes fast run, 2 minutes walk, or anything else. Also, I can't stop the "Heart rate alarm" app for a short walk, without stopping the Run app first.- IMO, before having a personnal trainer app, we need a runners coach app. Meaning, before having the watch decide of a set of running sessions (which will be different, like recovery: slow even pace in zone2, many different types of intervals, HIIT sessions, etc...), we need the watch to be able to offer specific kinds of runs and to give feedbacks (faster, slower, recover, half distance, you finished).
Maybe a fork of the run app with an extra screen we can swipe to could be an option.
I think a slider showing where in the heart rate zones you are any moment is what I'd love to see. I actually made a basic design of it half a year ago. And a distance gauge could be a great feedback too.
I use an ECG btw.
- IMO, before having a personnal trainer app, we need a runners coach app. Meaning, before having the watch decide of a set of running sessions (which will be different, like recovery: slow even pace in zone2, many different types of intervals, HIIT sessions, etc...), we need the watch to be able to offer specific kinds of runs and to give feedbacks (faster, slower, recover, half distance, you finished).
-
-I went for a run today after 7 weeks without any sport. I'm on 2v15.140, and the latest run app couldn't get the input from BTHRM.
Unexpectedly, the BTHRM app finds my device and displays its input.
-On a different note, the BTHRM app could have a little improvement in terms of UX. When modifying the settings of this app, usually, the next action is to go back the clock, then back to menu, then to the BTHRM app to check if settings work as expected. Maybe an option to check devices' inputs from the settings, or direct accesss to the app would be useful. -
- I'm all up for the app that suggests a workout plan. As seen in the video, the app suggests the intensity of the workout based on heart rate zones and shows these during the run.
- I think I already spoke a few dozen times of heart rate zones, this neat feature is needed to make banglejs a real sports watch (in line with competition), and/or to improve its fitness tracker possibilities.
I'm globally fully supporting all apps that would provide functionnalities present in other sport watches.
- I'm all up for the app that suggests a workout plan. As seen in the video, the app suggests the intensity of the workout based on heart rate zones and shows these during the run.
-
@RomanistHere , I use a Oh1+ from polar, the bthrm app mentionned above and the run app. The gps recorder is set on 1 sec and I also record bthrm. My longest run was 1h20 and I still had battery left. I suspect it can take almost 3 hours with these settings, so there's definitively something wrong with your watch.
-
I have to add that the Garmin watch knows my heart rate zones, because I've set them up. So I suspect it exports some extra bits of sorted out data in its .fit files that then appear in Golden Cheetah. My idea was that it would be great if the .gpx format included this too.
Maybe I'll ask on Golden Cheetah's forum, but I feel like here's the best place to ask and also to report. -
-
Is anyone using Golden Cheetah program to monitor their results ?
I was using this software before Banglejs with a Garmin forerunner 220, which records .fit files. It's a proprietary type of file, but I've read that it's well documented. Anyway, with the Garmin files, it was giving me % of time spent in each heart rate zone. With the banglejs, it doesn't, as can be seen in the picture below. Why is that ? Does it have it do with the gpx format ? Shoulud I tweak Golden Cheetah ? The heart rate being recorded every second on every run, I should be able to get that info. -
Whereas my banglejs worked pretty ok with latest V14, I decided to update it to V15.
My time changed to 10 hours earlier (my locale is at UTC +10, and even though this setting didn't change, I mention in case it would be related).
The screen displayed what's in the picture below. I got back to V14 and I'm having various issues I didn't have before. The BTHRM says that bthrm is disabled (it's on default mode). Also, this app quickly displays 4-5 lines of code when exited. Every action triggers a short apparition of the screen "updating boot 0...". The Pattern launcher doesn't work anymore.
The screen often display this sign in the bottom >.
I tried to restart the watch without code, but it didn't help. Any clu e? -
-
I'm going to describe what I need. I usually run 50 to 80 minutes. I'm almost satisfied with the run app's live data (HR, duration, distance, avg speed) and being able to extract a gpx after the run is critical to keep track of my runs. Basically, the run app covers the performance and the Karvonnen would allow me to check the intensity of my effort. So I need the Karvonnen app for most of my run and the run app just a few times during the run to check how I'm doing in terms of performance. Also, as soon as I'm running faster (increasing the intensity), I struggle to read the small numbers of the run app, I needed something bigger. For my personnal use, I will add a buzz when changing HR zone. I definitively want to swipe between run and Karvonnen and have the benefits of both.
I'm very happy to learn coding and I'm glad I have help to know where to look to implement what I need. Still, I have little spare time for coding and the process is very long for me. It took me 10 hours to get this code running. Now that I think about it, I think I should have written it differently... I will restart the process in a few weeks.