Avatar for Fteacher

Fteacher

Member since Nov 2021 • Last active Jan 2023
  • 12 conversations
  • 148 comments

I'm an enthusiastic Free and open source software proponent. Not a coder though.
I do sports and plan to find ways to use the bangle.js 2 in running, maybe swimming (I know about water resistance, but there are ways around that).

Most recent activity

  • in Bangle.js
    Avatar for Fteacher

    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 !

  • in Bangle.js
    Avatar for Fteacher

    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.d­rawString("ALERT", 20,53);g.drawString("HR limit", 18,84);
    }
    
  • in Bangle.js
    Avatar for Fteacher

    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("y­OR4cA///gEB/8H0EAkEBsARCkAsZzMIhMkyVIL9k­DGIVJwIDCAQI0pgguDAQI1EAQOAGkpoDAQeEAwqn­lhArFAQOQGoxukiQrHzAJIyVAakwCCycCGpACBGr­woJMII1KyRqdFBDMChI1KpI1bFBAMDgI1LkhGCGr­6uQUjiONgg1MUjEID4tAB441NQIwAQgQcEyAPIiQ­1NUiw1Fe5IPFARNIGqlCDgcwdSikaGokgCp6nLXp­IfNpgXSNxVAGtLgLGqrxVgLaaGrIABbTKIDXCQAF­hJuHDKY1YgA1HjahPDIOTGjDAFAQUa3gWOagI1bU­g0eyXwJh0ggY1bUgo1BpfAQR2AGrkAGotJm4mLoQ­TCGrsAGoskUZZrCa7gACgJXCuQmCNhUCJIVAGz0E­GoMPEwVOGtqQBAQM9EwNJvg1tAAfMGoMnUZA1ogc­yFIOcBpA1CpA1jgEMFIX4GpVgGskAnIpBp4LHhJr­ngEHsjaBnA1wgEZGoMm+A1Ipg1mgFyZwOcBIsBGo­NJGs8O5IsB/A1wgExFgNPBIo1CkA2o0gsBvg1xjI­sBk+ABAcEBAMkGtEAuQsB3wHDiA1sh3JkmTNglCG­oIHEAEs5kmX+AIEkI1rg9k3vAA4cSgECiA1pgEe9­0AwgGCgVJNVQABgeAgKbDGoMkOYgAngMJkmYAwQ1­ByY1rF4WSoAFBHYIFDNlQvBpA1EAoQAqF4NJkA7G­AFY1Bkg7EGtsSGoOAgEEGoIEBAFcCGoOQGoanBAF­kJkmTU4wArgLUBpCnFAFg1BpKnD4A1tagbdEAFqe­DAQOSGtyeDhI1BoA2uNAUBAQNIGtxoDAQNMGt0EN­AUEyVJwA2uGoNJiACBkA1ugAyBmACBkg1viQyB4Q­CBUV8CGomQNl4yBUIWSGt8JkmTAQOSoA1ugJrCyG­SpBsvNYMhGV5wIGWFJAQKkBG2ESGQI1CwA1ugQ1E­yCiwGoeSGt8JGolAGt0BGolINl4yBpmEHAI1vggy­BwACBmA1xkESpMmGt0CGQMkgQCByA2uGoWAAQOSN­l5oChI1BoA2uNAUBAQNIGtxoDgmSpOAGuMAGoMkG­tqeEiQ1BNlw1BpMAgQ1ByA1tagUgU4WTGtsQGoan­EAFg1BkinFAFkSGoOAOIY7CGtvAHYwAqgQvByAFE­HYQApgMJagIGCAoJrsAAOEGocBmEAhA0rkCeBoB0­FBIIApkMkcBDYrkmZA4kSGoOQGteSpIIEGoLgDAE­41HhIIBpA1skAINAEeEFg8EBAMkGtAsJiQIByA1n­iA1IgQIByRsoGoWABIsJGoNIGuMBGoLjGAEECZwX­AcaAAgGoWQBaY1pgQLByVAGs+YBhEJbQQ1koRfCB­pI1CbUhrCGpUQGoXANczLKIhoAYgQ1NgAOCpA1xg­I1kgEJGpsAwg1CwBrggBcPBwRHNACVCEYVgCJkIC­IVJGr9JkECGpo2BGoUwGrsSpMkwEgCh41BkmQGr+­SdaAUDbTggDUJyjCCgS5BGrSMCyT+BAB8JGoS5BG­rprQAAMEC4WTGjEQGqy5EpJtXwg1DfCg1DUi4aDR­KsBDTMEDTLyFpMgDCUJGoeSGq0CGocmDCUhGrakF­wBuPgUSoAXDyA1XYAIdC4CPCChmEyVIiAXDGrCkD­yDFDwgSJdgkSXKikLU4mSpgPFMoYCCJoQ1bAAOSY­ogCEwRiBBYzsQACA1JmA1IQAI0eAAMEGo8kwQ1Io­A1ggDFCFguQGpA0hAAQsHhIIFkw0kAAMIGomTgg1­FwA1mbo1gwg7DGdAAEyGSpkQAQJoYA=")) ;
      }
      
      function getzone2a() {
      return
      require("heatshrink").decompress(atob("y­OR4cA///gEg8E4kEh/8HgkggEB8EHFa+27dtiVJk­mAL9lbto1C0Q1ByQCBGlIyCAQW0GomSpA0mlo1F2­2JGoinmhYyEAQXRGoxujgQyFAQXaGo5uiiw1I7dE­GpGSoA1eGQ4CCoA1JpMgGjkFGpCwGHA+QGrctGo3­QCRJuGpA0ZgJoG2gULhJuGGr9oCxykehY1E7QXQN­wqkXGorUKAA8ENwkgGqtbGomADKUCUjQ1E2jyVUg­lAGrGgXyykEGrA0WAAKkEGq1oGrCkFGt6kFpA1Ue­CgAGgSkDkAVPhY1eUgg1QwEtGr0Agg1Cj+AW50AG­r8AiQ1C/wSOpECGr8AhI1B//4JB8LGr8AGoX/8A1­NkizOACY1C/4mLGoTaBGsnwGpyhgGon/4A10/
      
  • in Bangle.js
    Avatar for Fteacher

    I'm glad you added the option to switch off the rotation in the settings, the display was never in the correct position for me to watch it. Still, I used the settings to put rotation on "off", but it actually works anyway :/.

  • in Bangle.js
    Avatar for Fteacher

    I'm into scientific papers because I'm into a master's degree to become elearning project manager, but because I study, I have really little time for looking for docs for anything else :/ !

  • in Bangle.js
    Avatar for Fteacher

    I updated and ran a quick test with BTHRM, it worked, well done @halemmerich !

  • in Bangle.js
    Avatar for Fteacher

    Thanks for your reply
    I can't get BTHRM to give me inputs from my device anymore. I'll check it again later. I have little spare time for now.

  • in Bangle.js
    Avatar for Fteacher

    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.

Actions