Help for writing an app (running zones using Karvonnen method)

Posted on
Page
of 3
Prev
/ 3
Next
  • I can't even run the version 0.14 on my Bangle.js 1. I get low memory error. I say we just remove it from the supported list for this app.

  • Maybe just give the run app a mechanism to eval additional pages which can be selected by swiping but are installed as separate apps. Just to keep run as slim as possible by default. An example for this would be the Recorder app. That searches for all files named *.recorder.js and evals those. The resulting objects are in an array and could just provide a draw method to be called if the page is swiped to.
    I had a short run and I had two problems:

    • The settings do not seem to have defaults, app crashes accessing the undefined settings object
    • Swiping works fine, but the display was not updated but seemed complete otherwise
  • Maybe just give the run app a mechanism to eval additional pages which can be selected by swiping but are installed as separate apps.

    Sound like a good idea, it's beyond my current abilities though :P

    The settings do not seem to have defaults, app crashes accessing the undefined settings object

    Fixed this.

    Swiping works fine, but the display was not updated but seemed complete otherwise

    I've now seemingly got the ui to update as one would want. I tried to code it so it would only update the different elements when there is a relevant change, i.e. at least kind of lazily.

    Usual caveats that there is sure to still be bugs and the code is maybe not the easiest to follow.. Use the same links as before.

  • Hi all, and thanks for your participation in this !
    It seems all this is going a long way :) !
    Even though I have no time for this right now, I tried the app this morning and I could swipe, but reached a black screen each time I did so.
    It seems the code was improved, I don't check it otherwise I'll get involved, dragged into it and carried away from critical tasks I have to complete.
    I have no clue if it's the way to go, but I accepted the merge in github, I'll check it again when I'll try to catch up, but seemingly not before a week at least.

  • Did some tweaks to behavior on button presses, I think it may now be ready for testing on actual runs, as before install it via my app loader.

  • I have tested a bit:

    • Seems to work fine on dark theme, light theme needs dark fonts and light background arc for the zones.
    • On my daily driver bangle the pulse number jumped to the top left and number stacked on each other. That must have been something other installed, on my other bangle that was not the case.
    • I still get an error when there are no settings:

      Uncaught Error: Cannot read property 'min' of undefined
      at line 3 col 292 in run_karvonnen
      ...or",20);}let minhr=hrmSettings.min;let maxhr=hrmSettings.max;function calc...
                                              ^
      in function "show" called from line 38 col 216 in run.app.js
      ...(settings.HRM,exs.stats.bpm);}
      
  • Thanks, shouldn't the HRM key added to line 23 below have taken care of missing hrm settings?

    let settings = Object.assign({ 
       record: true, 
       B1: "dist", 
       B2: "time", 
       B3: "pacea", 
       B4: "bpm", 
       B5: "step", 
       B6: "caden", 
       paceLength: 1000, 
       notify: { 
         dist: { 
           value: 0, 
           notifications: [], 
         }, 
         step: { 
           value: 0, 
           notifications: [], 
         }, 
         time: { 
           value: 0, 
           notifications: [], 
         }, 
         HRM: { 
           min: 65, 
           max: 170, 
         } 
       }, 
     }, require("Storage").readJSON("run.json­", 1) || {});
    

    (https://github.com/thyttan/BangleApps/bl­ob/karvonnen/apps/run/app.js)

    The other stuff I should be able to sort out tomorrow.

  • Only if you give settings.notify.HRM to show(). I think HRM should not be under notify but directly under settings.

  • Thanks for spotting that 😊😅

    • I think I've fixed most things regarding theming, but not a light background arc.
    • I think the pulse number shouldn't jump around.
    • moved HRM out of the notify key in settings defaults.
    • light background arc now in place.

    Now I'm pretty confident with most things and I could do a PR to the main BangleApps repo. Ok with you, @Fteacher? :)

    I might look into using eval as you suggested, @halemmerich. (If you don't feel particularly compelled to do it :p)

  • Yeah sure, go ahead :).
    I uploaded the app on my watch and did a quick test a few hours ago, it already looked like it works ! Really nice.

  • I can have a look at splitting the additional page out :) Since the code is already in it's own file it probably is relatively easy. I suspect the combined code is to heavy for Bangle 1, so some changes have to be made anyway to keep Run feasible for Bangle 1. It seems to be very tight on memory as @Humpelstilzchen can not run it now. This of course depends on other installed widgets/boot code using memory, so maybe it is still working now for others.
    Will have a try this evening and do a pull on your repo if successful @Ganblejs.

  • @halemmerich Please note I wasn't even able to run the unchanged run app on the Bangle.JS1. So I would not invest to much work on this, just remove Bangle.js1 from the supported list.

  • Just using Run on my Bangle 2 uses around 2000 blocks of the available 12000. Since Bangle 2 has 4 times the memory of the Bangle 1 I guessed that Run should still fit, if there is not to much other stuff running.

  • I can have a look at splitting the additional page out :)

    Thanks, please do :) I had a stab at it and it works, updated on my karvonnen branch. But adding logic for eval-ing additional extension screens and handling if karvonnen is not installed is not there yet.

    I suspect the combined code is to heavy for Bangle 1, so some changes have to be made anyway to keep Run feasible for Bangle 1.

    That would be ideal if possible then.

  • I just opened a draft PR, so reviewing the code is a little easier now.

  • edit: Sorry, I didn't see the whole second page of comments, so this is less useful now!

    I'd say run.karvonnen.js or something like that would be a good bet.

    The thing I'm thinking of is there's a file for working out sunset, and then it started being used in a few places, and we had multiple apps providing sunset.js, many of which were different - and obviously we want to avoid that.

    If you though it might be used in other apps you could always add it to the modules folder?

  • I just saw the PR come in: https://github.com/espruino/BangleApps/p­ull/2591

    I've got to say, I'm a little anxious about adding this to the default run app - I remember folks with Bangle.js 1 complaining that even the current app could run into RAM issues with some extra widgets installed - this would make it almost unusable?

    The whole idea of me spending a bunch of time creating the exstats library was to try and make it easy for others to create new run apps with minimal code duplication, and to keep the standard run app as a very simple base that others could learn and build from.

    While the Karvonnen stuff looks great, it more than doubles the code size of the run app (145 to ~400 lines?)

    Maybe we should instead just rename it as a brand new app run-karvonnen or something?

  • Maybe we should instead just rename it as a brand new app run-karvonnen or something?

    Totally fine by me! Or would @halemmerich suggestion maybe be a good idea:

    Maybe just give the run app a mechanism to eval additional pages which can be selected by swiping but are installed as separate apps. Just to keep run as slim as possible by default. (...)

    ?

  • Maybe just give the run app a mechanism to eval additional pages which can be selected by swiping but are installed as separate apps. Just to keep run as slim as possible by default.

    I missed this! It seems like a good idea, but it feels a bit like we're almost re-implementing 'fast load' all over again...

    I'd rather not have a whole new app type that's a loadable fitness screen if it ends up only used by one app (run) and with only one screen (karvonnen). I know there are some apps (kitchen?) that have been made (by @HughB?) that had multiple screens loaded on demand, but I'm not sure if there would be any interest in splitting those screens out or how sensible it is.

    Maybe exstats could be modified so it stores the current run status on exit, and then you could switch apps while running - which would be a huge benefit anyway. Then it'd be as easy as allowing run to just fast-load another app on swipe and it'd be super configurable? ... but then what the swipe did would need configuring which isn't quite as easy as having it work straight away.

    It's a hard one... I feel like maybe a separate app that does it all (run-karvonnen / run+) is best for now, and then if we start to end up with a bunch of fitness apps/duplication we revisit it and see if there needs to be a whole new app type.

  • Maybe exstats could be modified so it stores the current run status on exit, and then you could switch apps while running - which would be a huge benefit anyway.

    Ooh, that could be cool indeed 😯

    It's a hard one... I feel like maybe a separate app that does it all (run-karvonnen / run+) is best for now, and then if we start to end up with a bunch of fitness apps/duplication we revisit it and see if there needs to be a whole new app type.

    Sounds sensible enough to me 🙂 I'll wait for @halemmerich to chime in before redoing the PR as a new app.

  • Then how about leaving it as is, renaming to Run+, specifying only Bangle 2 in metadata and just wait for somebody to implement additional screens there before thinking about how to split them out? That could also be a base to try out minimizing RAM usage by loading/unloading the screens inside the app to make it work on Bangle 1.
    Getting exstats to store on exit is probably useful anyway, since not being able to switch apps on a longer activity like biking is a bit limiting currently.

  • Then how about leaving it as is, renaming to Run+, specifying only Bangle 2 in metadata and just wait for somebody to implement additional screens there before thinking about how to split them out?

    Yes, sounds great to me!

    I'll see when I can get some time to tweak exstats

  • Ok! I'll do some changes and then mark the PR as ready for review.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Help for writing an app (running zones using Karvonnen method)

Posted by Avatar for Fteacher @Fteacher

Actions