Suunto app Forum Suunto Community Forum
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Ambit Apps Compilation

    Scheduled Pinned Locked Moved Digital service transition
    43 Posts 14 Posters 5.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pavel.samokhaP Offline
      pavel.samokha
      last edited by pavel.samokha

      What is it?

      Service to compile Ambit Apps into binaries ready for uploading to the watch after Movescount no longer available.

      ATTENTION The implementation lacks proper testing and provided AS IS without any warranties.

      Formal disclaimer:

      THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

      How to use it

      • Access Compiler UI
      • Sample code is loaded, press “Compile”
      • Grab the response, it has the same format as used by SuuntoLink
      • Add the response to ambit-apps index file in SuuntoLink
        • Mac: /Applications/Suuntolink.app/Contents/Resources/app/suunto-apps/index.json
        • Windows: C:\Users\<username>\AppData\Local\Suuntolink\app-4.x.x\resources\app\suunto-apps\index.json
      • Connect the watch to your computer, configure sport mode with custom app, in the dropdown list you will see your newly added app

      Screenshot 2022-02-13 at 22.52.45.png

      Detailed instructions

      • User variables are passed in the code in so called HEADER section
      • In the header section variable names “prefix”, “postfix” and “format” are reserved for:
        • prefix and postfix - results prefix and postfix texts
        • format - output format. Should be set to one of fixed values set. Possible values: ZeroDecimals, OneDecimal, TwoDecimals, Time
      • Response contains mock fields “ruleId”,“name”,“categoryId”,“activityId”,“userCount” which are always set to the same value. Feel free to change them as you want
      • Keep in mind, that “ruleId” should be unique within your SuuntoLink installation!

      API

      Compiler service can be called via API, sample request & response below:

      curl --location --request POST 'https://ambitappscompiler.azurewebsites.net/api/compile' \
      --header 'x-functions-key: qakj8vb/62VgzmSl19mDQzRmW7nCSDv0zAo2A1aC3ldfd8U8r5jksA==' \
      --header 'Content-Type: text/plain' \
      --data-raw '/***HEADER***/
      print = 0
      myCounter = 0
      estimateScreen = 0
      /***ENDHEADER***/
      /* While in sport mode do this once per second*/
      /* Make user run 1 km before any estimation is given, show the duration to estimate*/ if((SUUNTO_DISTANCE < 1) && (estimateScreen == 0)){
      print = ((1-SUUNTO_DISTANCE)*1000)/(SUUNTO_AVG_SPD*1000/3600); prefix = "Run";
      postfix = "h";
      }
      if ((SUUNTO_DISTANCE >= 1) && (estimateScreen == 0)){
      estimateScreen = 1;
      myCounter = 0; }
      /*Now when user have ran more than 1km*/
      /*Scroll through the different time estimation screens*/ if ((estimateScreen == 1) && (myCounter >= 2)){
      print = SUUNTO_DURATION * Suunto.pow((5000/(SUUNTO_DISTANCE*1000)), 1.06); prefix = "5K";
      myCounter = 0;
      estimateScreen = 2;
      }
      if ((estimateScreen == 2) && (myCounter >=2)){
      print = SUUNTO_DURATION * Suunto.pow((10000/(SUUNTO_DISTANCE*1000)), 1.06); prefix = "10K";
      myCounter = 0;
      estimateScreen = 3;
      }
      if ((estimateScreen == 3) && (myCounter >=2)){
      print = SUUNTO_DURATION * Suunto.pow((21097/(SUUNTO_DISTANCE*1000)), 1.06); prefix = "1/2 M";
      myCounter = 0;
      estimateScreen = 4;
      }
      if ((estimateScreen == 4) && (myCounter >=2)){
      print = SUUNTO_DURATION * Suunto.pow((42195/(SUUNTO_DISTANCE*1000)), 1.06); prefix = "Mara";
      myCounter = 0;
      estimateScreen = 1;
      }
      myCounter = myCounter+1;
      RESULT = print;'
      

      Response:

      {"ruleId":11000001,"name":"Ambit App","categoryId":0,"activityId":1,"userCount":1,"binary":[73,65,77,82,85,76,69,0,8,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,144,0,0,0,44,0,52,0,62,0,72,0,82,0,90,0,108,0,126,0,0,0,114,117,108,101,48,0,255,191,82,69,83,85,76,84,0,0,255,63,112,114,101,102,105,120,0,0,255,63,112,111,115,116,102,105,120,0,255,63,116,105,116,108,101,0,10,0,83,85,85,78,84,79,95,68,73,83,84,65,78,67,69,0,18,0,83,85,85,78,84,79,95,65,86,71,95,83,80,68,0,0,11,0,83,85,85,78,84,79,95,68,85,82,65,84,73,79,78,0,4,0,3,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,1,0,0,0,0,0,2,0,0,0,32,0,6,0,0,0,0,0,6,0,0,0,32,0,2,0,0,0,0,0,12,0,0,0,32,0,1,0,0,0,0,0,14,0,0,0,4,0,1,0,0,0,0,0,16,0,0,0,4,0,1,0,0,0,0,0,20,0,0,0,4,0,1,0,0,0,0,0,24,0,0,0,4,0,0,0,0,0,0,0,28,0,0,0,160,0,1,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,32,0,0,0,4,0,0,0,0,0,0,0,36,0,0,0,4,0,0,0,0,0,0,0,40,0,0,0,160,0,4,0,0,0,0,0,2,0,0,0,160,0,2,0,0,0,0,0,6,0,0,0,160,0,3,0,0,0,0,0,8,0,0,0,160,0,4,0,0,0,0,0,12,0,0,0,160,0,6,0,0,0,0,0,16,0,0,0,160,0,5,0,0,0,0,0,22,0,0,0,44,0,28,0,0,0,82,117,110,0,104,0,53,75,0,0,49,48,75,0,49,47,50,32,77,0,77,97,114,97,0,0,54,2,28,8,0,22,48,0,25,16,9,24,89,2,0,25,16,9,24,89,3,0,25,16,9,24,89,4,0,144,0,0,0,0,21,10,0,144,0,0,0,0,21,11,0,144,0,0,0,0,21,12,0,16,1,21,8,0,28,5,0,28,6,0,12,28,7,0,12,22,6,0,13,238,1,18,234,1,20,5,0,144,111,18,131,58,3,144,0,0,128,63,5,20,12,0,144,0,0,0,0,9,11,22,57,0,144,0,0,128,63,20,5,0,144,111,18,131,58,3,2,144,0,0,122,68,3,20,6,0,144,102,102,102,64,3,144,228,56,142,62,3,4,21,10,0,25,16,13,24,89,2,0,25,16,14,24,89,3,0,20,5,0,144,111,18,131,58,3,144,0,0,128,63,8,20,12,0,144,0,0,0,0,9,11,22,19,0,144,0,0,128,63,21,12,0,144,0,0,0,0,21,11,0,20,12,0,144,0,0,128,63,9,20,11,0,144,0,0,0,64,8,11,22,66,0,20,7,0,144,0,64,156,69,20,5,0,144,111,18,131,58,3,144,0,0,122,68,3,4,144,20,174,135,63,33,12,0,1,0,2,0,3,21,10,0,25,16,15,24,89,2,0,144,0,0,0,0,21,11,0,144,0,0,0,64,21,12,0,20,12,0,144,0,0,0,64,9,20,11,0,144,0,0,0,64,8,11,22,66,0,20,7,0,144,0,64,28,70,20,5,0,144,111,18,131,58,3,144,0,0,122,68,3,4,144,20,174,135,63,33,12,0,1,0,2,0,3,21,10,0,25,16,16,24,89,2,0,144,0,0,0,0,21,11,0,144,0,0,64,64,21,12,0,20,12,0,144,0,0,64,64,9,20,11,0,144,0,0,0,64,8,11,22,66,0,20,7,0,144,0,210,164,70,20,5,0,144,111,18,131,58,3,144,0,0,122,68,3,4,144,20,174,135,63,33,12,0,1,0,2,0,3,21,10,0,25,16,17,24,89,2,0,144,0,0,0,0,21,11,0,144,0,0,128,64,21,12,0,20,12,0,144,0,0,128,64,9,20,11,0,144,0,0,0,64,8,11,22,66,0,20,7,0,144,0,211,36,71,20,5,0,144,111,18,131,58,3,144,0,0,122,68,3,4,144,20,174,135,63,33,12,0,1,0,2,0,3,21,10,0,25,16,18,24,89,2,0,144,0,0,0,0,21,11,0,144,0,0,128,63,21,12,0,20,11,0,144,0,0,128,63,1,21,11,0,20,10,0,21,1,0,13,4,0,19,31,0],"compatibleVariants":["Colibri","Duck","Emu","Finch","Greentit","Ibisbill","Jabiru","Kaka","Loon"]}
      

      Known issues

      • Not properly tested
      • Lacks proper error handling
      • No way to pass app name/title, category/activity as params n etc.

      Thanks @margusl for feedback

      Opinions expressed are solely my own and do not express the views or opinions of my employer

      sebchastangS 1 Reply Last reply Reply Quote 26
      • isaziI Offline
        isazi Moderator
        last edited by

        😍

        Watch: Suunto Vertical Ti

        Blog: isazi's home

        1 Reply Last reply Reply Quote 2
        • ? Offline
          A Former User
          last edited by A Former User

          @pavel-samokha said in Ambit Apps Compilation:

          Service to compile Ambit Apps into binaries ready for uploading to the watch after Movescount no longer availa

          I’m head over heels in love with this.
          kudos to Suunto!

          Z 1 Reply Last reply Reply Quote 0
          • Stas VarazhbitS Offline
            Stas Varazhbit
            last edited by

            I don’t understand a damn thing about it 😁 .But it’s cool to be able to do structured training for A3P again. And I’m very happy for those who understand how to do it.

            Suunto 9P
            Suunto 9 no baro
            Suunto Ambit3S

            1 Reply Last reply Reply Quote 1
            • sebchastangS Offline
              sebchastang Silver Members @pavel.samokha
              last edited by

              @pavel-samokha @margusl One of the best posts of the year 🙌

              Thanks for this 👍

              Suunto Vertical
              Suunto Traverse

              sebchastangS 1 Reply Last reply Reply Quote 0
              • sebchastangS Offline
                sebchastang Silver Members @sebchastang
                last edited by

                Is it possible to create new apps with this method?
                How can we set the output format (0 decimal, 1 decimal, time, …)?
                How to declare new variables?
                Do we set prefix and postfix values just like other variables?

                Thanks a lot for help.

                It is definitely a great step forward to be able to edit Suunto Apps using a command line but it would be much more easy in a graphical way. Any plan for such a user interface?

                Suunto Vertical
                Suunto Traverse

                pavel.samokhaP 1 Reply Last reply Reply Quote 1
                • Z Offline
                  zt_zzzzz @Guest
                  last edited by

                  @pavel-samokha
                  Excellent

                  1 Reply Last reply Reply Quote 0
                  • Z Offline
                    zt_zzzzz
                    last edited by

                    ask for advice,how to use it?😊 😊

                    1 Reply Last reply Reply Quote 0
                    • Aleksander HA Offline
                      Aleksander H Bronze Member
                      last edited by

                      We’ll, this is just plain wonderfull!

                      1 Reply Last reply Reply Quote 0
                      • pavel.samokhaP Offline
                        pavel.samokha @sebchastang
                        last edited by

                        @sebchastang said in Ambit Apps Compilation:

                        Is it possible to create new apps with this method?

                        I assume so, though as it lacks proper error handling n etc I’d rather see it as a tool for existing apps users to adjust existing app settings than developing app from scratch.

                        How to declare new variables?

                        See “detailed instructions” section on user variables and sample request. Is that what you are asking for or something else?

                        How can we set the output format (0 decimal, 1 decimal, time, …)?
                        Do we set prefix and postfix values just like other variables?

                        I just added info about that int “detailed instructions” section

                        It is definitely a great step forward to be able to edit Suunto Apps using a command line but it would be much more easy in a graphical way. Any plan for such a user interface?

                        Well, it’s not difficult to create simple UI for that (like editor form & compilation output, not trying to copy Movescount UI) but not sure if I have time to do that and when. Also may be even better to integrate such UI into SL, but we’re unlikely have resources to do that soon.

                        Opinions expressed are solely my own and do not express the views or opinions of my employer

                        sebchastangS 1 Reply Last reply Reply Quote 5
                        • sebchastangS Offline
                          sebchastang Silver Members @pavel.samokha
                          last edited by

                          @pavel-samokha Thanks for the clarification and answers.

                          I also think it is more a way to modify an existing app than creating a new ones.

                          I asked for new variables because there was a specific section to declare them in movescount but I understand I have to declare and set variable values at the same time in the header section now.

                          Suunto Vertical
                          Suunto Traverse

                          1 Reply Last reply Reply Quote 0
                          • pavel.samokhaP Offline
                            pavel.samokha
                            last edited by

                            Added Simple UI for Compiler

                            Opinions expressed are solely my own and do not express the views or opinions of my employer

                            1 Reply Last reply Reply Quote 6
                            • EgikaE Offline
                              Egika Platinum Member
                              last edited by

                              Now I have learned more old watches internal names 🙂

                              t6, S6, Elementum Terra, Ambit 3 Sapphire, Spartan Ultra Copper, Traverse Alpha, S7 Graphite LE, S9B Ambassador, S9P Granite Blue Titanium, S9PP Titanium Sand, Vertical All Black, Race Titanium Charcoal,
                              Race S All Black - TI Canary - Titanium Courtney

                              sebchastangS 1 Reply Last reply Reply Quote 1
                              • sebchastangS Offline
                                sebchastang Silver Members @Egika
                                last edited by

                                Hi,

                                I have compilation error when I set prefix and postfix values in the header section.
                                I have tried:
                                prefix = “xxx”
                                prefix = ‘xxx’
                                prefix = xxx

                                format is OK. Only prefix and postfix give errors.

                                Can anybody help me?
                                Thanks.

                                Suunto Vertical
                                Suunto Traverse

                                ? pavel.samokhaP 2 Replies Last reply Reply Quote 0
                                • ? Offline
                                  A Former User @sebchastang
                                  last edited by A Former User

                                  @sebchastang did you put prefix/postfix in the header?
                                  yes (sorry I’ve just relized you wrote that). I moved those in the code .

                                  1 Reply Last reply Reply Quote 1
                                  • pavel.samokhaP Offline
                                    pavel.samokha @sebchastang
                                    last edited by

                                    @sebchastang I’ll check on the weekend

                                    Opinions expressed are solely my own and do not express the views or opinions of my employer

                                    sebchastangS 1 Reply Last reply Reply Quote 1
                                    • sebchastangS Offline
                                      sebchastang Silver Members @pavel.samokha
                                      last edited by

                                      @G-Q @pavel-samokha thanks for your answers.

                                      Suunto Vertical
                                      Suunto Traverse

                                      pavel.samokhaP 1 Reply Last reply Reply Quote 0
                                      • pavel.samokhaP Offline
                                        pavel.samokha @sebchastang
                                        last edited by

                                        @sebchastang prefix = xxx should work now

                                        Opinions expressed are solely my own and do not express the views or opinions of my employer

                                        sebchastangS 1 Reply Last reply Reply Quote 2
                                        • sebchastangS Offline
                                          sebchastang Silver Members @pavel.samokha
                                          last edited by

                                          @pavel-samokha Thanks a lot!
                                          It’s all good now 👍

                                          Do you think there is a possibility (in a near future) to give access to the app simulator we had in movescount to test the apps?

                                          Suunto Vertical
                                          Suunto Traverse

                                          pavel.samokhaP 1 Reply Last reply Reply Quote 1
                                          • pavel.samokhaP Offline
                                            pavel.samokha @sebchastang
                                            last edited by

                                            @sebchastang Unfortunately, I think it’s unlikely

                                            Opinions expressed are solely my own and do not express the views or opinions of my employer

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Suunto Terms | Privacy Policy