{"id":5064,"date":"2016-07-14T21:02:08","date_gmt":"2016-07-14T20:02:08","guid":{"rendered":"http:\/\/www.haydnwilliams.com\/blog\/?p=5064"},"modified":"2022-04-11T16:39:27","modified_gmt":"2022-04-11T15:39:27","slug":"suunto-watch-app","status":"publish","type":"post","link":"https:\/\/www.haydnwilliams.com\/blog\/suunto-watch-app\/","title":{"rendered":"Writing a Suunto watch app"},"content":{"rendered":"<p>I&#8217;ve just made my first app for the <a href=\"http:\/\/www.suunto.com\/en-GB\/Sports-Watch-Collections\/Suunto-Ambit-Collection\/\" target=\"_blank\" rel=\"noopener\">Suunto Ambit<\/a> range of watches (I have an Ambit 2), and thought I&#8217;d jot down some notes which might prove helpful to anyone else wanting to do the same. Points of note are&#8230;<\/p>\n<ol>\n<li>Suunto call the language &#8220;App Script&#8221;.<\/li>\n<li>There is a programming Guide from Suunto here: <a href=\"http:\/\/content.static.movescount.com\/downloads\/SuuntoAppZoneDeveloperManual.pdf\" target=\"_blank\" rel=\"noopener\">http:\/\/content.static.movescount.com\/downloads\/SuuntoAppZoneDeveloperManual.pdf<\/a><\/li>\n<li>Your &#8220;app&#8221; code is run once per second on the watch.<\/li>\n<li>As far as I can tell, variables are created and destroyed each time the code runs; there is no persistence of variables between executions. This means that you can&#8217;t count events over multiple code runs, for example &#8211; everything must be calculated from first principles each time.<\/li>\n<li>The only variable types available for you to use are\u00a0integer, float and datetime. These are defined using buttons on the website rather than within the code.\n<p><div id=\"attachment_5109\" style=\"width: 960px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5109\" class=\"size-full wp-image-5109\" src=\"http:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709a.png\" alt=\"Defining variables and setting the output format.\" width=\"950\" height=\"501\" srcset=\"https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709a.png 950w, https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709a-768x405.png 768w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><p id=\"caption-attachment-5109\" class=\"wp-caption-text\">Defining variables and setting the output format.<\/p><\/div><\/li>\n<li>The only output you can give from your code is a number (int or float) or a time. You must pass this by assigning its value to the &#8216;<code>RESULT<\/code>&#8216;\u00a0variable, <em>i.e.<\/em> <code>RESULT = 100;<\/code><\/li>\n<li>You also get six alphanumeric characters of text to play with in the output, split anywhere from &#8216;six before the result&#8217; to &#8216;six after the result&#8217; or anything in-between (<em>e.g.<\/em> three before and three after). You can change these labels in your code using <code>prefix=\"mystri\"<\/code> or <code>postfix=\"mystri\"<\/code> (that&#8217;s right &#8211; &#8216;<code>postfix<\/code>&#8216;. I think Suunto made that word up; seems to me that &#8216;suffix&#8217; is what they meant).<\/li>\n<li>There is no concept of &#8220;settings&#8221; for an app, so you cannot allow your users any kind of interaction to specify any times, numbers, <em>etc<\/em>. which may be relevant. You have to just hard-code with values you think will appeal to the majority of people. [As an aside, this leads to the existence of automatic code generators such as <a href=\"http:\/\/www.ambitintervals.com\/#!\/\" target=\"_blank\" rel=\"noopener\">Ambit Intervals<\/a>, which creates App Script code based on an individual user&#8217;s requirements.]<\/li>\n<li>You can test the app on the website, by playing around with sliders to represent changing values.\n<p><div id=\"attachment_5110\" style=\"width: 960px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5110\" class=\"size-full wp-image-5110\" src=\"http:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709c.png\" alt=\"App testing screen.\" width=\"950\" height=\"339\" srcset=\"https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709c.png 950w, https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2016\/07\/20160709c-768x274.png 768w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><p id=\"caption-attachment-5110\" class=\"wp-caption-text\">App testing screen.<\/p><\/div><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Notes on programming for the Suunto Ambit range of watches.<\/p>\n","protected":false},"author":2,"featured_media":5110,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[1177,1178,999],"class_list":["post-5064","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it","category-outdoors","tag-ambit","tag-app-script","tag-suunto"],"_links":{"self":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/5064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/comments?post=5064"}],"version-history":[{"count":0,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/5064\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/media\/5110"}],"wp:attachment":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/media?parent=5064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/categories?post=5064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/tags?post=5064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}