• 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+AIEkI1rg9k3vAA4cSgECiA1pgEe90AwgGCgVJNVQABgeAgKbDGoMkOYgAngMJkmYAwQ1ByY1rF4WSoAFBHYIFDNlQvBpA1EAoQAqF4NJkA7GAFY1Bkg7EGtsSGoOAgEEGoIEBAFcCGoOQGoanBAFkJkmTU4wArgLUBpCnFAFg1BpKnD4A1tagbdEAFqeDAQOSGtyeDhI1BoA2uNAUBAQNIGtxoDAQNMGt0ENAUEyVJwA2uGoNJiACBkA1ugAyBmACBkg1viQyB4QCBUV8CGomQNl4yBUIWSGt8JkmTAQOSoA1ugJrCyGSpBsvNYMhGV5wIGWFJAQKkBG2ESGQI1CwA1ugQ1EyCiwGoeSGt8JGolAGt0BGolINl4yBpmEHAI1vggyBwACBmA1xkESpMmGt0CGQMkgQCByA2uGoWAAQOSNl5oChI1BoA2uNAUBAQNIGtxoDgmSpOAGuMAGoMkGtqeEiQ1BNlw1BpMAgQ1ByA1tagUgU4WTGtsQGoanEAFg1BkinFAFkSGoOAOIY7CGtvAHYwAqgQvByAFEHYQApgMJagIGCAoJrsAAOEGocBmEAhA0rkCeBoB0FBIIApkMkcBDYrkmZA4kSGoOQGteSpIIEGoLgDAE41HhIIBpA1skAINAEeEFg8EBAMkGtAsJiQIByA1niA1IgQIByRsoGoWABIsJGoNIGuMBGoLjGAEECZwXAcaAAgGoWQBaY1pgQLByVAGs+YBhEJbQQ1koRfCBpI1CbUhrCGpUQGoXANczLKIhoAYgQ1NgAOCpA1xgI1kgEJGpsAwg1CwBrggBcPBwRHNACVCEYVgCJkICIVJGr9JkECGpo2BGoUwGrsSpMkwEgCh41BkmQGr+SdaAUDbTggDUJyjCCgS5BGrSMCyT+BAB8JGoS5BGrprQAAMEC4WTGjEQGqy5EpJtXwg1DfCg1DUi4aDRKsBDTMEDTLyFpMgDCUJGoeSGq0CGocmDCUhGrakFwBuPgUSoAXDyA1XYAIdC4CPCChmEyVIiAXDGrCkDyDFDwgSJdgkSXKikLU4mSpgPFMoYCCJoQ1bAAOSYogCEwRiBBYzsQACA1JmA1IQAI0eAAMEGo8kwQ1IoA1ggDFCFguQGpA0hAAQsHhIIFkw0kAAMIGomTgg1FwA1mbo1gwg7DGdAAEyGSpkQAQJoYA=")) ;
      }
      
      function getzone2a() {
      return
      require("heatshrink").decompress(atob("yOR4cA///gEg8E4kEh/8HgkggEB8EHFa+27dtiVJkmAL9lbto1C0Q1ByQCBGlIyCAQW0GomSpA0mlo1F22JGoinmhYyEAQXRGoxujgQyFAQXaGo5uiiw1I7dEGpGSoA1eGQ4CCoA1JpMgGjkFGpCwGHA+QGrctGo3QCRJuGpA0ZgJoG2gULhJuGGr9oCxykehY1E7QXQNwqkXGorUKAA8ENwkgGqtbGomADKUCUjQ1E2jyVUglAGrGgXyykEGrA0WAAKkEGq1oGrCkFGt6kFpA1UeCgAGgSkDkAVPhY1eUgg1QwEtGr0Agg1Cj+AW50AGr8AiQ1C/wSOpECGr8AhI1B//4JB8LGr8AGoX/8A1NkizOACY1C/4mLGoTaBGsnwGpyhgGon/4A10/
      

    1 Attachment

    • signal-2023-01-20-121526.jpg
About

Avatar for Fteacher @Fteacher started