# App Zone



## or_watching

Wow. Just read thru the Developer manual for the new app zone capability. 

This goes well beyond computing speed in furlongs per fortnight. 

I'm a total hack at programming, but it looks very promising and powerful. 

I think this is going to excite a certain number of tech savvy excercise fiends quite a bit. 

Of course it's still oriented to use during an excercise, vs in watch mode. Logging the result in Movescount = sweet!

Until an iOS or Android runners watch shows up, this the cats meow for versitility and data.


----------



## srwilson

I'm sorry, where did you find the Dev. Manual? I didn't see it. Probably right in front of me too.


----------



## jweak

Movescount.com - Powered by Suunto

Click enable advanced editing to open the new code editor and link to the Suunto App reference is on the left side.

Or just click here:
http://dcjitw11p57ya.cloudfront.net...perManual7A075CA1EB5F9948198673BFBBB0C586.pdf


----------



## srwilson

Thanks, if it were a snake...


----------



## Uoppi

or_watching (or anyone), would it be within possibility to create a PTE target app which shows the time left to a certain PTE value based on HR? I'm guessing it can't be done because one would need to know the PTE calculation algorithm used in Ambit. Perhaps the Suunto people would be able to devise such an app?


----------



## or_watching

Uoppi said:


> or_watching (or anyone), would it be within possibility to create a PTE target app which shows the time left to a certain PTE value based on HR? I'm guessing it can't be done because one would need to know the PTE calculation algorithm used in Ambit. Perhaps the Suunto people would be able to devise such an app?


yeah, it's ought to be doable as a rough estimate. Of course the watch has NO idea about your actual future effort/speed/hills.

Looks like current PTE and recent PTE are values that can be used in Apps. And so you ought to be able to extrapolate roughly with a "slope" of PTE. that would have to be coupled with some knowledge that the PTE bands (e.g. 1 to 2 vs 3-4) aren't equal size.
And all these are functions of Activity Class, which is also a App value.
Using the raw data of HR sounds harder unless you are Suunto


----------



## cobrapa

I see they added logic functions, does anyone know yet if they work on the current Ambit or are they limited to Ambit2?


----------



## Gerald Zhang-Schmidt

cobrapa said:


> I see they added logic functions, does anyone know yet if they work on the current Ambit or are they limited to Ambit2?


Some of the new app possibilities will work on the original Ambit, some won't. Unfortunately, it wasn't (yet?) possible to just blank them out depending on what's possible for the gear a user has, but there's a "check compatibility" (probably not the exact wording) option to see if something will work only on Ambit2 or also on original Ambit.
(Honestly, what I've mainly heard about that so far has been related to the "display flashing" that the 2 can do, but there seem to be some limits which e.g. make it impossible(?) to re-write the sunrise/set app for the original Ambit. Suunto was looking into that...)


----------



## Uoppi

or_watching said:


> Of course the watch has NO idea about your actual future effort/speed/hills.


Yeah, I found on the t3c, it took a while for the watch to come up with a reliable PTE target time once you reached a certain HR. If the HR was fluctuating, the feature was of limited use in practice. But it was very motivating to actually see how hard you still had to push instead of just hoping for the PTE to rise up one more notch (like on the Ambit currently).



> Using the raw data of HR sounds harder unless you are Suunto


Encouraged by your explanation of the matter, I will definitely be suggesting Suunto to create this app. Hmm, the same kind of target timer could be done with anticipated resting time too! |>


----------



## eeun

It's all very nice but is there any way to police or at least sort out the mess that is the app zone? 90 or more pages of duplicates, error ridden, time waster apps make near impossible to find anything useful. Not that I can suggest a workable solution myself but it does need tidying up and it's only going to get worse.


----------



## jweak

cobrapa said:


> I see they added logic functions, does anyone know yet if they work on the current Ambit or are they limited to Ambit2?


Yes. If-logic works in Ambit1. As do the new tail variables. You can see the compatibility if you enable the advanced editor and click the "verify" button. It shows compatible devices and how much memory it uses with each Ambit.


----------



## pjc3

jweak said:


> Yes. If-logic works in Ambit1. As do the new tail variables. You can see the compatibility if you enable the advanced editor and click the "verify" button. It shows compatible devices and how much memory it uses with each Ambit.


It does show from your simple example how resource hungry apps are for Ambit. It also appears Ambit2 has more than double "capacity"


----------



## primus

It looks like that the memory in the Ambit2(S) is 3 times larger than that of Ambit1.


----------



## Cyberbob13

Dear all,

What I really missed in Ambit so far was the option of creating workouts and loading them onto the device (as I did with Forerunner models, for example). Do you think that Apps may be used for workout scheduling / programing? What are your thoughts about this?

Best regards and kind greetings!
Christian


----------



## fredricl

Yes you can, the quote below is an exampel from the developers manual. I've just had a quick try out, and it seems the Ambit1 is very memory-constraint, currently does not support ie the new math-functions, and none of the Ambits allows to step the lap-counter from the app which would have been nice for app-controlled lap-meassurements.



> This App shows target speed based on accumulated distance. For the first two kilometers, the target pace is 6
> min/km. The next two kilometers the target pace is 5min/km, and for the last two, the target is 4min/km. After
> 6km theApp will ask you to slow down to recover properly by reducing heart rate to below 120.
> 
> if (SUUNTO_DISTANCE > 0 && SUUNTO_DISTANCE < 2){
> RESULT = ((SUUNTO_PACE - 6) / SUUNTO_PACE) * 100;
> }
> if (SUUNTO_DISTANCE > 2 && SUUNTO_DISTANCE < 4){
> RESULT = ((SUUNTO_PACE - 5) / SUUNTO_PACE) * 100;
> }
> if (SUUNTO_DISTANCE > 4 && SUUNTO_DISTANCE < 6){
> RESULT = ((SUUNTO_PACE - 4) / SUUNTO_PACE) * 100;
> }
> if (SUUNTO_DISTANCE >= 6){
> RESULT=((120 - SUUNTO_HR) / SUUNTO_HR) * 100;
> prefix="HR";
> }


----------



## ubiwan

The memory limitations for the Ambit 1 are definitely real... I managed to freeze mine with this app, which according to the movescount compatibility check uses 100% of the Ambit's capabilities:

if (SUUNTO_LAP_NUMBER <= 5) {
prefix = "5s";
RESULT = SUUNTO_PACE_AVG[5];
}
if (SUUNTO_LAP_NUMBER <= 10) {
prefix = "10s";
RESULT = SUUNTO_PACE_AVG[10];
}
if (SUUNTO_LAP_NUMBER <= 15) {
prefix = "15s";
RESULT = SUUNTO_PACE_AVG[15];
}
else {
prefix = "20s";
RESULT = SUUNTO_PACE_AVG[20];
}

Do not try this at home ;-) Fortunately, there seems to be a time-out implemented and the ambit gets restarted automatically after a while.


----------



## ubiwan

I removed some code and got it working. The embedded prefix="X" statements are not working however... The prefix is always "10s" somehow, no matter the lap nr. I wonder if the rest of the conditional statement is working properly. Going for a run now to check it out.


----------



## ubiwan

Created another version, which verified to 99% of Ambit1 capabilities and freezes the Ambit again :-( Suunto needs to do some more work on the logic behind the "verify" button it seems...


----------



## fredricl

Try with 'else if' in the latter cases. Otherwise it will use all tail-variables as the lapcount increases. It will fall through all you simple ifs and the last one execuded will remain on display:

if (SUUNTO_LAP_NUMBER <= 5) {
 prefix = "5s";
 RESULT = SUUNTO_PACE_AVG[5];
}
else if (SUUNTO_LAP_NUMBER <= 10) {
 prefix = "10s";
 RESULT = SUUNTO_PACE_AVG[10];
}
else if (SUUNTO_LAP_NUMBER <= 15) {
 prefix = "15s";
 RESULT = SUUNTO_PACE_AVG[15];
}
else {
 prefix = "20s";
 RESULT = SUUNTO_PACE_AVG[20];
}


Also we have this warning in the dev-guide:


> NOTE! Using different tail lengths within one App can lead to a very large App. So, depending to the
> device, such a largeApp might not fit into the device memory.


----------



## ubiwan

Hi,

Thanks for you reply, but I think this should not make a difference, the logic is the same for both cases. It will start at the first IF and continue to the second, etc., until one of the conditional statements is true. Then the rest is not processed:


> When the first if statement is true, then the remaining code is not processed.


. The RESULT = X is thus also considered as a RETURN.

My point is also that they have a "Verify" button that obviously is not yet working as it should.



fredricl said:


> Try with 'else if' in the latter cases. Otherwise it will use all tail-variables as the lapcount increases. It will fall through all you simple ifs and the last one execuded will remain on display:
> 
> if (SUUNTO_LAP_NUMBER <= 5) {
> prefix = "5s";
> RESULT = SUUNTO_PACE_AVG[5];
> }
> else if (SUUNTO_LAP_NUMBER <= 10) {
> prefix = "10s";
> RESULT = SUUNTO_PACE_AVG[10];
> }
> else if (SUUNTO_LAP_NUMBER <= 15) {
> prefix = "15s";
> RESULT = SUUNTO_PACE_AVG[15];
> }
> else {
> prefix = "20s";
> RESULT = SUUNTO_PACE_AVG[20];
> }
> 
> 
> Also we have this warning in the dev-guide:


----------



## fredricl

> _When the first if statement is true, then the remaining code is not processed._


 relates to figure 17 below the quote and talks about  'if ... else'.

I'm just speculating here, but memory may also be restricted by how many screens and values that are activated in the mode that the app is loaded into, making it impossible to give 100% answer. It can be a pain in the back programming low-memory embedded devices where you can't know the hard constraints up front.


----------



## ubiwan

You are right, I'm sorry. I interpreted RESULT=X as a return statement, similar to Java for instance, but maybe that's not correct. Still, it should not freeze because in some cases all ELSE IFs need to be checked anyway... I have changed it, but the behaviour seems to be the same. The prefix=X statements are still not working as they should.



fredricl said:


> relates to figure 17 below the quote and talks about 'if ... else'.
> 
> I'm just speculating here, but memory may also be restricted by how many screens and values that are activated in the mode that the app is loaded into, making it impossible to give 100% answer. It can be a pain in the back programming low-memory embedded devices where you can't know the hard constraints up front.


----------



## jweak

ubiwan said:


> Hi,
> 
> Thanks for you reply, but I think this should not make a difference, the logic is the same for both cases. It will start at the first IF and continue to the second, etc., until one of the conditional statements is true. Then the rest is not processed: . The RESULT = X is thus also considered as a RETURN.
> 
> My point is also that they have a "Verify" button that obviously is not yet working as it should.


This is not true. Every 'if' that the condition matches are processed. It does not exit after the first if. The quoted text is referring to the code example in the picture where 'else if' are used.

edit. Ah. fredricl replied correctly.


----------



## anto1980

There is not an App to get the autopause on Ambit1?


----------



## fredricl

There is an option for autopause for my Ambit1 in Movescount->Gear->Suunt Ambit->Customization->Running->Advanced Settings->Auto Pause.
I have not had any possibillity to try it yet, so I can't say if it works or how.


----------



## Guest

anto1980 said:


> There is not an App to get the autopause on Ambit1?


If I'm not wrong this morning looking in the customization section under advanced settings I've seen an autopause checkbox. Probably what you're asking for


----------



## arkiesg

ihoannes said:


> If I'm not wrong this morning looking in the customization section under advanced settings I've seen an autopause checkbox. Probably what you're asking for


The settings are there but looks like an ambit1 settings bug. I can't get it to autopause no matter how long I stand still.


----------



## anto1980

ihoannes said:


> If I'm not wrong this morning looking in the customization section under advanced settings I've seen an autopause checkbox. Probably what you're asking for


Does not functions on watch!


----------



## srwilson

fredricl said:


> There is an option for autopause for my Ambit1 in Movescount->Gear->Suunt Ambit->Customization->Running->Advanced Settings->Auto Pause.
> I have not had any possibillity to try it yet, so I can't say if it works or how.


hmmm... I see autolap but no autopause. Are you sure about this? I've never seen the option to autopause for the Ambit. I've asked for it but...


----------



## fredricl

Help-popup for Autopause in advanced settings:


> Autopause is a feature that will automatically stop the log recorder during your training session when very low speed is detected. The session is reactivated when you speed up again.


----------



## srwilson

Here is a screen capture of my advanced setting for running for my Ambit1. 







I know I'm prone to miss things, but where is it?


----------



## Guest

srwilson said:


> Here is a screen capture of my advanced setting for running for my Ambit1.
> I know I'm prone to miss things, but where is it?


you're right and believe or not but it's disappeared. Probably a leftover


----------



## srwilson

ihoannes said:


> you're right and believe or not but it's disappeared. Probably a leftover


Oh I believe it. LOL

I don't think it necessary to comment on Suunto's ability to put things together; they do a good enough job all by themselves.:-!


----------



## or_watching

Hi.
Pardon my basic question... as in TRS-80 BASIC. 
Anybody know why the first two snippets generates an error:
_Error in substitution on line 5_



> /* While in sport mode do this once per second */
> RESULT = 0;
> if (a > b) {
> a = b;
> b = SUUNTO_DURATION;
> timeVAR = SUUNTO_DURATION;
> }
> RESULT = timeVAR;





> /* While in sport mode do this once per second */
> RESULT = 0;
> if (a > b) {
> a = b;
> b = SUUNTO_DURATION;
> }
> RESULT = b;


but this does not


> /* While in sport mode do this once per second */
> RESULT = 0;
> if (a > b) {
> a = b;
> timeVAR = SUUNTO_DURATION;
> }
> RESULT = timeVAR;


Is there some syntax or logical reason a variable ("b") can't be used first to update another variable, and then itself be updated?


----------



## fredricl

That's wierd. I had a thought that simple cases of '=' might not be assignment but referencing instead (to save memory), so that referencés got write-protected to not change the assigne unexpectedly (a decent compiler should be able to figure it out and optimize regardless). But it does not work even if you change the first assignment to 'a = b+3;'. I don't know, strange.


----------



## Guest

or_watching said:


> Hi.
> Pardon my basic question... as in TRS-80 BASIC.
> Anybody know why the first two snippets generates an error:
> _Error in substitution on line 5_
> 
> but this does not
> 
> Is there some syntax or logical reason a variable ("b") can't be used first to update another variable, and then itself be updated?


for some good (wrong) reason "b" needs to be evaluated ahead. try to add

b = b;

at the beginning of your formula and see if it works. I'm also in troubles w/ prefix/postifix management.


----------



## fredricl

In simulation or in the Ambit? The dev-guide says:


> It is also possible to modify the prefix and postfix in advanced mode, but these are not updated in simulation.


----------



## Guest

fredricl said:


> In simulation or in the Ambit? The dev-guide says:


thanks, I'm aware of that. the problem is it does not like if I try to reword prefix or postfix e.g.

if (bla bla) {
...
prefix="xxx";
}
else {
....
prefix="yyy";
}

it returns a "Whoops error..." and anyway if I disregard the warning it does not work on the ambit1 (uhm, maybe it's a feature for the ambit2(s))


----------



## fredricl

Hmm, this verifies for me:

RESULT = 0;
if (1 < 2) {
 prefix="suunto";
}
else {
 prefix="ambit";
}


----------



## Guest

fredricl said:


> Hmm, this verifies for me:
> 
> RESULT = 0;
> if (1 < 2) {
> prefix="suunto";
> }
> else {
> prefix="ambit";
> }


while VERIFY is ok in the TEST window I still see:


 Whoops! Please check the formula.


----------



## fredricl

You are right, I get the same result with this simple code:

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED < 5) {
 prefix = "pace ";
 RESULT = SUUNTO_PACE;
}
else {
 prefix = "speed ";
 RESULT = SUUNTO_SPEED;
}

Looks like they need a better beta-program... :roll: (or maybe simply *a* beta-program).


----------



## Guest

fredricl said:


> You are right, I get the same result with this simple code:
> 
> /* While in sport mode do this once per second */
> RESULT = 0;
> if (SUUNTO_SPEED < 5) {
> prefix = "pace ";
> RESULT = SUUNTO_PACE;
> }
> else {
> prefix = "speed ";
> RESULT = SUUNTO_SPEED;
> }
> 
> Looks like they need a better beta-program... :roll: (or maybe simply *a* beta-program).


I've opened a ticket for this. Let's see what they say.


----------



## suecoloco

It would be interesting if someone could do a live TRIMP calculation with the same logic as in Sporttracks Training load


----------



## or_watching

suecoloco said:


> It would be interesting if someone could do a live TRIMP calculation with the same logic as in Sporttracks Training load


Hi.
I made one with the old App zone.
https://www.watchuseek.com/f233/ambit-app-ideas-783022-3.html#post5769322

I have no idea about the proper raw calculation, so I just made the best formula with the original app limits I could...that matches my ST3 TRIMP scores from mecht's plugin.
Works very well for me. like usually within a few %, for most of my training runs.
I have no clue how close it it for other folks.

With the new conditionals, it could be easily improved to remove the bogus negative values in the early part of the run. edit.... v2 is at: http://www.movescount.com/apps/app10000409-TRIMP_estimator_v2

and if you know the real TRIMP equation, it could probably made into a proper TRIMP calculation.


----------



## or_watching

suecoloco said:


> It would be interesting if someone could do a live TRIMP calculation with the same logic as in Sporttracks Training load


Hi again,
If someone with an Ambit2 wants to try this TRIMP app based on HR zones, let me know how it works. Or if it works. 
TRIMP (HR Zones) - App at Movescount.com

The exponents aren't Ambit1 compatible. 
And the Test sliders are kind of limited.

It won't match ST, because the app doesn't know you user entered HR zones. Instead it divides up your HRR into 9 zones. 
I'm interested to hear how it compares to anything else out there, and if the results make any sense.


----------



## or_watching

ihoannes said:


> for some good (wrong) reason "b" needs to be evaluated ahead. try to add
> 
> b = b;
> 
> at the beginning of your formula and see if it works.


Thanks. No more error!


----------



## suecoloco

I checked it but unfortunately it is too high for me. In training load I get for example 97 and with your plugin I get 125


----------



## mondoshawan

fredricl said:


> You are right, I get the same result with this simple code:
> 
> /* While in sport mode do this once per second */
> RESULT = 0;
> if (SUUNTO_SPEED < 5) {
> prefix = "pace ";
> RESULT = SUUNTO_PACE;
> }
> else {
> prefix = "speed ";
> RESULT = SUUNTO_SPEED;
> }
> 
> Looks like they need a better beta-program... :roll: (or maybe simply *a* beta-program).


i just discovered that there can't be 2 results at a time. i removed the "postfix" "prefix" code and then it works:

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED < 15){
RESULT = SUUNTO_PACE;
}
else{
RESULT = SUUNTO_SPEED;
}

Now, how do we get an prefix/postfix depending on the result again?


----------



## mondoshawan

the only one result theory isn't true!

this code works - no more errors - will check it on Ambit tomorrow:

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED < 15) {
RESULT = SUUNTO_PACE;
postfix = "/km";
}
else {
RESULT = SUUNTO_SPEED;
postfix = "Kmh";
}

don't use blank digit in pre and postfix!


----------



## mondoshawan

well&#8230;,
my code passes the hygene detector on movescount. But that's just all.

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED < 15) {
RESULT = SUUNTO_PACE;
postfix = "/km";
}
else {
RESULT = SUUNTO_SPEED;
postfix = "Kmh";
}

mid row is the code above and the lower one is the pace - the result that it should look like, but it did'nt:









Seems that there is a lot of work for Suunto&#8230;


----------



## srwilson

So can you change the format in the script? For pace it should show as time but for speed in decimals.


----------



## mondoshawan

srwilson said:


> So can you change the format in the script? For pace it should show as time but for speed in decimals.


i think no. The format has to be set for the hole app. But even when i change the format to time, then it looks like this:








i've to clean my Ambit screen&#8230; ;-)


----------



## srwilson

mondoshawan said:


> i think no. The format has to be set for the hole app. But even when i change the format to time, then it looks like this:
> 
> i've to clean my Ambit screen&#8230; ;-)


It looks right on the sample watch for me. So does it look different on the real watch from what you are seeing on the sample watch?

Here is what I did but have not checked it out. Format is set to time and I converted to miles.

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED <15){
RESULT=(SUUNTO_PACE*1.609)*60;
postfix = "/mile";
;
}
else{
RESULT=SUUNTO_SPEED*0.6214;
postfix = "Mph";
}


----------



## mondoshawan

srwilson said:


> It looks right on the sample watch for me. So does it look different on the real watch from what you are seeing on the sample watch?


Yes!
my code looked right on sample watch too.
Sample watch is not real watch.

Test your code on real Ambit.


----------



## srwilson

Ok just tested it and it seems to display correctly. The middle is regular pace and the lower is the test code.


----------



## or_watching

mondoshawan said:


> well&#8230;,
> my code passes the hygene detector on movescount. But that's just all.
> 
> /* While in sport mode do this once per second */
> RESULT = 0;
> if (SUUNTO_SPEED < 15) {
> RESULT = SUUNTO_PACE;
> postfix = "/km";
> }
> else {
> RESULT = SUUNTO_SPEED;
> postfix = "Kmh";
> }
> 
> mid row is the code above and the lower one is the pace - the result that it should look like, but it did'nt:
> 
> View attachment 1077164
> 
> 
> Seems that there is a lot of work for Suunto&#8230;


Does it matter to have started the Chronograph?
Since pace is "per km", and your "km" is 0.00, then maybe you are getting a kind of "division by zero" invalid result, and in this case it's a bogus number.

If so, you can add some conditionals to filter out such cases before the exercise has started.


----------



## srwilson

or_watching said:


> Does it matter to have started the Chronograph?


I did not start the Chronograph yet it seemed to work for me, but you still could be right.


----------



## mondoshawan

or_watching said:


> Does it matter to have started the Chronograph?


It doesn't matter.

Interestingly srwilson code works on his Ambit converted to miles - i tried that on mine, but i've got a constantly 48:30 mile pace&#8230;

I changed my code to convert the SUUNTO_Pace and the Format to time:

/* While in sport mode do this once per second */
RESULT = 0;
if (SUUNTO_SPEED < 6){
RESULT=SUUNTO_PACE*60;
postfix = "/km";
}
else{
RESULT=SUUNTO_SPEED;
postfix = "Kmh";
}

The pace is displayed correctly on the sample watch but not on my Ambit - midrow is the code above:









But anyway&#8230; since we could not adjust the Format per script, this App does make any sense. My Intention was to show me Speed instead of Pace, if i'm riding on a Bike during Triathlon and show the Pace while running.


----------



## suecoloco

Since it appears that we do not get fusedalti for ambit 1 i was thinking that it should not be that difficult to make an app that does the same, more or less, if they would give us GPS-altitude as parameter. The most important feature would be to calibrate the altitude initially but also if you take a break without pausing (more for hiking). It would be something like if speed is less than 2 km/h than ambit would consider this as a pause and hence if there are any barometric changes it would take the altitude from GPS (like fusedalti does) when you start moving again.

Any ideas?


----------



## mondoshawan

i did another test and reduced the code only to this one row:

/* While in sport mode do this once per second */
RESULT=SUUNTO_SPEED;

Format is 0 decimals and i defined a postfix "kmh"

This should show the actual speed, the sample watch does - my Ambit not. Could anybody check this too?


----------



## twelveone

Does anyone know if it's possible for an app to use the Suunto.alarmBeep() function based on when the result exceeds a certain amount, but only do it once, not every second, like what is happening with the following:

/* While in sport mode do this once per second */
RESULT = (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3);
/* 1 beep when in PZ1 */
if (RESULT <= (FTP*0.55)) {
Suunto.alarmBeep();
}
/* 2 beeps when in PZ2 */
if (RESULT >= (FTP*0.56) && RESULT <= (FTP*0.75)) {
Suunto.alarmBeep();
Suunto.alarmBeep();
}
/* 3 beeps when in PZ3 */
else if (RESULT >= (FTP*0.76) && RESULT < (FTP*0.90)) {
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
}
/* 4 beeps when in PZ4 */
else if (RESULT >= (FTP*0.91) && RESULT < (FTP*1.05)) {
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
}
/* 5 beeps when in PZ5 */
else if (RESULT >= (FTP*1.06) && RESULT < (FTP*1.2)) {
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
}
/* 6 beeps when in PZ6 */
else if (RESULT >= (FTP*1.21)) {
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
}


----------



## or_watching

twelveone said:


> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep()
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();


Remember, the entirety of app code is executed once each second. So multiple beeps are all consolidated down to one beep. I think you need to keep track with a counter to beep in the subsequent seconds.

I haven't tried it in the watch, but had written this to accomplish the same idea.



> ...blah blah ...
> if (Beep >0 && stateFood ==0) {
> Suunto.alarmBeep();
> Beep = Beep-1;
> prefix = "Drink" ;
> }
> .
> .
> .
> if (xyz true) {
> Beep = 10;
> }


Caveat emptor


----------



## srwilson

mondoshawan said:


> i did another test and reduced the code only to this one row:
> 
> /* While in sport mode do this once per second */
> RESULT=SUUNTO_SPEED;
> 
> Format is 0 decimals and i defined a postfix "kmh"
> 
> This should show the actual speed, the sample watch does - my Ambit not. Could anybody check this too?


It works for me. Not sure what you've going on there.









My watch is showing some age. Guess I'd better get a new one!!!


----------



## eeun

You're a clever lot! Anyone know how I could get a 'highest heart rate' displayed live that shows the highest HR of the move so far and continues to update it the HR is bettered?

Can't be as simple as 

/* While in sport mode do this once per second */
RESULT = SUUNTO_MAX_HR;

...can it?


----------



## mondoshawan

srwilson said:


> It works for me. Not sure what you've going on there.
> 
> View attachment 1079511
> 
> 
> My watch is showing some age. Guess I'd better get a new one!!!


Thx, Steve. That's interesting! I don't know why this is not working on mine and wrote a mail at Suunto support now.
My Ambit is Hardware Version E.1.J.4

With some age they even get better, i guess.


----------



## mondoshawan

eeun said:


> You're a clever lot! Anyone know how I could get a 'highest heart rate' displayed live that shows the highest HR of the move so far and continues to update it the HR is bettered?
> 
> Can't be as simple as
> 
> /* While in sport mode do this once per second */
> RESULT = SUUNTO_MAX_HR;
> 
> ...can it?


it could&#8230;
but since mine didn't show actual speed within an App, i would suggest to test it on real Ambit.


----------



## srwilson

eeun said:


> how I could get a 'highest heart rate' displayed live that shows the highest HR of the move so far and continues to update it the HR is bettered?
> 
> Can't be as simple as
> 
> /* While in sport mode do this once per second */
> RESULT = SUUNTO_MAX_HR;
> 
> ...can it?


That should work. Now how clever is that! b-)



mondoshawan said:


> My Ambit is Hardware Version E.1.J.4


Yep, that's the same as mine. Maybe a Reflash or Reset???? have you tried that?



mondoshawan said:


> With some age they even get better, i guess.


You know, I like this watch. Therefore I wear it almost everyday and it does see some abuse!! Which is obvious. ;-)


----------



## mondoshawan

srwilson said:


> That should work. Now how clever is that! b-)
> 
> Yep, that's the same as mine. Maybe a Reflash or Reset???? have you tried that?
> 
> You know, I like this watch. Therefore I wear it almost everyday and it does see some abuse!! Which is obvious. ;-)


I did a complete Reflash with FW 2.0.8 and a GPS reset too. That changed nothing.

Same as i, but my Ambit got a new beezel in the meantime at service.


----------



## eeun

eeun said:


> You're a clever lot! Anyone know how I could get a 'highest heart rate' displayed live that shows the highest HR of the move so far and continues to update it the HR is bettered?
> 
> Can't be as simple as
> 
> /* While in sport mode do this once per second */
> RESULT = SUUNTO_MAX_HR;
> 
> ...can it?





srwilson said:


> That should work. Now how clever is that! b-)


Well now my Ambit is fully charged I have run a short test and it does work, brilliant!

I've also made an app that shows the current % of your Max HR

/* While in sport mode do this once per second */
RESULT = SUUNTO_HR / SUUNTO_USER_MAX_HR * 100;

and one that show the highest % you hit of your MHR

/* While in sport mode do this once per second */
RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;

The only down side is the '1 app' as I'd like to see all 3 of these in addition to current HR and Average HR (which we get as standard fields) so I've sent this off to Suunto as a suggested 2.5 enhancement to add these to the standard fields away from apps altogether.


----------



## TrailRnR

eeun said:


> The only down side is the '1 app' as I'd like to see all 3 of these in addition to current HR and Average HR (which we get as standard fields) so I've sent this off to Suunto as a suggested 2.5 enhancement to add these to the standard fields away from apps altogether.


How about the following app for a work around (each value displayed for 3-seconds):

/* While in sport mode do this once per second */
count=count+1;
if (count<=3) {
prefix = "MAX";
postfix = "HR";
RESULT = SUUNTO_MAX_HR;
}
else if (count<=6) {
prefix = "%MX";
postfix = "HR";
RESULT = SUUNTO_HR / SUUNTO_USER_MAX_HR * 100;
}
else if (count<=9) {
prefix = "MX%";
postfix = "MHR";
RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
}
else {
count=0;
}

Unfortunately, with just one app you can't trend each data point in movescount doing this.


----------



## eeun

TrailRnR said:


> How about the following app for a work around (each value displayed for 3-seconds):
> 
> /* While in sport mode do this once per second */
> count=count+1;
> if (count<=3) {
> prefix = "MAX";
> postfix = "HR";
> RESULT = SUUNTO_MAX_HR;
> }
> else if (count<=6) {
> prefix = "%MX";
> postfix = "HR";
> RESULT = SUUNTO_HR / SUUNTO_USER_MAX_HR * 100;
> }
> else if (count<=9) {
> prefix = "MX%";
> postfix = "MHR";
> RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
> }
> else {
> count=0;
> }
> 
> Unfortunately, with just one app you can't trend each data point in movescount doing this.


Would this allow me to see all three 'in a rolling loop'? If so that might work pretty well.


----------



## twelveone

or_watching said:


> Remember, the entirety of app code is executed once each second. So multiple beeps are all consolidated down to one beep. I think you need to keep track with a counter to beep in the subsequent seconds.
> 
> I haven't tried it in the watch, but had written this to accomplish the same idea.
> 
> Caveat emptor


Thanks. I realised (duh) that displaying the current power zone on the watch would be infinitely more useful than beeping so did this instead:



> /* While in sport mode do this once per second */
> /* PZ1 when Kinetic Power @ <56% */
> if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*0.56)) {
> RESULT = 1;
> }
> /* PZ2 when Kinetic Power @ 56-75% */
> else if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) >= (FTP*0.56) && (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*0.76)) {
> RESULT = 2;
> }
> /* PZ3 when Kinetic Power @ 76-90% */
> else if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) >= (FTP*0.76) && (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*0.91)) {
> RESULT = 3;
> }
> /* PZ4 when Kinetic Power @ 91-105% */
> else if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) >= (FTP*0.91) && (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*1.06)) {
> RESULT = 4;
> }
> /* PZ5 when Kinetic Power @ 106-120% */
> else if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) >= (FTP*1.06) && (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*1.21)) {
> RESULT = 5;
> }
> /* PZ6 when Kinetic Power @ >121% */
> else if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) >= (FTP*1.21)) {
> RESULT = 6;
> }


Seems to do the trick.


----------



## TrailRnR

eeun said:


> Would this allow me to see all three 'in a rolling loop'? If so that might work pretty well.


I tried this on watch and the prefix and postfix will not change as the values update. The data rolls thru the data display properly but the pre/post remains MAX/HR.

Moving the prefix/postfix commands after the Results made no difference.:-s


----------



## eeun

TrailRnR said:


> I tried this on watch and the prefix and postfix will not change as the values update. The data rolls thru the data display properly but the pre/post remains MAX/HR.
> 
> Moving the prefix/postfix commands after the Results made no difference.:-s


I get the dreaded "Whoops, please check the formula" error.

On reflection it's the _RESULT = SUUNTO_MAX_HR; _and _SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100_ that I'm interested in combining. Any suggestions?


----------



## mondoshawan

eeun said:


> I get the dreaded "Whoops, please check the formula" error.
> 
> On reflection it's the _RESULT = SUUNTO_MAX_HR; _and _SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100_ that I'm interested in combining. Any suggestions?


First of all, you have to create your own variable on top "count" - set value to "0". Then you go with this code:

/* While in sport mode do this once per second */
count=count+1;
if (count<=4) {
prefix = "MAX";
postfix = "HR";
RESULT = SUUNTO_MAX_HR;
}
else if (count<=8) {
prefix = "MX%";
postfix = "MHR";
RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
}
else {
count=1;
RESULT = SUUNTO_MAX_HR;
prefix = "MAX";
postfix = "HR";
}

The values are displayed for 4 seconds.


----------



## eeun

mondoshawan said:


> First of all, you have to create your own variable on top "count" - no value needed. Then you go with this code:
> 
> /* While in sport mode do this once per second */
> count=count+1;
> if (count<=4) {
> prefix = "MAX";
> postfix = "HR";
> RESULT = SUUNTO_MAX_HR;
> }
> else if (count<=8) {
> prefix = "MX%";
> postfix = "MHR";
> RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
> }
> else {
> count=1;
> RESULT = SUUNTO_MAX_HR;
> prefix = "MAX";
> postfix = "HR";
> }
> 
> The values are displayed for 4 seconds.


Sorry, I'm a bit thick! The above code pasted into the custom app does not work for me. I get a 'compilation error ib line -1 and then the whoops error


----------



## mondoshawan

eeun said:


> Sorry, I'm a bit thick! The above code pasted into the custom app does not work for me. I get a 'compilation error ib line -1 and thwn the whoops error


yes, you are right&#8230; now i've got the same error.

I think for the first time "count" must have a value! Set it to "0", if you define it, then this should work.

I'll edit my post above that "count" must have a value&#8230;


----------



## TrailRnR

mondoshawan said:


> I think for the first time "count" must have a value! Set it to "0", if you define it, then this should work.


Have you tried this in the Ambit and did the pre/postfix commands work properly for you?


----------



## mondoshawan

TrailRnR said:


> Have you tried this in the Ambit and did the pre/postfix commands work properly for you?


it's the same like on yours&#8230; there is no update on Ambit for pre/postfix command, but the code works. Only on sample watch there is an update.
&#8230;maybe put the RESULT between the pre/postfix?


----------



## eeun

mondoshawan said:


> it's the same like on yours&#8230; there is no update on Ambit for pre/postfix command, but the code works. Only on sample watch there is an update.
> &#8230;maybe put the RESULT between the pre/postfix?


Still not working for me. Sorry to be a pain. If I want 2 showing with 1 sec between them for SUUNTO_MAX_HR and SUUNTO_MAX_HR/ SUUNTO_USER_MAX_HR*100, exactly what is the code I need?


----------



## or_watching

eeun said:


> Still not working for me. Sorry to be a pain. If I want 2 showing with 1 sec between them for SUUNTO_MAX_HR and SUUNTO_MAX_HR/ SUUNTO_USER_MAX_HR*100, exactly what is the code I need?


methinks the prefix postfix updates are broken on the watch. On Day1 of the new app zone, the simulator was broken for these, then they fixed that and seemingly the watch part doesn't work.

If you want a workaround you can try doing this.



> /* While in sport mode do this once per second */
> RESULT = SUUNTO_MAX_HR + SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR;


No user variable.
No prefix
Set postfix to "%MX"
Set decimal to 2

Then you get a persistent hybrid display of both numbers, without alternating back and forth. 
in the form of aaa.bb
- where aaa is your session Max HR
- where bb is your session Max HR as a % of your User Max HR.

MaxHR MaxHR% - App at Movescount.com


----------



## TrailRnR

eeun said:


> If I want 2 showing with 1 sec between them for SUUNTO_MAX_HR and SUUNTO_MAX_HR/ SUUNTO_USER_MAX_HR*100, exactly what is the code I need?


This script is an example of what you asked. As or_watching stated the prefix/postfix commands are broken. I emailed Suunto support about this yesterday. Hopefully the June update will resolve this and other function problems.

(When trying the following remember to add the variable "count" with a default value of "0" in the "Own Variables" section.)

/* While in sport mode do this once per second */
count=count+1;
if (count<=1) {
prefix = "MAX";
postfix = "HR";
RESULT = SUUNTO_MAX_HR;
}
else if (count<=2) {
prefix = "MX%";
postfix = "MHR";
RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
}
else {
count=0;
}


----------



## eeun

Tried all these variations and none currently works with my Ambit - hopefully they will with June update. Really appreciate the assistance though :-! |>

cheers

Ian


----------



## eeun

TrailRnR said:


> This script is an example of what you asked. As or_watching stated the prefix/postfix commands are broken. I emailed Suunto support about this yesterday. Hopefully the June update will resolve this and other function problems.
> 
> (When trying the following remember to add the variable "count" with a default value of "0" in the "Own Variables" section.)
> 
> /* While in sport mode do this once per second */
> count=count+1;
> if (count<=1) {
> prefix = "MAX";
> postfix = "HR";
> RESULT = SUUNTO_MAX_HR;
> }
> else if (count<=2) {
> prefix = "MX%";
> postfix = "MHR";
> RESULT = SUUNTO_MAX_HR / SUUNTO_USER_MAX_HR * 100;
> }
> else {
> count=0;
> }


OK, this now seems to work but the prefix-postix is broken in the Ambit display but I can live with that short-term so thanks again!


----------



## Guest

FYI. Suunto has just answered me that pre/postfix works only for ambit2 (on ambit1 cannot be updated). the verify button does not take into account this yet.


----------



## eeun

ihoannes said:


> FYI. Suunto has just answered me that pre/postfix works only for ambit2 (on ambit1 cannot be updated). the verify button does not take into account this yet.


That's a shame :-(


----------



## or_watching

Hi. 
Can someone with an Ambit2 tell me what the watch shows for the variable "Suunto Distance to Previous Target" when a route has been started and you are moving toward the first waypoint, eg WP1? Logically it's undefined, so, Eg, does it show 0.00 or -- or what?

Actual watch data, please. Two decimals. And make sure that first waypoint is >100m away when you start the route. Then move towards it. The variable ought to show ~0.02 once the route auto advances to the next segment. 

And if anyone is willing to answer that, pls PM me if you'd like to be a Beta tester for a little Ambit2 Nav app. Half baked, of course. 

Thanks.


----------



## pjc3

or_watching said:


> Hi.
> Can someone with an Ambit2 tell me what the watch shows for the variable "Suunto Distance to Previous Target" when a route has been started and you are moving toward the first waypoint, eg WP1? Logically it's undefined, so, Eg, does it show 0.00 or -- or what?


Unexpected and not logical.

It appears to be what the variable says "Distance to last waypoint" NOT what the code would indicate "Suunto distance to previous target"
It showed the distance to the last (final/end) waypoint on the route. The variable showed distance as meters in watch, not km as in app designer.


----------



## or_watching

pjc3 said:


> Unexpected and not logical.
> 
> It appears to be what the variable says "Distance to last waypoint" NOT what the code would indicate "Suunto distance to previous target"
> It showed the distance to the last (final/end) waypoint on the route. The variable showed distance as meters in watch, not km as in app designer.


Thanks for that.

One last straw to grasp at in deciphering this... Maybe it's a circular list. Once you are on your way to the second waypoint, does it still show the distance to the "final" waypoint, or does it jump and now show distance to the first waypoint?


----------



## pjc3

Always the last.


----------



## or_watching

pjc3 said:


> Always the last.


Rats. 
Since it's called "previous", I hope it's a bug and they change it. 
.


----------



## bowesmana

pjc3 said:


> It appears to be what the variable says "Distance to last waypoint" NOT what the code would indicate "Suunto distance to previous target"
> It showed the distance to the last (final/end) waypoint on the route. The variable showed distance as meters in watch, not km as in app designer.


The app designer doc also says it's distance to last. Do you know if it's

a) straight line distance from current position to last WP
b) straight line distance from current position to to last WP via each remaining WP in the route
c) distance from current position to to last WP via all route points


----------



## TrailRnR

ihoannes said:


> FYI. Suunto has just answered me that pre/postfix works only for ambit2 (on ambit1 cannot be updated). the verify button does not take into account this yet.


Ouch! This just put a major kink in a few apps that I had written hoping that the June update would allow them to properly function in watch. :-|

Based on Suunto's communication, I wrongfully assumed that with the June update I would be able to run the newly released enhanced app functions. (I fully understood the limitations to a single app and memory limits that made future updates or new features such as swimming functionality impractical for the Ambit1.)

Suunto may need to edit their letter to 1st gen Ambit owners (as well as the App Development Manual):

""
AMBIT Feature SW Upgrade (2.5 SW-version) AMBIT 2.5 SW-version will be made available in Movescount.com by end June 2013 and will bring the following most frequently asked new features of current AMBIT users: 

a) Further enriched Suunto Apps (*to Ambit2 level* with rich math functions, new variables, sound and backlight. NOTE: For original AMBIT only one App remains available per sport mode.) ""


----------



## or_watching

+1


----------



## suecoloco

TrailRnR said:


> Ouch! This just put a major kink in a few apps that I had written hoping that the June update would allow them to properly function in watch. :-|
> 
> Based on Suunto's communication, I wrongfully assumed that with the June update I would be able to run the newly released enhanced app functions. (I fully understood the limitations to a single app and memory limits that made future updates or new features such as swimming functionality impractical for the Ambit1.)
> 
> Suunto may need to edit their letter to 1st gen Ambit owners (as well as the App Development Manual):
> 
> ""
> AMBIT Feature SW Upgrade (2.5 SW-version) AMBIT 2.5 SW-version will be made available in Movescount.com by end June 2013 and will bring the following most frequently asked new features of current AMBIT users:
> 
> a) Further enriched Suunto Apps (*to Ambit2 level* with rich math functions, new variables, sound and backlight. NOTE: For original AMBIT only one App remains available per sport mode.) ""


Don't you think that they will fix this in SW 2.5? Meaning that at the moment Ambit 1 does not support pre/postfix


----------



## TrailRnR

suecoloco said:


> Don't you think that they will fix this in SW 2.5? Meaning that at the moment Ambit 1 does not support pre/postfix










Originally Posted by *ihoannes*  
FYI. Suunto has just answered me that pre/postfix works only for ambit2 (on ambit1 cannot be updated). the verify button does not take into account this yet.
--

I emailed Suunto last week and again yesterday with no response received as of this morning. I spoke with a Suunto rep by phone a few minutes ago and he said that their software engineers are still working on this but it should be fixed in the June update. The goal is still to have full app software compatibility in the orginal Ambit with the caveats spelled out in the letter to original Ambit owners.:-!

I apologize for misinterpreting Suunto's actions based on ihoannes earlier post (as I have done if the rep I spoke with is correct).

I will post an additional update of Suunto's response to this concern if/when they reply to my emails.


----------



## Fjeldheim

I have a big problem i cant figure out.
I have this code in the app: 
RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR;

It works great in the simulation but it does not work in my Ambit (this is the Ambit 1)?
On the watch its showing the wrong value.


----------



## eeun

Fjeldheim said:


> I have a big problem i cant figure out.
> I have this code in the app:
> RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR;
> 
> It works great in the simulation but it does not work in my Ambit (this is the Ambit 1)?
> On the watch its showing the wrong value.


What value are you trying to calculate/show?


----------



## or_watching

Hi. 

There are two variables: a session maximum and User Max. 

Maybe you want the User Max HR?


----------



## Fjeldheim

HR in %.
Eg. (100/197)*170=86%


----------



## Fjeldheim

or_watching said:


> Hi.
> 
> There are two variables: a session maximum and User Max.
> 
> Maybe you want the User Max HR?


HR in %.
Eg. (100/197)*170=86%


----------



## Fjeldheim

eeun said:


> What value are you trying to calculate/show?


HR in %.
Eg. (100/197)*170=86%


----------



## Fjeldheim

/* While in sport mode do this once per second */

/* Calculate % maks HR */
RESULT = (100 / SUUNTO_MAX_HR) * SUUNTO_HR;

/* Sone 0 */
if (RESULT < 60 && RESULT > 0) {
prefix="PUSH";
postfix = "%";
}

/* Sone 1 */
if (RESULT < 72 && RESULT > 60) {
prefix="Zone1";
postfix = "%";
}

/* Sone 2 */
if (RESULT < 82 && RESULT > 72) {
prefix="Zone2";
postfix = "%";
}

/* Sone 3 */
if (RESULT < 87 && RESULT > 82) {
prefix="Zone3";
postfix = "%";
}

/* Sone 4 */
if (RESULT < 92 && RESULT > 87) {
prefix="Zone4";
postfix = "%";
}

/* Sone 5 */
if (RESULT < 100 && RESULT > 92) {
prefix="Zone5";
postfix = "%";
}

/* Sone over max */
if (RESULT < 200 && RESULT>100) {
prefix="Ups..";
postfix = "%";
}


----------



## twelveone

Can anyone see what is wrong with this app I created? It works in the app designer test in movescount, with the PZ value increasing from 1 up to 6 (the max) as speed increases. On my watch however, the value correctly changes from 1 to 2, but never goes above 2, even though the power value is definitely well over 76% of the FTP variable value (167).

Essentially what this app is doing, is using a known calculation (P = (5.244820) * S + (0.019168) * S^3, where "S" is speed in mph) for getting a power output value for the Kurt Kinetic Road Machine indoor bike trainer, then displaying a power zone based on % of FTP where PZ1: less than 55%, PZ2: 56-75%, PZ3: 76-90%, PZ4: 91-105%, PZ5: 106-120%, PZ6: more than 121%



> /* While in sport mode do this once per second */
> /* PZ1 when Kinetic Power @ <55% */
> if ((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3) < (FTP*0.56)) {
> RESULT = 1;
> }
> /* PZ2 when Kinetic Power @ 56-75% */
> else if (((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) >= (FTP*0.56) && ((5.244820) * ( SUUNTO_SPEED *
> 
> 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) < (FTP*0.76)) {
> RESULT = 2;
> }
> /* PZ3 when Kinetic Power @ 76-90% */
> else if (((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) >= (FTP*0.76) && ((5.244820) * ( SUUNTO_SPEED *
> 
> 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) < (FTP*0.91)) {
> RESULT = 3;
> }
> /* PZ4 when Kinetic Power @ 91-105% */
> else if (((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) >= (FTP*0.91) && ((5.244820) * ( SUUNTO_SPEED *
> 
> 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) < (FTP*1.06)) {
> RESULT = 4;
> }
> /* PZ5 when Kinetic Power @ 106-120% */
> else if (((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) >= (FTP*1.06) && ((5.244820) * ( SUUNTO_SPEED *
> 
> 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) < (FTP*1.21)) {
> RESULT = 5;
> }
> /* PZ6 when Kinetic Power @ >121% */
> else if (((5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)) >= (FTP*1.21) {
> RESULT = 6;
> }


----------



## or_watching

Fjeldheim said:


> HR in %.
> Eg. (100/197)*170=86%


If you want a % of your personal maximum, use the User variable SUUNTO_USER_MAX_HR


----------



## Fjeldheim

or_watching said:


> If you want a % of your personal maximum, use the User variable SUUNTO_USER_MAX_HR


Is this always showing % not bpm?


----------



## Fjeldheim

Fjeldheim said:


> Is this always showing % not bpm?


RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR; 
Watch set to bpm, calculate value in %.


----------



## or_watching

twelveone said:


> Can anyone see what is wrong with this app I created? It works in the app designer test in movescount, with the PZ value increasing from 1 up to 6 (the max) as speed increases. On my watch however, the value correctly changes from 1 to 2, but never goes above 2, even though the power value is definitely well over 76% of the FTP variable value (167).
> 
> Essentially what this app is doing, is using a known calculation (P = (5.244820) * S + (0.019168) * S^3, where "S" is speed in mph) for getting a power output value for the Kurt Kinetic Road Machine indoor bike trainer, then displaying a power zone based on % of FTP where PZ1: less than 55%, PZ2: 56-75%, PZ3: 76-90%, PZ4: 91-105%, PZ5: 106-120%, PZ6: more than 121%


Hi, since I'm not at a real computer....
Perhaps the easiest thing is to make a Debug app that just shows this 
RESULT = (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)

and directly see what your formula is doing.

And for readability and to minimize error risk in your final app, assign the big formula once to a variable P. then use P in all your if statements.


----------



## twelveone

or_watching said:


> Hi, since I'm not at a real computer....
> Perhaps the easiest thing is to make a Debug app that just shows this
> RESULT = (5.244820) * ( SUUNTO_SPEED * 0.621371192 ) + (0.019168) * Suunto.pow(( SUUNTO_SPEED * 0.621371192 ),3)
> 
> and directly see what your formula is doing.
> 
> And for readability and to minimize error risk in your final app, assign the big formula once to a variable P. then use P in all your if statements.


I actually have another app that does just that, and I've been running the two in the same screen. The above works just fine and displays the correct power values. I like your idea of using the P variable though, will at least make the app a little cleaner 

Thanks!

Sent from my Galaxy Nexus using Tapatalk 2


----------



## or_watching

Fjeldheim said:


> RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR;
> Watch set to bpm, calculate value in %.


Hi.

RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR; 
this will show your current HR as a percent of the highest HR recorded during the current session.

RESULT=(100/SUUNTO_USER_MAX_HR)*SUUNTO_HR; 
this will show your current HR as a percent of your personal max HR as entered into Movescount (or your watch in the Options - Personal menu).

Does that help?


----------



## or_watching

oops


----------



## Gerald Zhang-Schmidt

or_watching said:


> Hi.
> 
> RESULT=(100/SUUNTO_USER_MAX_HR)*SUUNTO_HR;
> this will show your current HR as a percent of your personal max HR as entered into Movescount (or your watch in the Options - Personal menu).


That's the same display one could get by simply setting the watch to show HR in % rather than bpm, though, isn't it? Except, if you want the watch set to bpm and to also see %maxHR, then the app would help in getting that second display, right?

(Just trying to understand; methinks that may be one of the reasons why there's such a plethora of apps which seem to mirror what the device can already do...)


----------



## limo15

Made this app a few days ago, As you say, it makes sense: "Except, if you want the watch set to bpm and to also see %maxHR..." ;-)


----------



## Fjeldheim

or_watching said:


> Hi.
> 
> RESULT=(100/SUUNTO_MAX_HR)*SUUNTO_HR;
> this will show your current HR as a percent of the highest HR recorded during the current session.
> 
> RESULT=(100/SUUNTO_USER_MAX_HR)*SUUNTO_HR;
> this will show your current HR as a percent of your personal max HR as entered into Movescount (or your watch in the Options - Personal menu).
> 
> Does that help?


Thx


----------



## or_watching

Gerald Zhang-Schmidt said:


> That's the same display one could get by simply setting the watch to show HR in % rather than bpm, though, isn't it? Except, if you want the watch set to bpm and to also see %maxHR, then the app would help in getting that second display, right?
> 
> (Just trying to understand; methinks that may be one of the reasons why there's such a plethora of apps which seem to mirror what the device can already do...)


Who am I to judge any man, or his choice of Apps? ;-)


----------



## anto1980

Is possible to creates an App that show the slope in + or - simultaneously? Or need of two Apps separately?


----------



## or_watching

anto1980 said:


> Is possible to creates an App that show the slope in + or - simultaneously? Or need of two Apps separately?


Hi. I don't understand. Can you explain more exactly what you mean? Maybe give an example.


----------



## twelveone

Support got back to me about the issues I've been having. I've confirmed the workaround fixes it, and both apps now work as expected.



> our Software Team has confirmed that there is a known bug in the App Compiler, which causes the error you have experienced. However, there is a workaround, please apply this to all similar future cases. If a app has if-sentence with '&&'-operator like, if (a < 1 && b > 2) both conditions must have their own parentheses if ((a < 1) && (b > 2)) After applying this workaround, Ambit must be synced. Our technicians are working on a fix for this bug.


Sent from my Galaxy Nexus using Tapatalk 2


----------



## pa7a7oz

Hi everybody,
i am a newbie in this forum, and i don't speak very well french.
i have a problem with my ambit2 using a garmin heart rate belt. the belt works perfectly (pair and see heart rate) but i have a problem using a home made app.
i have made a app to see the time in each heart rate zone (Z1 = 50%HRmax Z2 =60% HRmax, Z3, Z4, Z5 = 90% ...), my app works well in the movescount emulator but when i use the app, the ambit2 was blocked in the last zone (Z5)
here you can see the source:
/* While in sport mode do this once per second */

HR = SUUNTO_HR;

SSSSS = 0.9 * SUUNTO_USER_MAX_HR;
SSSS = 0.8 * SUUNTO_USER_MAX_HR;
SSS = 0.7 * SUUNTO_USER_MAX_HR;
SS = 0.6 * SUUNTO_USER_MAX_HR;
S = 0.5 * SUUNTO_USER_MAX_HR;

if (HR <= S ) {
T = T + 1 ;
RESULT = T;
postfix = "Z0";

}

if (HR >= S && HR <= SS ) {
TT = TT + 1 ;
RESULT = TT;
postfix = "Z1";

}

if (HR >= SS && HR <= SSS) {
TTT = TTT + 1 ;
RESULT = TTT;
postfix = "Z2";

}

if (HR >= SS && HR <= SSS) {
TTT = TTT + 1 ;
RESULT = TTT;
postfix = "Z2";

}

if (HR >= SSS && HR <= SSSS) {
TTTT = TTTT + 1 ;
RESULT = TTTT;
postfix = "Z3";

}

if (HR >= SSSS && HR <= SSSSS) {
TTTTT = TTTTT + 1 ;
RESULT = TTTTT;
postfix = "Z4";

}

if (HR >= SSSSS && HR <= 250) {
TTTTTT = TTTTTT + 1 ;
RESULT = TTTTTT;
postfix = "Z5";
}

I think have a problem with the SUUNTO_HR input because the program go directly at the last "if", maybe because using a garmin heart rate belt i need to change SUUNTO_HR to GARMIN_HR 

Please Help Me,

Thanks,

pa7a7oz


----------



## jweak

pa7a7oz said:


> Hi everybody,
> 
> I think have a problem with the SUUNTO_HR input because the program go directly at the last "if", maybe because using a garmin heart rate belt i need to change SUUNTO_HR to GARMIN_HR
> 
> Please Help Me,


I think the problem is the if-logic bug that is in Ambit. It should work if you put the conditionals inside parentheses.

So maybe this would work:

/* While in sport mode do this once per second */

HR = SUUNTO_HR;

SSSSS = 0.9 * SUUNTO_USER_MAX_HR;
SSSS = 0.8 * SUUNTO_USER_MAX_HR;
SSS = 0.7 * SUUNTO_USER_MAX_HR;
SS = 0.6 * SUUNTO_USER_MAX_HR;
S = 0.5 * SUUNTO_USER_MAX_HR;

if (HR <= S ) {
T = T + 1 ;
RESULT = T;
postfix = "Z0";
}

if ((HR >= S) && (HR <= SS) ) {
TT = TT + 1 ;
RESULT = TT;
postfix = "Z1";
}

if ((HR >= SS) && (HR <= SSS)) {
TTT = TTT + 1 ;
RESULT = TTT;
postfix = "Z2";
}

if ((HR >= SS) && (HR <= SSS)) {
TTT = TTT + 1 ;
RESULT = TTT;
postfix = "Z2";
}

if ((HR >= SSS) && (HR <= SSSS)) {
TTTT = TTTT + 1 ;
RESULT = TTTT;
postfix = "Z3";
}

if ((HR >= SSSS) && (HR <= SSSSS)) {
TTTTT = TTTTT + 1 ;
RESULT = TTTTT;
postfix = "Z4";
}

if ((HR >= SSSSS) && (HR <= 250)) {
TTTTTT = TTTTTT + 1 ;
RESULT = TTTTTT;
postfix = "Z5";
}


----------



## thompu

Hello everyone,
since a couple of days I own an Ambit2 and as many others I have run into a couple of problems when programming my own app. I do not quite understand yet how the <<own variables>> work or how I can achieve what I want to do.
I am trying to write an app that will calculate the physical amount of work that is required when climbing a hill.
The formula is pretty simple:

W = m * g * h

where g is the gravity constant 9.81m/s², h is the ascent and m is the total mass that I am moving uphill, including but usually not limited to my personal weight, unless I am climbing the hill naked...
So I figured the app would have to look like this:

RESULT = 9.81/1000*(SUUNTO_USER_WEIGHT+equipweight)*SUUNTO_ASCENT;

This would calculate the amount of work in "kJ", with "equipweight" being an <<own variable>> for all the additional equipment that I am carrying: clothes, shoes, backpack and so forth.
The problem is that this is a value that might vary from event to event. Today that number might be just 2 or 3kg (light clothes, shoes, no backpack) and some other day it might be 25kg.
So before starting the "move" on my Ambit, I would want to set that value individually, directly on the watch, each time I am at it. I would have expected a page in the options menu on the watch where I could adjust the variable "equipweight", but I don't find anything like that. Is this feasible at all or am I missing something here?
Thanks for your comments.

Thomas


----------



## pa7a7oz

jweak said:


> I think the problem is the if-logic bug that is in Ambit. It should work if you put the conditionals inside parentheses.
> 
> So maybe this would work:
> 
> /* While in sport mode do this once per second */
> 
> HR = SUUNTO_HR;
> 
> SSSSS = 0.9 * SUUNTO_USER_MAX_HR;
> SSSS = 0.8 * SUUNTO_USER_MAX_HR;
> SSS = 0.7 * SUUNTO_USER_MAX_HR;
> SS = 0.6 * SUUNTO_USER_MAX_HR;
> S = 0.5 * SUUNTO_USER_MAX_HR;
> 
> if (HR <= S ) {
> T = T + 1 ;
> RESULT = T;
> postfix = "Z0";
> }
> 
> if ((HR >= S) && (HR <= SS) ) {
> TT = TT + 1 ;
> RESULT = TT;
> postfix = "Z1";
> }
> 
> ....
> }


Thanks a lot for the tips.. i will try this afternoon if it works now !!!

Pa7a7oz


----------



## pa7a7oz

jweak said:


> I think the problem is the if-logic bug that is in Ambit. It should work if you put the conditionals inside parentheses.
> 
> So maybe this would work:
> 
> /* While in sport mode do this once per second */
> 
> HR = SUUNTO_HR;
> 
> SSSSS = 0.9 * SUUNTO_USER_MAX_HR;
> SSSS = 0.8 * SUUNTO_USER_MAX_HR;
> SSS = 0.7 * SUUNTO_USER_MAX_HR;
> SS = 0.6 * SUUNTO_USER_MAX_HR;
> S = 0.5 * SUUNTO_USER_MAX_HR;
> 
> if (HR <= S ) {
> T = T + 1 ;
> RESULT = T;
> postfix = "Z0";
> }
> 
> if ((HR >= S) && (HR <= SS) ) {
> TT = TT + 1 ;
> RESULT = TT;
> postfix = "Z1";
> }
> 
> if ((HR >= SS) && (HR <= SSS)) {
> TTT = TTT + 1 ;
> RESULT = TTT;
> postfix = "Z2";
> }
> 
> if ((HR >= SS) && (HR <= SSS)) {
> TTT = TTT + 1 ;
> RESULT = TTT;
> postfix = "Z2";
> }
> 
> if ((HR >= SSS) && (HR <= SSSS)) {
> TTTT = TTTT + 1 ;
> RESULT = TTTT;
> postfix = "Z3";
> }
> 
> if ((HR >= SSSS) && (HR <= SSSSS)) {
> TTTTT = TTTTT + 1 ;
> RESULT = TTTTT;
> postfix = "Z4";
> }
> 
> if ((HR >= SSSSS) && (HR <= 250)) {
> TTTTTT = TTTTTT + 1 ;
> RESULT = TTTTTT;
> postfix = "Z5";
> }


I have tried putting the conditionals inside parentheses and i have the same problem, i m blocked in Zone 5  
Very strange...


----------



## bowesmana

pa7a7oz said:


> I have tried putting the conditionals inside parentheses and i have the same problem, i m blocked in Zone 5
> Very strange...


Couple of things.

You should probably be using

if ...
else if ...

as that is more efficient and at least you will see if it's passing ONLY the last test rather than all of them.

You have duplicated the



pa7a7oz said:


> if ((HR >= SS) && (HR <= SSS)) {


test.


----------



## SavageSS

Some questions regarding the apps, hopefully someone can help.

1) I've save an app in MovesCount. How do I view saved apps, and how do I delete them?
2) Someone posted their own Sunset and Sunrise app. It's set to GMT +2 and he has mentioned that you can edit it to your own time zone. How do I go about editing the code, I know what to change but can see any where to edit this.

Thanks


----------



## thompu

While I am still hoping that someone can help me with my <<own variable>> problem, maybe in the meantime I can give you some hints about your heart rate zone problem... 

1. S, SS, SSS, SSSS and so forth is pretty confusing. Why not call them S1, S2, S3 and T1, T2, T3 and so forth? (That's just for readability of the code, not so much for function)
2. Does the compiler KNOW all these variables, the "SS"s, the "TT"s and "HR"? Did you declare them as your own variables and set them all to zero by default? (Seriously, these are common mistakes)
3. You should definitely use the "if - else if" construct rather than just "if - if - if". It shouldn't make a difference in the result, but it saves CPU time. If you just use "if"s, you are forcing the processor to go through each of the boolean checks, while with the "if - else if" construct, if the first "if" was true, the app can disregard the rest.
4. As bowesmana pointed out, you got a zone 2 duplicate.
5. You can omit the (HR<=250) check in zone 5. From a mathematical point of view, I would consider a value of 251 as zone 5 as well anyway. From a medical point of view I would consider it as "intensive care" zone...
6. You shouldn't use "<=" in one zone as the upper limit and ">=" as the lower limit of the next at the same time. Let's assume SSS were 140, and HR happened to be exactly 140 as well. Then this value belongs to both zone 2 and 3 at the same time. Then what? Your boolean checks should look like this:
if ((HR >= SS) && (HR < SSS)) {
7. When you are saying you are "blocked" in zone 5, then probably what happens is that the boolean check is always "true". So at any given time, HR>=SSSSS is TRUE. Since you are only using "if"s, all the other checks may be TRUE as well, but you don't know, because they are just run over by the following checks. I would assume that maybe all the "SS"s are just zero, because they weren't properly initialized.

This ought to work (at least it does perfectly in test mode):

/* While in sport mode do this once per second */

if (SUUNTO_HR <= 0.5*SUUNTO_USER_MAX_HR) {
postfix = "Z0";
T0 = T0 + 1 ;
RESULT = T0;
}
else if (SUUNTO_HR <= 0.6*SUUNTO_USER_MAX_HR) {
postfix = "Z1";
T1 = T1 + 1 ;
RESULT = T1;
}
else if (SUUNTO_HR <= 0.7*SUUNTO_USER_MAX_HR) {
postfix = "Z2";
T2 = T2 + 1 ;
RESULT = T2;
}
else if (SUUNTO_HR <= 0.8*SUUNTO_USER_MAX_HR) {
postfix = "Z3";
T3 = T3 + 1 ;
RESULT = T3;
}
else if (SUUNTO_HR <= 0.9*SUUNTO_USER_MAX_HR) {
postfix = "Z4";
T4 = T4 + 1 ;
RESULT = T4;
}
else {
postfix = "Z5";
T5 = T5 + 1 ;
RESULT = T5;
}

Way more effective, isn't it. ;-)
Just declare the variables T0, T1... T5 and set them to zero.

Thomas


----------



## pa7a7oz

thompu said:


> While I am still hoping that someone can help me with my <<own variable>> problem, maybe in the meantime I can give you some hints about your heart rate zone problem...
> 
> 1. S, SS, SSS, SSSS and so forth is pretty confusing. Why not call them S1, S2, S3 and T1, T2, T3 and so forth? (That's just for readability of the code, not so much for function)
> 2. Does the compiler KNOW all these variables, the "SS"s, the "TT"s and "HR"? Did you declare them as your own variables and set them all to zero by default? (Seriously, these are common mistakes)
> 3. You should definitely use the "if - else if" construct rather than just "if - if - if". It shouldn't make a difference in the result, but it saves CPU time. If you just use "if"s, you are forcing the processor to go through each of the boolean checks, while with the "if - else if" construct, if the first "if" was true, the app can disregard the rest.
> 4. As bowesmana pointed out, you got a zone 2 duplicate.
> 5. You can omit the (HR<=250) check in zone 5. From a mathematical point of view, I would consider a value of 251 as zone 5 as well anyway. From a medical point of view I would consider it as "intensive care" zone...
> 6. You shouldn't use "<=" in one zone as the upper limit and ">=" as the lower limit of the next at the same time. Let's assume SSS were 140, and HR happened to be exactly 140 as well. Then this value belongs to both zone 2 and 3 at the same time. Then what? Your boolean checks should look like this:
> if ((HR >= SS) && (HR < SSS)) {
> 7. When you are saying you are "blocked" in zone 5, then probably what happens is that the boolean check is always "true". So at any given time, HR>=SSSSS is TRUE. Since you are only using "if"s, all the other checks may be TRUE as well, but you don't know, because they are just run over by the following checks. I would assume that maybe all the "SS"s are just zero, because they weren't properly initialized.
> 
> This ought to work (at least it does perfectly in test mode):
> 
> /* While in sport mode do this once per second */
> 
> if (SUUNTO_HR <= 0.5*SUUNTO_USER_MAX_HR) {
> postfix = "Z0";
> T0 = T0 + 1 ;
> RESULT = T0;
> }
> else if (SUUNTO_HR <= 0.6*SUUNTO_USER_MAX_HR) {
> postfix = "Z1";
> T1 = T1 + 1 ;
> RESULT = T1;
> }
> else if (SUUNTO_HR <= 0.7*SUUNTO_USER_MAX_HR) {
> postfix = "Z2";
> T2 = T2 + 1 ;
> RESULT = T2;
> }
> else if (SUUNTO_HR <= 0.8*SUUNTO_USER_MAX_HR) {
> postfix = "Z3";
> T3 = T3 + 1 ;
> RESULT = T3;
> }
> else if (SUUNTO_HR <= 0.9*SUUNTO_USER_MAX_HR) {
> postfix = "Z4";
> T4 = T4 + 1 ;
> RESULT = T4;
> }
> else {
> postfix = "Z5";
> T5 = T5 + 1 ;
> RESULT = T5;
> }
> 
> Way more effective, isn't it. ;-)
> Just declare the variables T0, T1... T5 and set them to zero.
> 
> Thomas


Thanks a lot Thomas !!! your are the King of C language !!!!! I am a newbie in C. the app works well now, I have now the same feature than my ex polar RCX5 in my new Suunto !!!!

Thanks,

Julien,


----------



## PabloAlarcon

thompu said:


> While I am still hoping that someone can help me with my <<own variable>> problem, maybe in the meantime I can give you some hints about your heart rate zone problem...
> 
> 1. S, SS, SSS, SSSS and so forth is pretty confusing. Why not call them S1, S2, S3 and T1, T2, T3 and so forth? (That's just for readability of the code, not so much for function)
> 2. Does the compiler KNOW all these variables, the "SS"s, the "TT"s and "HR"? Did you declare them as your own variables and set them all to zero by default? (Seriously, these are common mistakes)
> 3. You should definitely use the "if - else if" construct rather than just "if - if - if". It shouldn't make a difference in the result, but it saves CPU time. If you just use "if"s, you are forcing the processor to go through each of the boolean checks, while with the "if - else if" construct, if the first "if" was true, the app can disregard the rest.
> 4. As bowesmana pointed out, you got a zone 2 duplicate.
> 5. You can omit the (HR<=250) check in zone 5. From a mathematical point of view, I would consider a value of 251 as zone 5 as well anyway. From a medical point of view I would consider it as "intensive care" zone...
> 6. You shouldn't use "<=" in one zone as the upper limit and ">=" as the lower limit of the next at the same time. Let's assume SSS were 140, and HR happened to be exactly 140 as well. Then this value belongs to both zone 2 and 3 at the same time. Then what? Your boolean checks should look like this:
> if ((HR >= SS) && (HR < SSS)) {
> 7. When you are saying you are "blocked" in zone 5, then probably what happens is that the boolean check is always "true". So at any given time, HR>=SSSSS is TRUE. Since you are only using "if"s, all the other checks may be TRUE as well, but you don't know, because they are just run over by the following checks. I would assume that maybe all the "SS"s are just zero, because they weren't properly initialized.
> 
> This ought to work (at least it does perfectly in test mode):
> 
> /* While in sport mode do this once per second */
> 
> if (SUUNTO_HR <= 0.5*SUUNTO_USER_MAX_HR) {
> postfix = "Z0";
> T0 = T0 + 1 ;
> RESULT = T0;
> }
> else if (SUUNTO_HR <= 0.6*SUUNTO_USER_MAX_HR) {
> postfix = "Z1";
> T1 = T1 + 1 ;
> RESULT = T1;
> }
> else if (SUUNTO_HR <= 0.7*SUUNTO_USER_MAX_HR) {
> postfix = "Z2";
> T2 = T2 + 1 ;
> RESULT = T2;
> }
> else if (SUUNTO_HR <= 0.8*SUUNTO_USER_MAX_HR) {
> postfix = "Z3";
> T3 = T3 + 1 ;
> RESULT = T3;
> }
> else if (SUUNTO_HR <= 0.9*SUUNTO_USER_MAX_HR) {
> postfix = "Z4";
> T4 = T4 + 1 ;
> RESULT = T4;
> }
> else {
> postfix = "Z5";
> T5 = T5 + 1 ;
> RESULT = T5;
> }
> 
> Way more effective, isn't it. ;-)
> Just declare the variables T0, T1... T5 and set them to zero.
> 
> Thomas


Hi, I felt free to take this app and modify it a bit to use Karvonen formula so I replace some variables, i changed 
(SUUNTO_HR <= 0.5*SUUNTO_USER_MAX_HR) to

(SUUNTO_HR <= (0.5*(SUUNTO_USER_MAX_HR-SUUNTO_USER_REST_HR)+SUUNTO_USER_REST_HR)) and so on for the rest of the % zones . it worked ok in the test mode (in Google Chrome, don´t know why in Firefox it comes up with an error) but was to big for tha Ambit 1 memory so I just replace with numbers SUUNTO_USER_MAX_HR and SUUNTO_USER_REST_HR an it fitted ok (91% memory in ambit 1)

also i replace postfix: Z1, Z2, Z3, Z4 and Z5 with te postfix 50-60% (Z1), 60-70%(Z2), 70-80%(Z3), 80-90%(Z4) and MAX (Z5), so i can see % I'm training in.

It seems to work ok. Credits to pa7a7oz and thompu


----------



## mondoshawan

PabloAlarcon said:


> Hi, I felt free to take this app and modify it a bit to use Karvonen formula so I replace some variables, i changed
> (SUUNTO_HR <= 0.5*SUUNTO_USER_MAX_HR) to
> 
> (SUUNTO_HR <= (0.5*(SUUNTO_USER_MAX_HR-SUUNTO_USER_REST_HR)+SUUNTO_USER_REST_HR)) and so on for the rest of the % zones . it worked ok in the test mode (in Google Chrome, don´t know why in Firefox it comes up with an error) but was to big for tha Ambit 1 memory so I just replace with numbers SUUNTO_USER_MAX_HR and SUUNTO_USER_REST_HR an it fitted ok (91% memory in ambit 1)
> 
> also i replace postfix: Z1, Z2, Z3, Z4 and Z5 with te postfix 50-60% (Z1), 60-70%(Z2), 70-80%(Z3), 80-90%(Z4) and MAX (Z5), so i can see % I'm training in.
> 
> It seems to work ok. Credits to pa7a7oz and thompu


really nice work guys! I would use this too, but you forgot one odd thing with Ambit1:
There is no update on the Pre/Postfix command within an App on a real world Ambit1
So we just don't know in what Zone we are Training.
arrrggg&#8230;


----------



## pa7a7oz

mondoshawan said:


> really nice work guys! I would use this too, but you forgot one odd thing with Ambit1:
> There is no update on the Pre/Postfix command within an App on a real world Ambit1
> So we just don't know in what Zone we are Training.
> arrrggg&#8230;


Hi
you need to add a other app displaying the zone... but i don t know if you can run 2 apps with the ambit 1 
let's hope ambit 1 update !!!!


----------



## starryalley

Hi, why not try using current lap number as the user input of equipment weight? I read somewhere else people are doing this (can't remember where, probably here?) for a N-km run estimated time app.
You may want to add another app showing the current equipweight (probably: LapNumber % 40, in kg, since I heard people can bring as heavy as 40kg when trekking) in the same view of your climb work app. One constraint though, disable auto lap in this exercise profile.

Haven't tried. If this works please tell me since I haven't got time to experiment this.



thompu said:


> Hello everyone,
> since a couple of days I own an Ambit2 and as many others I have run into a couple of problems when programming my own app. I do not quite understand yet how the <<own variables>> work or how I can achieve what I want to do.
> I am trying to write an app that will calculate the physical amount of work that is required when climbing a hill.
> The formula is pretty simple:
> 
> W = m * g * h
> 
> where g is the gravity constant 9.81m/s², h is the ascent and m is the total mass that I am moving uphill, including but usually not limited to my personal weight, unless I am climbing the hill naked...
> So I figured the app would have to look like this:
> 
> RESULT = 9.81/1000*(SUUNTO_USER_WEIGHT+equipweight)*SUUNTO_ASCENT;
> 
> This would calculate the amount of work in "kJ", with "equipweight" being an <<own variable>> for all the additional equipment that I am carrying: clothes, shoes, backpack and so forth.
> The problem is that this is a value that might vary from event to event. Today that number might be just 2 or 3kg (light clothes, shoes, no backpack) and some other day it might be 25kg.
> So before starting the "move" on my Ambit, I would want to set that value individually, directly on the watch, each time I am at it. I would have expected a page in the options menu on the watch where I could adjust the variable "equipweight", but I don't find anything like that. Is this feasible at all or am I missing something here?
> Thanks for your comments.
> 
> Thomas


----------



## PabloAlarcon

mondoshawan said:


> really nice work guys! I would use this too, but you forgot one odd thing with Ambit1:
> There is no update on the Pre/Postfix command within an App on a real world Ambit1
> So we just don't know in what Zone we are Training.
> arrrggg&#8230;


Hi, you are right just tried it and the postfix doesnt chage I thought that if if worked ok and passed the compatibility check it'd work ok in Ambit 1 but it seems it doesnt  I didn't know there wasn't an update on the pre/postfix for the Ambit1...


----------



## Ilia Stark

Hello everyone!
I just bought my Suunto Ambit2 Saphire and i am wondering would i be able to program my apps if i study the developer manual but have almost zero knowledge of programming?


----------



## thompu

Ilia Stark said:


> Hello everyone!
> I just bought my Suunto Ambit2 Saphire and i am wondering would i be able to program my apps if i study the developer manual but have almost zero knowledge of programming?


How are we supposed to tell you what you are able to do? Just try it...
Start by copy and paste, use an existing app from the "app zone" that is simple and short. Don't forget the ";" at the end of each line. If the compiler does not understand what you tried to program, it will tell you so. And if you can't get it to work, you can still post your code here and have other users have a look at it and help you out.

Thomas


----------



## thompu

starryalley said:


> Hi, why not try using current lap number as the user input of equipment weight? I read somewhere else people are doing this (can't remember where, probably here?) for a N-km run estimated time app.
> You may want to add another app showing the current equipweight (probably: LapNumber % 40, in kg, since I heard people can bring as heavy as 40kg when trekking) in the same view of your climb work app. One constraint though, disable auto lap in this exercise profile.
> 
> Haven't tried. If this works please tell me since I haven't got time to experiment this.


Dunno. The "current lap number" does not sound like a variable that I can manipulate before the training even starts, does it? Besides, that would be a workaround at best. I don't like workarounds, I prefer true solutions... 
I think we have to face the fact that variables cannot be set beforehand on the watch. Maybe after the first major software update...
Anyway, I have sent my request to Suunto. Let's wait and see.

Thomas


----------



## starryalley

Right, it doesn't look like user can configure this value before an exercise. Yes this WAR is not a best solution but after briefly reading through app dev manual let's what we can do now Iguess. Let's wait for next updates.. anyway..


----------



## Paolo Costantini

Hi, i have the same issue with ambit2, a simple app like that reports a fix value of 214748368!!!!

RESULT = SUUNTO_PACE;

could you sort this out?
thanks


----------



## mondoshawan

Paolo Costantini said:


> Hi, i have the same issue with ambit2, a simple app like that reports a fix value of 214748368!!!!
> 
> RESULT = SUUNTO_PACE;
> 
> could you sort this out?
> thanks


Ahh, this is very interesting!! Even on an Ambit2! No i couldn't&#8230;
And i did not have a satisfactory answer from suunto yet. I mailed this issue three times to support.

Please mail that to [email protected]
thx


----------



## Paolo Costantini

I did it and they replied a nonsense sentence "Please be informed that you need to copy this formula entirely in order to work properly: /* While in sport mode do this once per second */ RESULT = SUUNTO_PACE; Should you have any other questions, please do not hesitate to contact us" ... Whatever it means! Be sure I will contact them again!


----------



## Paolo Costantini

See this... Simulation is ok but log on Ambit2 is the fix number 214748368















Anyone has a clue? Is it a bug?


----------



## mondoshawan

Paolo Costantini said:


> Anyone has a clue? Is it a bug?


i believe this is a bug.

The 21474836 Bug.

This also happens if i'm using with 2 decimals:
RESULT = SUUNTO_DISTANCE;

I mean Speed, Pace and Distance are the basics&#8230; and should be better monitored by Suunto.

Interestingly only a small amounts of Ambits are affected. But it seems that this bug is also ported with newer firmware to Ambit2s.
And BTW i got that same unsatisfactory answer from Suunto.


----------



## Paolo Costantini

mondoshawan said:


> i believe this is a bug.
> 
> The 21474836 Bug.
> 
> This also happens if i'm using with 2 decimals:
> RESULT = SUUNTO_DISTANCE;
> 
> I mean Speed, Pace and Distance are the basics&#8230; and should be better monitored by Suunto.
> 
> Interestingly only a small amounts of Ambits are affected. But it seems that this bug is also ported with newer firmware to Ambit2s.
> And BTW i got that same unsatisfactory answer from Suunto.


I sent a very disappointed email documenting again everything and saying to not accept any standard and temptative answer as they have done so far. Let's see.

mmhhh mondoshawan are you using maybe an imac to upload apps on your ambit?


----------



## mondoshawan

Paolo Costantini said:


> I sent a very disappointed email documenting again everything and saying to not accept any standard and temptative answer as they have done so far. Let's see.
> 
> mmhhh mondoshawan are you using maybe an imac to upload apps on your ambit?


No, MacBookPro 13" 10.6.8


----------



## Paolo Costantini

mondoshawan said:


> No, MacBookPro 13" 10.6.8


You didn't get my point... Maybe movelink for MacOs has a bug, I can't see any reason why in same watches work an in other not... I will try with windows

Hi got the bug!!

The problem is Movescount not the watch.
If I create/save the app using Movescount in ITALIAN the app give the error... Follow the test I did

I created 2 apps:
one called TEST PACE1 using MOVESCOUNT in italian
and one called TEST PACE using MOVESCOUNT in english

Both are simply as usual
RESULT = SUUNTO_PACE;

And I created a watch screen with both apps. One works and the one in italian no

Then I switch MoVESCOUNt in english. I edited doing nothing TEST PACE 1, save it and transfer again to watch with moveslink2: now it works

=> SO it looks there's a language issue that when you save an app in italian it saves some wrong data and when you transfer to the watch it defaults the fake number.

Maybe there's the issue with other languages.

BTW I explained the problem to support...


----------



## mondoshawan

ahh… i was creating Apps using the German Website. That could be the point. Will test this tonight using the english one.
thx!

UPDATE:

Yes i can confirm this! The 21474836 bug is gone with the english site of movescount! And it doesn't matter which language is selected then in moveslink2. There you can go with a different one.

thx paolo!


----------



## suecoloco

I would like to do an app for interval training. Like warmup until you press lapbutton and then for example 5*8minutes with a 5 beeps and 5 backlights blinks 5 seconds before the end of each interval (both rest and active) and then lapbutton until stop for cooldown.

There is an interval app that does pyramide interval but it does not beep and does not have the backlight flash.

Any suggestions?

Pyramid-Interval 2 - App at Movescount.com

/* While in sport mode do this once per second */RESULT = 0;

/* we are in the warm-up */
if ( SUUNTO_LAP_NUMBER <= 1 ) {
WARMUP = SUUNTO_DURATION;
RESULT = SUUNTO_DURATION;
} else {
DURATION = SUUNTO_DURATION - WARMUP;

/* we are in the cool-down, increase the time counter */
if ( DURATION >= 1980 ) { RESULT = SUUNTO_DURATION - WARMUP - 1980; }
/* we are doing an interval, decrease the time counter */
else if ( DURATION >= 1920 ) { RESULT = 1979 - DURATION; } /* 1' */
else if ( DURATION >= 1860 ) { RESULT = 1919 - DURATION; } /* 1' */
else if ( DURATION >= 1740 ) { RESULT = 1859 - DURATION; } /* 2' */
else if ( DURATION >= 1680 ) { RESULT = 1739 - DURATION; } /* 1' */
else if ( DURATION >= 1500 ) { RESULT = 1679 - DURATION; } /* 3' */
else if ( DURATION >= 1440 ) { RESULT = 1499 - DURATION; } /* 1' */
else if ( DURATION >= 1200 ) { RESULT = 1439 - DURATION; } /* 4' */
else if ( DURATION >= 1140 ) { RESULT = 1199 - DURATION; } /* 1' */
else if ( DURATION >= 840 ) { RESULT = 1139 - DURATION; } /* 5' */
else if ( DURATION >= 780 ) { RESULT = 839 - DURATION; } /* 1' */
else if ( DURATION >= 540 ) { RESULT = 779 - DURATION; } /* 4' */
else if ( DURATION >= 480 ) { RESULT = 539 - DURATION; } /* 1' */
else if ( DURATION >= 300 ) { RESULT = 479 - DURATION; } /* 3' */
else if ( DURATION >= 240 ) { RESULT = 299 - DURATION; } /* 1' */
else if ( DURATION >= 120 ) { RESULT = 239 - DURATION; } /* 2' */
else if ( DURATION >= 60 ) { RESULT = 119 - DURATION; } /* 1' */
else { RESULT = 59 - DURATION; } /* 1' */

/* alert between fast and slow running */
if ( DURATION == 1979 || DURATION == 1919 || DURATION == 1859 ||
DURATION == 1739 || DURATION == 1679 || DURATION == 1499 ||
DURATION == 1439 || DURATION == 1199 || DURATION == 1139 ||
DURATION == 839 || DURATION == 779 || DURATION == 539 ||
DURATION == 479 || DURATION == 299 || DURATION == 239 ||
DURATION == 119 || DURATION == 59 ) { Suunto.alarmBeep(); }
}


----------



## suecoloco

I got another problem with this app:
/* While in sport mode do this once per second */

RESULT = SUUNTO_HR;

if ((10 - Suunto.mod(SUUNTO_DURATION, 10) < 3) && SUUNTO_HR > HighHR 
|| 
(10 - Suunto.mod(SUUNTO_DURATION, 10) < 3) && SUUNTO_HR < LowHR )
{
Suunto.alarmBeep();
Suunto.light () ;
}

In movescount it looks like it is working fine, it is supposed to check every 10 seconds to see if my HR is outside of my predefined HRzone and if so alert me with beep and light. However when I try it on my watch it just beeps all the time and the light stays on as well.

Any ideas?


----------



## thompu

suecoloco said:


> I got another problem with this app:
> /* While in sport mode do this once per second */
> 
> RESULT = SUUNTO_HR;
> 
> if ((10 - Suunto.mod(SUUNTO_DURATION, 10) < 3) && SUUNTO_HR > HighHR
> ||
> (10 - Suunto.mod(SUUNTO_DURATION, 10) < 3) && SUUNTO_HR < LowHR )
> {
> Suunto.alarmBeep();
> Suunto.light () ;
> }
> 
> In movescount it looks like it is working fine, it is supposed to check every 10 seconds to see if my HR is outside of my predefined HRzone and if so alert me with beep and light. However when I try it on my watch it just beeps all the time and the light stays on as well.
> 
> Any ideas?


Without having tried: too few parantheses? I have read that this is supposed to be a problem. As far as efficient programming, this ought to be better:

if (Suunto.mod(SUUNTO_DURATION, 10) < 3)
{
if ((HighHR-SUUNTO_HR)*(SUUNTO_HR-LowHR)<0)
{
Suunto.alarmBeep();
Suunto.light();
}
}

This way, you only make the CPU check what the status of the HR is when it is time, and not every second. And when it's due, it's just one boolean check.

Thomas


----------



## Querfeldein

Hi,

I just created my first App, and seem to have run into a similar bug:



Code:


[FONT=Verdana][COLOR=#000000]if (SUUNTO_LAP_DURATION < 5){
[/COLOR][/FONT]RESULT = SUUNTO_LAP_PACE_PREV;
}
else{
RESULT = SUUNTO_LAP_PACE;
}

Lap Pace - previous and current - App at Movescount.com

The simulation works fine, but on the watch (Ambit 2S), I get strange values (e.g. for a pace of around 5' / km, the value displayed (whether lap_pace or lap_pace_prev) is around 18'00". It reacts to acceleration, but neither the current lap pace nor the previous lap pace is displayed correctly. I am using the English version of movescount.

I tried to search for other apps that use SUUNTO_LAP_PACE, but only found apps that seem to use a workaround (based on distance and time). I'll try that, but I don't like code that's unnecessarily complicated.


----------



## suecoloco

thompu said:


> Without having tried: too few parantheses? I have read that this is supposed to be a problem. As far as efficient programming, this ought to be better:
> 
> if (Suunto.mod(SUUNTO_DURATION, 10) < 3)
> {
> if ((HighHR-SUUNTO_HR)*(SUUNTO_HR-LowHR)<0)
> {
> Suunto.alarmBeep();
> Suunto.light();
> }
> }
> 
> This way, you only make the CPU check what the status of the HR is when it is time, and not every second. And when it's due, it's just one boolean check.
> 
> Thomas


Thanks for the input! It seems to work fine now on the watch, much appreciated


----------



## thompu

Querfeldein said:


> Hi,
> 
> I just created my first App, and seem to have run into a similar bug:
> 
> 
> 
> Code:
> 
> 
> [FONT=Verdana][COLOR=#000000]if (SUUNTO_LAP_DURATION < 5){
> [/COLOR][/FONT]RESULT = SUUNTO_LAP_PACE_PREV;
> }
> else{
> RESULT = SUUNTO_LAP_PACE;
> }
> 
> Lap Pace - previous and current - App at Movescount.com
> 
> The simulation works fine, but on the watch (Ambit 2S), I get strange values (e.g. for a pace of around 5' / km, the value displayed (whether lap_pace or lap_pace_prev) is around 18'00". It reacts to acceleration, but neither the current lap pace nor the previous lap pace is displayed correctly. I am using the English version of movescount.
> 
> I tried to search for other apps that use SUUNTO_LAP_PACE, but only found apps that seem to use a workaround (based on distance and time). I'll try that, but I don't like code that's unnecessarily complicated.


What are you actually trying to achieve? It looks like during the first 5 seconds of a new lap you are showing the average pace of the previous lap, and after the first 5 seconds the average pace of the current lap. Is that what it is supposed to do? It makes me wonder why a number like 18'00'' would be shown, because according to the app developer's manual, the range of pace is from 0.6 to 17. Maybe this is just a case of overflow. When you are standing still, you evidently have an average pace of infinite minutes per kilometer. Maybe you literally have to get going first... :-d
... or switch to speed as opposed to pace, if the pace is out of range. Speed never is infinite, so it is less prone to typical overflow errors.

Thomas


----------



## suecoloco

I did this script that works well in the simulator but not on the watch (ambit 2), any ideas? Distance is an Own variable in this case set to 13 (starts when lapnumber equals to 3 and then countsdown.

/* While in sport mode do this once per second */
RESULT = SUUNTO_DISTANCE ;

if ( SUUNTO_LAP_NUMBER <= 2 ) 
{
RESULT = SUUNTO_DISTANCE ;
prefix = "warm" ;
}

else if

(SUUNTO_LAP_NUMBER > Distance)
{
RESULT =SUUNTO_DISTANCE;

prefix = "cool";
}
else if
(SUUNTO_LAP_NUMBER == Distance)
{
Suunto.alarmBeep ();
Suunto.light () ;
}
else 
{
RESULT = (Distance - SUUNTO_LAP_NUMBER);

prefix = "run" ;

}


----------



## suecoloco

suecoloco said:


> I did this script that works well in the simulator but not on the watch (ambit 2), any ideas? Distance is an Own variable in this case set to 13 (starts when lapnumber equals to 3 and then countsdown.
> 
> /* While in sport mode do this once per second */
> RESULT = SUUNTO_DISTANCE ;
> 
> if ( SUUNTO_LAP_NUMBER <= 2 )
> {
> RESULT = SUUNTO_DISTANCE ;
> prefix = "warm" ;
> }
> 
> else if
> 
> (SUUNTO_LAP_NUMBER > Distance)
> {
> RESULT =SUUNTO_DISTANCE;
> 
> prefix = "cool";
> }
> else if
> (SUUNTO_LAP_NUMBER == Distance)
> {
> Suunto.alarmBeep ();
> Suunto.light () ;
> }
> else
> {
> RESULT = (Distance - SUUNTO_LAP_NUMBER);
> 
> prefix = "run" ;
> 
> }


nevermind, I switched from lap_number to distance and that worked on the watch


----------



## PabloAlarcon

Hi ppl  Does anyone know if the pre/postfix is usable in Ambit1 after the Fw. update regardings the logging in Movescount?? The thing is I hav an app that ishows the Heart Zones while training (as in polar watches) with the prefix "ZN" and Postfix is suppose to change acording to zone, Easy, Mod (moderate), Hard, Vhrd, and so on....it works fine in real time in watch while training, but afeter I download the move to movescount, the log for the app shows the right zones but the postfix is stuck in "Mod" for all the zones, it doesnt change. I saw other ppl using the same app having the same issue. Any hint or ideas as what i could be wrong? is it the app or Movescount?

I deleted my move but here is a screen showing what I mean; it shows ZONE 5 Easy


----------



## slav_2000

Thanks God, Suunto has fixed the problem with postfix and prefix commands for Ambit1. At the same time, I've faced another issue with postfix: when I'm trying to set in the code postfix value to "km/h", I'm getting compilation error at line -1 !!! Checking different options and tying to play with the code, I've realized that the problem is in the "/" symbol. When I remove it from the postfix value, setting it to "kmh", for example, the code works perfectly. What is it this time with App compiler?


----------



## slav_2000

slav_2000 said:


> Thanks God, Suunto has fixed the problem with postfix and prefix commands for Ambit1. At the same time, I've faced another issue with postfix: when I'm trying to set in the code postfix value to "km/h", I'm getting compilation error at line -1 !!! Checking different options and tying to play with the code, I've realized that the problem is in the "/" symbol. When I remove it from the postfix value, setting it to "kmh", for example, the code works perfectly. What is it this time with App compiler?


The problem is clear now:
1. The watch can show prefix-postfix if their common lenght is not more than 6 symbols (for example, "XX-XXXX", "XXX-XXX" or "XXXX-XX").
2. At the same time, in order to protect themselves, in the compiler they simply do not allow us to put in both prefix and postfix not more than 3 symblos each. No matter what will be your second part of prefix-postfix. Very stupid but simple solution. For them.

Therefore, you will never be able to program in your App postfix like "km/h" (4 symblos) or prefix "speed" (5 symbols), for example. Very bad for user apps.


----------



## slav_2000

One additional question: in the airplane Ambit can not show the speed and the altitude greater than 999 km/h and meters. If I create the App and show there the value of altitude and speed, devided by 1000 or by 100, will the result fit on the screen, or this is hardware limitation, according to which the watch can not maitain the values more than 999?


----------



## bowesmana

I found an interesting feature of apps today. If your app contains an incrementing counter each time the app is called, the value will start to increment as soon as you initiate the exercise even though you have not started the exercise. Also, when the exercise is paused it still calls the app once per second.

I was trying to see if there was a variable that indicated the exercise state, but can't find a way to know if the exercise is started or paused. The only way I can think to do this is to save the SUUNTO_DURATION each pass and first compare that saved value with SUUNTO_DURATION, e.g.

if (SUUNTO_DURATION > lastDuration) {
lastDuration = SUUNTO_DURATION;
doStuff:
}

Anyone else found a better way to do this?


----------



## slav_2000

bowesmana said:


> I found an interesting feature of apps today. If your app contains an incrementing counter each time the app is called, the value will start to increment as soon as you initiate the exercise even though you have not started the exercise. Also, when the exercise is paused it still calls the app once per second.
> 
> I was trying to see if there was a variable that indicated the exercise state, but can't find a way to know if the exercise is started or paused. The only way I can think to do this is to save the SUUNTO_DURATION each pass and first compare that saved value with SUUNTO_DURATION, e.g.
> 
> if (SUUNTO_DURATION > lastDuration) {
> lastDuration = SUUNTO_DURATION;
> doStuff:
> }
> 
> Anyone else found a better way to do this?


Exactly, App will be called immediately after its selection, even before the start of the exercise. Therefore, for some "counter" Apps you don't even need to start the exercise. But, I found several interesting points:
1) if your App requests GPS-based values and non-GPS-based values, the counter will not start until GPS-fix will be obtained by the watch.
2) for example, baro sensor needs some time to initialize, before you can get its correct value. If you try to read SUUNTO_PRESSURE immediately at the start of the App, it will return incorrect zero value instead of real pressure. Therefore, you need to create the cycle (I put around 10-15 seconds), based on counter, and only after 10-15 seconds read the PRESSURE variable, which you will use afterwards. Perhaps, there are some another similar variable, which needs some time to initialize.


----------



## Tony L

Hi guys

As you all know, when you set HR Limits in Movescount, the Ambit will chime once when your actual HR exceeds your HR Limits after 2 mins. If your actual HR continue to remain in the exceeded zone, the watch will not chime anymore, unless you return to your zone & exceed again.

I have made a simple App that will beep when my actual HR falls below 70% of my Max HR, & when equal to or exceed 85% of my Max HR.
The screen shows actual HR. I have set "HR" as Prefix & "%" as Postfix.

The App works fine & is shown below:

/* While in sport mode do this once per second */

RESULT = (SUUNTO_HR/SUUNTO_USER_MAX_HR)*100 ;

if (SUUNTO_HR < (0.7* SUUNTO_USER_MAX_HR ) ) {

Suunto.alarmBeep() ;
}

if ( SUUNTO_HR >= (0.85* SUUNTO_USER_MAX_HR ) ) {

Suunto.alarmBeep() ;
}

Anyone know how to program a delay duration to the beeping, ie, when the actual HR exceeds the HR limit for a certain maintained duration, say 10 secs?
In Pg 6 of the App Developer Manual, there is an example for Sprint Counter for Cycling, whereby bike power above 300W *maintained for 3 secs* is counted as a sprint.

I am no programmer, but have put in the time duration of 10secs into my App as shown below but it does not work:

/* While in sport mode do this once per second */

RESULT = (SUUNTO_HR/SUUNTO_USER_MAX_HR)*100 ;

if (SUUNTO_HR[10] < (0.7* SUUNTO_USER_MAX_HR ) ) {

Suunto.alarmBeep() ;
}

if ( SUUNTO_HR[10] >= (0.85* SUUNTO_USER_MAX_HR ) ) {

Suunto.alarmBeep() ;
}

Anyone savvy programmers out there know how to solve this?


----------



## bowesmana

Tony L said:


> I am no programmer, but have put in the time duration of 10secs into my App as shown below but it does not work:
> 
> /* While in sport mode do this once per second */
> 
> RESULT = (SUUNTO_HR/SUUNTO_USER_MAX_HR)*100 ;
> 
> if (SUUNTO_HR[10] < (0.7* SUUNTO_USER_MAX_HR ) ) {
> 
> Suunto.alarmBeep() ;
> }
> 
> if ( SUUNTO_HR[10] >= (0.85* SUUNTO_USER_MAX_HR ) ) {
> 
> Suunto.alarmBeep() ;
> }
> 
> Anyone savvy programmers out there know how to solve this?


I think you'll find the correct variable to use is

SUUNTO_HR_AVG[10]


----------



## Tony L

bowesmana said:


> I think you'll find the correct variable to use is
> 
> SUUNTO_HR_AVG[10]


Thanks Bowesmana, I will give it a try.


----------



## newbie007

Hi,

I have a problem if I am using the AppDesigner (Editor). I am not able to get a code which is working, even if it is a very easy code (with the right syntax) I got the message "Upps - please check your formula". If I do not use the Editor it works.

As an example I attached an screenshot (the app works with my watch).








Any idea ?

Thanks


----------



## PabloAlarcon

Hi, maybe it's the browser, sometimes i have problems using the editor with Firefox but with Chrome it works fine.


----------



## Fjeldheim

*App Zone -App does not work in watch*

Hi all.
I have created an app that calculate the Zone and show the zone as a preFix before the HR in %.
The problem is that the app works 100% in the simulation but does not change the preFix (tested on both Ambit and Ambit2).
Link to the app:Training zone 1-5 and max HR in % - App at Movescount.com_

For me it looks like the if statement dosent trigger?

The code:
-----
/* While in sport mode do this once per second */
/* Calculate the HR in % from the HR */

RESULT = (100 / SUUNTO_USER_MAX_HR) * SUUNTO_HR;

/* Sone 0 */
if (RESULT < 60 && RESULT > 0) {
prefix="PUSH";
postfix = "%";
}
/* Sone 1 */
if (RESULT < 72 && RESULT > 60) {
prefix="Zone1";
postfix = "%";
}
/* Sone 2 */
if (RESULT < 82 && RESULT > 72) {
prefix="Zone2";
postfix = "%";
}
/* Sone 3 */
if (RESULT < 87 && RESULT > 82) {
prefix="Zone3";
postfix = "%";
}
/* Sone 4 */
if (RESULT < 92 && RESULT > 87) {
prefix="Zone4";
postfix = "%";
}
/* Sone 5 */
if (RESULT < 100 && RESULT > 92) {
prefix="Zone5";
postfix = "%";
}
/* Sone over max */
if (RESULT<200 && RESULT>100) {
prefix="Ups..";
postfix = "%";
}


----------



## bowesmana

*Re: App Zone -App does not work in watch*



Fjeldheim said:


> Hi all.
> I have created an app that calculate the Zone and show the zone as a preFix before the HR in %.
> The problem is that the app works 100% in the simulation but does not change the preFix (tested on both Ambit and Ambit2).
> Link to the app:Training zone 1-5 and max HR in % - App at Movescount.com_
> 
> For me it looks like the if statement dosent trigger?
> 
> The code:
> -----
> /* While in sport mode do this once per second */
> /* Calculate the HR in % from the HR */
> 
> RESULT = (100 / SUUNTO_USER_MAX_HR) * SUUNTO_HR;
> 
> /* Sone 0 */
> if (RESULT < 60 && RESULT > 0) {
> prefix="PUSH";
> postfix = "%";
> }
> /* Sone 1 */
> if (RESULT < 72 && RESULT > 60) {
> prefix="Zone1";
> postfix = "%";
> }
> /* Sone 2 */
> if (RESULT < 82 && RESULT > 72) {
> prefix="Zone2";
> postfix = "%";
> }
> /* Sone 3 */
> if (RESULT < 87 && RESULT > 82) {
> prefix="Zone3";
> postfix = "%";
> }
> /* Sone 4 */
> if (RESULT < 92 && RESULT > 87) {
> prefix="Zone4";
> postfix = "%";
> }
> /* Sone 5 */
> if (RESULT < 100 && RESULT > 92) {
> prefix="Zone5";
> postfix = "%";
> }
> /* Sone over max */
> if (RESULT<200 && RESULT>100) {
> prefix="Ups..";
> postfix = "%";
> }


So what do you get. Just the number or number + postfix or something else?

Firstly you should be using

if...
else if...
else if...

otherwise it will evaluate all statements.

Secondly, you should be using either <= or >+for one of you range values, otherwise it will not do anything if your result is 60, 72, 82, 87, 92 100

Thirdly, there's no point in the <200 test otherwise you will get no result if it's >= 200. I don't suppose that's likely, but it has the effect of hiding a possible problem in the code.

As postfix is always %, you could also set postfix at the same time as RESULT. Less code to run = more efficient = less battery.


----------



## Fjeldheim

*Re: App Zone -App does not work in watch*

THX. I will try 
I Guess that this means taht the simulator can not be 100% trusted?


----------



## slav_2000

*Re: App Zone -App does not work in watch*

What is going on with Movescount App editor? Can not save the App, always warning me about leaving the page...


----------



## Fjeldheim

*Re: App Zone -App does not work in watch*



slav_2000 said:


> What is going on with Movescount App editor? Can not save the App, always warning me about leaving the page...


I had the same problem yeasterday.


----------



## Catalyst47

*Re: App Zone -App does not work in watch*

Does anyone know how to code the watch to beep multiple times. Say you reach your max heart rate and want it to beep 5 times. I have tried the following, but not sure it works:

RESULT = ((SUUNTO_USER_MAX_HR - SUUNTO_HR)/100);
if(RESULT == .9){Suunto.alarmBeep();Suunto.alarmBeep();Suunto.alarmBeep();Suunto.alarmBeep();}


----------



## bowesmana

*Re: App Zone -App does not work in watch*



Catalyst47 said:


> Does anyone know how to code the watch to beep multiple times. Say you reach your max heart rate and want it to beep 5 times. I have tried the following, but not sure it works:
> 
> RESULT = ((SUUNTO_USER_MAX_HR - SUUNTO_HR)/100);
> if(RESULT == .9){Suunto.alarmBeep();Suunto.alarmBeep();Suunto.alarmBeep();Suunto.alarmBeep();}


To make it beep 5 times, you need to set a counter if the condition is met and the counter is not already set. As your app is called once a second, each time into your app, if the counter is set, then make the beep and decrement the counter. For example, I have a nutrition reminder that will beep twice after 20 minutes, four times after 40 minutes and then cycle between 2/4 each 20 minutes. Note that it also does not operate before the exercise is started and when it's paused.



Code:


if (SUUNTO_DURATION == 0) {
  RESULT = 0;
}
else if (SUUNTO_DURATION > lastDuration) {
  counter = counter + 1;
  if (counter - 1200 == 0) {
    RESULT = RESULT + 0.5;
    beepCount = 2;
  }
  if (counter - 2400 == 0) {
    RESULT = RESULT + 0.5;
    beepCount = 4;
    counter = 0;
  }
  if (beepCount > 0) {
    beepCount = beepCount - 1;
    Suunto.alarmBeep();
  }
  lastDuration = SUUNTO_DURATION;
}

So you need to do something like this



Code:


RESULT = ((SUUNTO_USER_MAX_HR - SUUNTO_HR)/100);
if (RESULT == .9 && beepCount == 0) {
    beepCount = 5;
}
if (beepCount > 0) {
    Suunto.alarmBeep();
    beepCount = beepCount - 1;
}

Don't forget to set up your own variable beepCount with starting value 0.

I suspect you also want to test RESULT >= .9 rather than ==


----------



## Catalyst47

*Re: App Zone -App does not work in watch*



bowesmana said:


> Don't forget to set up your own variable beepCount with starting value 0.


Wow, thank you for the quick reply. I think I understand the logic, but I am new to programming and don't really understand how to incorporate the variable for beepCount and Counter. Can you give me an example like in your 20/40 Nutrition of how you defined the variables? Assuming you have to do something like: beepCount(); in prior to starting any of the line in the code?


----------



## Cyberbob13

You can define own variables and starting values at the top of the app designing page in Movescount (there are dedicated input fields for this).


----------



## bowesmana

*Re: App Zone -App does not work in watch*



Catalyst47 said:


> Wow, thank you for the quick reply. I think I understand the logic, but I am new to programming and don't really understand how to incorporate the variable for beepCount and Counter. Can you give me an example like in your 20/40 Nutrition of how you defined the variables? Assuming you have to do something like: beepCount(); in prior to starting any of the line in the code?


Here's my app, see Own Variables section at top


----------



## Catalyst47

*Re: App Zone -App does not work in watch*

Thanks for the help everyone. I built this app using the suggestions from above. Let me know if you have any comments on ways to improve it. Think it turned out pretty good for my first one. Audio Cues for Heart Rate - App at Movescount.com


----------



## Appie123

*Re: App Zone -App does not work in watch*

/* While in sport mode do this once per second */
RESULT = SUUNTO_HR;
count = count + 1;
if (count == 1 || RESULT >= 146)
{
Suunto.alarmBeep();
}
else if (count == 2 || RESULT >= 146)
{
Suunto.alarmBeep();
}
else if (count == 3 || RESULT <= 136)
{
Suunto.alarmBeep();
}
else if (count == 4)
{
count = 0;
}
Hi guys and ladies, I am trying to make an app that beeps like crazy when my HR is above a value and beeps slowe when below a value. I think the above should work, but I still get the message: Whoops! Please check the formula.'.......Do you have any suggestions?Allard


----------



## SiRoB1

*Re: App Zone -App does not work in watch*

Hi Appie123,

you just need to define "count" as a variable:


----------



## mondoshawan

*Re: App Zone -App does not work in watch*



Appie123 said:


> /* While in sport mode do this once per second */
> RESULT = SUUNTO_HR;
> count = count + 1;
> if (count == 1 || RESULT >= 146)
> {
> Suunto.alarmBeep();
> }
> else if (count == 2 || RESULT >= 146)
> {
> Suunto.alarmBeep();
> }
> else if (count == 3 || RESULT <= 136)
> {
> Suunto.alarmBeep();
> }
> else if (count == 4)
> {
> count = 0;
> }
> Hi guys and ladies, I am trying to make an app that beeps like crazy when my HR is above a value and beeps slowe when below a value. I think the above should work, but I still get the message: Whoops! Please check the formula.'.......Do you have any suggestions?Allard


&#8230;and you need to use the *and* (&&) conjunction instead of *or", otherwise the watch will beep all the time, cause one of your statements is always true. Beepfree between 137 and 145:

/* While in sport mode do this once per second */
RESULT = SUUNTO_HR;
count = count + 1;
if (count == 1 && RESULT >= 146)
{
Suunto.alarmBeep();
}
else if (count == 2 && RESULT >= 146)
{
Suunto.alarmBeep();
}
else if (count == 3 && RESULT <= 136)
{
Suunto.alarmBeep();
}
else if (count == 4)
{
count = 0;
}


----------



## Appie123

*Re: App Zone -App does not work in watch*



mondoshawan said:


> &#8230;and you need to use the *and* (&&) conjunction instead of *or", otherwise the watch will beep all the time, cause one of your statements is always true. Beepfree between 137 and 145:
> 
> /* While in sport mode do this once per second */
> RESULT = SUUNTO_HR;
> count = count + 1;
> if (count == 1 && RESULT >= 146)
> {
> Suunto.alarmBeep();
> }
> else if (count == 2 && RESULT >= 146)
> {
> Suunto.alarmBeep();
> }
> else if (count == 3 && RESULT <= 136)
> {
> Suunto.alarmBeep();
> }
> else if (count == 4)
> {
> count = 0;
> }


Dear Mondoshawan and Sirob1 (above reply),

Thanks for your input! I will try it out.

Kind regards,

Allard


----------



## richard1102ho

*Re: App Zone ( new back-light app development)*

i am not a expert programmer, but it would be great if someone can kindly help me to make an back-light app that will switch it-self on when i make a menu-lap or auto-lap in the exercise mode after the sun is set ( similar to the 'after sunset' back-light mode on garmin fenix)..(i can't switch the back-light mode during exercise in my ambit 2)

this function is really essential for me , because i am a day to night runner, hope that some expert can help me with this....many thanks


----------



## SiRoB1

*Re: App Zone ( new back-light app development)*



richard1102ho said:


> i am not a expert programmer, but it would be great if someone can kindly help me to make an back-light app that will switch it-self on when i make a menu-lap or auto-lap in the exercise mode after the sun is set ( similar to the 'after sunset' back-light mode on garmin fenix)..(i can't switch the back-light mode during exercise in my ambit 2)
> 
> this function is really essential for me , because i am a day to night runner, hope that some expert can help me with this....many thanks


Hi richard1102ho,
it could be a tiny feature request for suunto dev, i think i didn't seen this request yet.
Something like new back-light mode that would mix sunrise and sunset with the night mode during an exercise.
But it will not respond to the auto lap request.



richard1102ho said:


> (i can't switch the back-light mode during exercise in my ambit 2)


It should be also a tiny feature request for suunto dev, by allowing us to change the back-light mode during exercises.



richard1102ho said:


> this function is really essential for me , because i am a day to night runner, hope that some expert can help me with this....many thanks


Anyway, i'm ready to develop this app, i've just got some idea to make it universal.
The basic idea will be to use most of the "Sunrise Sunset Time of Day" app from or_watching, add a workaround to be free of the time zone and add a tiny code to address self lighting when a lap occur.

I'll create a new thread to discuss the application when I have finished.
EDIT: https://www.watchuseek.com/f233/[ambit-app]-back-light-during-night-new-lap-950873.html


----------



## or_watching

*Re: App Zone ( new back-light app development)*



SiRoB1 said:


> Hi richard1102ho,
> it could be a tiny feature request for suunto dev, i think i didn't seen this request yet.
> Something like new back-light mode that would mix sunrise and sunset with the night mode during an exercise.
> But it will not respond to the auto lap request.
> 
> It should be also a tiny feature request for suunto dev, by allowing us to change the back-light mode during exercises.
> 
> Anyway, i'm ready to develop this app, i've just got some idea to make it universal.
> The basic idea will be to use most of the "Sunrise Sunset Time of Day" app from or_watching, add a workaround to be free of the time zone and add a tiny code to address self lighting when a lap occur.
> 
> I'll create a new thread to discuss the application when I have finished.


Hi. I like this app request. But don't have much time for apps nowadays.
regarding the auto-laps... you could always hard-code the app to turn the light on every mile and/or every km. Not too much harm in that, right?

I haven't tried Suunto.light(), if used for continuous seconds does the light flicker or is it truely continuous?


----------



## SiRoB1

*Re: App Zone ( new back-light app development)*



or_watching said:


> I haven't tried Suunto.light(), if used for continuous seconds does the light flicker or is it truely continuous?


No flicker, there is a trigger ( like for normal or night back-light mode.
I made the app but i didn't retrieve your var app setting, so i used an other method.
We need to decide to adjust offset to trigger night back-light before official sunset as weather conditions may be cloudy.
I think changing sun's zenith could be the best way, but i have no idea what value will suit the best.
For sure less than 90.83333 Degrees that is used for official sunrise/sunset, 89 degrees, 88 degrees...

EDIT: Changing official sunset/sunrise sun's zenith is not needed, by comparing the lighting this morning.


----------



## eeun

*Re: App Zone ( new back-light app development)*

Trying to build some code that causes beeps based on moving to a new PTE zone. I'll just add this to other apps I have as I don't need the results displayed. I can get a single beep for each zone but I'd like 2 beeps when a PTE of 2 is reached, 3 at 3, 4 beeps at 4 and 5 at 5.

Can't seem to get this working. Any help appreciated.



Code:


if (SUUNTO_PEAKTE == 2){
Suunto.alarmBeep();
}
else if (SUUNTO_PEAKTE == 3)
{
Suunto.alarmBeep();
}
else if (SUUNTO_PEAKTE == 4)
{
Suunto.alarmBeep();
}
else if (SUUNTO_PEAKTE == 5)
{
Suunto.alarmBeep();
}


----------



## mondoshawan

*Re: App Zone ( new back-light app development)*



eeun said:


> Trying to build some code that causes beeps based on moving to a new PTE zone. I'll just add this to other apps I have as I don't need the results displayed. I can get a single beep for each zone but I'd like 2 beeps when a PTE of 2 is reached, 3 at 3, 4 beeps at 4 and 5 at 5.
> 
> Can't seem to get this working. Any help appreciated.
> 
> 
> 
> Code:
> 
> 
> if (SUUNTO_PEAKTE == 2){
> Suunto.alarmBeep();
> }
> else if (SUUNTO_PEAKTE == 3)
> {
> Suunto.alarmBeep();
> }
> else if (SUUNTO_PEAKTE == 4)
> {
> Suunto.alarmBeep();
> }
> else if (SUUNTO_PEAKTE == 5)
> {
> Suunto.alarmBeep();
> }


try to use the beep command multiple times. Not that elegant like using a counter, but i think that's the easiest way to make it beep multiple times. This could work:



Code:


if (SUUNTO_PEAKTE == 2){
Suunto.alarmBeep();
Suunto.alarmBeep();
}
else if (SUUNTO_PEAKTE == 3)
{
Suunto.alarmBeep();
Suunto.alarmBeep();
Suunto.alarmBeep();
}


----------



## or_watching

*Re: App Zone ( new back-light app development)*



mondoshawan said:


> try to use the beep command multiple times. Not that elegant like using a counter, but i think that's the easiest way to make it beep multiple times. This could work:
> 
> 
> 
> Code:
> 
> 
> if (SUUNTO_PEAKTE == 2){
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> }
> else if (SUUNTO_PEAKTE == 3)
> {
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> }


Since PEAKTE could sit at value for while, e.g. at 3.0 for several minutes, wouldn't that beep and beep for the several minutes?

Here's an app which should trigger only on the first second that the whole values (2, 3, 4, 5) are reached. I think. But haven't tried it in a watch.


Code:


RESULT = SUUNTO_PEAKTE;
if (Suunto.mod(SUUNTO_PEAKTE,1)==0 && previous != SUUNTO_PEAKTE) {
    counter = SUUNTO_PEAKTE;
}
if (counter > 0) {
  Suunto.alarmBeep();
  counter = counter -1;
}
previous = SUUNTO_PEAKTE;

_
Intialize variable "previous" to 1, and "counter" to 0._


----------



## eeun

*Re: App Zone ( new back-light app development)*



or_watching said:


> Since PEAKTE could sit at value for while, e.g. at 3.0 for several minutes, wouldn't that beep and beep for the several minutes?
> 
> Here's an app which should trigger only on the first second that the whole values (2, 3, 4, 5) are reached. I think. But haven't tried it in a watch.
> 
> 
> Code:
> 
> 
> RESULT = SUUNTO_PEAKTE;
> if (Suunto.mod(SUUNTO_PEAKTE,1)==0 && previous != SUUNTO_PEAKTE) {
> counter = SUUNTO_PEAKTE;
> }
> if (counter > 0) {
> Suunto.alarmBeep();
> counter = counter -1;
> }
> previous = SUUNTO_PEAKTE;
> 
> _
> Intialize variable "previous" to 1, and "counter" to 0._


Yes it would have done, and yes, your modification is better.... and it works, well it does at PTE of 1 where there is an immediate double beep and then nothing. I'll test this at training tomorrow, having a rest day today as I have bad DOMS from running!

Without wishing to be a pain (but no doubt managing to be :roll, I still don't really understand how this code hangs together. For each of the three code statements above, could you explain what they mean? I am hoping one day I might understand this well enough to 'fly solo' but it seems I still don't really get it o|


----------



## or_watching

*Re: App Zone ( new back-light app development)*



mondoshawan said:


> try to use the beep command multiple times. Not that elegant like using a counter, but i think that's the easiest way to make it beep multiple times. This could work:
> 
> 
> 
> Code:
> 
> 
> if (SUUNTO_PEAKTE == 2){
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> }
> else if (SUUNTO_PEAKTE == 3)
> {
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> Suunto.alarmBeep();
> }


And one more observation wrt how apps work... those consecutive beep commands are actually overlapping (redundant) in the same second. They do not represent beeps in consecutive seconds. Remember, your entire code flow is executed once per second.


----------



## mondoshawan

*Re: App Zone ( new back-light app development)*



or_watching said:


> And one more observation wrt how apps work... those consecutive beep commands are actually overlapping (redundant) in the same second. They do not represent beeps in consecutive seconds. Remember, your entire code flow is executed once per second.


you're absolutely right&#8230;

not my best idea with the consecutive beep commands&#8230; a most stupid idea since the app calls it once a second!
For penalty, i'll do an an extra Butterfly session within Poolswim next week&#8230; ;-)


----------



## eeun

*Re: App Zone ( new back-light app development)*

OK, 2 sets of code. The first does not beep unless the exercise is running and will not beep until PTE reaches 2. The second beeps from PTE of 2 (2 beeps), 3 with 3 beeps and so on. Both use a lot of memory, 20% and 24% respectively. Is there a more efficient way of doing either?



Code:


/* While in sport mode do this once per second 
*/RESULT = SUUNTO_MAX_HR;
if (Suunto.mod(SUUNTO_PEAKTE,1)==0 && previous != SUUNTO_PEAKTE) {
    counter = SUUNTO_PEAKTE;
}
if (counter > 0 && SUUNTO_DURATION >0 && SUUNTO_PEAKTE > 1.9) {
  Suunto.alarmBeep();
  counter = counter -1;
}
previous = SUUNTO_PEAKTE;




Code:


/* While in sport mode do this once per second 
*/RESULT = SUUNTO_MAX_HR;

if (SUUNTO_PEAKTE < 2 && beepCount == 0 && counter != 0 ) {
    beepCount = 0;
    counter = 0;
}
if (SUUNTO_PEAKTE == 2 && beepCount == 0 && counter != 1 ) {
    beepCount = 2;
    counter = 1;
}
if ( SUUNTO_PEAKTE == 3 && beepCount == 0 && counter != 2 ) {
    beepCount = 3;
    counter = 2;
}
if ( SUUNTO_PEAKTE == 4 && beepCount == 0 && counter != 3 ) {
    beepCount = 4;
    counter = 3;
}
if (SUUNTO_PEAKTE == 5 && beepCount == 0 && counter != 4 ) {
    beepCount = 5;
    counter = 4;
}
if (beepCount > 0) {
    Suunto.alarmBeep();
    beepCount = beepCount - 1;
}


----------



## SiRoB1

*Re: App Zone ( new back-light app development)*



eeun said:


> OK, 2 sets of code. The first does not beep unless the exercise is running and will not beep until PTE reaches 2. The second beeps from PTE of 2 (2 beeps), 3 with 3 beeps and so on. Both use a lot of memory, 20% and 24% respectively. Is there a more efficient way of doing either?


can't get under 18%:
- 5 second delay between beep series


Code:


if ((counter <= -5) && (previous > SUUNTO_PEAKTE || SUUNTO_PEAKTE >= previous + 1)) {
  previous = SUUNTO_PEAKTE - Suunto.mod(SUUNTO_PEAKTE, 1);
  counter = previous;
}
if (counter > 0) {
  Suunto.alarmBeep();
}
counter = counter - 1;


----------



## PabloAlarcon

*Re: App Zone ( new back-light app development)*

Hi,  I just wrote myself an app that shows a "TargetAscent" that decreases till 0 as i run and beeps every time 100+ mts are climbed and beeps continuosly after target is reached. I have no clue about programming so just need to know if theres a better more "elegant" solution for this. Also I would've like a way to show postfix "Mts" as the target decreases and postfix " DONE" once completed, plus the alarm beeping me not to keep going up once target reach . heres my code:

/* While in sport mode do this once per second */
RESULT = (-TargetAsc + SUUNTO_ASCENT_TOT[10]);
if(RESULT==-600){Suunto.alarmBeep();} 
else if(RESULT==-500){Suunto.alarmBeep();} 
else if(RESULT==-400){Suunto.alarmBeep();} 
else if(RESULT==-300){Suunto.alarmBeep();} 
else if(RESULT==-200){Suunto.alarmBeep();} 
else if(RESULT==-100){Suunto.alarmBeep();} 
else if(RESULT==-10){Suunto.alarmBeep();}
else if(RESULT==-5){Suunto.alarmBeep();}
else if(RESULT>=0){Suunto.alarmBeep();}

i used my own var "TargetAscent" value 700 in this case. Is there a way to manually imput target so not to modify the app each time??

thanks very much in advance!!


----------



## SiRoB1

Hi PabloAlarcon,

you may use something like this and use LAP button to change your climb target during your exercise.
Note that the app will continue to beep until you click on LAP button to add 100m to target.



PHP:


/* While in sport mode do this once per second */
TargetAsc = 100 * SUUNTO_LAP_NUMBER;
RESULT = SUUNTO_ASCENT - TargetAsc;
if (SUUNTO_ASCENT - ASCENTlast >= 100) {
  /* the diff between ASCENT and ASCENTlast is more 100m */
  ASCENTlast = SUUNTO_ASCENT - Suunto.mod(SUUNTO_ASCENT, 100); /* 207 - (207 mod 100) = 207 - 7 = 200 */
  Suunto.alarmBeep();
}
if (RESULT >= 0) {
  postfix = "DONE";
  Suunto.alarmBeep();
} else if(RESULT >= -5 ) {
  Suunto.alarmBeep();
} else if(RESULT >= -10 ) {
  Suunto.alarmBeep();
} else {
  postfix = "Mts";
}


----------



## PabloAlarcon

SiRoB1 said:


> Hi PabloAlarcon,
> 
> you may use something like this and use LAP button to change your climb target during your exercise.
> Note that the app will continue to beep until you click on LAP button to add 100m to target.
> 
> 
> 
> PHP:
> 
> 
> /* While in sport mode do this once per second */
> TargetAsc = 100 * SUUNTO_LAP_NUMBER;
> RESULT = SUUNTO_ASCENT - TargetAsc;
> if (SUUNTO_ASCENT - ASCENTlast >= 100) {
> /* the diff between ASCENT and ASCENTlast is more 100m */
> ASCENTlast = SUUNTO_ASCENT - Suunto.mod(SUUNTO_ASCENT, 100); /* 207 - (207 mod 100) = 207 - 7 = 200 */
> Suunto.alarmBeep();
> }
> if (RESULT >= 0) {
> postfix = "DONE";
> Suunto.alarmBeep();
> } else if(RESULT >= -5 ) {
> Suunto.alarmBeep();
> } else if(RESULT >= -10 ) {
> Suunto.alarmBeep();
> } else {
> postfix = "Mts";
> }


thanks for your response SiRoB1 ! I'll be trying your code next time i go for a run.


----------



## PabloAlarcon

SiRoB1 said:


> Hi PabloAlarcon,
> 
> you may use something like this and use LAP button to change your climb target during your exercise.
> Note that the app will continue to beep until you click on LAP button to add 100m to target.
> 
> 
> 
> PHP:
> 
> 
> /* While in sport mode do this once per second */
> TargetAsc = 100 * SUUNTO_LAP_NUMBER;
> RESULT = SUUNTO_ASCENT - TargetAsc;
> if (SUUNTO_ASCENT - ASCENTlast >= 100) {
> /* the diff between ASCENT and ASCENTlast is more 100m */
> ASCENTlast = SUUNTO_ASCENT - Suunto.mod(SUUNTO_ASCENT, 100); /* 207 - (207 mod 100) = 207 - 7 = 200 */
> Suunto.alarmBeep();
> }
> if (RESULT >= 0) {
> postfix = "DONE";
> Suunto.alarmBeep();
> } else if(RESULT >= -5 ) {
> Suunto.alarmBeep();
> } else if(RESULT >= -10 ) {
> Suunto.alarmBeep();
> } else {
> postfix = "Mts";
> }


Hi SiRoB1 sorry to bother you but I have some trouble copying and saving your code to apps ddesigner. I get the "at least one error in line 1 " message. Am I forgeting something?
Do I have to set "targetAsc" as an "Own variable " with any value (0, 1, ?? ) or any other variable that I should have missed?. I also tried deleting the coments */ but (dont know if it matters) it didnt work either. Also, I assume Autolap should be disable fot the apps to work wright ? otherwise it'd be adding mts every lap.
Well thanks very much again for your help !!


----------



## SiRoB1

Yes i didn't mention to add ASCENTlast variable set to zero, you may need to set TargetAsc to a non zero value to prevent beep when you select your exercise.
Autolap need to be disable too.
I added comment to let peoples not familiar with coding to understand it. ;-)


----------



## PabloAlarcon

SiRoB1 said:


> Yes i didn't mention to add ASCENTlast variable set to zero, you may need to set TargetAsc to a non zero value to prevent beep when you select your exercise.
> Autolap need to be disable too.
> I added comment to let peoples not familiar with coding to understand it. ;-)


nice! it works as a charm now in the simulator, I'll be testing it next time I go out . Thank you very much for your time and help SiRoB1 !!!:-!


----------



## PabloAlarcon

Hi, just going through the App Zone in Movescount I found this SUUNTO AMBIT APPS just wanted to post it here in case anybody finds it useful.


----------



## SiRoB1

Just noticed that we can log all our app now with a yellow note appear when more than 2 are checked:


> When App is logged you can view the data from the graph in Move.
> NOTE: Adding Apps to log fills logbook faster.


----------



## PabloAlarcon

SiRoB1 said:


> Just noticed that we can log all our app now with a yellow note appear when more than 2 are checked:


also the app logo shows when selected


----------



## PabloAlarcon

PabloAlarcon said:


> Hi, just going through the App Zone in Movescount I found this SUUNTO AMBIT APPS just wanted to post it here in case anybody finds it useful.


just another apps generators that i found: SUUNTO Ambit Series Generator | Betatrailrunner. Diario de un corredor en prácticas Interval App Generator | Seckle


----------



## tone0

Does anyone know if it's possible to detect any other button press than the lap? Lap works, but it does mean your laps count is messed up. Would be great if we could detect something like the light button being pressed? Thanks.


----------



## SiRoB1

SiRoB1 said:


> Just noticed that we can log all our app now with a yellow note appear when more than 2 are checked:





PabloAlarcon said:


> also the app logo shows when selected





tone0 said:


> Does anyone know if it's possible to detect any other button press than the lap? Lap works, but it does mean your laps count is messed up. Would be great if we could detect something like the light button being pressed? Thanks.


Not possible.
Depending what you need to do, you may consider to catch pause that can be detected with:


PHP:


if (SUUNTO_DURATION == DURATIONlast) {
  /* exercise paused */

}
DURATIONlast = SUUNTO_DURATION;


----------



## tone0

SiRoB1 said:


> Not possible.
> Depending what you need to do, you may consider to catch pause that can be detected with:
> 
> 
> PHP:
> 
> 
> if (SUUNTO_DURATION == DURATIONlast) {
> /* exercise paused */
> 
> }
> DURATIONlast = SUUNTO_DURATION;


Thanks! That would work, hit pause twice, does not disturb anything else, but can be picked up by your app!

Thanks
Tony


----------



## jsherwill

Hi all,

I've been persisting with an error but can't seem to get fixed. I've written an app that tells me what zones I'm in and beeps at me. The preview of the app functions correctly.

I get this error: Compilation has at least one error on line -1

I've defined all the variables.










Here is the code:

/* While in sport mode do this once per second */

if (SUUNTO_HR < 142){
prefix = "Recov";
postfix = "%";
RESULT = (((SUUNTO_HR - SUUNTO_USER_REST_HR)/(142 - SUUNTO_USER_REST_HR)) * 100); 
}

else if (SUUNTO_HR >= 142 && SUUNTO_HR < 155) {
prefix = "ExAer";
postfix = "%";
RESULT = ((SUUNTO_HR - 142) / 13) * 100;
}

else if (SUUNTO_HR >= 155 && SUUNTO_HR < 162) {
prefix = "InAer";
postfix = "%";
RESULT = ((SUUNTO_HR - 155) / 7) * 100;
}

else if (SUUNTO_HR >= 162 && SUUNTO_HR < 173) {
prefix = "ThrZ4";
postfix = "%";
RESULT = ((SUUNTO_HR - 163) / 9) * 100;
}

else if (SUUNTO_HR >= 173 && SUUNTO_HR < 177) {
prefix = "ThZ5a";
postfix = "%";
RESULT = ((SUUNTO_HR - 172) / 4) * 100;
}

else if (SUUNTO_HR >= 177 && SUUNTO_HR < 182) {
prefix = "V025b";
postfix = "%";
RESULT = ((SUUNTO_HR - 171) / 6) * 100;
}

else if (SUUNTO_HR >= 183 && SUUNTO_HR < 197) {
prefix = "Ana5c";
postfix = "%";
RESULT = ((SUUNTO_HR - 182) / 14) * 100;
}

else if (SUUNTO_HR >= 197) {
prefix = "STOP";
postfix = "bp";
RESULT = SUUNTO_HR; 
}

Any ideas??? Thanks in advance....


----------



## SiRoB1

jsherwill said:


> Any ideas??? Thanks in advance....


It's due to the last prefix/postfix couple
pre compile JavaScript check doesn't allow us to mix different prefix/postfix size (in your case 5+1 then 4+2).


PHP:


prefix = "STOP";
postfix = "bp";


----------



## or_watching

yeah, what SiRoB1 says. 

It's been complained about before.


----------



## jsherwill

SiRoB1 said:


> It's due to the last prefix/postfix couple
> pre compile JavaScript check doesn't allow us to mix different prefix/postfix size (in your case 5+1 then 4+2).
> 
> 
> PHP:
> 
> 
> prefix = "STOP";
> postfix = "bp";


Cheers mate - did the trick!


----------



## Kim Clausen

im super new at this , so im hoping someone can help me out .
i would like to have the date shown as ( SAT 21 NOV ) but i cant figure out the way to sett the code.

In advance thanks Kim


----------



## SiRoB1

Kim Clausen said:


> im super new at this , so im hoping someone can help me out .
> i would like to have the date shown as ( SAT 21 NOV ) but i cant figure out the way to sett the code.
> 
> In advance thanks Kim


Hi Kim Clausen,
you can checkthe code of INLINE DATE - App at Movescount.com
change:


PHP:


D = y*10000+M*100+d;

to:


PHP:


D = d;

EDIT: didn't seen that you already use this app, so i did the one you just requested
http://www.movescount.com/apps/app10025145-CALENDAR


----------



## Kim Clausen

SiRoB1 said:


> Hi Kim Clausen,
> you can checkthe code of INLINE DATE - App at Movescount.com
> change:
> 
> 
> PHP:
> 
> 
> D = y*10000+M*100+d;
> 
> to:
> 
> 
> PHP:
> 
> 
> D = d;
> 
> EDIT: didn't seen that you already use this app, so i did the one you just requested
> CALENDAR - App at Movescount.com


Wow !!! thank you so much !


----------



## hresch

Hi I am looking for a way how to achive following funktion.
I want to use autolap (every km), but if I manually press the LAP button it should start the discance for the autolap.

For example how it works now (autolap 1km)

Km 1,0 autolap 1
Km 2,0 autolap 2
km 2,4 manual lap 3
km 3,0 autolap 4
km 4, autolap 5

what I want to achive (also these laps should been shown in movescount laps)

Km 1,0 autolap 1
Km 2,0 autolap 2
km 2,4 manual lap 3
km 3,4 autolap 4
km 4,4 autolap 5

this is the normal function of Garmin Forerunner, and I have to admit I really miss it since a changed to Ambit2


Any Idea out there?

Thanks a lot !!!


----------



## SiRoB1

Unfortunately, it's not possible.
May i ask, what is the final goal?
Which data will take your attention while reading movescount results?
There could be an other solution by using apps...


----------



## Skijeti

What am i doing wrong, can anyone help:

/**********************/
/* WARM UP */

if (SUUNTO_LAP_NUMBER==1) {
if (SUUNTO_LAP_DURATION>=0.0 && SUUNTO_LAP_DURATION<300.0) {
RESULT=300.0-SUUNTO_LAP_DURATION;
prefix="8.0";
postfix="7.0";
if (SUUNTO_PACE<8.0 || SUUNTO_PACE>7.0) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DURATION>=300.0) {
prefix="PRS";
postfix="LAP";
RESULT=0.0;
Suunto.alarmBeep();
}
}

/**********************/
/* INTERVALS */

if (SUUNTO_LAP_NUMBER>1 && SUUNTO_LAP_NUMBER<=9) {
if (Suunto.mod(SUUNTO_LAP_NUMBER-1,4)==1) {
if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
RESULT=0.5-SUUNTO_LAP_DISTANCE;
prefix="6.5";
postfix="6.0";
if (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DISTANCE>=0.5) {
prefix="PRS";
postfix="LAP";
RESULT=0.0;
Suunto.light();
Suunto.alarmBeep();
}
}

if (Suunto.mod(SUUNTO_LAP_NUMBER-1,4)==2) {
if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
RESULT=0.5-SUUNTO_LAP_DISTANCE;
prefix="6.0";
postfix="5.5";
if (SUUNTO_PACE<6.0 || SUUNTO_PACE>5.5) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DISTANCE>=0.5) {
prefix="PRS";
postfix="LAP";
RESULT=0.0;
Suunto.light();
Suunto.alarmBeep();
}
}

if (Suunto.mod(SUUNTO_LAP_NUMBER-1,4)==3) {
if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
RESULT=0.5-SUUNTO_LAP_DISTANCE;
prefix="5.5";
postfix="5.0";
if (SUUNTO_PACE<5.5 || SUUNTO_PACE>5.0) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DISTANCE>=0.5) {
prefix="PRS";
postfix="LAP";
RESULT=0.0;
Suunto.light();
Suunto.alarmBeep();
}
}

if (Suunto.mod(SUUNTO_LAP_NUMBER-1,4)==0) {
if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
RESULT=0.5-SUUNTO_LAP_DISTANCE;
prefix="6.5";
postfix="6.0";
if (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DISTANCE>=0.5) {
prefix="PRS";
postfix="LAP";
RESULT=0.0;
Suunto.light();
Suunto.alarmBeep();
}
}

}

/**********************/
/* COLDDOWN */

if (SUUNTO_LAP_NUMBER==10) {
if (SUUNTO_LAP_DURATION>=0.0 && SUUNTO_LAP_DURATION<300.0) {
RESULT=300.0-SUUNTO_LAP_DURATION;
prefix="12.0";
postfix="9.0";
if (SUUNTO_PACE<12.0 || SUUNTO_PACE>9.0) {
if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
}
}
if (SUUNTO_LAP_DURATION>=300.0) {
prefix="NEXT";
postfix="->";
RESULT=0.0;
}
}

Always the same 'Compilation has at least one error on line -1'


----------



## SiRoB1

the guilty is:


PHP:


prefix="12.0";

and


PHP:


prefix="NEXT";

For understanding https://www.watchuseek.com/f233/app-zone-855160-21.html#post7360976


----------



## Skijeti

SiRoB1 said:


> the guilty is:
> 
> 
> PHP:
> 
> 
> prefix="12.0";
> 
> and
> 
> 
> PHP:
> 
> 
> prefix="NEXT";
> 
> For understanding https://www.watchuseek.com/f233/app-zone-855160-21.html#post7360976


Got it but now my Ambit memory came a little short so i need to delete 1 interval section from the code or to erase the cooldown part, i'll work something out. Thank you very much sir.


----------



## SiRoB1

Skijeti said:


> Got it but now my Ambit memory came a little short so i need to delete 1 interval section from the code or to erase the cooldown part, i'll work something out. Thank you very much sir.


you may condensate INTERVAL part like this, now the code fit into Ambit 1 


PHP:


/**********************/
/* INTERVALS */

if (SUUNTO_LAP_NUMBER>1 && SUUNTO_LAP_NUMBER<=9) {
  if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
    RESULT = Suunto.mod(SUUNTO_LAP_NUMBER-1,4);
    if (((RESULT==1) && (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0)) ||
        ((RESULT==2) && (SUUNTO_PACE<6.0 || SUUNTO_PACE>5.5)) ||
        ((RESULT==3) && (SUUNTO_PACE<5.5 || SUUNTO_PACE>5.0)) ||
        ((RESULT==0) && (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0))
       ) {
       if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
    }
    if (RESULT==1)       { prefix="6.5"; postfix="6.0"; }
    else if (RESULT==2) { prefix="6.0"; postfix="5.5"; }
    else if (RESULT==3) { prefix="5.5"; postfix="5.0"; }
    else if (RESULT==0) { prefix="6.5"; postfix="6.0"; }
    RESULT=0.5-SUUNTO_LAP_DISTANCE;
  }
  if (SUUNTO_LAP_DISTANCE>=0.5) {
    prefix="PRS";
    postfix="LAP";
    RESULT=0.0;
    Suunto.light();
    Suunto.alarmBeep();
  }
}

EDIT: note that i've left the behavior of (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0) that is always true, not sur when you want to make watch beep.


----------



## pjc3

SiRoB1, I commend you on your continued efforts to help those having problems with app coding. You are indeed an asset to the Ambit community.


----------



## Skijeti

SiRoB1 said:


> you may condensate INTERVAL part like this, now the code fit into Ambit 1
> 
> 
> PHP:
> 
> 
> /**********************/
> /* INTERVALS */
> 
> if (SUUNTO_LAP_NUMBER>1 && SUUNTO_LAP_NUMBER<=9) {
> if (SUUNTO_LAP_DISTANCE>=0.0 && SUUNTO_LAP_DISTANCE<0.5) {
> RESULT = Suunto.mod(SUUNTO_LAP_NUMBER-1,4);
> if (((RESULT==1) && (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0)) ||
> ((RESULT==2) && (SUUNTO_PACE<6.0 || SUUNTO_PACE>5.5)) ||
> ((RESULT==3) && (SUUNTO_PACE<5.5 || SUUNTO_PACE>5.0)) ||
> ((RESULT==0) && (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0))
> ) {
> if (Suunto.mod(SUUNTO_TIME,10)==0) {Suunto.alarmBeep();}
> }
> if (RESULT==1)       { prefix="6.5"; postfix="6.0"; }
> else if (RESULT==2) { prefix="6.0"; postfix="5.5"; }
> else if (RESULT==3) { prefix="5.5"; postfix="5.0"; }
> else if (RESULT==0) { prefix="6.5"; postfix="6.0"; }
> RESULT=0.5-SUUNTO_LAP_DISTANCE;
> }
> if (SUUNTO_LAP_DISTANCE>=0.5) {
> prefix="PRS";
> postfix="LAP";
> RESULT=0.0;
> Suunto.light();
> Suunto.alarmBeep();
> }
> }
> 
> EDIT: note that i've left the behavior of (SUUNTO_PACE<6.5 || SUUNTO_PACE>6.0) that is always true, not sur when you want to make watch beep.


Regarding alarm i need to have beeps every time i'm out of target pace and at the end of each interval. Once again many thanks and i fully agree with pjc3 statement above.
Keep up the good work sir.


----------



## SiRoB1

To address this request https://www.watchuseek.com/f233/new...ur-suunto-ambit-2-a-938187-6.html#post7593647



PHP:


/* Warn during 10s when we move and exercise is still paused or not started

Variable to create with 0 value
LAST_DURATION, COUNTER

*/
if (LAST_DURATION == SUUNTO_DURATION) {
  if (SUUNTO_SPEED > 4){
    if ((COUNTER >= 5) && (COUNTER < 15)) {
      Suunto.alarmBeep();
    }
    COUNTER = COUNTER + 1;
  } else {
    COUNTER = 0;
  }
} else {
  LAST_DURATION = SUUNTO_DURATION;
  COUNTER = 0;
}

Add a result line or merge this code with an other app to minimize app number.

*EDIT: As SUUNTO_SPEED equal to zero in paused mode this code can't work, i made a workaround *https://www.watchuseek.com/f233/app-zone-855160-23.html#post7693588


----------



## Rem_

Hi There,

we have seen various way of providing "Virtual Pace" or Estimated finish time like these ones : 


PHP:


/* Virtual Pace */
if ( SUUNTO_DURATION == 0 )
{
    Pace_Ref        = 360;  /* Ghost pace in seconds/km */
}
RESULT = SUUNTO_DURATION - (Pace_Ref * SUUNTO_DISTANCE);




PHP:


/* Estimated Finish Time */
if ( SUUNTO_DURATION == 0 )
{
    Distance_Ref     = 42.195;  /* Exercice or Race distance in km*/
}

RESULT = SUUNTO_DURATION + (( Distance_Ref - SUUNTO_DISTANCE) / SUUNTO_AVG_SPD) * 3600 ;

but did not see yet an attempt for providing "Virtual Race" a la Garmin.
Below, i've tried to not only compare with avg pace for the whole exercice , but compare with a Virtual Race with various pace per section of , here 2 km each, can be 1 , 5 , etc
Tested it once, seems to work fine. 
A bit cumbersome though as you have to estimate your pace for each section , but can be of an interest.
http://www.movescount.com/apps/app10031801-Virtual_Race


PHP:


/* Virtual Race */
if ( SUUNTO_DURATION == 0 )
{
    section       = 1;    /* current section # as per increment, total 10 sections */
    incr            = 2;    /* increment here 2km */
    Comp            = 0;    /* remaining part in current section */
    GHOST_DURATION  = 0;    /* time estimated for ghost runner at current distance */
    GhP1            = 330;  /* Ghost pace in seconds/km km1-2*/
    GhP2            = 360;  /* Ghost pace in seconds/km km3-4*/
    GhP3            = 400;  /* Ghost Pace In seconds/Km Km5-6*/
    GhP4            = 400;  /* Ghost Pace In seconds/Km Km7-8*/
    GhP5            = 360;  /* Ghost Pace In seconds/Km Km9-10*/
    GhP6            = 360;  /* Ghost Pace In seconds/Km Km11-12*/
    GhP7            = 330;  /* Ghost Pace In seconds/Km Km13-14*/
    GhP8            = 400;  /* Ghost Pace In seconds/Km Km15-16*/
    GhP9            = 330;  /* Ghost Pace In seconds/Km Km17-18*/
    GhP10             = 330;  /* Ghost pace in seconds/km km19-*/
}

/*----------------------------------------------------------------------
    Calculate Virtual Race GHOST_DURATION for Current SUUNTO_DISTANCE
-----------------------------------------------------------------------*/

section = SUUNTO_DISTANCE/incr;
if (section >= 9) 
{ 
    Comp = ( SUUNTO_DISTANCE - (9*incr) ); 
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4+GhP5+GhP6+GhP7+GhP8+GhP9) + ( Comp*GhP10 );
}
if ((section >= 8) && (section < 9) )
{ 
    Comp = ( SUUNTO_DISTANCE - (8*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4+GhP5+GhP6+GhP7+GhP8) + ( Comp*GhP9 );
}
if ((section >= 7) && (section < 8) )
{ 
    Comp = ( SUUNTO_DISTANCE - (7*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4+GhP5+GhP6+GhP7) + ( Comp*GhP8 );
}
if ((section >= 6) && (section < 7) )
{ 
    Comp = ( SUUNTO_DISTANCE - (6*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4+GhP5+GhP6) + ( Comp*GhP7 );
}
if ((section >= 5) && (section < 6) )
{ 
    Comp = ( SUUNTO_DISTANCE - (5*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4+GhP5) + ( Comp*GhP6 );
}
if ((section >= 4) && (section < 5) )
{ 
    Comp = ( SUUNTO_DISTANCE - (4*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3+GhP4) + ( Comp*GhP5 );
}
if ((section >= 3) && (section < 4) )
{ 
    Comp = ( SUUNTO_DISTANCE - (3*incr) ) ;
    GHOST_DURATION = incr * (GhP1+GhP2+GhP3) + ( Comp*GhP4 );
}
if ((section >= 2) && (section < 3) )
{ 
    Comp = ( SUUNTO_DISTANCE - (2*incr) );
    GHOST_DURATION = incr * (GhP1+GhP2) + ( Comp*GhP3 );
}
if ((section >= 1) && (section < 2) )
{ 
    Comp = ( SUUNTO_DISTANCE - (1*incr) );
    GHOST_DURATION = incr * (GhP1) + ( Comp*GhP2 );
}

if (section < 1) 
{ 
    Comp = ( SUUNTO_DISTANCE - (0*incr) );
    GHOST_DURATION = ( Comp*GhP1 );
}

RESULT = SUUNTO_DURATION-GHOST_DURATION ;


----------



## mrtv2dk

Motion Alert - Thank you so much for sharing SiRoB1 - Really great, and can't wait to try it out.


----------



## SiRoB1

mrtv2dk said:


> Motion Alert - Thank you so much for sharing SiRoB1 - Really great, and can't wait to try it out.


Hi, it doesn't seem to work, SUUNTO_SPEED is computed from distance, and in paused mode well speed stays to 0.
But i'm working to provide a solution by using gps position change.
Anyway, if you are using a bike pod, the cadence var could provide a simple alternative to detect movement...


----------



## mrtv2dk

Okay - that was a shame. But please post again if you are able to find a workaround ;-)


----------



## SiRoB1

Suunto gives us access to its distance and heading GPS computing into our app.


Suunto.distance(lat1, lon1) 
Suunto.distance(lat1, lon1, lat2, lon2) 
Suunto.heading(lat1, lon1) 
Suunto.heading(lat1, lon1, lat2, lon2) 

there is also new var around distance, time and personal section.

@mrtv2dk, i'm testing the work around tomorrow, but i will not use the above solution to keep ambit1 compatibility.


----------



## j_winston

SiRoB1 said:


> Suunto gives us access to its distance and heading GPS computing into our app.
> 
> 
> Suunto.distance(lat1, lon1)
> Suunto.distance(lat1, lon1, lat2, lon2)
> Suunto.heading(lat1, lon1)
> Suunto.heading(lat1, lon1, lat2, lon2)
> 
> there is also new var around distance, time and personal section.


Those new variables/functions are not compatible with the existing Ambit software versions, you need to wait until the new software version is released to test those in your Ambit.


----------



## SiRoB1

Ok finished and tested an app that displays Paused Time and warn when moving away from 30m/30s if watch is in manual paused mode.
It should work ok.
Display a "W" when alert occured at least one time.
Display a "N" when number of alert has been reached.

The code is bit more complex than the previous but i did find any other way (if you know a better way, don't hesitate).
The code is usable by Ambit1 users.
If you need a code without the Paused Time or an AppZone app, let me know.



PHP:


/* Paused Time with alert when moving away from 60m/30" if watch is in manual paused mode

Variable to create with value
BEEPduration : duration in second for beep alert
REMINDERtime : amount of time to rise alert

Variable to create with 0 value
DURATIONlast, DAYS_AFTER_2000, COUNTER, PAUSEDtime, LAUNCHtime, 
SPDavg, GPST, LATorig, LONGorig, WARN

*/
if (DAYS_AFTER_2000 == 0) {
  DAYS_AFTER_2000 = SUUNTO_DAYS_AFTER_1_1_2000;
  LAUNCHtime = SUUNTO_TIME;
  COUNTER = -1;
  WARN = REMINDERtime;
}
if (DURATIONlast == SUUNTO_DURATION_PREV + SUUNTO_LAP_DURATION) {
  /* EXERCICE PAUSED */
  PAUSEDtime = Suunto.mod(SUUNTO_TIME - LAUNCHtime + 86400, 86400) + 86400 * (SUUNTO_DAYS_AFTER_1_1_2000 - DAYS_AFTER_2000) - SUUNTO_DURATION_PREV - SUUNTO_LAP_DURATION;
  if (WARN > 0) {
    if ((SUUNTO_GPS_LATITUDE != LATorig) || (SUUNTO_GPS_LONGITUDE != LONGorig)) {
      if (COUNTER == BEEPduration) {
        SPDavg = Suunto.sind((SUUNTO_GPS_LATITUDE-LATorig)/2);
        SPDavg = SPDavg * SPDavg;
        COUNTER = Suunto.sind((SUUNTO_GPS_LONGITUDE-LONGorig)/2);
        SPDavg = SPDavg + Suunto.cosd(LATorig) * Suunto.cosd(SUUNTO_GPS_LATITUDE) * COUNTER * COUNTER;
        SPDavg = 12742000 * Suunto.atan2(Suunto.sqrt(SPDavg), Suunto.sqrt(1 - SPDavg)) / Suunto.mod(SUUNTO_TIME + 86400 - GPST, 86400);
        COUNTER = BEEPduration-1;
        if ((SPDavg <= 1) || ((SUUNTO_MAX_SPD > 0) && (SPDavg > SUUNTO_MAX_SPD))) {
          COUNTER = -1;
        }
      }
      if (COUNTER < 0) {
        LATorig = SUUNTO_GPS_LATITUDE;
        LONGorig = SUUNTO_GPS_LONGITUDE;
        if (COUNTER == -1) {
          COUNTER = -2;
        } else {
          COUNTER = 30+BEEPduration;
          GPST = SUUNTO_TIME;
        }
      }
    }
    if ((COUNTER >= 0) && (COUNTER != BEEPduration)) {
      if (COUNTER < BEEPduration) {
        Suunto.alarmBeep();
      }
      COUNTER = COUNTER - 1;
      if (COUNTER == -1) {
        WARN = WARN - 1;
        prefix = "W";
      }
    }
  } else {
    prefix = "N";
  }
} else {
  COUNTER = -1;
  WARN = REMINDERtime;
  DURATIONlast = SUUNTO_DURATION_PREV + SUUNTO_LAP_DURATION;
  prefix = " ";
}
/*RESULT = SPDavg;*/ 
RESULT = PAUSEDtime;


----------



## mrtv2dk

@SiRoB1 That is great, and you are quick to make a workaround. I will try it out. Again, thank you for sharing. 


Sent from my iPad using Tapatalk


----------



## anto1980

Hi all!

I need, if possible, of an App that calculates the real 3D distance as Garmin fenix/fenix2.
Today I tested Ambit2 and fenix2 and I discovered a difference of distance af about 7-10%!!!
Please to check:

Ski-Running KMV Matese by 8627antonio at Garmin Connect - Details

2:25 h Multisport di ANTONIODALESSANDRO Move

SiRoB1, can you help me???

Best Regards
Antonio


----------



## or_watching

Hi. I'll play.

Firstly, I think for your run posted at Garmin the approximate 3D distance should only be about 4% higher, not 7-10%.
I say that because, ignoring the possibility for micro-variations of up and down on your path, drawing a few triangles on your profile, that's what I compute.
If there are many micro ups and downs that don't show in your profile, then I stand corrected.

Here's your profile








Here's my approximation of it








Here's the same graph with a similar scale on the X and Y axes.








Doing the math on this for a 3D distance gives me the 4%.








As for an app, here's something quick and dirty that is *untested*.
First thing is that I believe the additional 3D distance should not be computed every second. It would add too much falsey with up/down ticks in the altimeter. IMO.
So I chose to add a "3D adder" every 100meter of distance. In between these 100m points, I just add the incremental 2D distance



Code:


if (SUUNTO_DISTANCE == 0) {  prevAlti = SUUNTO_ALTI;
}
if (Suunto.mod(SUUNTO_DISTANCE,0.1) == 0) {
  ThreeDDist = ThreeDDist + 
    Suunto.sqrt((SUUNTO_DISTANCE-prevDist)*(SUUNTO_DISTANCE-prevDist) + 
    (SUUNTO_ALTI-prevAlti)*(SUUNTO_ALTI-prevAlti)/1000000);
  prevAlti = SUUNTO_ALTI;
  prevDist = SUUNTO_DISTANCE;
}
RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;

Need 3 variables set to zero: ThreeDDist, prevDist, prevAlti
prefix = "3D", postfix = "km"
And IIRC SUUNTO_DISTANCE is in km, whereas the SUUNTO_ALTI is in meters.
Conversion for miles is left to the reader.


----------



## anto1980

Hi or_watching.
Thank you very much!

I can assure you that in the first 3 km ascent there are not micro-variations of altitude. Costant ascent!

About the App, have you created it in Movescount? I do not found it...

Sorry for my english!

Best Regards



or_watching said:


> Hi. I'll play.
> 
> Firstly, I think for your run posted at Garmin the approximate 3D distance should only be about 4% higher, not 7-10%.
> I say that because, ignoring the possibility for micro-variations of up and down on your path, drawing a few triangles on your profile, that's what I compute.
> If there are many micro ups and downs that don't show in your profile, then I stand corrected.
> 
> Here's your profile
> View attachment 1470528
> 
> 
> Here's my approximation of it
> View attachment 1470531
> 
> 
> Here's the same graph with a similar scale on the X and Y axes.
> View attachment 1470532
> 
> 
> Doing the math on this for a 3D distance gives me the 4%.
> View attachment 1470530
> 
> 
> As for an app, here's something quick and dirty that is *untested*.
> First thing is that I believe the additional 3D distance should not be computed every second. It would add too much falsey with up/down ticks in the altimeter. IMO.
> So I chose to add a "3D adder" every 100meter of distance. In between these 100m points, I just add the incremental 2D distance
> 
> 
> 
> Code:
> 
> 
> if (SUUNTO_DISTANCE == 0) {  prevAlti = SUUNTO_ALTI;
> }
> if (Suunto.mod(SUUNTO_DISTANCE,0.1) == 0) {
> ThreeDDist = ThreeDDist +
> Suunto.sqrt((SUUNTO_DISTANCE-prevDist)*(SUUNTO_DISTANCE-prevDist) +
> (SUUNTO_ALTI-prevAlti)*(SUUNTO_ALTI-prevAlti)/1000000);
> prevAlti = SUUNTO_ALTI;
> prevDist = SUUNTO_DISTANCE;
> }
> RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;
> 
> Need 3 variables set to zero: ThreeDDist, prevDist, prevAlti
> prefix = "3D", postfix = "km"
> And IIRC SUUNTO_DISTANCE is in km, whereas the SUUNTO_ALTI is in meters.
> Conversion for miles is left to the reader.


----------



## or_watching

anto1980 said:


> About the App, have you created it in Movescount? I do not found it...


Hi. It's not published Public since it's not tested. I will not have a chance to test it soon. 
Perhaps someone else can test it, fix it, and publish it.

Nice outing by the way. Looks tough!


----------



## or_watching

d'oh!

Forgot there's a Suunto.hypot() function. Ha. Don't need that silly old sqrt. Miuch easier to read.



Code:


if (SUUNTO_DISTANCE == 0) {  
  prevAlti = SUUNTO_ALTI;
}
if (Suunto.mod(SUUNTO_DISTANCE,0.1) == 0) {
  ThreeDDist = ThreeDDist + Suunto.hypot((SUUNTO_DISTANCE-prevDist),(SUUNTO_ALTI-prevAlti)/1000);  
  prevAlti = SUUNTO_ALTI;
  prevDist = SUUNTO_DISTANCE;
}
RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;

but I still don't know if it actually works.


----------



## SiRoB1

or_watching said:


> d'oh!
> 
> Forgot there's a Suunto.hypot() function. Ha. Don't need that silly old sqrt. Miuch easier to read.
> 
> 
> 
> Code:
> 
> 
> if (SUUNTO_DISTANCE == 0) {
> prevAlti = SUUNTO_ALTI;
> }
> if (Suunto.mod(SUUNTO_DISTANCE,0.1) == 0) {
> ThreeDDist = ThreeDDist + Suunto.hypot((SUUNTO_DISTANCE-prevDist),(SUUNTO_ALTI-prevAlti)/1000);
> prevAlti = SUUNTO_ALTI;
> prevDist = SUUNTO_DISTANCE;
> }
> RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;
> 
> but I still don't know if it actually works.


I still prefer the sqrt as Ambit1 didn't get hypot i guess even if the user interface tel the opposite.
The only trouble that can't be solved is around Multisport to get total 3D distance.
The code need a little change to avoid trouble on sport change, but you will still only be able to see per activity 3D distance.
I also changed the distance check as SUUNTO_DISTANCE as meter accuracy. 



PHP:


if (prevDist == 0) {
  prevAlti = SUUNTO_ALTI;
  prevDist = SUUNTO_DISTANCE;
}

if ((SUUNTO_DISTANCE - prevDist) >= 0.1) {
  ThreeDDist = ThreeDDist + Suunto.sqrt((SUUNTO_DISTANCE-prevDist)*(SUUNTO_DISTANCE-prevDist) + (SUUNTO_ALTI-prevAlti)*(SUUNTO_ALTI-prevAlti)/1000000);
  prevAlti = SUUNTO_ALTI;
  prevDist = SUUNTO_DISTANCE;
}
RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;


----------



## or_watching

SiRoB1 said:


> I still prefer the sqrt as Ambit1 didn't get hypot i guess even if the user interface tel the opposite.
> The only trouble that can't be solved is around Multisport to get total 3D distance.
> The code need a little change to avoid trouble on sport change, but you will still only be able to see per activity 3D distance.
> I also changed the distance check as SUUNTO_DISTANCE as meter accuracy.
> 
> 
> 
> PHP:
> 
> 
> if (prevDist == 0) {
> prevAlti = SUUNTO_ALTI;
> prevDist = SUUNTO_DISTANCE;
> }
> 
> if ((SUUNTO_DISTANCE - prevDist) >= 0.1) {
> ThreeDDist = ThreeDDist + Suunto.sqrt((SUUNTO_DISTANCE-prevDist)*(SUUNTO_DISTANCE-prevDist) + (SUUNTO_ALTI-prevAlti)*(SUUNTO_ALTI-prevAlti)/1000000);
> prevAlti = SUUNTO_ALTI;
> prevDist = SUUNTO_DISTANCE;
> }
> RESULT = ThreeDDist + SUUNTO_DISTANCE-prevDist;


Looks better. As expected. 
Thanks for removing the mod function. I did realize after it would be a problem sometimes for higher speed and 60s mode, for example.

Ambit1. Hmm. I didn't notice a verify/compile error when I put in hypot. I thought unsupported functions gave a red X. Probably I'm confused.


----------



## SiRoB1

or_watching said:


> Ambit1. Hmm. I didn't notice a verify/compile error when I put in hypot. I thought unsupported functions gave a red X. Probably I'm confused.


I'm not sure about this, if an Ambit1 user could confirm, it would be nice.


----------



## anto1980

PLEASE TO PUBLIC THE APP... 

I'm not able to create it! 



or_watching said:


> Hi. It's not published Public since it's not tested. I will not have a chance to test it soon.
> Perhaps someone else can test it, fix it, and publish it.
> 
> Nice outing by the way. Looks tough!


----------



## or_watching

SiRoB1 said:


> Suunto gives us access to its distance and heading GPS computing into our app.
> 
> 
> Suunto.distance(lat1, lon1)
> Suunto.distance(lat1, lon1, lat2, lon2)
> Suunto.heading(lat1, lon1)
> Suunto.heading(lat1, lon1, lat2, lon2)


Thanks Suunto. Do you even know how much debugging of my bad typing this could have saved me were it there during my mad coding phase?


Code:


/* Compute distance d, from Point A to current position*/
a = Suunto.sind((Lat-LatA)/2)*Suunto.sind((Lat-LatA)/2);
a = a + Suunto.cosd(LatA)*Suunto.cosd(Lat)*Suunto.sind(Long-LongA)*Suunto.sind(Long-LongA)/4;
c = 2*Suunto.atan2(Suunto.sqrt(a),Suunto.sqrt(1-a));  /*atan2(y,x) */
/* Distance in km */
d = 6371*c;

But now I'm compelled to compare Suunto.distance() with the trusty haversine friend. And IMO those monks, or whoever, in 1640 figured out stuff like haversines, they were really damn smart.


----------



## anto1980

I copied and pasted the formula but does not functions... :-(

[QUOTE = or_watching; 7734972] Grazie Suunto. Non si sa nemmeno quanto il debug del mio cattivo digitando questo avrebbe potuto salvare me erano lì durante la mia folle fase di codifica ? 


Code:


 / * Calcola la distanza d, dal punto A al posizione corrente * / 
a = Suunto.sind ((Lat -lata) / 2) * Suunto.sind ((Lat-lata) / 2), 
a = a + Suunto.cosd (lata) * Suunto.cosd (Lat) * Suunto.sind (Long-longa) * Suunto.sind (Long-longa) / 4; 
c = 2 * Suunto.atan2 (Suunto.sqrt (a), Suunto.sqrt (1-a)); / * Atan2 (y, x) * / 
/ * Distanza in km * / 
d = 6371 * c; [/ CODE] Ma ora sono costretto a confrontare Suunto.distance () con l'amico fidato haversine. E IMO quei monaci, o chi, nel 1640 capito roba come haversines, erano davvero dannatamente intelligenti. [/ QUOTE]


----------



## or_watching

anto1980 said:


> I copied and pasted the formula but does not functions... :-(


hi anto1980,
that code I pasted there in a reply to SiRoB1 noticing that Suunto has added some new latitude/longitude distance calculation functions. It has nothing to do with your 3D distance app request.

Did you try SiRoB1's code above. Here.


----------



## SiRoB1

Moreno1974 said:


> Hi,
> do someone try the new suunto.distance or suunto.heading function yet ?
> I've had some problem with distance. do you ?


Hi Moreno1974,

What kind of trouble?
Could you describe what you are trying to achieve?

I only tested the Suunto.distance with the online user interface.
And the only thing i can tell:
- the online user interface uses a spherical model with *Equatorial radius*.


----------



## SiRoB1

Moreno1974 said:


> I can get the same distance measured by google earth by 2 point.
> they are :
> 1 )Lat : 45.10000, Lon : 10.45000
> 2 )Lat : 45.06000, Lon : 10.50000
> 
> if u look at the same coords in g.e. or wathever, and get their distance (in meters) the result 9903 meters (no, the app result is not in miles, i set movescount in metrics).
> I checked also suunto.heading ad it returns a correct value 318 degrees.:-s


Suunto user interface is right. 
You need to be careful around units.
Suunto.distance() needs decimal degrees.

You can look at this online web site http://www.movable-type.co.uk/scripts/latlong.html
It gives many useful coding.


----------



## SiRoB1

Moreno1974 said:


> Oh no! what a stupid error i did !!! I used degrees and decimal minutes !!
> Many thanks !
> I was writing an app to calculate distance from a point through triangulation. now i'm ready to testi it.
> Thanks again.


It's nothing.
An other thing with Suunto.heading() we also need to be careful because lat1/lon1 is always the target.


----------



## or_watching

SiRoB1 said:


> An other thing with Suunto.heading() we also need to be careful because lat1/lon1 is always the target.


Well, if you do it backwards, theoretically you'd *eventually* still get there.


----------



## or_watching

SiRoB1 said:


> - the online user interface uses a spherical model with *Equatorial radius*.


Great. That's handy to know.


----------



## anto1980

Today's Move with Ambit2 3D distance App vs Fenix2 with 3D distance feature activated:

2:29 h Sci alpinismo di ANTONIODALESSANDRO Move

Untitled by 8627antonio at Garmin Connect - Details



Moreno1974 said:


> Hi,
> do someone try the new suunto.distance or suunto.heading function yet ?
> I've had some problem with distance. do you ?


----------



## mrtv2dk

mrtv2dk said:


> @SiRoB1 That is great, and you are quick to make a workaround. I will try it out. Again, thank you for sharing.
> 
> Sent from my iPad using Tapatalk



@SiRoB1
I have been testing the Motion Alert App in various activities and it works great. Exactly what I could wish for.
Tried setting BEEPduration = 5 and REMINDERtime = 10.

But what effect does REMINDERtime exactly have? 

Thank you.


----------



## SiRoB1

mrtv2dk said:


> @SiRoB1
> I have been testing the Motion Alert App in various activities and it works great. Exactly what I could wish for.
> Tried setting BEEPduration = 5 and REMINDERtime = 10.
> 
> But what effect does REMINDERtime exactly have?
> 
> Thank you.


it just gives you the possibility to stop to being warned even if you run in paused mode.
So after an amount of warning even if you move there will be no more beeps.
Useful when you get back somewhere but you don't want to log and you still want to know your speed or anything else.


----------



## mrtv2dk

Thank you for clearing that up. That is useful 


Sent from my iPad using Tapatalk


----------



## greg3

I often forget to stop the gps when returning to the car and remember some ways down the road. Of course this throws everything off and movescount doesn't allow editing. Is it possible to design an app that causes the watch to beep when nearing the starting location to remind me?

Thanks


----------



## or_watching

greg3 said:


> I often forget to stop the gps when returning to the car and remember some ways down the road. Of course this throws everything off and movescount doesn't allow editing. Is it possible to design an app that causes the watch to beep when nearing the starting location to remind me?
> 
> Thanks


Hi.

It sure would be. Just state what proximity you want to use for the reminder. Eg 5 beeps at 100 meters? 
It would also be possible to have the app beep continuously once you start moving away after getting the reminder.


----------



## greg3

or_watching said:


> Hi.
> 
> It sure would be. Just state what proximity you want to use for the reminder. Eg 5 beeps at 100 meters?
> It would also be possible to have the app beep continuously once you start moving away after getting the reminder.


Maybe 50 meters. My memory is quite short. I probably don't need the moving away alert.


----------



## pjc3

greg3 said:


> Is it possible to design an app that causes the watch to beep when nearing the starting location to remind me?
> 
> Thanks


I'm sure it is (but I can't). In the interim it is possible to activate "Find Back" at some stage during your Move which will indeed remind you you have arrived at the start point.


----------



## or_watching

greg3 said:


> Maybe 50 meters. My memory is quite short. I probably don't need the moving away alert.


Here it is with the moving away alert. Can't hurt to have as a back-up if you don't hear the 5 beeps. (_Unless you run back to your car for sunglasses soon after starting, then the bloody thing will beep for your whole outing. _ )
I gave it one test outside my house, it seemed to work and beep appropriately.
The app has to display something, so I wrote it to display distance from Start in meters.
The app will display "--" until after 5 seconds and having a valid GPS location.



Code:


/* OFF reminder to turn GPS off when returning to Start */

/* Define these 4 Variables to 0 
   startLatitude 
   startLongitude
   mode  
   countBeep 

/* Set Format to "0 decimals" */

/* mode definition
/* (1 = outbound <=50m, 2= outbound/inbound >50m, 3 = inbound <50m, 4 = forgot >50m) */

prefix = "Start";
postfix = "m";

if (SUUNTO_DURATION > 5 && SUUNTO_GPS_LATITUDE != 0 && mode ==0) {
  startLatitude = SUUNTO_GPS_LATITUDE;
  startLongitude = SUUNTO_GPS_LONGITUDE;
  Suunto.alarmBeep(); 
  mode = 1;  
}
if (mode ==1 && Suunto.distance(startLatitude, startLongitude) >50) {
  mode = 2;  
}
if (mode ==2 && Suunto.distance(startLatitude, startLongitude) <50) {
  mode = 3;  
}
if (mode == 3 && countBeep < 5 ) {
  prefix = "GPS";
  Suunto.alarmBeep();
  countBeep = countBeep +1;
}
if (mode ==3 && Suunto.distance(startLatitude, startLongitude) > 50) {
  mode = 4;  
}
if (mode == 4) {
  Suunto.alarmBeep();
}

RESULT = Suunto.distance(startLatitude, startLongitude);

If you don't want the moving away function, you can remove the "mode 4" code. 
I'm not quite sure about the latest status for best methods of "error checking" for valid GPS data at the start of excercises. SiRoB1 I'm sure can easily make the app 3x better.


----------



## greg3

Thank you or_watching. That app will save me a lot of hassle.


----------



## or_watching

Happy to help. It's a good idea... Who hasn't forgotten this at some point. 

The other thing to mention is that since the displayed result is unimportant, this code + variables could be added to any other small app and leave out the "RESULT." It will do the beeps, but then not needlessly take up a display field or your app count budget. 

In fact I think I'll do exactly that myself for Trekking, etc.


----------



## pjc3

Thanks for your efforts. Do you have to have the exercise mode started for the "move away" alert to activate? I would find a start reminder more useful than a finish reminder.


----------



## or_watching

pjc3 said:


> Thanks for your efforts. Do you have to have the exercise mode started for the "move away" alert to activate? I would find a start reminder more useful than a finish reminder.


The way I wrote this, yes, the exercise needs to be started, but that's the point since it supposed to be an OFF reminder. 
But it would be doable to make it work as a Start reminder too. 
It'll be a few days before I can make that edit and test it.


----------



## mondoshawan

After 4 days of cycling in lower German mountains last week and no idea of the correct actual altitude at starting point due to lack of internet connection, i did a simple GPS Alticheck app for Ambit1 owners.

Set up a Sportmode with sea level pressure in up row (or whatever you like), bottom row actual Baro Alti and mid row this app:



PHP:


/* Define these 3 Variables to 0
    count
    maxAlti
    minAlti
    */
/* Set Format to "0 decimals" */

/*No need to run the Stopwatch in SportMode */

RESULT = SUUNTO_GPS_ALTITUDE;
prefix = "GPS";
postfix = "m";
count = count + 1;
if (count>=540) {
  if (maxAlti == 0 || SUUNTO_GPS_ALTITUDE > maxAlti) {
    maxAlti = SUUNTO_GPS_ALTITUDE;
  }
  if (minAlti == 0 || SUUNTO_GPS_ALTITUDE < minAlti) {
  minAlti = SUUNTO_GPS_ALTITUDE;
  }
}
if (count==630) {
  count = 600;
}
if (count == 600) {
  Suunto.alarmBeep();
}
if (count>=600) {
  RESULT = ((SUUNTO_GPS_ALTITUDE*3)+minAlti+maxAlti)/5;
  prefix ="ref";
}
if (count>=610) {
  RESULT = maxAlti;
  prefix ="max";
}
if (count>=615) {
  RESULT = minAlti;
  prefix ="min";
}
if (count>=620) {
  RESULT = SUUNTO_GPS_ALTITUDE;
  prefix ="act";
}

You don't have to start the timer in Sportmode, the app has it's own counter. Just let the watch sit there&#8230;

It will show actual GPS altitude and will beep after 10min and then every 30sec showing a new reference (GPS) height by a very simple math and then toggles max and min height started recorded after 9min and the actual GPS Alti again.

I'm shure this app could be done much better by the 2 Master coders here&#8230; ;-), but it works.


----------



## or_watching

mondoshawan said:


> It will show actual GPS altitude and will beep after 10min and then every 30sec showing a new reference (GPS) height by a very simple math and then toggles max and min height started recorded after 9min and the actual GPS Alti again ;-)


Hi. 
So what were your observations/comparisons between ref, act and alto baro?
Did the results depend on your sky view, etc?


----------



## mondoshawan

> Hi.
> So what were your observations/comparisons between ref, act and alto baro?
> Did the results depend on your sky view, etc?


Hi.
&#8230;no.
I did that app afterwards and living next to sealevel with not much elevation gain here in this area.
My test show, if sky view and reception is bad, let it be bad&#8230; even indoors. It's better that you don't move the watch then.
If reception is good&#8230; good!

The tests didn't show more than 20m between min and max alti, but this could have just been only luck&#8230; ;-)

The comparison between ref/max/min/act altitude is only a help to make a decision and this is better than having nothing.

edit: just to make this point clear, it's always better to have a clear sky view, but even under bad conditions the results are not too bad. Ideas for a more complex fake fused alti app are welcome ;-)


----------



## hvrietsc

The problem with this app is the in-preciseness of the GPS location. Once you have moved more than 50 meters away it will go into mode2. But if then a second later your GPS says the distance is 49 meters (because it is not one meter precise) then the mode will be set to 3, even though you are still moving away from the start. The solution is to check if mode == 1 and distance > 100 (instead of 50).

Second problem is when you are running a track that gets close (less than 50m) to the start and then moves away again. This app will start beeping until you stop the exercise (not what you want).


----------



## mondoshawan

Alticheck app for Ambit 1 V1.1



&#8230;well, i added two more variables and changed the math for reference.
Now the GPS Alti is added to a summery and then divided by a second counter. This makes the GPS reference Alti much more stable and accurate.

The App starts to log the GPS Alti data now after 8min, without the need to run the timer and will beep after 10 min to show the refencence GPS Alti and then, as it was in the first version before, toggling max, min and actual GPS Alti every 30 sec with a beep.



PHP:


/* Define these 5 Variables to 0
    count
    maxAlti
    minAlti
    sumAlti
    refcount
    */
/* Set Format to "0 decimals" */

/*No need to run the Stopwatch in SportMode */

RESULT = SUUNTO_GPS_ALTITUDE;
prefix = "GPS";
postfix = "m";
count = count + 1;
if (count>=480) {
  refcount=refcount+1;
  sumAlti = sumAlti + SUUNTO_GPS_ALTITUDE;
  if (maxAlti == 0 || SUUNTO_GPS_ALTITUDE > maxAlti) {
    maxAlti = SUUNTO_GPS_ALTITUDE;
  }
  if (minAlti == 0 || SUUNTO_GPS_ALTITUDE < minAlti) {
  minAlti = SUUNTO_GPS_ALTITUDE;
  }
}
if (count==630) {
  count = 600;
}
if (count == 600) {
  Suunto.alarmBeep();
}
if (count>=600) {
  RESULT = sumAlti/refcount;
  prefix ="ref";
}
if (count>=615) {
  RESULT = maxAlti;
  prefix ="max";
}
if (count>=620) {
  RESULT = minAlti;
  prefix ="min";
}
if (count>=625) {
  RESULT = SUUNTO_GPS_ALTITUDE;
  prefix ="act";
}


----------



## hvrietsc

I have created a new thread (this one is too long) so newbies can see what kind of apps I am adding to my Ambit2R: https://www.watchuseek.com/f233/making-my-ambit2r-near-perfect-using-apps-1033995.html I try to explain how the app works and how you can modify it.

Have a look and tell me what you think.


----------



## MME75

Hi all. Not being a programmer I would like to calculate the average speed over 500 meters with windsurfing. There are already apps for measuring the average speed over 10 seconds and I have tried to adept those and others but they were not successful because I lack the knowledge. I guess it shouldn't be so difficult. Can anybody help me with this?


----------



## or_watching

MME75 said:


> Hi all. Not being a programmer I would like to calculate the average speed over 500 meters with windsurfing. There are already apps for measuring the average speed over 10 seconds and I have tried to adept those and others but they were not successful because I lack the knowledge. I guess it shouldn't be so difficult. Can anybody help me with this?


Hi. Can you clarify, would you like to show a continuously updating value of the average over the most recent 500 meters? Or would you like to show a value that only updates once every 500m? (e.g. 0.5km, 1km, 1.5km... ). Or would you like to choose a start point, e.g. hitting the pause button, and then compute a value after 500m, and hold that display value until you choose a new start point.


----------



## MME75

What I would to like be able to see is that if I have done say 3 km and I make turn I see my fastest 500 meters or nautical mile. The function fastest km or mile(1,6 km) is already there but I want to be free in setting the distance.


----------



## SiRoB1

MME75 said:


> What I would to like be able to see is that if I have done say 3 km and I make turn I see my fastest 500 meters or nautical mile. The function fastest km or mile(1,6 km) is already there but I want to be free in setting the distance.


As i already worked around this kind of code (vspd and P.Trend application) here it is:


PHP:


/* 500m SPEED AVG

Variables with value:
distavg = 0.5 (km)

Variables with zero value:
vm, TIMElast, time,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13,

*/
if (d1 > 0) {
  time = time + Suunto.mod(SUUNTO_TIME - TIMElast + 86400, 86400);
  if (SUUNTO_DISTANCE > d1) {
    vm = 13;
    if (SUUNTO_DISTANCE - d1 >= distavg) { t1 = 0; }
    if (SUUNTO_DISTANCE - d2 >= distavg) { t2 = 0; }
    if (SUUNTO_DISTANCE - d3 >= distavg) { t3 = 0; }
    if (SUUNTO_DISTANCE - d4 >= distavg) { t4 = 0; }
    if (SUUNTO_DISTANCE - d5 >= distavg) { t5 = 0; }
    if (SUUNTO_DISTANCE - d6 >= distavg) { t6 = 0; }
    if (SUUNTO_DISTANCE - d7 >= distavg) { t7 = 0; }
    if (SUUNTO_DISTANCE - d8 >= distavg) { t8 = 0; }
    if (SUUNTO_DISTANCE - d9 >= distavg) { t9 = 0; }
    if (SUUNTO_DISTANCE - d10 >= distavg) { t10 = 0; }
    if (SUUNTO_DISTANCE - d11 >= distavg) { t11 = 0; }
    if (SUUNTO_DISTANCE - d12 >= distavg) { t12 = 0; }
    if (SUUNTO_DISTANCE - d13 >= distavg) { t13 = 0; }
    if (t13 != 0) {
      /* we didn't made space into the history list
         so we merge the nearest neighbours */
      vm = d12 - d14;
      if (d11 - d13 < vm) { vm = d11 - d13; }
      if (d10 - d12 < vm) { vm = d10 - d12; }
      if (d9 - d11 < vm) { vm = d9 - d11; }
      if (d8 - d10 < vm) { vm = d8 - d10; }
      if (d7 - d9 < vm) { vm = d7 - d9; }
      if (d6 - d8 < vm) { vm = d6 - d8; }
      if (d5 - d7 < vm) { vm = d5 - d7; }
      if (d4 - d6 < vm) { vm = d4 - d6; }
      if (d3 - d5 < vm) { vm = d3 - d5; }
      if (d2 - d4 < vm) { vm = d2 - d4; }
      if (d1 - d3 < vm) { vm = d1 - d3; }
      if (SUUNTO_DISTANCE - d2 < vm) { vm = SUUNTO_DISTANCE - d2; }
      if (d12 - d14 == vm) { t13 = t13 + t12; d13 = d12; vm = 12; }
      else if (d11 - d13 == vm) { t12 = t12 + t11; d12 = d11; vm = 11; }
      else if (d10 - d12 == vm) { t11 = t11 + t10; d11 = d10; vm = 10; }
      else if (d9 - d11 == vm) { t10 = t10 + t9; d10 = d9; vm = 9; }
      else if (d8 - d10 == vm) { t9 = t9 + t8; d9 = d8; vm = 8; }
      else if (d7 - d9 == vm) { t8 = t8 + t7; d8 = d7; vm = 7; }
      else if (d6 - d8 == vm) { t7 = t7 + t6; d7 = d6; vm = 6; }
      else if (d5 - d7 == vm) { t6 = t6 + t5; d6 = d5; vm = 5; }
      else if (d4 - d6 == vm) { t5 = t5 + t4; d5 = d4; vm = 4; }
      else if (d3 - d5 == vm) { t4 = t4 + t3; d4 = d3; vm = 3; }
      else if (d2 - d4 == vm) { t3 = t3 + t2; d3 = d2; vm = 2; }
      else if (d1 - d3 == vm) { t2 = t2 + t1; d2 = d1; vm = 1; }
      else { t1 = t1 + time; d1 = SUUNTO_DISTANCE; vm = 0; }
    }
    if (vm > 12) { t13 = t12; d14 = d13; d13 = d12; }
    if (vm > 11) { t12 = t11; d12 = d11; }
    if (vm > 10) { t11 = t10; d11 = d10; }
    if (vm > 9) { t10 = t9; d10 = d9; }
    if (vm > 8) { t9 = t8; d9 = d8; }
    if (vm > 7) { t8 = t7; d8 = d7; }
    if (vm > 6) { t7 = t6; d7 = d6; }
    if (vm > 5) { t6 = t5; d6 = d5; }
    if (vm > 4) { t5 = t4; d5 = d4; }
    if (vm > 3) { t4 = t3; d4 = d3; }
    if (vm > 2) { t3 = t2; d3 = d2; }
    if (vm > 1) { t2 = t1; d2 = d1; }
    if (vm > 0) { t1 = time; d1 = SUUNTO_DISTANCE; }
    time = 0;
  }
  if ((time == 0) || (time > 10)) {
    vm = time + t1;
    if (d1 - d2 < distavg) {
      if (d1 - d3 >= distavg) { vm = vm + t2 * (distavg - d1 + d2) / (d2 - d3); }
      else if (d1 - d4 >= distavg) { vm = vm + t2 + t3 * (distavg - d1 + d3) / (d3 - d4); }
      else if (d1 - d5 >= distavg) { vm = vm + t2 + t3 + t4 * (distavg - d1 + d4) / (d4 - d5); }
      else if (d1 - d6 >= distavg) { vm = vm + t2 + t3 + t4 + t5 * (distavg - d1 + d5) / (d5 - d6); }
      else if (d1 - d7 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 * (distavg - d1 + d6) / (d6 - d7); }
      else if (d1 - d8 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 * (distavg - d1 + d7) / (d7 - d8); }
      else if (d1 - d9 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 * (distavg - d1 + d8) / (d8 - d9); }
      else if (d1 - d10 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 * (distavg - d1 + d9) / (d9 - d10); }
      else if (d1 - d11 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 * (distavg - d1 + d10) / (d10 - d11); }
      else if (d1 - d12 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 * (distavg - d1 + d11) / (d11 - d12); }
      else if (d1 - d13 >= distavg) { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 * (distavg - d1 + d12) / (d12 - d13); }
      else { vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 * (distavg - d1 + d13) / (d13 - d14); }
    }
    vm = distavg / vm * 3600;
  }
} else {
  /* just for multisport compatibility */
  d1 = SUUNTO_DISTANCE;
  d2 = d1; d3 = d1; d4 = d1; d5 = d1; d6 = d1; d7 = d1; d8 = d1; d9 = d1; d10 = d1; d11 = d1; d12 = d1; d13 = d1; d14 = d1;
}
TIMElast = SUUNTO_TIME;
RESULT = vm;

We could probably get better accuracy by merging similar avg speed (d[SUB]i[/SUB]/t[SUB]i[/SUB]) first in the history list instead of nearest neighbors...

If someone found an other solution post it, i don't like my code at all.
But it works and you should see in the graph the same value of the fastest km feature if you set distavg to 1.


----------



## MME75

Ok thanks. Trying to understand what you're doing. So in Movescount I set all the variables(0.5 becomes 5) and I first get a error in formula at line 50 followed by compilation has at least one error at -1. When trying to save I get a popup that I have to leave the page or do I want to stay. In both cases nothing is saved. anybody else has this problem? I already mailed Suunto before the weekend about this.


----------



## hvrietsc

You have to create the following variables first before saving:

Variables with value:
distavg = 0.5 (km)

Variables with zero value:
vm, TIMElast, time,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13,


----------



## SiRoB1

MME75 said:


> Ok thanks. Trying to understand what you're doing. So in Movescount I set all the variables(0.5 becomes 5) and I first get a error in formula at line 50 followed by compilation has at least one error at -1. When trying to save I get a popup that I have to leave the page or do I want to stay. In both cases nothing is saved. anybody else has this problem? I already mailed Suunto before the weekend about this.





hvrietsc said:


> You have to create the following variables first before saving:
> 
> Variables with value:
> distavg = 0.5 (km)
> 
> Variables with zero value:
> vm, TIMElast, time,
> d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14
> t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13,


Thanks hvrietsc.

Yes you need to create vars i listed in the code comment.
Anyway i created a public application to avoid some headache just look at 500m AVG SPEED.
If you plan to edit the app, when you need to change distavg value with decimal, you will have to copy past "." because the point char is not allowed by keyboard (i wonder why).
When you need to add var name that contain "0" you also need to copy past the "0".

EDIT: Removed the public app to use a filter based on nearest average sample instead of distance. Give me one day to test the new code.


----------



## hvrietsc

MME75 said:


> Hi all. Not being a programmer I would like to calculate the average speed over 500 meters with windsurfing. There are already apps for measuring the average speed over 10 seconds and I have tried to adept those and others but they were not successful because I lack the knowledge. I guess it shouldn't be so difficult. Can anybody help me with this?


Here is a maybe too simple app: it will display the average speed in km/h over the last 500 meters. If you turn on recording for this app then you will get a nice graph of all your average speeds and you will be able to see in movescount as to when you were going fast or slow.



Code:


/*    variables to create all initial value 0:
   lastdist
   lastspeed
   lasttime   */

/* While in sport mode do this once per second */


if ( SUUNTO_DISTANCE >= 0.5 + lastdist ) {
  /* 500 meters have passed */
  lastspeed = (SUUNTO_DISTANCE - lastdist) / (SUUNTO_DURATION - lasttime) * 3600;
  lasttime = SUUNTO_DURATION;
  lastdist = SUUNTO_DISTANCE;
}

RESULT = lastspeed;


----------



## MME75

Thanks a lot. Will try it out whenever Movescount works again.


----------



## SiRoB1

Ok now movescount revive, i can provide my result with the change i did in my code.

Previously i gave a code to estimate avg speed over a distance.
I filtered sample by merging the shortest distance between them.
But this time we merge sample by their smallest difference. This way we keep samples having a weightier impact.



PHP:


/* 500m SPEED AVG

Variables with value:
distavg = 0.5 (km)

Variables with zero value:
vm, tmp, time, lastdist,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13,
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13,

*/
if (lastdist > 0) {
  time = time + Suunto.mod(SUUNTO_TIME - tmp + 86400, 86400);
  if (SUUNTO_DISTANCE > lastdist) {
    vm = 13;
    if ((SUUNTO_DISTANCE - lastdist + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 < distavg) && (d13 != 0)) {
      /* not enough sample to drop the (d13;t13)
         so we merge the segment with nearest average speed */
      vm = 12;
      tmp = Suunto.abs(d12/t12 - d13/t13);
      RESULT = Suunto.abs(d11/t11 - d12/t12); if (RESULT < tmp) { tmp = RESULT; vm = 11; }
      RESULT = Suunto.abs(d10/t10 - d11/t11); if (RESULT < tmp) { tmp = RESULT; vm = 10; }
      RESULT = Suunto.abs(d9/t9 - d10/t10); if (RESULT < tmp) { tmp = RESULT; vm = 9; }
      RESULT = Suunto.abs(d8/t8 - d9/t9); if (RESULT < tmp) { tmp = RESULT; vm = 8; }
      RESULT = Suunto.abs(d7/t7 - d8/t8); if (RESULT < tmp) { tmp = RESULT; vm = 7; }
      RESULT = Suunto.abs(d6/t6 - d7/t7); if (RESULT < tmp) { tmp = RESULT; vm = 6; }
      RESULT = Suunto.abs(d5/t5 - d6/t6); if (RESULT < tmp) { tmp = RESULT; vm = 5; }
      RESULT = Suunto.abs(d4/t4 - d5/t5); if (RESULT < tmp) { tmp = RESULT; vm = 4; }
      RESULT = Suunto.abs(d3/t3 - d4/t4); if (RESULT < tmp) { tmp = RESULT; vm = 3; }
      RESULT = Suunto.abs(d2/t2 - d3/t3); if (RESULT < tmp) { tmp = RESULT; vm = 2; }
      RESULT = Suunto.abs(d1/t1 - d2/t2); if (RESULT < tmp) { tmp = RESULT; vm = 1; }
      RESULT = Suunto.abs((SUUNTO_DISTANCE-lastdist)/time - d1/t1); if (RESULT < tmp) { tmp = RESULT; vm = 0; }

      if (vm == 12) { t13 = t13 + t12; d13 = d13 + d12; }
      if (vm == 11) { t12 = t12 + t11; d12 = d12 + d11; }
      if (vm == 10) { t11 = t11 + t10; d11 = d11 + d10; }
      if (vm ==  9) { t10 = t10 +  t9; d10 = d10 +  d9; }
      if (vm ==  8) { t9  = t9  +  t8; d9  = d9  +  d8; }
      if (vm ==  7) { t8  = t8  +  t7; d8  = d8  +  d7; }
      if (vm ==  6) { t7  = t7  +  t6; d7  = d7  +  d6; }
      if (vm ==  5) { t6  = t6  +  t5; d6  = d6  +  d5; }
      if (vm ==  4) { t5  = t5  +  t4; d5  = d5  +  d4; }
      if (vm ==  3) { t4  = t4  +  t3; d4  = d4  +  d3; }
      if (vm ==  2) { t3  = t3  +  t2; d3  = d3  +  d2; }
      if (vm ==  1) { t2  = t2  +  t1; d2  = d2  +  d1; }
      if (vm ==  0) { t1  = t1  + time; d1 = d1 + SUUNTO_DISTANCE-lastdist; }
    }
    if (vm > 12) { t13 = t12; d13 = d12; }
    if (vm > 11) { t12 = t11; d12 = d11; }
    if (vm > 10) { t11 = t10; d11 = d10; }
    if (vm >  9) { t10 = t9;  d10 = d9; }
    if (vm >  8) { t9  = t8;  d9  = d8; }
    if (vm >  7) { t8  = t7;  d8  = d7; }
    if (vm >  6) { t7  = t6;  d7  = d6; }
    if (vm >  5) { t6  = t5;  d6  = d5; }
    if (vm >  4) { t5  = t4;  d5  = d4; }
    if (vm >  3) { t4  = t3;  d4  = d3; }
    if (vm >  2) { t3  = t2;  d3  = d2; }
    if (vm >  1) { t2  = t1;  d2  = d1; }
    if (vm >  0) { t1  = time; d1 = SUUNTO_DISTANCE-lastdist; }
    time = 0;
    lastdist = SUUNTO_DISTANCE;
  }
  if ((time == 0) || (time > 10)) {
    vm = time + t1;
    if (d1 < distavg) {
      tmp = distavg - d1;
      if (d2 >= tmp) {
        vm = vm + t2 * tmp / d2;
      } else {
        tmp = tmp -  d2;
        if (d3 >= tmp) {
          vm = vm + t2 + t3 * tmp / d3;
        } else {
          tmp = tmp -  d3;
          if (d4 >= tmp) {
            vm = vm + t2 + t3 + t4 * tmp / d4;
          } else {
            tmp = tmp -  d4;
            if (d5 >= tmp) {
              vm = vm + t2 + t3 + t4 + t5 * tmp / d5;
            } else {
              tmp = tmp -  d5;
              if (d6 >= tmp) {
                vm = vm + t2 + t3 + t4 + t5 + t6 * tmp / d6;
              } else {
                tmp = tmp -  d6;
                if (d7 >= tmp) {
                  vm = vm + t2 + t3 + t4 + t5 + t6 + t7 * tmp / d7;
                } else {
                  tmp = tmp -  d7;
                  if (d8 >= tmp) {
                    vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 * tmp / d8;
                  } else {
                    tmp = tmp -  d8;
                    if (d9 >= tmp) {
                      vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 * tmp / d9;
                    } else {
                      tmp = tmp -  d9;
                      if (d10 >= tmp) {
                        vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 * tmp / d10;
                      } else {
                        tmp = tmp - d10;
                        if (d11 >= tmp) {
                          vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 * tmp / d11;
                        } else {
                          tmp = tmp - d11;
                          if (d12 >= tmp) {
                            vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 * tmp / d12;
                          } else {
                            tmp = tmp - d12;
                            if (d13 >= tmp) {
                              vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 * tmp / d13;
                            } else {
                              vm = (vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13) / (distavg - tmp + d13) * distavg;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    vm = distavg / vm * 3600;
  }
} else {
  /* just for multisport compatibility */
  lastdist = SUUNTO_DISTANCE;
}
tmp = SUUNTO_TIME;
RESULT = vm;

I made this code public under "500m avg SPD" name in AppZone.

Now the result:









I zoomed to get the same scale for all avg speed (kmh).
Fastest km (Fkm) is RESULT = 1 / SUUNTO_FASTEST_DISTANCE * 3600;
As you may notice max Fkm occured first but i only set 1 decimal so it could be down to 33.25km/h before reaching a max that could be 33.34km/h.

If you need more comment to understand the code let me know and i will put extra orange lines.

EDIT: After a deeper look something was wrong to me (spike just before 38' for the 500m avg SPD). I looked into the xml file and find wrong value 16km/h instead of 32km/h.
I reviewed the code and found the mistake: forgot to add many else at the end. :-d
I will set back the application to public after my ride, anyway the code has been corrected in this post.
Back from ride and much better now! happy 500m avg or ever distance you want.


----------



## MME75

Think I understand how it works. Works fine, adapted it to measure also the nautical mile. Since the memory is almost full with this app would it technically possible to calculate the avg over 500 meter including a 180 degree turn. Start and finish point should be within 50 meters from each other. The logic would be like if direction changes 180 degrees calculate avg speed of previous 250 and coming 250 m in which start and endpoint lie within 50 m.


----------



## SiRoB1

MME75 said:


> Think I understand how it works. Works fine, adapted it to measure also the nautical mile. Since the memory is almost full with this app would it technically possible to calculate the avg over 500 meter including a 180 degree turn. Start and finish point should be within 50 meters from each other. The logic would be like if direction changes 180 degrees calculate avg speed of previous 250 and coming 250 m in which start and endpoint lie within 50 m.


Be careful, i updated the code above.
You need to use my last code as i forgot some else at the end of the code. 
Well if you need some extra memory you can change the code to remove one segment record (i.e.: removing (d13;t13)).

Anyway i don't think you need extra code, as the application is really computing speed avg over the last distavg distance from your position.

EDIT: ok got the point, you want to prevent taking into account low speed sample.
In this case it's very simple, you just need to define a speed limit, and prevent sample to enter in history list.
Something like this


PHP:


/* original code */
if (SUUNTO_DISTANCE > lastdist) {
  if ((SUUNTO_DISTANCE-lastdist) > time * speedlimit) /* speedlimit in km/s */
    /* original code */

  }
  time = 0;
  lastdist = SUUNTO_DISTANCE;
}
/* original code */


----------



## MME75

Having a lower treshold is really useful but not what I ment. What I mean is a 500 meter including a jybe ending within 50 m of the startingpoint.
I tested the 500 and mile in my car today but I find some weird stuff. Sometimes either the 500 or mile avg speed is higher then the max speed reached in that part.








I also tried to add something like this

vm = distavg / vm * 3600;
}

if (vm>mile) {
mile = vm;
}

} else {
/* just for multisport compatibility */
lastdist = SUUNTO_DISTANCE;
}
tmp = SUUNTO_TIME;
RESULT = mile; 

But it doesn't work


----------



## SiRoB1

MME75 said:


> Having a lower treshold is really useful but not what I ment. What I mean is a 500 meter including a jybe ending within 50 m of the startingpoint.


So you want to reset every measure during the first 50m the time to reach your cruising speed then then start to collect sample then reset again when you turn.
But this will not work, results from the 50m until the 50+distavg will not correspond to a proper average because based on a shorter distance. This case occur once in this application at start when we fill the history list for the first time.



MME75 said:


> I tested the 500 and mile in my car today but I find some weird stuff. Sometimes either the 500 or mile avg speed is higher then the max speed reached in that part.


Probably due to wrong code used?
Your latest test seems fine to me.
But again check your "avg spd Nautical Mile" because the code is not the proper one.








After High to low speed transition








Including High and Low speed, i couldn't select 1.85km so i used the nearest dist other choice was 1.94km with avg speed of 18.6km/h

Each value of the "avg SPD Nautical Mile" graph is calculated by distavg / time_needed_to_travel_distavg.
time_needed_to_travel_distavg is interpolated.



MME75 said:


> But it doesn't work


Not sure what you are attempting to do with this code.
Do you want to display some max value between each veer directly on your watch like SUUNTO_FATEST_DISTANCE?
In this case your code is right, but you need to reset mile when you veer or when speed fall. 
To detect veer, i would suggest recording gps heading when vm > mile.
Then when gps heading recorded differ from current gps heading well reset mile.


PHP:


vm = distavg / vm * 3600;
    if (vm > mile) {
      mile = vm;
      head = SUUNTO_GPS_HEADING;
    }
  }
} else {
  /* just for multisport compatibility */
  lastdist = SUUNTO_DISTANCE;
}
tmp = SUUNTO_TIME;
if (180-Suunto.abs(Suunto.abs(SUUNTO_GPS_HEADING-head)-180) > 90) {
    mile = vm;
}
RESULT = mile;

EDIT:
- added reply to first quote
- updated the coding suggestion mile = vm instead of mile = 0 when we veer


----------



## MME75

Thought I had the right but apparently not. Will update it withe the new code and your suggestions. Yeah would to see the 500/mile max after changing direction so including the heading is also what is been used in the 5x10 sec app.

See the awesome Paint picture for what I mean with the 500 meter with a turn. So the distance between start and finish should 500 meters and the finish has to been within 50 meter of the start. So something with IF GPS_heading is 180>90 and GPS positionA<50m GPS position B then average of 250m before GPS_HEAD is 180>90 plus average of 250 m after GPS_HEAD is 180>90


----------



## SiRoB1

MME75 said:


> See the awesome Paint picture for what I mean with the 500 meter with a turn. So the distance between start and finish should 500 meters and the finish has to been within 50 meter of the start. So something with IF GPS_heading is 180>90 and GPS positionA<50m GPS position B then average of 250m before GPS_HEAD is 180>90 plus average of 250 m after GPS_HEAD is 180>90
> View attachment 1536343


Ok, now it's clear.
But is the GPS position is important or we can use distance instead?
I mean is the physical end position has to be near the start physical position?


----------



## MME75

As long as the start and end are 50 m from each other were fine. Introducing your last code gives me a compilation error at line -1


----------



## SiRoB1

MME75 said:


> As long as the start and end are 50 m from each other were fine. Introducing your last code gives me a compilation error at line -1


It should work. Did you add head var?

Otherwise, here a code that should correspond to your second request.
Be careful, it's not the same code with several new vars listed on top of the code.
I'm not 100% sure about the code, but it should work as expected.
You will have to test.



PHP:


/* no name :p

- Travel at least distavg/2 distance
- Turn more than 90deg
- Travel again at least distavg/2 distance
Result is finally updated with the new distavg distance avg speed

Variables with value:
distavg = 0.5 (km)

Variables with zero value:
tmp, diff, time, lastdist, i, turn, head,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16,
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16

*/
if (lastdist > 0) {
  time = time + Suunto.mod(SUUNTO_TIME - tmp + 86400, 86400); /* cumulate seconds from the lastdist update */
  if (SUUNTO_DISTANCE > lastdist) {
    lastdist = SUUNTO_DISTANCE - lastdist;
    i = 16;
    if ((lastdist+d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15 < distavg) && (d16 != 0)) {
      /* not enough sample to drop the (d16;t16)
         so we merge the segment with nearest average speed */
      i = 15;
      tmp = Suunto.abs(d15/t15 - d16/t16);
      diff = Suunto.abs(d14/t14 - d15/t15); if (diff < tmp) { tmp = diff; i = 14; }
      diff = Suunto.abs(d13/t13 - d14/t14); if (diff < tmp) { tmp = diff; i = 13; }
      diff = Suunto.abs(d12/t12 - d13/t13); if (diff < tmp) { tmp = diff; i = 12; }
      diff = Suunto.abs(d11/t11 - d12/t12); if (diff < tmp) { tmp = diff; i = 11; }
      diff = Suunto.abs(d10/t10 - d11/t11); if (diff < tmp) { tmp = diff; i = 10; }
      diff = Suunto.abs(d9/t9   - d10/t10); if (diff < tmp) { tmp = diff; i = 9; }
      diff = Suunto.abs(d8/t8   - d9/t9);   if (diff < tmp) { tmp = diff; i = 8; }
      diff = Suunto.abs(d7/t7   - d8/t8);   if (diff < tmp) { tmp = diff; i = 7; }
      diff = Suunto.abs(d6/t6   - d7/t7);   if (diff < tmp) { tmp = diff; i = 6; }
      diff = Suunto.abs(d5/t5   - d6/t6);   if (diff < tmp) { tmp = diff; i = 5; }
      diff = Suunto.abs(d4/t4   - d5/t5);   if (diff < tmp) { tmp = diff; i = 4; }
      diff = Suunto.abs(d3/t3   - d4/t4);   if (diff < tmp) { tmp = diff; i = 3; }
      diff = Suunto.abs(d2/t2   - d3/t3);   if (diff < tmp) { tmp = diff; i = 2; }
      diff = Suunto.abs(d1/t1   - d2/t2);   if (diff < tmp) { tmp = diff; i = 1; }
      diff = Suunto.abs(lastdist/time - d1/t1); if (diff < tmp) { tmp = diff; i = 0; }
      /* we determined which sample need to be merged 
         so merge the proper couple */
      if (i == 15) { t16 = t16 + t15; d16 = d16 + d15; }
      if (i == 14) { t15 = t15 + t14; d15 = d15 + d14; }
      if (i == 13) { t14 = t14 + t13; d14 = d14 + d13; }
      if (i == 12) { t13 = t13 + t12; d13 = d13 + d12; }
      if (i == 11) { t12 = t12 + t11; d12 = d12 + d11; }
      if (i == 10) { t11 = t11 + t10; d11 = d11 + d10; }
      if (i ==  9) { t10 = t10 +  t9; d10 = d10 +  d9; }
      if (i ==  8) { t9  = t9  +  t8; d9  = d9  +  d8; }
      if (i ==  7) { t8  = t8  +  t7; d8  = d8  +  d7; }
      if (i ==  6) { t7  = t7  +  t6; d7  = d7  +  d6; }
      if (i ==  5) { t6  = t6  +  t5; d6  = d6  +  d5; }
      if (i ==  4) { t5  = t5  +  t4; d5  = d5  +  d4; }
      if (i ==  3) { t4  = t4  +  t3; d4  = d4  +  d3; }
      if (i ==  2) { t3  = t3  +  t2; d3  = d3  +  d2; }
      if (i ==  1) { t2  = t2  +  t1; d2  = d2  +  d1; }
      if (i ==  0) { t1  = t1  + time; d1 = d1 + lastdist; }
    }
    /* time to slide our history list if needed */
    if (i > 15) { t16 = t15; d16 = d15; }
    if (i > 14) { t15 = t14; d15 = d14; }
    if (i > 13) { t14 = t13; d14 = d13; }
    if (i > 12) { t13 = t12; d13 = d12; }
    if (i > 11) { t12 = t11; d12 = d11; }
    if (i > 10) { t11 = t10; d11 = d10; }
    if (i >  9) { t10 = t9;  d10 = d9; }
    if (i >  8) { t9  = t8;  d9  = d8; }
    if (i >  7) { t8  = t7;  d8  = d7; }
    if (i >  6) { t7  = t6;  d7  = d6; }
    if (i >  5) { t6  = t5;  d6  = d5; }
    if (i >  4) { t5  = t4;  d5  = d4; }
    if (i >  3) { t4  = t3;  d4  = d3; }
    if (i >  2) { t3  = t2;  d3  = d2; }
    if (i >  1) { t2  = t1;  d2  = d1; }
    if (i >  0) { t1  = time; d1 = lastdist; }
    time = 0;
    lastdist = SUUNTO_DISTANCE;
  }
  if (turn && ((SUUNTO_DISTANCE-turn) >= distavg/2)) {
    /* we turned and we traveled distavg/2 distance after the turn */
    tmp = distavg-d15-d14-d13-d12-d11-d10-d9-d8-d7-d6-d5-d4-d3-d2-d1;
    if (d16 >= tmp) {
      /* our history list cover at least distavg distance */
      RESULT = distavg /(time+t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16*tmp/d16) * 3600;
    }
    turn = 0; /* result has been computed so reset turn flag */
  }
} else {
  /* just for multisport compatibility */
  lastdist = SUUNTO_DISTANCE;
}
tmp = SUUNTO_TIME;
if (turn && ((SUUNTO_DISTANCE-turn) < distavg/2)) {
  /* we are going away from a turn */
  head = SUUNTO_GPS_HEADING; /* keep head updated */
}
if (180-Suunto.abs(Suunto.abs(SUUNTO_GPS_HEADING-head)-180) > 90) {
  /* we just turned more than 90deg */
  turn = SUUNTO_DISTANCE; /* record where we turned */
}
RESULT = RESULT;

EDIT: removed "°" char from code to avoid compilation error


----------



## MME75

Nice work, Suunto should hire you. 

Yes added the head var but still the compilation error.

Second code(let's call it Alpha) gives a code contains unsupported character error


----------



## SiRoB1

MME75 said:


> Nice work, Suunto should hire you.
> 
> Yes added the head var but still the compilation error.


Works here maybe an extra anchor somewhere when you pasted the code.
Original code of 500m avg SPD with extra code should look like this:











MME75 said:


> Second code(let's call it Alpha) gives a code contains unsupported character error


My bad, remove "°" char in orange comment.
Will update the post without those unauthorized char.


----------



## MME75

Ok removed the degree signs and now it's accepted. Will test it today.

With NM I missed a } added it but now I gets this.








Code looks the same as above or am I missing something?


----------



## SiRoB1

MME75 said:


> Code looks the same as above or am I missing something?


Not the same number of line.
Remove the line 129, it should be ok after.


----------



## MME75

Then you get the compilation error again.


----------



## SiRoB1

MME75 said:


> Then you get the compilation error again.


You probably edited the code somewhere or it is too big.
made this one a bit shorter.



PHP:


/* Display Max 500m avg Until a turn

Variables with value:
distavg = 0.5 (km)

Variables with zero value:
vm, tmp, time, lastdist, head, mile,
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13,
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13,

*/
if (lastdist > 0) {
  time = time + Suunto.mod(SUUNTO_TIME - tmp + 86400, 86400);
  if (SUUNTO_DISTANCE > lastdist) {
    lastdist = SUUNTO_DISTANCE - lastdist;
    vm = 13;
    if ((lastdist + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 < distavg) && (d13 != 0)) {
      /* not enough sample to drop the (d13;t13)
         so we merge the segment with nearest average speed */
      vm = 12;
      tmp = Suunto.abs(d12/t12 - d13/t13);
      RESULT = Suunto.abs(d11/t11 - d12/t12); if (RESULT < tmp) { tmp = RESULT; vm = 11; }
      RESULT = Suunto.abs(d10/t10 - d11/t11); if (RESULT < tmp) { tmp = RESULT; vm = 10; }
      RESULT = Suunto.abs(d9/t9 - d10/t10); if (RESULT < tmp) { tmp = RESULT; vm = 9; }
      RESULT = Suunto.abs(d8/t8 - d9/t9); if (RESULT < tmp) { tmp = RESULT; vm = 8; }
      RESULT = Suunto.abs(d7/t7 - d8/t8); if (RESULT < tmp) { tmp = RESULT; vm = 7; }
      RESULT = Suunto.abs(d6/t6 - d7/t7); if (RESULT < tmp) { tmp = RESULT; vm = 6; }
      RESULT = Suunto.abs(d5/t5 - d6/t6); if (RESULT < tmp) { tmp = RESULT; vm = 5; }
      RESULT = Suunto.abs(d4/t4 - d5/t5); if (RESULT < tmp) { tmp = RESULT; vm = 4; }
      RESULT = Suunto.abs(d3/t3 - d4/t4); if (RESULT < tmp) { tmp = RESULT; vm = 3; }
      RESULT = Suunto.abs(d2/t2 - d3/t3); if (RESULT < tmp) { tmp = RESULT; vm = 2; }
      RESULT = Suunto.abs(d1/t1 - d2/t2); if (RESULT < tmp) { tmp = RESULT; vm = 1; }
      RESULT = Suunto.abs((lastdist)/time - d1/t1); if (RESULT < tmp) { tmp = RESULT; vm = 0; }

      if (vm == 12) { t13 = t13 + t12; d13 = d13 + d12; }
      if (vm == 11) { t12 = t12 + t11; d12 = d12 + d11; }
      if (vm == 10) { t11 = t11 + t10; d11 = d11 + d10; }
      if (vm ==  9) { t10 = t10 +  t9; d10 = d10 +  d9; }
      if (vm ==  8) { t9  = t9  +  t8; d9  = d9  +  d8; }
      if (vm ==  7) { t8  = t8  +  t7; d8  = d8  +  d7; }
      if (vm ==  6) { t7  = t7  +  t6; d7  = d7  +  d6; }
      if (vm ==  5) { t6  = t6  +  t5; d6  = d6  +  d5; }
      if (vm ==  4) { t5  = t5  +  t4; d5  = d5  +  d4; }
      if (vm ==  3) { t4  = t4  +  t3; d4  = d4  +  d3; }
      if (vm ==  2) { t3  = t3  +  t2; d3  = d3  +  d2; }
      if (vm ==  1) { t2  = t2  +  t1; d2  = d2  +  d1; }
      if (vm ==  0) { t1  = t1  + time; d1 = d1 + lastdist; }
    }
    if (vm > 12) { t13 = t12; d13 = d12; }
    if (vm > 11) { t12 = t11; d12 = d11; }
    if (vm > 10) { t11 = t10; d11 = d10; }
    if (vm >  9) { t10 = t9;  d10 = d9; }
    if (vm >  8) { t9  = t8;  d9  = d8; }
    if (vm >  7) { t8  = t7;  d8  = d7; }
    if (vm >  6) { t7  = t6;  d7  = d6; }
    if (vm >  5) { t6  = t5;  d6  = d5; }
    if (vm >  4) { t5  = t4;  d5  = d4; }
    if (vm >  3) { t4  = t3;  d4  = d3; }
    if (vm >  2) { t3  = t2;  d3  = d2; }
    if (vm >  1) { t2  = t1;  d2  = d1; }
    if (vm >  0) { t1  = time; d1 = lastdist; }
    time = 0;
    lastdist = SUUNTO_DISTANCE;
  }
  if ((time == 0) || (time > 10)) {
    vm = time + t1;
    if (d1 < distavg) {
      tmp = distavg - d1;
      if (d2 >= tmp) {
        vm = vm + t2 * tmp / d2;
      } else {
        tmp = tmp -  d2;
        if (d3 >= tmp) {
          vm = vm + t2 + t3 * tmp / d3;
        } else {
          tmp = tmp -  d3;
          if (d4 >= tmp) {
            vm = vm + t2 + t3 + t4 * tmp / d4;
          } else {
            tmp = tmp -  d4;
            if (d5 >= tmp) {
              vm = vm + t2 + t3 + t4 + t5 * tmp / d5;
            } else {
              tmp = tmp -  d5;
              if (d6 >= tmp) {
                vm = vm + t2 + t3 + t4 + t5 + t6 * tmp / d6;
              } else {
                tmp = tmp -  d6;
                if (d7 >= tmp) {
                  vm = vm + t2 + t3 + t4 + t5 + t6 + t7 * tmp / d7;
                } else {
                  tmp = tmp -  d7;
                  if (d8 >= tmp) {
                    vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 * tmp / d8;
                  } else {
                    tmp = tmp -  d8;
                    if (d9 >= tmp) {
                      vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 * tmp / d9;
                    } else {
                      tmp = tmp -  d9;
                      if (d10 >= tmp) {
                        vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 * tmp / d10;
                      } else {
                        tmp = tmp - d10;
                        if (d11 >= tmp) {
                          vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 * tmp / d11;
                        } else {
                          tmp = tmp - d11;
                          if (d12 >= tmp) {
                            vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 * tmp / d12;
                          } else {
                            tmp = tmp - d12;
                            if (d13 >= tmp) {
                              vm = vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 * tmp / d13;
                            } else {
                              vm = (vm + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13) / (distavg - tmp + d13) * distavg;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    vm = distavg / vm * 3600;
    if (vm > mile) {
      mile = vm;
      head = SUUNTO_GPS_HEADING;
    }
  }
} else {
  /* just for multisport compatibility */
  lastdist = SUUNTO_DISTANCE;
}
tmp = SUUNTO_TIME;
if (180-Suunto.abs(Suunto.abs(SUUNTO_GPS_HEADING-head)-180) > 90) {
    mile = vm;
}
RESULT = mile;


----------



## MME75

Tested the apps against measurements made with the Doppler based GT31 and there is minor difference in speed but it's really useful to see this data on the water. Thanks a lot.


----------



## SiRoB1

MME75 said:


> Tested the apps against measurements made with the Doppler based GT31 and there is minor difference in speed but it's really useful to see this data on the water. Thanks a lot.


Nice to hear.
If we really need better accuracy (avoid overestimation) we may try by recording gps points, filter and interpolate to bypass Suunto distance algorithm.
I will attempt to give a try but i'm not sure about a proper result due to app memory limit.


----------



## snailmale

Hi all,

Since I'm too cheap to buy a power meter, I've been digging around the App Zone for an app that can approximate my power reasonably. However, thus far none have proven to anywhere close to being accurate, so I wrote one myself. I used the calculations that Strava uses (https://strava.zendesk.com/entries/20959332-Power-Calculations) and based my values off whatever averages I could find online, namely:
Crr = 0.0035 (Durano S clincher, that I presume to be slightly worse than the GP4000)
Bike weight: 10kg (inclusive of bottles, water, tools, shoes, helmet - actually probably closer to 11-12kg)
CdA = 0.4 (hoods from here: http://www.cyclingpowerlab.com/cyclingaerodynamics.aspx)
Air Density = 1.29 (average sea level density from wikipedia)

Here is my first app:


> /* While in sport mode do this once per second */RESULT = 0;
> 
> VERTPOW = (SUUNTO_USER_WEIGHT + 10) * 9.81 * (SUUNTO_VERTICAL_SPD / 60);
> 
> SPEEDMS = SUUNTO_SPEED / 3.6;
> FRICPOW = (SUUNTO_USER_WEIGHT + 10) * 9.81 * 0.0035 * SPEEDMS;
> 
> AIRPOW = 0.5 * 1.29 * 0.4 * (Suunto.pow(SPEEDMS, 3));
> 
> CurrentAcc = SUUNTO_SPEED - Lastspeed;
> ACCPOW = CurrentAcc / 3.6 * (SUUNTO_USER_WEIGHT + 10) * SUUNTO_SPEED / 3.6;
> Lastspeed = SUUNTO_SPEED;
> 
> if (SUUNTO_SPEED > 0) {
> if (VERTPOW + FRICPOW + AIRPOW + ACCPOW + 1 > 0){
> RESULT = VERTPOW + FRICPOW + AIRPOW + ACCPOW + 1;
> }
> else {
> RESULT = 0;
> }
> }
> else {
> RESULT = 0;
> }


My question is, if I am defining Lastspeed correctly to get acceleration from the last second, or if I should use SUUNTO_SPEED_AVG[2]. Any other way to smooth the ACCPOW more realistically would be good too.

Apart from acceleration portion, my calculations come out pretty close to this website: Bike Calculator

Would love any and all feedback/testing/help! If it works reasonably well in real-life testing, I'd be glad to make it a public app for all to use.

Edit: A 5 minute test on a nearby slope showed up big spikes in ACCPOW when I turned to go downhill. This was because vertical speed has some lag time that cannot be avoided, while ACCPOW was calculated much faster. I've changed to Lastspeed = SUUNTO_SPEED_AVG[2] to try to reduce the spiking. Will test more soon.


----------



## SiRoB1

snailmale said:


> My question is, if I am defining Lastspeed correctly to get acceleration from the last second, or if I should use SUUNTO_SPEED_AVG[2]. Any other way to smooth the ACCPOW more realistically would be good too.


Well i didn't use this POWER part with my cycling calories estimation and results were near strava computing.
But i will give a try today, to see if this change things.
My guess is that we may use CurrentAcc = SUUNTO_SPEED_DIFF[10] / 10 to avoid noisy result.
Vertical Speed should also be averaged over 10 seconds.

EDIT: better with the computing of negative vertical speed. 

EDIT2:


snailmale said:


> Edit: A 5 minute test on a nearby slope showed up big spikes in ACCPOW when I turned to go downhill. This was because vertical speed has some lag time that cannot be avoided, while ACCPOW was calculated much faster. I've changed to Lastspeed = SUUNTO_SPEED_AVG[2] to try to reduce the spiking. Will test more soon.


This is the main trouble, vertical speed could react within 10s in worst case.
As you said we can't avoid this, but we can lower the effect by using larger window for speed and vertical speed.
Also note that altitude has some kind of queued value within 10s.


----------



## hvrietsc

SiRoB1 said:


> Well i didn't use this POWER part with my cycling calories estimation and results were near strava computing.
> But i will give a try today, to see if this change things.
> My guess is that we may use CurrentAcc = SUUNTO_SPEED_DIFF[10] / 10 to avoid noisy result.
> Vertical Speed should also be averaged over 10 seconds.
> 
> EDIT: better with the computing of negative vertical speed.
> 
> EDIT2:
> This is the main trouble, vertical speed could react within 10s in worst case.
> As you said we can't avoid this, but we can lower the effect by using larger window for speed and vertical speed.
> Also note that altitude has some kind of queued value within 10s.


Suunto_speed_avg[10] gives the average over the last 10 seconds of the average speed, not sure if that is what you want. To eliminate spikes better to do your calculations over the last 10 seconds by adding this code :

if modulo(Suunto_duration,10) == 0) then do your calculations otherwise results = previous result.


----------



## SiRoB1

hvrietsc said:


> Suunto_speed_avg[10] gives the average over the last 10 seconds of the average speed, not sure if that is what you want. To eliminate spikes better to do your calculations over the last 10 seconds by adding this code :
> 
> if modulo(Suunto_duration,10) == 0) then do your calculations otherwise results = previous result.


Note that i'm not telling to use average speed, i'm using differential speed to smooth speed change at steady speed, the idea is to spread ACCPOWER over the next 10s. 

Here is the code i'm going to test with a ride profile that contain many stop and go (City).
Note that RESULT return Watts/kg with a 10s latency:


PHP:


CdA = 0.6;
Crr = 0.007;
RESULT = (SUUNTO_SPEED-SUUNTO_SPEED_DIFF[10])/3.6;
RESULT = (CdA * 0.5 * 100 * SUUNTO_PRESSURE * (1-0.0001184*SUUNTO_ALTI) / 287.0529 / (SUUNTO_TEMP+273) * RESULT * RESULT / (SUUNTO_USER_WEIGHT + 15) +
          Crr * 9.8 + SUUNTO_SPEED_DIFF[10]/10/3.6) * RESULT + (SUUNTO_VERTICAL_SPD)/60*9.8;

if (RESULT < 0) {
  RESULT = 0;
}

EDIT: here my result to compare the behavior of ACCPOW in both code
On a relatively flat section:








On a light slope (2%) with red light stop:








With strava estimated Calories, i'm getting 397kCal and 387kCal with the App.
It remains to find a good solution for a proper vertical speed.


----------



## snailmale

Thanks very much for all the help! I'm still trying to understand the comments -> I'm not extremely savvy in code just yet.

Another quick test brought me to realise the code I had above was causing just as many spikes, and more prolonged. So I changed to the following:


> CurrentAcc = SUUNTO_SPEED_AVG[2] - Lastspeed;
> ACCPOW = CurrentAcc / 3.6 * (SUUNTO_USER_WEIGHT + 10) * SUUNTO_SPEED / 3.6;
> Lastspeed = SUUNTO_SPEED_AVG[2];


Results after a 50km ride seemed encouraging (significantly more smooth) but still high. It appears to be in line with your suggestion of using SUUNTO_SPEED_AVG[10]. However, 10s seems like an overly long delay. I have since upped it to 3s and will test 3s, 4s and 5s over the next week. Would be great if someone with an actual powermeter could run this app and compare the values with the powermeter.

In theory, the wattage we see should indeed be relatively spikey - more power does go into the acceleration, and leaving that portion out results in poorer understanding of our power output. In an ideal world where vertical speed has no lag, it would give us the most accurate results. Using AVG[x] is just an artificial smoothing based on limited resources.

But then again, in an ideal world, I would have a powermeter and not have to think too much about this!

Edit: I looked it up a bit and it seems powermeters also use 1, 3, 5, 10 or 30s smoothing, with most people using 3s or 5s. So I suppose 3-5s is a good range for me to test.


----------



## SiRoB1

To help everyone understand why you could encountering wrong spike, you need to understand how each SUUNTO VAR are computed.
SUUNTO_SPEED uses distance and elapsed time to travel it.
distance is updated when there is enough gps sample and can occur at variable time, depending to current GPS accuracy (quality of reception) and our current speed.
So now we know that distance can be updated every 1s to undefined time,
and that SUUNTO_SPEED changes the same way.

Why those spike? Just because we assume that SUUNTO_SPEED changes every seconds.
If the SUUNTO_SPEED has not been updated since 5s you are going to think you have accelerated only in one second whereas you have accelerated over 5s at least ( maybe less but we have no way to know this).
So to correct this you need to check when SPEED has been updated.
But we encounter a dilemma, if SPEED doesn't change over some time when i consider the starting point to compute my differential speed?
Well it depends of error we are able to accept.

The code could be enhanced this way:


PHP:


if (SUUNTO_SPEED != Lastspeed) {
  lastDURATION = SUUNTO_DURATION-lastDURATION;
  if (lastDURATION > 10) {
    lastDURATION = 10;
  }
  CurrentAcc = (SUUNTO_SPEED - Lastspeed)/lastDURATION;
  Lastspeed = SUUNTO_SPEED;
  lastDURATION = SUUNTO_DURATION;
}
ACCPOW = CurrentAcc / 3.6 * (SUUNTO_USER_WEIGHT + 10) * SUUNTO_SPEED / 3.6;

EDIT: forgot to manage to turn CurrentAcc to zero if speed didn't change and distance still updating, so the code becomes:


PHP:


if (SUUNTO_SPEED != Lastspeed) {
  /* SPEED has been updated */
  lastDURATION = SUUNTO_DURATION-lastDURATION; /* Elapsed time since last SPEED update */
  if (lastDURATION > 10) { lastDURATION = 10; }
  CurrentAcc = (SUUNTO_SPEED - Lastspeed)/lastDURATION; /* mean acceleration over lastDURATION seconds */
  Lastspeed = SUUNTO_SPEED; /* records SPEED */
  lastDISTANCE = SUUNTO_DISTANCE; /* record distance when SPEED has been updated */
  lastDURATION = SUUNTO_DURATION; /* records when SPEED changed */
} else if (SUUNTO_DISTANCE!=lastDISTANCE) {
  /* SPEED has not been updated but DISTANCE has been updated */
  CurrentAcc = 0; /* considering constant speed */
  lastDISTANCE = SUUNTO_DISTANCE; /* record distance when SPEED is constant and distance has been updated */
  lastDURATION = SUUNTO_DURATION; /* records when SPEED is constant and distance has been updated */
}
ACCPOW = CurrentAcc / 3.6 * (SUUNTO_USER_WEIGHT + 10) * SUUNTO_SPEED / 3.6;

Here the code i'm going to test.
Still Watts/kg result with 10s latency because i'm considering that SUUNTO_VERTICAL_SPD has a 10s latency:


PHP:


RESULT = (SUUNTO_SPEED-SUUNTO_SPEED_DIFF[10])/3.6; /* SPEED 10s earlier */
if (RESULT>0) {
  if (RESULT != lastSPEED) {
    /* SPEED 10s earlier has changed */
    lastSPEEDchange = SUUNTO_DURATION-lastSPEEDchange; /* Elapsed time since last speed change */
    if (lastSPEEDchange == 0) { lastSPEEDchange = 1; }
    if (lastSPEEDchange > 10) { lastSPEEDchange = 10; }
    Acceleration = (RESULT - lastSPEED)/lastSPEEDchange; /* mean acceleration over lastSPEEDchange seconds */
    lastSPEED = RESULT; /* record SPEED 10s earlier */
    lastDISTANCE = SUUNTO_DISTANCE-SUUNTO_DISTANCE_TOT[10]; /* record distance when SPEED 10s earlier has been updated */
    lastSPEEDchange = SUUNTO_DURATION; /* record when speed changed */
  } else if (SUUNTO_DISTANCE-SUUNTO_DISTANCE_TOT[10]!=lastDISTANCE) {
    /* DISTANCE 10s earlier has been updated but SPEED 10s earlier didn't change */
    Acceleration = 0;
    lastDISTANCE = SUUNTO_DISTANCE-SUUNTO_DISTANCE_TOT[10]; /* record distance when SPEED 10s earlier is constant */
    lastSPEEDchange = SUUNTO_DURATION; /* record when SPEED 10s earlier is constant  */
  }
  RESULT = (   /* CdA */ 0.6
             * /* 1/2 */ 0.5
             * /* density of the air based on alti, pressure and Temperature */ 100 * SUUNTO_PRESSURE * (1-0.0001184*SUUNTO_ALTI) / 287.0529 / (SUUNTO_TEMP+273)
             * /* v^2 */ RESULT * RESULT
             / /* Pu+Pb */ (SUUNTO_USER_WEIGHT + 15)
             + /* Crr */ 0.007
             * /* g */ 9.8
             + /* Acc */ Acceleration
           )
           * /* v */ RESULT
           + /* vertical speed */ SUUNTO_VERTICAL_SPD/60
           * /* g */ 9.8;
}
if (RESULT < 0) {
  RESULT = 0;
}


----------



## snailmale

Hmm that is an interesting point about SUUNTO_SPEED, I have never thought of that before. However, I use a speed/cadence meter that takes precedence over GPS, and should be consistently available regardless of GPS strength. This would mean that SUUNTO_SPEED (and acceleration) is calculated every second. For those without a speedometer, then yes such an addition to the code would be very useful.


----------



## SiRoB1

snailmale said:


> Hmm that is an interesting point about SUUNTO_SPEED, I have never thought of that before. However, I use a speed/cadence meter that takes precedence over GPS, and should be consistently available regardless of GPS strength. This would mean that SUUNTO_SPEED (and acceleration) is calculated every second. For those without a speedometer, then yes such an addition to the code would be very useful.


I would be interested if you could measure minimum step for distance update.

EDIT: My previous attempt to smooth acceleration didn't work, so now i'm going to try to avoid output result until we moved (different than speed>0) , this way graphic drawing should fill gap properly and shouldn't be filled by wrong intermediary values:


PHP:


/* While in sport mode do this once per second */
if (SUUNTO_DISTANCE != lastDISTANCE) {
  /* DISATNCE has been updated */
  VERTPOW = (SUUNTO_USER_WEIGHT + 15) * 9.8 * (SUUNTO_VERTICAL_SPD / 60);

  SPEEDMS = SUUNTO_SPEED / 3.6;
  FRICPOW = (SUUNTO_USER_WEIGHT + 15) * 9.8 * 0.007 * SPEEDMS;

  AIRPOW = 0.5 * 1.29 * 0.6 * SPEEDMS * SPEEDMS * SPEEDMS;

  lastDURATION = SUUNTO_DURATION-lastDURATION; /* Elapsed time since last DISTANCE update */
  meanAcc = (SUUNTO_SPEED - Lastspeed)/lastDURATION; /* mean acceleration over lastDURATION seconds */
  ACCPOW = meanAcc / 3.6 * (SUUNTO_USER_WEIGHT + 15) * SPEEDMS;  
  RESULT = (VERTPOW + FRICPOW + AIRPOW + ACCPOW)/(SUUNTO_USER_WEIGHT + 15);

  Lastspeed = SUUNTO_SPEED; /* records SPEED */
  lastDISTANCE = SUUNTO_DISTANCE; /* record distance where DISTANCE has been updated */
  lastDURATION = SUUNTO_DURATION; /* records when DISTANCE changed */
}

if ((RESULT < 0) || (SUUNTO_SPEED == 0)) {
  RESULT = 0;
}

I'm still testing some kind of Grade code instead VERTICAL_SPEED to avoid this:







Note that i was at constant speed on a 6% slope


----------



## mondoshawan

new app


Swim Intervalset Counter (for Poolswimming exercises)

this App counts swim interval sets handsfree. There is no need to press the Lap Button to count a set. It's based on Suuntos swimming rest timer to identify a set, not on distance, cause sometimes Ambit is missing a pool length. Note: this is not a pool length counter. So if you do a 200m warmup followed by a rest and then 10x 100m with 10sec rest each in a 25m pool, the result is 11 then, and not 48 as a length counter would be.



PHP:


/* Define these 3 Variables to 0
    IntervalSet
    rest
    stop
    */
/* Set Format to "0 decimals" */

if (SUUNTO_DURATION && SUUNTO_DISTANCE>0) {
  if (SUUNTO_SWIMMING_REST_TIME>0 && stop == 0) {
    rest=1;
  }
  if (rest==1 && stop==0) {
    IntervalSet=IntervalSet+1;
    stop=1;
    Suunto.light();
  }
  if (SUUNTO_SWIMMING_REST_TIME==0) {
      rest=0;
      stop=0;
  }
}
RESULT=IntervalSet;

edit: i changed the code a bit so that the light is still on as long as you are standing at the wall:



PHP:


/* Define these 3 Variables to 0
    IntervalSet
    rest
    stop
    */
/* Set Format to "0 decimals" */

if (SUUNTO_DURATION && SUUNTO_DISTANCE>0) {
  if (SUUNTO_SWIMMING_REST_TIME>0 && stop == 0) {
    rest=1;
  }
  if (rest==1 && stop==0) {
    IntervalSet=IntervalSet+1;
    stop=1;
  }
  if (rest==1) {
    Suunto.light();
  }
  if (SUUNTO_SWIMMING_REST_TIME==0) {
    rest=0;
    stop=0;
  }
}
RESULT=IntervalSet;


----------



## hclofes

Hello watchuseek-forum,

I am a new Ambit 3 sport user and I miss the function to display the time in a certain HR-Zone and also an immediate alert when I leave this zone.

I have copied together a code from other apps, and this code is fairly working. the only issue I have is that the time (=counter) continues when i pause the training.

here is the code i am using:
/* While in sport mode do this once per second */
if (SUUNTO_LAP_NUMBER >=1) {

if (SUUNTO_HR <= 135 && SUUNTO_HR >= 110) {

postfix = "INZONE";
if (SUUNTO_DURATION != DURATIONlast) {
/* exercise not paused */
T0 = T0 + 1 ;
}
DURATIONlast = SUUNTO_DURATION;

}
if (SUUNTO_HR >135) {
if (flagInterval>1){
flagInterval=0;
}
if (flagUWL == 0){
Suunto.alarmBeep();
flagUWL=1;
}

if ( flagInterval==1){ 
Suunto.alarmBeep();
flagInterval=0;
} 
else if (flagInterval!=1){
flagInterval = flagInterval +1; 
} 
} 
if (SUUNTO_HR <110) { 
if (flagUWL == 0){
Suunto.alarmBeep();
flagUWL=1;
}
if ( flagInterval==5){ 
Suunto.alarmBeep();
flagInterval=0;
} 
else if (flagInterval!=5){
flagInterval = flagInterval +1; 
} 
} 
RESULT = T0;

}

The 2nd app i would like to have is the possibility to show the time in each HR-zone during training. I have found this app:
TimeZ - App auf Movescount.com (which I also used as basis for above mentioned app).

As far as i know in this app only the time in the actual zone is shown. I would prefer that every 3 seconds the displayed HR-Zone changes. so I am always aware how much time I spent in each zone.

Thanks again for your help which is much appreciated.

kr hclofes
PS. sorry for my poor english, my native language is german


----------



## morey000

OK- I just created my first app. Seemed pretty easy. I want a marathon finish time predictor, but one that uses my current time/distance, and then my current average pace.

RESULT = SUUNTO_DURATION + (21.1 - SUUNTO_DISTANCE) / SUUNTO_SPEED_AVG[30] * 3600;

Seems straightforward enough. Except when I did the "compatibility check" it gave me this (below): A red checkmark Where the "movescount app" size is 101%. How is that possible, the whole app is just a single line? Should I just ignore the compatibility checker?

COMPATIBILITY


[*][FONT=SuuntoIcons !important]​​Ambit (size 55%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Ambit2 (size 27%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Ambit2 R (size 27%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Ambit2 S (size 27%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Ambit3 Peak (size 27%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Ambit3 Sport (size 27%)[/FONT]

[*][FONT=SuuntoIcons !important]​​Movescount App (size 101%)[/FONT]

Also- It appears that SUUNTO_SPEED_AVG[30] is a defined variable. I was hoping that I could change the 30s to a 60 second window- but it didn't like that. Any way I could make it a 60 second average? By the way the variable is defined, it sure looks like that "30" can be changed.


----------



## j_winston

morey000 said:


> when I did the "compatibility check" it gave me this (below): A red checkmark Where the "movescount app" size is 101%.


The mobile application doesn't seem to support apps, at least those cannot be selected when starting an activity from mobile. I'd guess that they've added the compatibility check to appdesigner, but the functionality itself does not work in the mobile application. So I'd ignore the compatibility check from mobile application point-of-view, but for the Ambits it should be pretty much valid.


----------



## anto1980

Hi all!

I just bought an Ambit3 Sport ad I'm searching a reliable App for ASCENT and DESCENT. The Suunto alghorithm is not reliable...


----------



## hclofes

hclofes said:


> I am a new Ambit 3 sport user and I miss the function to display the time in a certain HR-Zone and also an immediate alert when I leave this zone.


I found a code in this thread, which should stops the counter when excercise is paused. so i copied it in and yesterday i found out - it works - THANKS...

here is the code:
/* While in sport mode do this once per second */
if (SUUNTO_LAP_NUMBER >=1) {

if (SUUNTO_HR <= 135 && SUUNTO_HR >= 110) {

postfix = "INZONE";
if (SUUNTO_DURATION != DURATIONlast) {
/* exercise not paused */
T0 = T0 + 1 ;
}
DURATIONlast = SUUNTO_DURATION;

}
if (SUUNTO_HR >135) {
if (flagInterval>1){
flagInterval=0;
}
if (flagUWL == 0){
Suunto.alarmBeep();
flagUWL=1;
}

if ( flagInterval==1){ 
Suunto.alarmBeep();
flagInterval=0;
} 
else if (flagInterval!=1){
flagInterval = flagInterval +1; 
} 
} 
if (SUUNTO_HR <110) { 
if (flagUWL == 0){
Suunto.alarmBeep();
flagUWL=1;
}
if ( flagInterval==5){ 
Suunto.alarmBeep();
flagInterval=0;
} 
else if (flagInterval!=5){
flagInterval = flagInterval +1; 
} 
} 
RESULT = T0;

}

maybe someone can still help me with my 2nd topic:


hclofes said:


> The 2nd app i would like to have is the possibility to show the time in each HR-zone during training. I have found this app:
> TimeZ - App auf Movescount.com (which I also used as basis for above mentioned app).
> 
> As far as i know in this app only the time in the actual zone is shown. I would prefer that every 3 seconds the displayed HR-Zone changes. so I am always aware how much time I spent in each zone.


thanks in advance
kr hclofes


----------



## morey000

j_winston said:


> The mobile application doesn't seem to support apps, at least those cannot be selected when starting an activity from mobile. I'd guess that they've added the compatibility check to appdesigner, but the functionality itself does not work in the mobile application. So I'd ignore the compatibility check from mobile application point-of-view, but for the Ambits it should be pretty much valid.


Oh- this was for the mobile app? Anyway- the app works fine on my Ambit 2S. Just what I wanted! (which, I guess is the whole purpose of being able to create a custom app in the first place


----------



## SiRoB1

anto1980 said:


> Hi all!
> 
> I just bought an Ambit3 Sport ad I'm searching a reliable App for ASCENT and DESCENT. The Suunto alghorithm is not reliable...


Well as i said to you by MP, you will never get accurate ASCENT DESCENT by using only GPS.



hclofes said:


> As far as i know in this app only the time in the actual zone is shown. I would prefer that every 3 seconds the displayed HR-Zone changes. so I am always aware how much time I spent in each zone.


Something like this should help you:


PHP:


if (Suunto.mod(SUUNTO_TIME, 15) < 3) { prefix = "T1"; RESULT = T1; }
else if (Suunto.mod(SUUNTO_TIME, 15) < 6) { prefix = "T2"; RESULT = T2; }
else if (Suunto.mod(SUUNTO_TIME, 15) < 9) { prefix = "T3"; RESULT = T3; }
else if (Suunto.mod(SUUNTO_TIME, 15) < 12) { prefix = "T4"; RESULT = T4; }
else { prefix = "T5"; RESULT = T5; }


----------



## Anita Renes

Goodmorning, I am new to this forum, as well as to Suunto . I bought an ambit 2R after multiple problems with my Garmin 610. Now.. I do need a proper intervaltraining, one that can handle speed/pace, and disctance and time combined (so each time 2 out of these 3). But also warning beeps. Now, I tried a few, but somehow they dont work properly, especially the alarmfunction doesnt work in the one that seemed best to me. I can read the code a biut due to some programming work in SAP in the past, but am far from an expert. Can someone help me? else the watch needs to be returned:-(


----------



## danielp27

Anita Renes said:


> Goodmorning, I am new to this forum, as well as to Suunto . I bought an ambit 2R after multiple problems with my Garmin 610. Now.. I do need a proper intervaltraining, one that can handle speed/pace, and disctance and time combined (so each time 2 out of these 3). But also warning beeps. Now, I tried a few, but somehow they dont work properly, especially the alarmfunction doesnt work in the one that seemed best to me. I can read the code a biut due to some programming work in SAP in the past, but am far from an expert. Can someone help me? else the watch needs to be returned:-(


did you checked these two web pages? i think you can achieve what you need with them
Suunto Ambit Intervals App Generator
Ambit Interval App


----------



## Anita Renes

danielp27 said:


> did you checked these two web pages? i think you can achieve what you need with them
> Suunto Ambit Intervals App Generator
> Ambit Interval App


Yes, Thanks. I use the 1st one (tried all that I could find on internet) but the warnings didnt work. Let me try it again this morning. The 2nd one doesnt make sense to me, didnt understand how to set the values, since changing the "MAS"value changes all other values, and I am not sure what that MAS is. I asume some.. intensity figure?


----------



## danielp27

Anita Renes said:


> Yes, Thanks. I use the 1st one (tried all that I could find on internet) but the warnings didnt work. Let me try it again this morning. The 2nd one doesnt make sense to me, didnt understand how to set the values, since changing the "MAS"value changes all other values, and I am not sure what that MAS is. I asume some.. intensity figure?


MAS is maximum speed, in km/h. it is not necessary to use it, you can manually specify the zones below. MAS exists for convenience:
if you define a MAS, then , 
z1 < 60%MAS, 
Z2 < 67% MAS
z3 < 75% MAS
z4 < 87,5%MAS
z5<100% MAS

if this ranges are OK for you, then you can create a config for you faster

remember that in both web sites you need to enable the alarms, so that the code for the alarm is generated.


----------



## Anita Renes

Allright. I figured, can later change the parameters in de code (such as speed/pace) so didnt bother, just set it to something that came close. But now it generated code thats too long?
: Compiled binary is too large for any supported device.:

It just doesnt make a very efficient code. The first interval creator you mension does that better, i sais, lap e.g. 1, 3, 5 etc etc. SO less code.

Been testing (or am testing) the 1st mensioned interval app again, the one that seperates the prgram in 2 parts, one for the duration and one for the target. It does seem to give noices..just have to figure out if the sounds are all the same.

What I miss anyway is a display that shows the target. I asume I can make a 3th app for that, so all is visible in one screen. But can someone give me an example of that?

this is a part of the target code; 
/* Lap 2, 6, 10, 14, 18, 22, 26, 30, 34, 38 is step type Interval with target type Pace */

if (SUUNTO_LAP_NUMBER == 2 || SUUNTO_LAP_NUMBER == 6 || SUUNTO_LAP_NUMBER == 10 || SUUNTO_LAP_NUMBER == 14 || SUUNTO_LAP_NUMBER == 18 || SUUNTO_LAP_NUMBER == 22 || SUUNTO_LAP_NUMBER == 26 || SUUNTO_LAP_NUMBER == 30 || SUUNTO_LAP_NUMBER == 34 || SUUNTO_LAP_NUMBER == 38) {

ACTUAL = SUUNTO_PACE * 60;

FROM = 400;

TO = 387;

FORMATPACE = 1;

postfix = "/km";

}

And then this is the part of code in the duration app that goes with it;
/* Lap 2, 6, 10, 14, 18, 22, 26, 30, 34, 38 is step type Interval with duration type Distance */

if (SUUNTO_LAP_NUMBER == 2 || SUUNTO_LAP_NUMBER == 6 || SUUNTO_LAP_NUMBER == 10 || SUUNTO_LAP_NUMBER == 14 || SUUNTO_LAP_NUMBER == 18 || SUUNTO_LAP_NUMBER == 22 || SUUNTO_LAP_NUMBER == 26 || SUUNTO_LAP_NUMBER == 30 || SUUNTO_LAP_NUMBER == 34 || SUUNTO_LAP_NUMBER == 38) {

prefix = "int";

postfix = "m";

RESULT = 400 - (SUUNTO_LAP_DISTANCE * 1000);

}

Ideally these 2 would be combined into one app, but I gues the creator did it this way so he wouldnt hit the length restriction of the generated code.


----------



## Anita Renes

Allright. Did the best I could by peeking at others. It shuld be fine, but it keeps telling me there is an error in line -1 (?)
/* copy the content of this window in Movescount App designer */
RESULT= 0;

if(SUUNTO_SPEED < 7.20 ) {zone = 1;} 
if(SUUNTO_SPEED >= 7.21 && SUUNTO_SPEED < 8.99) {zone =2;} 
if(SUUNTO_SPEED >= 9.00 && SUUNTO_SPEED < 9.30) {zone =3;} 
if(SUUNTO_SPEED >= 9.31 && SUUNTO_SPEED < 10.00) {zone=4;} 
if(SUUNTO_SPEED >= 10.01) {zone=5;}

if (int == 0) { 
prefix="WarmUp"; postfix=" "; RESULT =600- SUUNTO_DURATION; 
if (SUUNTO_DURATION >= 595 ) {Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 600 ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) { 
prefix="INT"; postfix="Zo"; RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600; 
if ( zone < 3 ) {postfix="++"; Suunto.alarmBeep();} 
if ( zone > 3 ) {postfix="--"; Suunto.alarmBeep();} 
if (SUUNTO_DISTANCE*1000 >= 380 + Dist*1000 ) {Suunto.alarmBeep();} 
if (SUUNTO_DISTANCE*1000 >= 400 + Dist*1000 ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 2 || int == 6 || int == 10 || int == 14 || int == 18 || int == 22 || int == 26 || int == 30 || int == 34 || int == 38) { 
prefix="walk"; postfix="Zo"; RESULT =(20+ Dur) - SUUNTO_DURATION; 
if ( zone < 1 ) { postfix="++"; Suunto.alarmBeep();} 
if ( zone > 1 ) {postfix="--"; Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 17 + Dur ) {Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 20+ Dur ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 3 || int == 7 || int == 11 || int == 15 || int == 19 || int == 23 || int == 27 || int == 31 || int == 35 || int == 39) { 
prefix="REC"; postfix="Zo"; RESULT =((380/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600; 
if ( zone < 2 ) {postfix="++"; Suunto.alarmBeep();} 
if ( zone > 2 ) {postfix="--"; Suunto.alarmBeep();} 
if (SUUNTO_DISTANCE*1000 >= 360 + Dist*1000 ) {Suunto.alarmBeep();} 
if (SUUNTO_DISTANCE*1000 >= 380 + Dist*1000 ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 4 || int == 8 || int == 12 || int == 16 || int == 20 || int == 24 || int == 28 || int == 32 || int == 36 || int == 40) { 
prefix="walk"; postfix="Zo"; RESULT =(20+ Dur) - SUUNTO_DURATION; 
if ( zone < 1 ) { postfix="++"; Suunto.alarmBeep();} 
if ( zone > 1 ) {postfix="--"; Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 17 + Dur ) {Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 20+ Dur ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 41) { 
prefix="CD"; postfix=" "; RESULT =(300+ Dur) - SUUNTO_DURATION; 
if (SUUNTO_DURATION >= 295 + Dur ) {Suunto.alarmBeep();} 
if (SUUNTO_DURATION >= 300+ Dur ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 42) {prefix=" "; postfix="END"; RESULT = SUUNTO_DURATION-Dur;}

EDIT; checked all figures again, created the app and the variables again and now I can save it. Going to try it tonight! If someone has an idea how to display the targets that would be great


----------



## PabloAlarcon

hi, here there's another app generator you can try, maybe you can find it useful for what your trying to achieve. 

SUUNTO AMBIT APPS


----------



## or_watching

OK... it's been a while. I've been just too too busy. But I wanted to refresh my trusty old-school Ambit2 with some new Apps to get motivated for the winter running season. I've now added Suunto's EPOC. woo-hoo.

I sure do like that link above to the auto-generated interval apps web page. Kudos to that good soul. I may just to to delete the crazy app I made wherein I walk around in circles to set a target pace hands-free and web-free.

Now it's time for all the App Maniacs to fess up. How many apps have you got?
Here are my stats
- 27 sport modes defined. Including however many were there by default.
- 76 apps saved to my account7 from Movescount
63 from or_watching
6 from other folks​
Is this step 1 of 12?

Any other great or crazy apps that have cropped up in the last 6 months?


----------



## Anita Renes

Thanks for the other app, it did gave me some new ideas.
Now, I tried the app yesterday, but it was completely annoying, since the GPS is sooo accurate the smallest speedchange is recorded (not sure if I have to switch that GPS interval to 5 secs, of that makes that better?), missed something that shows me what I am suppose to do that interval, and the beeps made me crazy.
SO, been changing it a bit... did got all compiled but I dont know how to tell the app that it only needs to beep 1 times at exceeding and 2 times at being too slow for the definied speed zones. What nw happens, is that it sees I am too slow, starts beeping but obviously I never told it only to do that once e.g. every 10 seconds. 
Its mensioned earlyer in this topic, but I just dont get it!

if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) {
prefix=""; postfix="Zo"; RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;

if ( zone < 3 && beepCount == 0) { postfix="fstr"; 
beepCount = 2; 
}
if ( zone > 3 && beepCount == 0) { postfix="slwr";
beepCount = 1; 
}
if (beepCount > 0) {
Suunto.alarmBeep(); Suunto.light();

beepCount = beepCount - 1;
}


----------



## danielp27

if you want it to beep only every 10 seconds, then you can do something like this (took it from an app of mine, you had to adapt it for your purposes):
/*every 10 seconds handle alarms*/
if(Suunto.mod(SUUNTO_DURATION,10)==0)
{
if(aux_alarm == 1)
{
aux_alarm = 0;
if(enable_beep==1)
{
Suunto.alarmBeep();
}
if(enable_light==1)
{
Suunto.light();
}
}
}


----------



## Anita Renes

I saw that first line somewhere else, but dont know how to embed it in my code:-(


----------



## danielp27

well, i think this would do the trick most of the time(not tested, just guessing  ) . there might be some issues missing some 2nd beeps if you fall below target exactly after Suunto.mod(SUUNTO_DURATION,10)==0 has been triggered. 

if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1)
{
if (beepCount > 0) {
Suunto.alarmBeep(); Suunto.light();

beepCount = beepCount - 1;
}
}


----------



## Anita Renes

thanks!! Had to try a few times to see where the code should be applied, but as far as I can test it (sitting om a couch it works line a charm

EDIT more testing..as I am not going out today I changed some paramters (< in stead of >) but it keeps doing the same;
if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) {
prefix="fst"; postfix=""; RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1){
if ( zone > 3 && beepCount == 0) {
beepCount = 2;}
if (beepCount > 0) {
Suunto.alarmBeep(); Suunto.light();
beepCount = beepCount - 1;}}
if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1){
if ( zone < 3 && beepCount == 0) {
beepCount = 1;}
if (beepCount > 0) {
Suunto.alarmBeep(); Suunto.light();
beepCount = beepCount - 1;}}

SO, when I am sitting, the speed is below zone 3, so it should now beep once. But it beep twice every 10 seconds. what am I doing wrong?


----------



## danielp27

you can handle beeps every ten seconds, but you have to check the limits every second. i have removed the check beepCount == 0. in my opinion the most recent alarms should have higher priority than the pending ones. 
it would be something like this:
if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) 
{
prefix="fst"; postfix=""; 
RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
if ( zone > 3) 
{
beepCount = 2;
}
if (zone < 3) 
{
beepCount = 1;
}

if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1)
{

if (beepCount > 0) 
{
Suunto.alarmBeep(); 
Suunto.light();
beepCount = beepCount - 1;
}
}
}

EDIT: testing on the coach might not be a good way of testing. even though you are not moving, the gps, because of poor reception inside home, can produce spurious data.


----------



## Anita Renes

ALlright, applied your code, but it still beeps twice when it should only beeb once. so odd.. And its probably a small thingy but what? I will take it with me to work to test it with acurate GPS. But still. Inside it says it finds the GPS, so the "< zone 3" should always work properly I think?

EDIT; tried it on my way to work.. its still beeping twice regardless the speed.


----------



## danielp27

we did not handle the case when you are on target  

if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) 
{
prefix="fst"; postfix=""; 
RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
if(zone==3)
{

beepCount =0;
}
if ( zone > 3) 
{
beepCount = 2;
}
if (zone < 3) 
{
beepCount = 1;
}

if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1)
{

if (beepCount > 0) 
{
Suunto.alarmBeep(); 
Suunto.light();
beepCount = beepCount - 1;
}
}
}


----------



## Anita Renes

Wanted to say...thats not very smart of the watch, but allright, sounds logical that that also needs to be defined. 
Will do so when I am home. Was just wandering, dus pointing out the target also then helps what happens when below or above target? Because it only beeps twice = above target?

 I am a little rusty in programming and understanding the logic!


----------



## mondoshawan

Anita Renes said:


> thanks!! Had to try a few times to see where the code should be applied, but as far as I can test it (sitting om a couch it works line a charm
> 
> EDIT more testing..as I am not going out today I changed some paramters (< in stead of >) but it keeps doing the same;
> if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37) {
> prefix="fst"; postfix=""; RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
> if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1){
> if ( zone > 3 && beepCount == 0) {
> beepCount = 2;}
> if (beepCount > 0) {
> Suunto.alarmBeep(); Suunto.light();
> beepCount = beepCount - 1;}}
> if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1){
> if ( zone < 3 && beepCount == 0) {
> beepCount = 1;}
> if (beepCount > 0) {
> Suunto.alarmBeep(); Suunto.light();
> beepCount = beepCount - 1;}}
> 
> SO, when I am sitting, the speed is below zone 3, so it should now beep once. But it beep twice every 10 seconds. what am I doing wrong?


This beep code should do the trick:



PHP:


if(Suunto.mod(SUUNTO_DURATION,10)==0) {
  if (zone > 3) {
    beepCount = 2;
  }
  if (zone <= 3) {
    beepCount = 1;
  }
}
if (beepCount > 0) {
    beepCount = beepCount - 1;
    Suunto.alarmBeep(); Suunto.light();
}

this:
|| Suunto.mod(SUUNTO_DURATION,10)==1
was making it beeping twice


----------



## Anita Renes

TRied both solutions.
daniel; I now have this;
if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37)
{
prefix="fst"; postfix="";
RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
if(zone==1)
{

beepCount =0;
}
if ( zone > 1)
{
beepCount = 2;
}
if (zone < 1)
{
beepCount = 1;
}
if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1)
{

if (beepCount > 0)
{
Suunto.alarmBeep();
Suunto.light();
beepCount = beepCount - 1;
}
}

It does beep once when I am above the zone which is correct. But below zone it remains silent?

The other solution, Mondoshawan, made it only beep one time and never again after that


----------



## Anita Renes

oh this is so frutrating..

I comnbined both your solutions now and added one thing; I forgot to define the zone below1. so now have this;

/* copy the content of this window in Movescount App designer */
RESULT= 0;
if(SUUNTO_SPEED < 5.00 ) {zone =0;}
if(SUUNTO_SPEED >= 5.01 && SUUNTO_SPEED < 6.00) {zone =1;}
if(SUUNTO_SPEED >= 7.31 && SUUNTO_SPEED < 8.40) {zone =2;}
if(SUUNTO_SPEED >= 9.20 && SUUNTO_SPEED < 9.60) {zone =3;}
if(SUUNTO_SPEED >= 9.62 && SUUNTO_SPEED < 10.00) {zone=4;}
if(SUUNTO_SPEED >=10.01 && SUUNTO_SPEED < 12.99) {zone =5;}

if (int == 0) {
prefix=""; postfix=" "; RESULT =60- SUUNTO_DURATION;
if (SUUNTO_DURATION >= 58 ) {Suunto.alarmBeep();}
if (SUUNTO_DURATION >= 60 ) {Dur=SUUNTO_DURATION; Dist= SUUNTO_DISTANCE; int = int+ 1; } }

if (int == 1 || int == 5 || int == 9 || int == 13 || int == 17 || int == 21 || int == 25 || int == 29 || int == 33 || int == 37)
if(Suunto.mod(SUUNTO_DURATION,10)==0) {
{
prefix="fst"; postfix="";
RESULT =((400/1000 + Dist) - SUUNTO_DISTANCE)/SUUNTO_SPEED_AVG[10]*3600;
if(Suunto.mod(SUUNTO_DURATION,10)==0) {
if (zone > 1) {
beepCount = 2;
}
if (zone <= 1) {
beepCount = 1;
}
}
if (beepCount > 0) {
beepCount = beepCount - 1;
Suunto.alarmBeep(); Suunto.light();
}



I changed " if (zone <= 1) into "if (zone < 1) and added a seperate "if (zone =1), thought being smart, but then it beeped everywhere in or outside zone, every 10 sec, one or twice, depending on the setting in
if(Suunto.mod(SUUNTO_DURATION,10)==0 || Suunto.mod(SUUNTO_DURATION,10)==1)

Now it does work! Will take the watch when I go shopping, to see if all the rest also still works, and then looks like it I can use it tonight

Thanks for all the help sofar.

Does anyone happen to know if we can use the other tones (like start session, save, stop, etc) that are on the watch?


----------



## danielp27

ok ok, it makes sense. check target once every 10 secs, and handle beeps if necessary but starting from next iteration to avoid that some alarms get mixed with others:



PHP:


if(Suunto.mod(SUUNTO_DURATION,10)==0)
{

if ( zone > 1)
{
beepCount = 2;
}
if (zone < 1)
{
beepCount = 1;
}
if (zone == 1)
{
beepCount = 0;
}

if(Suunto.mod(SUUNTO_DURATION,10)==1 || Suunto.mod(SUUNTO_DURATION,10)==2)
{

if (beepCount > 0)
{
Suunto.alarmBeep();
Suunto.light();
beepCount = beepCount - 1;
}


----------



## Anita Renes

Daniel, wat does the if(Suunto.mod(SUUNTO_DURATION,10)==1 || Suunto.mod(SUUNTO_DURATION,10)==2) do?
I still didnt figure out the function of this.


----------



## danielp27

Anita Renes said:


> Daniel, wat does the if(Suunto.mod(SUUNTO_DURATION,10)==1 || Suunto.mod(SUUNTO_DURATION,10)==2) do?
> I still didnt figure out the function of this.


hi, it is the remainder of the division
Modulo operation - Wikipedia, the free encyclopedia

if remainder is 0, it means the condition will be met at a duration of 0, 10, 20, 30, .....
if remainder is 1 or 2, it means the condition will be met at a duration of 1, 2, 11, 12, 21, 22, 31, 32, ....

so, if duration == 40 secs => target speed will be checked
duration == 41 => beep first time if necessary
duration == 42 => beep second time if necessary
nothing happens until duration == 50, when the process is repeated

btw , you might want to replace SUUNTO_SPEED by SUUNTO_SPEED_AVG[10]
even though suunto speed is pretty stable compared with the competitors (in my old FR405 the pace was everything but stable), it still has some variations due to gps variability. working with a moving average helps.


----------



## Anita Renes

well..thats a bit more clear to me now, although I will try to find the explanation in dutch, think thats better

Anyway. did my interval earlyer tonight. I was shocked for the very very bad performance on GPS on the Garmin FR610.. en pleasantly surprised with the Suunto. I used , for the warning beeps, average lap pace, but I will change that back to speed, as it was a steady speed that it showed. 
The functioning of the beeps I am not sure; the Garmin was shouting very loud so couldnt focus on the Suunto. But will fiddle and try further, and try the above solution if its not all working ok. Now, one thing I am missing; the ability to see at what lap I am? So.. lap XX out of XX. Is that possible, eventually in an other app?
And not only that; more important is (jiust found out now); the Suunto doesnt show the laps in Movevcount. So how can I get that recorded without needing to press lap everytime? pretty essential to me:/


----------



## anto1980

Ambit series does not sounds when you stop the chronometer! Is there an App to solve the problem?


----------



## DonTom71

*Differentiate Autolaps from Manual Laps?*

I have been trying to create an app that can help me maintain a good tempo during Norwegian intervals (4x4-intervals) - but my problem is that I use Autolap, and want to keep using it, also during the remaining (and initial) part of the run.

Therefore I have difficulties detecting the manual lap button push, that is supposed to initiate the 4x4-session, and my code.

Initially I used a start/initiation sequence as per below:

if (SUUNTO_LAP_NUMBER >= 2 )
{start interval}

but it appears as if there is no distinction made between autolaps and manual laps when it comes to SUUNTO_LAP_NUMBER - and in the same spirit I also imagine that SUUNTO_MANUAL_LAP_DURATION starts counting already when I start the exercise.

So - to put it short - how can I separate and identify the manual lap from the autolaps?

As I imagine that it might be a bit blurry I also attach the current code below:

Any help would be greatly appreciated!



Code:


/* Check if it is time to start */
if (SUUNTO_LAP_NUMBER >= 2 && RESTCOUNT <= 0 && TIMECOUNT == 0) {
  RESTCOUNT = 0 ;
  RUNDIST = SUUNTO_DISTANCE ;
}


/* Start interval */
if (SUUNTO_LAP_NUMBER >= 2 && RESTCOUNT <= 0 ) {
  TIMECOUNT = TIMECOUNT + 1 ;
  if (Suunto.mod(TIMECOUNT, 4) == 0) {
    RESULT = -((4*60) - TIMECOUNT) ;
}
  if (Suunto.mod(TIMECOUNT, 4) != 0) {
    RESULT = TIMECOUNT / ( SUUNTO_DISTANCE - RUNDIST) ;
  postfix = "/km";}
}


/* end interval */
if (TIMECOUNT >= 4 * 60) {
  Suunto.light();
  Suunto.alarmBeep();
  COUNTER = COUNTER + 1;
  TIMECOUNT = 0;
  RESTCOUNT = 3 * 60 ;
}


if (RESTCOUNT >= 1) {
  RESTCOUNT = RESTCOUNT - 1 ;
  TIMECOUNT = 0 ;
  RESULT = RESTCOUNT ;
}


if (RESTCOUNT <= 0 && COUNTER >= 1 && TIMECOUNT == 0) {
  Suunto.light();
  Suunto.alarmBeep();
  RESTCOUNT = 0 ;
  TIMECOUNT = 0;
  RUNDIST = SUUNTO_DISTANCE ;
}


if (COUNTER == 0) 
  { prefix = "1" ;}
  if (COUNTER == 1) 
  { prefix = "2" ;}
  if (COUNTER == 2) 
  { prefix = "3" ;}
  if (COUNTER == 3) 
  { prefix = "4" ;}
  if (COUNTER > 3) 
  { prefix = ">4" ;}


----------



## danielp27

*Re: Differentiate Autolaps from Manual Laps?*

wouldn't something like this work?



PHP:


if(SUUNTO_MANUAL_LAP_DURATION == SUUNTO_DURATION)
{
/*first time manual lap not yet pressed*/
}
else
{
/*intervals*/

/* end interval */
if (SUUNTO_MANUAL_LAP_DURATION >= 240) 
{
  Suunto.light();
  Suunto.alarmBeep(); 
}
}


----------



## DonTom71

*Re: Differentiate Autolaps from Manual Laps?*

Thanks for the support - but unfortunately it did not work, and the interval section of the code was started as soon as the exercise was started. I really cannot understand why there should be a divergence between the SUUNTO_MANUAL_LAP_DURATION and SUUNTO_DURATION just after starting the exercise.

Currently Movescount is not accessible so I cannot retrieve my code...... because there COULD of course be something obviously (for someone else) wrong, even though it runs fine in simulator. It is a good thing that Movescount is down currently, this problem is driving me crazy.....


----------



## Anita Renes

*Re: Differentiate Autolaps from Manual Laps?*

I been trying to so simulair things (record laps within in interval), so also trying to use the Suunto_lap_number etc, but seems its not useable as such. Let me know if you manage to get something working!


----------



## DonTom71

*Re: Differentiate Autolaps from Manual Laps?*

I have now tried another approach - utilizing the standard interval feature; as it at least gets me pretty close to my target - but this approach does not seem to work either. My thinking was:

Start the run (start the exercise)
When warmup is done - activate the interval feature (prepared in Movescount prior to run) - Autolap completely disabled (do not really need it)
During interval I would like the watch to display (one screen, two fields):
1. Average pace during the interval (corresponds to SUUNTO_LAP_PACE in this case)
2. Remaining time of the interval/rest

With standard features I can achieve #2 through the interval functionality - but the secondary display field displays instant pace as opposed to lap average pace (by changing view in the bottom field). So I guess I will have to do with a workaround - one field with SUUNTO_LAP_DURATION/SUUNTO_LAP_DISTANCE (Pace) and another one with SUUNTO_LAP_TIME.


----------



## DonTom71

*Re: Differentiate Autolaps from Manual Laps?*

The way I understand it the following are the guidelines when it comes to laps:


SUUNTO_LAP_DISTANCE/SUUNTO_LAP_DURATION
Records lap distance / time regardless of how the lap was initiated. Also laps created using the standard interval timer are recorded.
SUUNTO_AUTOLAP_DISTANCE/SUUNTO_AUTOLAP_DURATION
Records all automatically created laps (autolaps and interval laps)
SUUNTO_MANUAL_LAP_DISTANCE/SUUNTO_MANUAL_LAP_DURATION
Manual press of lap button

There is very limited use of lap counting, specifically if autolaps are used in combination w. anything else. All SUUNTO variables are passive, i.e. they can only be read - they cannot be set. Typically A = SUUNTO_LAP_NUMBER is OK, while SUUNTO_LAP_NUMBER = A will not work.


----------



## DonTom71

*Re: Differentiate Autolaps from Manual Laps?*

Nope. The above seems incorrect. I cannot figure out the differences between SUUNTO_LAP_DISTANCE/SUUNTO_AUTOLAP_DISTANCE/SUUNTO_MANUAL_LAP_DISTANCE and the same for the time based similarities.

Anyone knows what SUUNTO_LAP_DISTANCE captures that differentiates it from the two others?

What I am trying to achieve is to display average lap pace during an interval. The interval is initiated using the standard interval functionality.


----------



## zipuni

*Re: Differentiate Autolaps from Manual Laps?*



DonTom71 said:


> Nope. The above seems incorrect. I cannot figure out the differences between SUUNTO_LAP_DISTANCE/SUUNTO_AUTOLAP_DISTANCE/SUUNTO_MANUAL_LAP_DISTANCE and the same for the time based similarities.
> 
> Anyone knows what SUUNTO_LAP_DISTANCE captures that differentiates it from the two others?
> 
> What I am trying to achieve is to display average lap pace during an interval. The interval is initiated using the standard interval functionality.


Maybe we should start a wiki where we add all that we know about each variable? I am still trying to figure out what SUUNTO_GPS_STATE means ...


----------



## Lornga

*Create a simple lap counter*

Hi,
I've just recived my Ambit2 S and I love it. 
I have alredy made my first simple app but I am woundering if someone can give me some ideas on how to create my next app.
I sometimes run some 6h and 12h ultra races on courses and after a couple of laps I have some trouble remember how many laps I have run.
My idea is to create a app that just show the number of laps I have run.
E.G. if the course (or lap) is 2500 meters (2,5km). If I have run 2,5km I want the app the show "1 lap" if I have run 25km I want the app to show "10 lap".
I know I could set the autolap to 2,5km but the trouble with that is that I wish to keep my autolap at 1km for timekeeping.
Does this make any sence and is it possible?

Edit:
Ok I came up with this easy solution and I think it will work.


Code:


RESULT = SUUNTO_DISTANCE / 2.5;

But now I came up with a new problem. My next race will be a 6h race around a lake that is 2562m. In order to get a even marathon lap number we will start and run a 1194 m prolog first. 16 whole laps around the lake will then make 42195m.

Example

Prolog1194Lap 13756Lap 26318Lap 38881Lap 411443Lap 514006Lap 616568Lap 719131Lap 821694Lap 924256

So for this race my "solution" above dosen't work that well


----------



## SiRoB1

*Re: Create a simple lap counter*



Lornga said:


> Hi,
> I've just recived my Ambit2 S and I love it.
> I have alredy made my first simple app but I am woundering if someone can give me some ideas on how to create my next app.
> I sometimes run some 6h and 12h ultra races on courses and after a couple of laps I have some trouble remember how many laps I have run.
> My idea is to create a app that just show the number of laps I have run.
> E.G. if the course (or lap) is 2500 meters (2,5km). If I have run 2,5km I want the app the show "1 lap" if I have run 25km I want the app to show "10 lap".
> I know I could set the autolap to 2,5km but the trouble with that is that I wish to keep my autolap at 1km for timekeeping.
> Does this make any sence and is it possible?
> 
> Edit:
> Ok I came up with this easy solution and I think it will work.
> 
> 
> Code:
> 
> 
> RESULT = SUUNTO_DISTANCE / 2.5;
> 
> But now I came up with a new problem. My next race will be a 6h race around a lake that is 2562m. In order to get a even marathon lap number we will start and run a 1194 m prolog first. 16 whole laps around the lake will then make 42195m.
> 
> Example
> 
> Prolog1194Lap 13756Lap 26318Lap 38881Lap 411443Lap 514006Lap 616568Lap 719131Lap 821694Lap 924256
> 
> So for this race my "solution" above dosen't work that well


Hi Lornga,

i think the best way could be to use GPS position to make the app setting free.

Otherwise for your tiny app you just need to do this:



PHP:


if (1000*SUUNTO_DISTANCE>=1194) {
  RESULT = Suunto.floor((1000*SUUNTO_DISTANCE-1194) / 2562);
} else {
  RESULT = 0;
}


----------



## Lornga

*Re: Create a simple lap counter*

SiroB1: Thank you very mutch, I think this will do the trick for me.
I have a small injury at the moment but on my next run I will take the app for a testrun 

Once again thank you very mutch.


----------



## mondoshawan

*Re: Create a simple lap counter*

excuse me, if this had been discussed before, but i've just noticed a glitch with *SUUNTO_LAP_NUMBER_PREV* on my Ambit2

running the first Lap everything is like it should be and the value is 0, but hitting the LapButton the first time, from that point on it will take the numbers from the actual lap - 2 instead of 1 like it should be. So now i'm curios, if this happens to the other Ambits as well?


----------



## SiRoB1

*Re: Create a simple lap counter*



mondoshawan said:


> excuse me, if this had been discussed before, but i've just noticed a glitch with *SUUNTO_LAP_NUMBER_PREV* on my Ambit2
> 
> running the first Lap everything is like it should be and the value is 0, but hitting the LapButton the first time, from that point on it will take the numbers from the actual lap - 2 instead of 1 like it should be. So now i'm curios, if this happens to the other Ambits as well?


Noticed it too.
But i'm fed up to report bugs now and i'm sure this already done.

I would suggest you to use your own var to compare with SUUNTO_LAP_NUMBER.


----------



## PabloAlarcon

*Respiratory frecuency*

Hi, just wondering if it would be posible to have this variable shown on the watch, i think this variable is calculated from HR frecuency plus other variables and movescount does the math...but perhaps some could write something to estimate this, I know i can check this on movescount but I'd like to have it live . Thanks


----------



## 01jeremy

*Re: Respiratory frecuency*

Hi, I'm interested in creating an app for swimming, have no idea how to do it, and would appreciate any help anyone could offer.

What I'd like to do is have a screen that shows my pace for my last pool length, below that the pace from the length before that, and if possible, below that the pace from the length before that. So basically if I'm doing 100m (four lengths), I'd like to see if I'm slowing down from length to length or keeping my pace up. I can see the info from each length on Movescount, but it would be great to see it on the watch after the interval and while I'm still in the pool.

Do you think it's possible to show the pace from the lengths before the latest one? If so, how?

Thanks for your help!

Jeremy


----------



## SiRoB1

*Re: Respiratory frecuency*



PabloAlarcon said:


> Hi, just wondering if it would be posible to have this variable shown on the watch, i think this variable is calculated from HR frecuency plus other variables and movescount does the math...but perhaps some could write something to estimate this, I know i can check this on movescount but I'd like to have it live . Thanks


I think it's possible by estimating our respiratory volume and using energy consumption variable.
But i don't know if the result will be reliable.



01jeremy said:


> Hi, I'm interested in creating an app for swimming, have no idea how to do it, and would appreciate any help anyone could offer.
> 
> What I'd like to do is have a screen that shows my pace for my last pool length, below that the pace from the length before that, and if possible, below that the pace from the length before that. So basically if I'm doing 100m (four lengths), I'd like to see if I'm slowing down from length to length or keeping my pace up. I can see the info from each length on Movescount, but it would be great to see it on the watch after the interval and while I'm still in the pool.
> 
> Do you think it's possible to show the pace from the lengths before the latest one? If so, how?
> 
> Thanks for your help!
> 
> Jeremy


I never used the watch for swimming so i can't tell if the following code will work as expected.
I attempted to fix case when pace is identical from the last result, but i really don't know if it will work.
If someone knows a better solution to detect turn don't hesitate.


PHP:


/* Alternate display of the last 4 pool length pace (s/100m) and the best pace

Set format to time

Variable to create with 0 value:
pace1, pace2, pace3, pace4, dist

variable to create with non zero value:
best = 65535

*/
RESULT = 100*SUUNTO_SWIMMING_PREVIOUS_POOL_LENGTH_DURATION/SUUNTO_SWIMMING_POOL_LENGTH;
if (RESULT != pace4 || (SUUNTO_SWIMMING_INTERVAL_DISTANCE > dist + SUUNTO_SWIMMING_POOL_LENGTH)) {
  if (best > RESULT) { best = RESULT; }
  pace1 = pace2;
  pace2 = pace3;
  pace3 = pace4;
  pace4 = RESULT;
  dist = SUUNTO_SWIMMING_INTERVAL_DISTANCE;
}
RESULT = Suunto.mod(SUUNTO_TIME, 10);
if (RESULT < 2) {
  prefix = "1/4";
  RESULT = pace1;
} else if (RESULT < 4) {
  prefix = "2/4";
  RESULT = pace2;
} else if (RESULT < 6) {
  prefix = "3/4";
  RESULT = pace3;
} else if (RESULT < 8) {
  prefix = "4/4";
  RESULT = pace4;
} else {
  prefix = "best";
  RESULT = best;
}


----------



## mondoshawan

*Re: Respiratory frecuency*

&#8230;what an elegant way to toggle the Results&#8230;
we idiots are always creating a counter to do that, but the counter is already there&#8230; 

since SiRoB1 and or_watching are posting codes here, we can all learn and take profit from that. thx guys.

Happy new year to all!


----------



## federaa

*Re: App Zone ( new back-light app development)*

I've had some good luck with writing my own apps so far, but I can't seem to get the source code to modify the default Storm Alarm app? I'd like to have it keep track of minimum temp (idea is to set this for a campsite overnight). Any help would be greatly appreciated Storm Alarm - App at Movescount.com


----------



## richard521

Can someone kindly help me to create a new sunrise/sunset app in movescount's app zone ?

I know that there is. a official sunrise/sunset created by suunto, but actually it's a sunrise/sunset countdown timer..only showing how much time is left before sunset/sunrise...it can't show the exact time of sunset/sunrise ( like the one that Garmin used in fenix 1or 2).

Would greatly appreciate if some expert in here can help me to build this app ...thx


----------



## SiRoB1

richard521 said:


> Can someone kindly help me to create a new sunrise/sunset app in movescount's app zone ?
> 
> I know that there is. a official sunrise/sunset created by suunto, but actually it's a sunrise/sunset countdown timer..only showing how much time is left before sunset/sunrise...it can't show the exact time of sunset/sunrise ( like the one that Garmin used in fenix 1or 2).
> 
> Would greatly appreciate if some expert in here can help me to build this app ...thx


Hi richard521,
you may have a look to this topic:
https://www.watchuseek.com/f233/[ambit-app]-back-light-during-night-new-lap-950873.html
Otherwise, there is also nice code in appzone from many people that should satisfy your need.
The only draw back is that we are still unable to provide universal app due to time zone.


----------



## richard521

SiRoB1 said:


> richard521 said:
> 
> 
> 
> Can someone kindly help me to create a new sunrise/sunset app in movescount's app zone ?
> 
> I know that there is. a official sunrise/sunset created by suunto, but actually it's a sunrise/sunset countdown timer..only showing how much time is left before sunset/sunrise...it can't show the exact time of sunset/sunrise ( like the one that Garmin used in fenix 1or 2).
> 
> Would greatly appreciate if some expert in here can help me to build this app ...thx
> 
> 
> 
> Hi richard521,
> you may have a look to this topic:
> https://www.watchuseek.com/f233/[ambit-app]-back-light-during-night-new-lap-950873.html
> Otherwise, there is also nice code in appzone from many people that should satisfy your need.
> The only draw back is that we are still unable to provide universal app due to time zone.
Click to expand...

Which app in movescount , can exactly show the exact time of sunrise/sunset ?
Do u have any recommendations ?


----------



## SiRoB1

richard521 said:


> Which app in movescount , can exactly show the exact time of sunrise/sunset ?
> Do u have any recommendations ?


Unfortunately no recommendation, this mostly depends of your exact need.
Some display both Rise and Set for civil, nautical or twilight time.
You can have a look to app from or_watching_apps, DMartin and probably other.
Anyway, you may have to copy app and set your timezone accordingly.


----------



## SiRoB1

Hi everyone,

I've just finished to build the app i wanted since a long time.
I solved the main issue that rises when we move at very low speed doing most of actual percentage of slope apps unusable.

The app is named "Accurate Grade" in appzone.

If you have technical question about the code don't hesitate.


----------



## or_watching

SiRoB1 said:


> Hi everyone,
> 
> I've just finished to build the app i wanted since a long time.
> I solved the main issue that rises when we move at very low speed doing most of actual percentage of slope apps unusable.
> 
> The app is named "Accurate Grade" in appzone.
> 
> If you have technical question about the code don't hesitate.


Great. I can't wait to try it out. But maybe won't get on a real hike until next month.


----------



## mondoshawan

SiRoB1 said:


> Hi everyone,
> 
> I've just finished to build the app i wanted since a long time.
> I solved the main issue that rises when we move at very low speed doing most of actual percentage of slope apps unusable.
> 
> The app is named "Accurate Grade" in appzone.
> 
> If you have technical question about the code don't hesitate.


tested it last weekend on a bike ride. This app is a bit too laggy while riding, therefore the Hill Grade Live app gives better and instantly results. But i believe at lower speeds this app will work better than others.


----------



## martowl

SiRoB1 said:


> Hi everyone,
> 
> I've just finished to build the app i wanted since a long time.
> I solved the main issue that rises when we move at very low speed doing most of actual percentage of slope apps unusable.
> 
> The app is named "Accurate Grade" in appzone.
> 
> If you have technical question about the code don't hesitate.


I will give it a try running as I have noticed the apps available do not work. Thanks


----------



## SiRoB1

mondoshawan said:


> tested it last weekend on a bike ride. This app is a bit too laggy while riding, therefore the Hill Grade Live app gives better and instantly results. But i believe at lower speeds this app will work better than others.


Hill Grade Live is definitely not accurate at all. You need to ride at "high constant speed" to get a proper value.
What you mean by laggy? Value not going to zero when flat? The change is done only when altitude change and not over time.

There is a good example at low speed: ANTONIODALESSANDRO's 2:05 h Ski touring Move
I should add a filter once we keep the watch paused. 
Forgot this case.


----------



## mondoshawan

SiRoB1 said:


> Hill Grade Live is definitely not accurate at all. You need to ride at "high constant speed" to get a proper value.
> What you mean by laggy? Value not going to zero when flat? The change is done only when altitude change and not over time.
> 
> There is a good example at low speed: ANTONIODALESSANDRO's 2:05 h Ski touring Move
> I should add a filter once we keep the watch paused.
> Forgot this case.


Your App is more accurate than hill grade live no question, but on my bike ride it has had a delay within a few seconds before recognizing the change and yes, sometimes not going to zero when riding flat or showing me still a positiv low grade for 10 secends while riding down, that's the advantage from Hill grade live - change is showing instantly on a bike, but sometimes not accurate, depends on speed, i know.

For a run or hike your app is perfect. On a bike i still prefer the simple grade live app at the moment. Isn't there a way to make this work faster ?  Here is my data. Take a look.


----------



## SiRoB1

mondoshawan said:


> Isn't there a way to make this work faster ?  Here is my data. Take a look.


Of course by removing ||Suunto.abs(RESULT)<3 part.
It means that reference point will change as soon as sign change and don't wait for 2m diff.


----------



## NunoPinto

Hi there people,
Does anyone knows if it is possible on the AMBIT 3 to create an app that alerts whenever we forgot to start an exercise. Sometimes I select the exercise I want to do (running, TACX...), wait for the GPS and heart-band detection but then forgot to start it.
I know that an app that does more or less the inverse, it reminds us to stop the exercise when we are back to the same location we started...
Thanks in advance.


----------



## danielp27

Code:




hi, 
funny that you forget to press start, it has never happened to me  
i think something like this would do the trick.... (i have not tested it)

/*beep while move duration is less than 1s*/
if(SUUNTO_DURATION < 1)
{
Suunto.alarmBeep();
}
/*output anything useful, for instance, date*/
RESULT=SUUNTO_TIME;


----------



## raducanmihai

I don't think it's possible because any app starts running only after you pressed the button (after you start the activity in which you added the app). Until then the app is not running. So it's not possible to receive a notification from something that is not running yet. 

From Nexus 7 using Tapatalk


----------



## danielp27

raducanmihai said:


> I don't think it's possible because any app starts running only after you pressed the button (after you start the activity in which you added the app). Until then the app is not running. So it's not possible to receive a notification from something that is not running yet.
> 
> From Nexus 7 using Tapatalk


but he has started the activity. he mentions that he's waited for gps and heart rate monitor.


----------



## raducanmihai

Yes, but SUUNTO_DURATION is staying 0 until you actually start recording. Or am I mistaken? 

It might work with a variable not linked with any other measurements. Like a timer. N= N+1 (every second) and when it reaches 30 then Beep. 

LE: I see now how your algorithm works and it should be ok. It beeps every second until SUUNTO_DURATION =1

From Galaxy S5 using Tapatalk


----------



## mondoshawan

NunoPinto said:


> Hi there people,
> Does anyone knows if it is possible on the AMBIT 3 to create an app that alerts whenever we forgot to start an exercise. Sometimes I select the exercise I want to do (running, TACX...), wait for the GPS and heart-band detection but then forgot to start it.
> I know that an app that does more or less the inverse, it reminds us to stop the exercise when we are back to the same location we started...
> Thanks in advance.


Try this:



PHP:


/* While in sport mode do this once per second */
/* set format to time */

RESULT = 0;

if (SUUNTO_DURATION == 0) {
  if(SUUNTO_SPEED > 4 && Suunto.mod(SUUNTO_TIME, 3)) {
    postfix="Start!";
    Suunto.alarmBeep();
  }
}
else {
  RESULT = SUUNTO_DURATION;
  postfix="";
}

This App will start beeping every 3 seconds only if you move faster than 5 Km/h and did'nt start the timer. After starting the timer it shows your duration.
Could not test it yet in watch, but runs in the simulator.

edit:

i set the threshold speed down to 4, but you can enter whatever you like.

and the watch is not beeping every 3 seconds as i explained before, it beeps 2 seconds long, followed by a 1 second brake.


----------



## NunoPinto

Hi there fellow suunto users, thank you for the feedback about "forgetting to start the exercise". Right now I am on "Friday" mode....I mean, having a good time with family, good meal with some wine...after this, I will try your ideas.
Thank you soo much !!!


----------



## NunoPinto

danielp27 said:


> hi,
> funny that you forget to press start, it has never happened to me
> i think something like this would do the trick.... (i have not tested it)
> 
> /*beep while move duration is less than 1s*/
> if(SUUNTO_DURATION < 1)
> {
> Suunto.alarmBeep();
> }
> /*output anything useful, for instance, date*/
> RESULT=SUUNTO_TIME;


Works Great !!! As simple as possible. Thank you !!!​


----------



## NunoPinto

Works Great !!! I just added a little twist, the beep and the light on until I press start !!!


----------



## NunoPinto

Works Great !!! I just added a little twist, the beep and the light on until I press start !!!​



*​*


mondoshawan said:


> Try this:
> 
> 
> 
> PHP:
> 
> 
> /* While in sport mode do this once per second */
> /* set format to time */
> 
> RESULT = 0;
> 
> if (SUUNTO_DURATION == 0) {
> if(SUUNTO_SPEED > 4 && Suunto.mod(SUUNTO_TIME, 3)) {
> postfix="Start!";
> Suunto.alarmBeep();
> }
> }
> else {
> RESULT = SUUNTO_DURATION;
> postfix="";
> }
> 
> This App will start beeping every 3 seconds only if you move faster than 5 Km/h and did'nt start the timer. After starting the timer it shows your duration.
> Could not test it yet in watch, but runs in the simulator.
> 
> edit:
> 
> i set the threshold speed down to 4, but you can enter whatever you like.
> 
> and the watch is not beeping every 3 seconds as i explained before, it beeps 2 seconds long, followed by a 1 second brake.


----------



## ErickSaint

So I'm new to Suunto, coming to an Ambit2 from a Garmin FR305, this thing is a completely different animal. I'm sure I will find other apps and make my own once I get the hang of the programming. I was looking for an app to give me a beep every mile. I loaded one that seems to work just fine, except it's in km. I was hoping it would default the the imperial setting of my watch, but no such luck. I will post the code below but I'm wondering if I can modify something in this to make it beep on the mile. I tried to find an answer by searching but not really coming up with much.

If I were to change the (Distance1km) tag to 0.621371 would that give me the change I'm looking for? Thanks for any help.



PHP:


/* While in sport mode do this once per second */
if (nextbeep == 1) {
   nextbeep = 0;  
   Suunto.alarmBeep();
}
Distance1km = SUUNTO_DISTANCE - Distance;
if (Distance1km > 1) {
  Distance = Distance +1; 
  Suunto.alarmBeep();  
  nextbeep = 1; 
}
RESULT = Distance1km;


----------



## pjc3

ErickSaint said:


> So I'm new to Suunto, coming to an Ambit2 from a Garmin FR305, this thing is a completely different animal. I'm sure I will find other apps and make my own once I get the hang of the programming. I was looking for an app to give me a beep every mile. I loaded one that seems to work just fine, except it's in km. I was hoping it would default the the imperial setting of my watch, but no such luck. I will post the code below but I'm wondering if I can modify something in this to make it beep on the mile. I tried to find an answer by searching but not really coming up with much.
> 
> If I were to change the (Distance1km) tag to 0.621371 would that give me the change I'm looking for? Thanks for any help.
> 
> 
> 
> PHP:
> 
> 
> /* While in sport mode do this once per second */
> if (nextbeep == 1) {
> nextbeep = 0;
> Suunto.alarmBeep();
> }
> Distance1km = SUUNTO_DISTANCE - Distance;
> if (Distance1km > 1) {
> Distance = Distance +1;
> Suunto.alarmBeep();
> nextbeep = 1;
> }
> RESULT = Distance1km;


Have you tried just activating auto lap in the A2 settings? Then it beeps without an app.

Sent from my iPhone using Tapatalk


----------



## ErickSaint

pjc3 said:


> Have you tried just activating auto lap in the A2 settings? Then it beeps without an app.
> 
> Sent from my iPhone using Tapatalk


 I did see that option, but didn't activate it. On hikes I don't necessarily need each mile broken down into individual laps. I wasn't sure how much memory that took up in the watch. Not a big deal for day hikes as I load info when I get home, but I do have a few multi day trips planned, including an 85 mile hike later in the year. Didn't know if the info from 85 "laps" would clog up the device.

Then again this may not mean anything, I'm just new to the device.


----------



## pjc3

Auto laps don't take up any space really. Better than running an app.


Sent from my iPhone using Tapatalk


----------



## ErickSaint

Thanks, I'll give it a shot the next time out.


----------



## kpflugshaupt

ErickSaint said:


> I did see that option, but didn't activate it. On hikes I don't necessarily need each mile broken down into individual laps. I wasn't sure how much memory that took up in the watch. Not a big deal for day hikes as I load info when I get home, but I do have a few multi day trips planned, including an 85 mile hike later in the year. Didn't know if the info from 85 "laps" would clog up the device.
> 
> Then again this may not mean anything, I'm just new to the device.


Since you came from the Garmin world (like me), you're probably not yet aware that you can define your own Exercise types (Sport modes) in Movescount, which you use for different workout types. This allows you to use Auto-Lap only when needed.

For instance, I have currently three running exercise types on my Ambit: "Run: Autolap" (beep every km), "Run: Free" (no Autolap), "Run: Interval" (with an Interval App I wrote). For races, I define additional types like "Run:Race 10k" (that includes apps with a 10k distance countdown and an estimated finishing time). Besides these, I have modes for biking, hiking, swimming and alpine skiing, each configured to taste.

The beauty is that even though the watch can hold only 10 such modes at a time, you can define as many as you want, and sync to the watch as needed.

Overall, this makes the Ambit much more configurable than the Garmins I've used (FR220 and Fenix 2).


----------



## ErickSaint

kpflugshaupt said:


> Since you came from the Garmin world (like me), you're probably not yet aware that you can define your own Exercise types (Sport modes) in Movescount, which you use for different workout types. This allows you to use Auto-Lap only when needed.
> 
> For instance, I have currently three running exercise types on my Ambit: "Run: Autolap" (beep every km), "Run: Free" (no Autolap), "Run: Interval" (with an Interval App I wrote). For races, I define additional types like "Run:Race 10k" (that includes apps with a 10k distance countdown and an estimated finishing time). Besides these, I have modes for biking, hiking, swimming and alpine skiing, each configured to taste.
> 
> The beauty is that even though the watch can hold only 10 such modes at a time, you can define as many as you want, and sync to the watch as needed.
> 
> Overall, this makes the Ambit much more configurable than the Garmins I've used (FR220 and Fenix 2).


I've just barely started to scratch the surface of what it can do. The customization options are what blew me away compared to the Garmin. But the 305 was very basic by comparison of the Ambit2.


----------



## WatchFreak_71

Hello you all Suunto App enthusiasts here at watchuseek forum. I am new Suunto user, and also new in this forum, this is my first post here. It is nice to meet you all. ;-)

One of the reasons I bought Ambit 3 Sport couple of weeks ago, is the concept of Suunto Apps, which seems an interesting way to enhance the functionality of the watch. I have been doing some (more or less) constant speed walks, usually at speed 5-6 km/h. I have found with the 'Good' GPS setting (update interval about 5 sec), there are some low and high speed peaks (even in open terrain) which are quite annoying. So I wrote this simple median filter to filter them out. This works well in the App Designer Test section, no problems whatsoever. However, with the real device, this doesn't work, the watch constantly displays "Spd 0.0 km/h". :-( The GPS speed shown in display is non-zero, so bad reception of signal can't be the reason.

Any ideas what might be wrong here?



Code:


/*

  Median speed filter, window size 5. Filters out some high and low
  speed peaks, which I find annoying during my constant speed walks.
  
  Define these variables in the variables section:
  v1, v2, v3, v4, v5, v1b, v2b, v3b, v4b, v5b, vMedian, count
  
*/

count = count + 1;

if (count >= 8 && SUUNTO_DURATION > 0) {

    count = 0;

    v5 = v4;
    v4 = v3;
    v3 = v2;
    v2 = v1;
    v1 = SUUNTO_SPEED_PREV;


    /* Round 1, 5 variables */

    /* v1 biggest */
    if (v1 >= v2 && v1 >= v3 && v1 >= v4 && v1 >= v5) { 
        v1b = v2; v2b = v3; v3b = v4; v4b = v5;  /* drop biggest (v1) */
    } 
    /* v2 biggest */
    else if (v2 >= v1 && v2 >= v3 && v2 >= v4 && v2 >= v5) { 
        v1b = v1; v2b = v3; v3b = v4; v4b = v5; 
    } 
    /* v3 biggest */
    else if (v3 >= v1 && v3 >= v2 && v3 >= v4 && v3 >= v5) {  
        v1b = v1; v2b = v2; v3b = v4; v4b = v5; 
    } 
    /* v4 biggest */
    else if (v4 >= v1 && v4 >= v2 && v4 >= v3 && v4 >= v5) { 
      v1b = v1; v2b = v2; v3b = v3; v4b = v5;
    }
    /* v5 biggest */
    else { 
      v1b = v1; v2b = v2; v3b = v3; v4b = v4;
    }

    /* Round 2, 4 variables */

    /* v1 biggest */
    if (v1b >= v2b && v1b >= v3b && v1b >= v4b) { 
        v1b = v2b; v2b = v3b; v3b = v4b; 
    } 
    /* v2 biggest */
    else if (v2b >= v1b && v2b >= v3b && v2b >= v4b) { 
        v2b = v3b; v3b = v4b; 
    } 
    /* v3 biggest */
    if (v3b >= v1b && v3b >= v2b && v3b >= v4b) { 
        v3b = v4b; 
    } 
    /* v4 biggest */

    /* Round 3, 3 variables */

    /* v1 biggest */
    if (v1b >= v2b && v1b >= v3b) { 
        vMedian = v1b; 
    } 
    /* v2 biggest */
    else if (v2b >= v1b && v2b >= v3b) { 
        vMedian = v2b; 
    } 
    /* v3 biggest) */
    else  { 
      vMedian = v3b; 
    } 

}  
  
prefix = "Spd";
postfix = "kmh";
RESULT = vMedian;


----------



## danielp27

hi WatchFreak, 
i think the problem is that you are using an instant value:
"Instant value is the value that was recorded when the lap ended"

you have to use SUUNTO_SPEED instead. 

cool app! ;-)


----------



## WatchFreak_71

danielp27 said:


> hi WatchFreak,
> i think the problem is that you are using an instant value:
> "Instant value is the value that was recorded when the lap ended"
> 
> you have to use SUUNTO_SPEED instead.
> 
> cool app! ;-)


Hi danielp27! Thanks for the tip, I'll give it a try. Suunto Developer manual is very vague about the documentation of the variable, it only states:

"Instant speed SUUNTO_SPEED_PREV"

It does not mention anything about the lap stuff. Same vagueness is true for all the variables, and generally, the level of documentation is not very professional. I come from a software background, so I guess I know what I am talking about here...


----------



## mondoshawan

WatchFreak_71 said:


> Hi danielp27! Thanks for the tip, I'll give it a try. Suunto Developer manual is very vague about the documentation of the variable, it only states:
> 
> "Instant speed SUUNTO_SPEED_PREV"
> 
> It does not mention anything about the lap stuff. Same vagueness is true for all the variables, and generally, the level of documentation is not very professional. I come from a software background, so I guess I know what I am talking about here...


All different watch variables types are completely documentated at page 22 to 24 of the AppZoneDevelopment guide.


----------



## WatchFreak_71

mondoshawan said:


> All different watch variables types are completely documentated at page 22 to 24 of the AppZoneDevelopment guide.


They could have been documented also in the table, in a bit more detailed fashion.

And then there is this "There is compilation error on line -1" error, which has been there at least two years. I know it is for undefined variables and for invalid prefix/posfix, but why Suunto cannot fix it? The error message could be bit more descriptive, such as "Variable xxx not defined", "Invalid prefix length" etc... How difficult can it be to fix such simple things?


----------



## danielp27

WatchFreak_71 said:


> It does not mention anything about the lap stuff.


what a instant value is is documented before, in the same manual. It is the text i provided you in my post before.
another tip: you can export a move to f.i. Excel, and test your apps ofline there. Or even import the gpx file in visual studio (given than you have programming background) , this is even more powerful.


----------



## mondoshawan

WatchFreak_71 said:


> They could have been documented also in the table, in a bit more detailed fashion.
> 
> And then there is this "There is compilation error on line -1" error, which has been there at least two years. I know it is for undefined variables and for invalid prefix/posfix, but why Suunto cannot fix it? The error message could be bit more descriptive, such as "Variable xxx not defined", "Invalid prefix length" etc... How difficult can it be to fix such simple things?


don't ask me that&#8230; only Suunto knows.
You're right, could be much more helpful, but they are even unable to fix minor bugs.

BTW don't use *LAP_NUMBER_PREV* it has the same value as *LAP_NUMBER* after pressing the lap button the first time.


----------



## WatchFreak_71

danielp27 said:


> hi WatchFreak,
> i think the problem is that you are using an instant value:
> "Instant value is the value that was recorded when the lap ended"
> 
> you have to use SUUNTO_SPEED instead.
> 
> cool app! ;-)


Did some walking with the modified app, seems to work now. Here is the output of the speed filter vs. realtime speed:



The filter seems to nicely cut the most annoying noise peaks in the speed.

I wonder why MovesCount chooses to create two axis, one for each output, with some Y-offset between them? I made another implementation of the filter, using 1 sec execution and recording interval, and there both datas are on same axis:



Is there an option in MovesCount for this?

One more observation / question: When exporting move to xlsx file, it looks like the output of Apps are not exported, although app is setup to be logged, and the output data of app is show in the graph. Any workaround / solution for this?


----------



## danielp27

WatchFreak_71 said:


> Did some walking with the modified app, seems to work now. Here is the output of the speed filter vs. realtime speed:


looks fine!



> I wonder why MovesCount chooses to create two axis, one for each output, with some Y-offset between them?


this is the normal behaviour, i dont think it can be configurated otherwise. if you ask me, i think it is better so. if you mix up apps providing very different value ranges, with just one axis might not be enough. i agree, it would be nice to be able to manually configure the maximum and minimum value for each axis.



> One more observation / question: When exporting move to xlsx file, it looks like the output of Apps are not exported, although app is setup to be logged, and the output data of app is show in the graph. Any workaround / solution for this?


yes, they are not logged, and i also think it is a pity. you can sort of get the data by reverse engineering the web site, look this:

https://www.watchuseek.com/f233/how-export-move-app-data-1258202.html#post10178554

i have done it a couple of times. get the data, paste to excel, and substitute commas. not optimal, but can do the trick somehow.


----------



## Mnweni

Just got my Ambit2 and am loving it!
*
A question for the Guru's here:*
To test my training, from time to time I run a certain known route. To measure progress is simple,faster time = improvement etc.
Now for motivation, the idea of a "ghost runner" sounds brilliant. The ones in the app zone don't quite meet my requirements(I probably just don't understand them!).
*
I would like an app that remembers my route and performance on that route and let's me run against myself. So like a ghost runner but on a saved route.Does such an app exist?
*I saw the app "Ghost previous lap" but I don't think will do it unless I'm mistaken?

*Answers will be appreciated.
*


----------



## danielp27

Mnweni said:


> Just got my Ambit2 and am loving it!
> *
> A question for the Guru's here:*
> To test my training, from time to time I run a certain known route. To measure progress is simple,faster time = improvement etc.
> Now for motivation, the idea of a "ghost runner" sounds brilliant. The ones in the app zone don't quite meet my requirements(I probably just don't understand them!).
> *
> I would like an app that remembers my route and performance on that route and let's me run against myself. So like a ghost runner but on a saved route.Does such an app exist?
> *I saw the app "Ghost previous lap" but I don't think will do it unless I'm mistaken?
> 
> *Answers will be appreciated.
> *


hi Mnweni, 
i dont think it can be done, at least on a saved route. afaik they cannot be accessed from apps. 
youd need somehow to parse the gpx file of an existing route, select some points with coordinates and time label, and create a suunto app which compares coordinates and time label. lot of work.

do you know the web site ambitintervals.com? the guy who mantains the site is really a guru, he rocks. his site autogenerate apps based on some parameters. this is something he could implement if he likes the idea. he implemented a couple of suggestions of mine.


----------



## Mnweni

Thanks danielp27! Much appreciated,will try.


----------



## WatchFreak_71

danielp27 said:


> hi Mnweni,
> i dont think it can be done, at least on a saved route. afaik they cannot be accessed from apps.
> youd need somehow to parse the gpx file of an existing route, select some points with coordinates and time label, and create a suunto app which compares coordinates and time label. lot of work.
> 
> do you know the web site ambitintervals.com? the guy who mantains the site is really a guru, he rocks. his site autogenerate apps based on some parameters. this is something he could implement if he likes the idea. he implemented a couple of suggestions of mine.


Maybe a more simplistic approach could be taken. You could for example select the current ghost pace based on distance runned. You can get the distances from lap distances; just run your route once, an take lap at each zone boundary. Something like this:



PHP:


/* 0 - 500 m */
if (dist < 0.500) {
    ghostPace = 274;
    prefix = "4:34";
}
/* 501 - 1000 m */
else if (dist >= 0.501 && dist <= 1.000) {
    ghostPace = 264;
    prefix = "4:24";
}
/* 1001 - 1750 m */
else if (dist >= 1.001 && dist <= 1.750) {
    ghostPace = 254;
    prefix = "4:14";
}
/* 1751 - 2500 m */
else if (dist >= 1.751 && dist <= 2.500) {
    ghostPace = 244;
    prefix = "4:04";
}
/* Finish */
else {
    ghostPace = 0;
    prefix = "Done";
}

This of course doesn't take into account if your ghost has already entered next zone, and is leading when you enter the next zone; the "competition" is per zone. With a bit of code this could be enhanced. I might try to find a solution for this later this week, now I am too tired and lazy.


----------



## raducanmihai

This way of implementation is not usable on a trail where pace is constantly changing. 

Garmin's virtual racer is the only way to go on a trail, but it requires access to previous moves which is not possible on an Ambit. 

From Galaxy S5 using Tapatalk


----------



## raducanmihai

On a second thought, it would be possible but it's a nightmare to do it. One would have to split the previous move (reference one) in small segments (every km or segments based on slope/pace) and design an app based on this. But you need to do this for each move that you want to compare yourself with. 

From Galaxy S5 using Tapatalk


----------



## WatchFreak_71

I wrote this simple App generator with Java, to create a "phased ghost racer" App. Check it out at:

Zippyshare.com - PhasedGhostRacer.zip

I have tested the generated app in MovesCount App Designer test section, seems to work pretty well there. Not tested in real device though... Since Suunto App language is quite simple (it lacks loops, arrays etc.), some programming with high-level language was needed. The task was not a "nightmare" at all, just couple of hours of coding during the weekend and few beers. ;-)

I think it is also possible to automate the process of splitting a Move to phases, but the needed algorithm could become quite complex, especially if there a lots of speed variations during the move. The App created can support max. 30 phases. I might optimize it later, I think I can fit in couple of more phases with some variable re-use.


----------



## danielp27

WatchFreak_71 said:


> I wrote this simple App generator with Java, to create a "phased ghost racer" App. Check it out at:
> 
> Zippyshare.com - PhasedGhostRacer.zip
> 
> I have tested the generated app in MovesCount App Designer test section, seems to work pretty well there. Not tested in real device though... Since Suunto App language is quite simple (it lacks loops, arrays etc.), some programming with high-level language was needed. The task was not a "nightmare" at all, just couple of hours of coding during the weekend and few beers. ;-)
> 
> I think it is also possible to automate the process of splitting a Move to phases, but the needed algorithm could become quite complex, especially if there a lots of speed variations during the move. The App created can support max. 30 phases. I might optimize it later, I think I can fit in couple of more phases with some variable re-use.


awesome!


----------



## WatchFreak_71

I hope you like it.  The app is quite simple and doesn't look that polished (I am not an UI designer  ), but I guess it does the job. I plan to add also loading and saving of the table data used for generating the phases. 

The idea of auto-generating the phases (from XLS file exported from MovesCount) is fascinating, but it may be too complex to develop an algorithm that can handle many pace changes at random intervals, because hardware memory limits number of phases to 30.

By the way, how do you app hackers test/debug your apps? It is quite painful to try to debug complex apps with MovesCount App Designer, since you can't for example step the code, set breakpoints, do printf-debugging etc, as you can do with your favourite IDE/debugger. 

To overcome this problem, I wrote a simple Suunto SDK simulator, which updates values of Suunto variables, such as SUUNTO_DISTANCE, SUUNTO_DURATION etc. It also has some of the Suunto functions implemented. Since Suunto scripting language is a subset of Java (and C), I simply write a Java class for my App, using only the Suunto compatible syntax in the code. My app is inherited from Suunto simulation class, which has the functions and updates the variables. Result is that I can test and debug Suunto Apps in NetBeans / Eclipse, as easily as I test/debug my Java Apps! Once I get the code working in Eclipse, I can then test it in MovesCount App Designer test section, and finally in real hardware.


----------



## axborn

Just a quick question. 
Is there any way to output text? I've tried with prefix and postfix but they in total can only contain 6 letters. Weird thing is that the length of prefix and postfix cannot change (if prefix contains 2 letters from the start, it can't be more than 2 letters even if postfix is less than 4).
RESULT, correct me if I'm wrong, can only be no more than 6 numbers.
Is there a workaround for this? I'm trying to create an app which would say what stretch/drill to do every lap.


----------



## WatchFreak_71

axborn said:


> Just a quick question.
> Is there any way to output text? I've tried with prefix and postfix but they in total can only contain 6 letters. Weird thing is that the length of prefix and postfix cannot change (if prefix contains 2 letters from the start, it can't be more than 2 letters even if postfix is less than 4).
> RESULT, correct me if I'm wrong, can only be no more than 6 numbers.
> Is there a workaround for this? I'm trying to create an app which would say what stretch/drill to do every lap.


Maybe you could post an example of your not working code, so I could see if I can help you?


----------



## WatchFreak_71

Hey, check out this Smart Cardiac Speed App I wrote:

http://www.movescount.com/apps/app10162394-Smart_Cardiac_Speed


----------



## axborn

WatchFreak_71 said:


> Maybe you could post an example of your not working code, so I could see if I can help you?


What I initially intended and what problem I encountered can be simplified to this example:


Code:


ACTUAL = "LATERAL CROSS-OVER LUNGE";
RESULT = ACTUAL;

RESULT as I found out is an integer (6 digits max). Then I tried to output text using prefix and postfix, e.g.:


Code:


prefix = "TEXT";
postfix = "TEXT";

Which works fine as long as prefix and postfix don't exceed 6 symbols *together*. Also, interesting note - their lengths cannot change, e.g. this will not compile:


Code:


prefix = "1234";
postfix = "12";
...
prefix = "12";
postfix = "1234";

Back to the problem, I could just abbreviate but that becomes painful with many exercises.
So yeah... any ideas?


----------



## WatchFreak_71

I think there are some limitations to postfix and prefix lengths, and their combinations. I recall it was mentioned somewhere earlier in this thread. These limitations are _of_course_ not documented in Suunto App doc. 

Some of these limitations might be caused by the buggy web app; if you could bypass the pre-check in the app, I think your code might work in the actual device.

I have also noticed that sometimes when you comment out or even remove the code causing the error, Movescount still show this vague "Compilation has at least one error on line -1". You need to logout, clear cookies etc. and log in again, to get rid of this error.

One way to output long texts might be to split them, something like this:



PHP:


/* While in sport mode do this once per second */

md = Suunto.mod(SUUNTO_DURATION, 4);

/* "LATERAL CROSS-OVER LUNGE */

if (md == 0) {
    prefix = "LATERA";  
}
else if (md == 1) {
    prefix = "L CROS";
}
else if (md == 2) {
    prefix = "S OVER";
}
else {
    prefix = "LUNGE ";
}

RESULT = md;


----------



## WatchFreak_71

WatchFreak_71 said:


> I wrote this simple App generator with Java, to create a "phased ghost racer" App. Check it out at:


I just released V 0.0.2 of PhasedGhostRacer, it includes a feature to load a Move exported from MovesCount.com (in XLSX format), into the phase editor table of GUI. This new version splits a Move into 30 equal length phases, making creation of phased ghost runner Suunto app easier.

Zippyshare.com - PhasedGhostRacer.zip


----------



## WatchFreak_71

WatchFreak_71 said:


> I just released V 0.0.2 of PhasedGhostRacer, it includes a feature to load a Move exported from MovesCount.com (in XLSX format), into the phase editor table of GUI. This new version splits a Move into 30 equal length phases, making creation of phased ghost runner Suunto app easier.
> 
> Zippyshare.com - PhasedGhostRacer.zip


There was a bug in V 0.0.2: the generated app didn't always fit into memory of any supported Suunto device. It is now fixed in V 0.1.0:

Zippyshare.com - PhasedGhostRacer_V_0.1.0.zip

Please also note that the generated code is optimized in terms of Own variable use, so you need only these variables in the Own Variables section of the App:

ghostDist, distDiff, stopped, currPhase, prevPhase, numBeeps.


----------



## WatchFreak_71

There is now V 0.1.1 available at:

Zippyshare.com - PhasedGhostRacer_V_0.1.1.zip

The generated app now shows the final difference between user and ghost also as seconds. And you can now split the phases (when loading a Move exported as .XLSX file) also based on duration, in addition to distance.


----------



## WatchFreak_71

PhasedGhostRacer App is now public at MovesCount:

Phased Ghost Racer - App at Movescount.com

The app generator can be downloader from:

https://my.cloudme.com/#javac0der71/PhasedGhostRacer_V_0.1.2


----------



## richard521

can someone help me to creat an app for ambit 3 that will trigger and turn on the backlight after sunset when i press any button on the watch ?


----------



## urtenmurtel

Just in case someone is interested. I modified a conventional app from user "guigui" that gives you your heart rate zone after Karvonen BUT also displays the actual beats per minutes.
Very simple of course and the original author did the hard work but I really find the result very useful and the ability to have the app change the prefix depending on the zone, while displaying heart rate as result is cool.

/* While in sport mode do this once per second */
if (SUUNTO_HR < ((SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (modmin/100) + SUUNTO_USER_REST_HR)) {
prefix="ONE";
RESULT = SUUNTO_HR;
}
else if (SUUNTO_HR > ((SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (modmin/100) + SUUNTO_USER_REST_HR) && (SUUNTO_HR < (SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (hardmin/100) + SUUNTO_USER_REST_HR)) {
prefix="TWO";
RESULT = SUUNTO_HR;

}
else if (SUUNTO_HR > ((SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (hardmin/100) + SUUNTO_USER_REST_HR) && (SUUNTO_HR < (SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (vhrdmin/100) + SUUNTO_USER_REST_HR)) {
prefix="THREE";
RESULT = SUUNTO_HR;
}
else if (SUUNTO_HR > ((SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (vhrdmin/100) + SUUNTO_USER_REST_HR) && (SUUNTO_HR < (SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (maxmin/100) + SUUNTO_USER_REST_HR)) {
prefix="FOUR";
RESULT = SUUNTO_HR;
}
else if (SUUNTO_HR > ((SUUNTO_USER_MAX_HR - SUUNTO_USER_REST_HR) * (maxmin/100) + SUUNTO_USER_REST_HR)) {
prefix="FIVE";
RESULT = SUUNTO_HR;
}


----------



## austriker

I like this idea.. Sorry I'm no help when it comes to app creation..



richard521 said:


> can someone help me to creat an app for ambit 3 that will trigger and turn on the backlight after sunset when i press any button on the watch ?


----------



## danielp27

WatchFreak_71 said:


> PhasedGhostRacer App is now public at MovesCount:
> 
> Phased Ghost Racer - App at Movescount.com
> 
> The app generator can be downloader from:
> 
> https://my.cloudme.com/#javac0der71/PhasedGhostRacer_V_0.1.2


hi WatchFreak, 
i am going to test this weekend your app generator. my idea is to create a ghost racer app using a move where a run a certain strava segment. 
may i suggest a new feature? it would be great if you could add a checkbox in the app generator, something like "include warm up". if it is checked, then ghost racer would ignore time & distance until lap button is pressed for the 1st time. 
what do you think?


----------



## WatchFreak_71

danielp27 said:


> hi WatchFreak,
> i am going to test this weekend your app generator. my idea is to create a ghost racer app using a move where a run a certain strava segment.
> may i suggest a new feature? it would be great if you could add a checkbox in the app generator, something like "include warm up". if it is checked, then ghost racer would ignore time & distance until lap button is pressed for the 1st time.
> what do you think?


Hi danielp27,

Thanks for you suggestion. I think it is doable. Since the feature requires a bit more code, I think I have to drop max supported phases from 30 a bit, to make sure the app fits in watch memory.

I am quite busy now, so I will probably take couple of weeks until I can do this. In the meantime, you can always do your warmup as a seperate exercise.

Anyway, I am looking forward your impressions and feedback of the current version of Phased Ghost Racer, is it working OK etc?


----------



## danielp27

WatchFreak_71 said:


> Anyway, I am looking forward your impressions and feedback of the current version of Phased Ghost Racer, is it working OK etc?


cool, thanks . next time i will run my circuit as a separate exercise, and i will isue this move to create the app. i will let you know.


----------



## Tripp Knightly

richard521 said:


> can someone help me to creat an app for ambit 3 that will trigger and turn on the backlight after sunset when i press any button on the watch ?


 Not a bad idea. But I don't think it's possible. There are, as you've probably seen, apps that determine sunset or sunrise based on time of year so that's doable. There is a function that can turn on the light: _Suunto.light()_. But I don't think there are any variables that we have access to that would allow awareness of a recent button push and so that's the showstopper.


----------



## danielp27

WatchFreak_71 said:


> PhasedGhostRacer App is now public at MovesCount:
> 
> Phased Ghost Racer - App at Movescount.com
> 
> The app generator can be downloader from:
> 
> https://my.cloudme.com/#javac0der71/PhasedGhostRacer_V_0.1.2


hi WatchFreak, 
yesterday i tested the ghost racer app i generated using PhasedGhostRacer_V_0.1.2. Congratulations! it works like a charm:









distance graph is very smooth. i had 30 phases for around 5km. therefore the phases are short enough, that it did not matter that the track was rather hilly. i run the track last week and generated the app with this move. and yesterday I run against that move. the result is realistic, it matches what i'd expect.

my 5 cents: i am going to delete the beep-part of the app. hearing 3 beeps every 150m bothers me somewhat. maybe the beeps might be optional, with a check box in the app generator. but the source code is very easy to locate and delete when pasting in movescount. so not a big deal.

thanks for your effort!


----------



## WatchFreak_71

Hi danielp27,

I am glad to hear you like the app and it worked correctly.  I'll add the optional beep to my TODO-list.

Edit: There seems to be a bug in MovesCount; on graph it doesn't show application prefix and postfix correctly, the last logged prefix and postfix are displayed everywhere on the graph.


----------



## achtungpop

Hello all  .
1st I'm sorry in advance for my english, I'm a french runner , and I don't find what I'm looking for in french forums ...
For this reason, it's also hard for me to read the 42 pages here, so sorry in advance too if answers to my questions are already in this thread !

i've a Suunto Ambit 2 for 1 month . But I miss some cool and simple functions of my old garmin forerunners 210 ... and I d'like to know if those things are possible to build with app programmation :

1) When I make special training with for example 3000m fast then 1min30sec cool then 2000m fast then 1min30sec cool etc ... I've understood how to build the app itself, but I d'love that each of thoses steps appears as a lap, to check live the speed, average speed, remaining distance or time , etc ! For now I just have a "beep" at the end of each step, not bad, but far from what I expected !

2) with the same training example, I like to ask a warning beep if I run too fast or too slow . the problem is that this beep is the same that the beep giving the end of the step ... is it possible to program different beep ? for example when we begin something, the triple beep is not the same, like when GPS are found ? can we use this special beep ?

3) is it possible to see something like 30sec 29 28 27 26 25 ....3 2 1 before a special step will begin ? or even better, that the 3 last seconds beep, so that we are ready to begin ? I've found this could happen with "warntime" function, but as I told I'm unable to program so I absolutly don't know where to insert this in a program !!

Thanx in advance for any advices !! great forum


----------



## RockBird

Does anyone know how to detect manual laps or laps between 2 waypoints ?


----------



## nerd_runner

Hi WatchFreak_71!
Your ghost racer looks promising. I'm entering a trail marathon in 3 weeks, and been thinking about different ways for pacing. I did the same race in 2013, so I have the splits form my Polar watch. I initially wrote a simple app that compares 5k splits from 2013 to SUUNTO_DURATION, and shows the difference in percentage. This way I know I'll finish in under 5 hours, if I only manage to keep the difference in -4% (my time in 2013 was 5:11:00). To keep the app as simple as possible I took only 5k splits and interpolated the pace in between.

Now I'm thinking of doing something more complicated, and ran into your app. It doesn't work for me as it is, because the distance difference is not important for me. I would need the time difference displayed in minutes or percentage. 
Would it be easy to do it this way? Btw, what does the prefix tell? I tried to figure it out from the code, but no luck...


----------



## nerd_runner

Any tips on optimizing this code? It's the app I refer to in my previous message.

/* While in sport mode do this once per second */
if (SUUNTO_DISTANCE<5) {
 ghostpace = (1693/5);
}
else if (SUUNTO_DISTANCE>=5 && SUUNTO_DISTANCE<10){
 ghostpace = ((1693+427*(SUUNTO_DISTANCE-5))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=10 && SUUNTO_DISTANCE<15){
 ghostpace = ((3827+380*(SUUNTO_DISTANCE-10))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=15 && SUUNTO_DISTANCE<20){
 ghostpace = ((5727+419*(SUUNTO_DISTANCE-15))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=20 && SUUNTO_DISTANCE<25){
 ghostpace = ((7824+524*(SUUNTO_DISTANCE-20))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=25 && SUUNTO_DISTANCE<30){
 ghostpace = ((10444+530*(SUUNTO_DISTANCE-25))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=30 && SUUNTO_DISTANCE<35){
 ghostpace = ((13096+400*(SUUNTO_DISTANCE-30))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=35 && SUUNTO_DISTANCE<40){
 ghostpace = ((15096+398*(SUUNTO_DISTANCE-35))/SUUNTO_DISTANCE);
}
else if (SUUNTO_DISTANCE>=40 && SUUNTO_DISTANCE<45){
 ghostpace = ((17084+498*(SUUNTO_DISTANCE-40))/SUUNTO_DISTANCE);
}


RESULT = (SUUNTO_DURATION/SUUNTO_DISTANCE - ghostpace) / ghostpace*100;


----------



## WatchFreak_71

nerd_runner said:


> Any tips on optimizing this code? It's the app I refer to in my previous message.


You could do the comparisons starting from highest distance; when doing so, you need only on comparison / line:

if (SUUNTO_DISTANCE >= 45) 
ghostpace = xxxxx
else if (SUUNTO_DISTANCE >= 40)
ghostpace = yyyyyy
else if (SUUNTO_DISTANCE >= 35)
ghostpace = zzzzzz

etc...

This could save you few bytes of app memory.


----------



## Ivan_Ivanusic

How I can import file from PolarPersonalTrainer to PhasedGhostRacer?
Does anybody have idea? 
Thanks


----------



## danielp27

Ivan_Ivanusic said:


> How I can import file from PolarPersonalTrainer to PhasedGhostRacer?
> Does anybody have idea?
> Thanks


you can use this tool:
Meeximum Running Blog: MXActivityMover

i used it when i bought my suunto to export all my garmin connect activities to movescount. i have just checked, and it seems it supports polar personal trainer too. once the move is in movescount, you should be able to download any activity as an excel file. at least i can download my old adidas micoach and garmin fr405 in excel format. i guess it will work for polar too.


----------



## Ivan_Ivanusic

I made that but I think movescount shows wrong value when i'm testing it.
I havent tested app yet on watch


----------



## richard521

Can anyone help me to create an app that works as a countdown timer, which can calculate the time to sunrise/sunset, based on the watch's gps coordinate of last known position ?


----------



## pjc3

richard521 said:


> Can anyone help me to create an app that works as a countdown timer, which can calculate the time to sunrise/sunset, based on the watch's gps coordinate of last known position ?


Suunto already has one.

Sent from my iPhone using Tapatalk


----------



## richard521

pjc3 said:


> richard521 said:
> 
> 
> 
> Can anyone help me to create an app that works as a countdown timer, which can calculate the time to sunrise/sunset, based on the watch's gps coordinate of last known position ?
> 
> 
> 
> Suunto already has one.
> 
> Sent from my iPhone using Tapatalk
Click to expand...

Suunto's sunrise/sunset app required the watch to get a perfect gps signal every time in order to show the time to sunrise/ sunset
.
...my point is, i hope that someone can create an sunrise/sunset count timer app that use watch last known gps position, so that when I am indoor , the watch can still show the time to sunrise / sunset


----------



## danielp27

richard521 said:


> Suunto's sunrise/sunset app required the watch to get a perfect gps signal every time in order to show the time to sunrise/ sunset
> .
> ...my point is, i hope that someone can create an sunrise/sunset count timer app that use watch last known gps position, so that when I am indoor , the watch can still show the time to sunrise / sunset


hi Richard, 
i think the code necessary to implement it is here
sunrise.c

it is not straight forward because in suunto apps you cannot define subroutines. but should be doable by substituting the subroutine calls by the subroutine code itself. and of course some testing effort. the source code is even written in c which is very similar to the language used in apps. 
sorry i am not helping more here. i have very limited free time. but maybe somebody might read this and try to implement it.


----------



## Nick Sutton

Hi All, just popped by as I got myself stuck with the App Designer. I got a Suunto Traverse for Christmas (Awesome!) and it replaces my Garmin smart band thingy that used to shout at me if i hadn't moved for a number of hours (I'm usually office based).

So I was thinking of starting a lap, and if speed doesn't get above 5km/h within 2 hours of the duration then it should beep, or light up, or add a prefix.
This is pretty simple, but I'm having trouble working out a way to reset the lap duration where speed > 5 is found... 

Is there a better way?

Cheers,
Nick


----------



## danielp27

Nick Sutton said:


> I'm having trouble working out a way to reset the lap duration where speed > 5 is found...


Hi Nick, I'm not sure I have understood what you pretend. You want to trigger a new lap from an app? If that's what you want, I am sorry to say it's not possible. There are just two options there: manual lap button or autolap settings.
Maybe you can post your app so that we can figure out a workaround depending on your needs.


----------



## Nick Sutton

Hi Daniel,
Thanks for the reply - Allow me to expand.

I'd like to use the traverse to remind me to move a minimum distance whilst sat at my desk every few hours. There are many evidenced health benefits to this, and with the Traverse being such a beauty I intend to wear it at work and not just out on the hills.

The traverse replaces my Garmin Vivosmart which periodically alerts you to move following about two hours of inactivity.

So I was thinking I could replicate this functionality with a Suunto App?

The logic being:

timer = 0

if speed > 5kmh or distance moved > 200 meters then reset timer

else if timer breaches two hours alert user 
Optionally, record the number of alerts triggered until movement is detected

I was thinking to start the lap as the timer, but can't see a way to reset following movement being detected!

Cheers,
Nick


----------



## danielp27

Nick Sutton said:


> Hi Daniel,
> The logic being:
> 
> timer = 0
> 
> if speed > 5kmh or distance moved > 200 meters then reset timer
> 
> else if timer breaches two hours alert user


Hi Nick, 
i think this might work. by the way, there is a known bug in watchuseek. closing brace is shown as '..'. take this into account when writing your app. 
you have to create and initialize to zero variables ZERO_DURATION and ZERO_DISTANCE
the app will show how long has gone by since you moved for the last time. choose format 'time'. 
i hope it suits your needs.



Code:


/* While in sport mode do this once per second */
/* if speed > 5kmh or distance moved > 200 meters then reset timer */
if(SUUNTO_SPEED>5 || SUUNTO_DISTANCE-ZERO_DISTANCE>0.2)
{
  ZERO_DURATION = SUUNTO_DURATION;
  ZERO_DISTANCE= SUUNTO_DISTANCE;
..
/* else if timer breaches two hours alert user  */
else if((SUUNTO_DURATION-ZERO_DURATION) > 7200)
{
  Suunto.alarmBeep();
..
/*choose format 'time' and the app will show how long since you moved for the last time*/
RESULT=SUUNTO_DURATION-ZERO_DURATION;


----------



## Nick Sutton

Thanks Daniel,
it doesn't work entirely as expected now its on the watch, but I'll have play around and see what I can do - Was super impressed though that the app appeared from MovesCount over BT sync with my phone though!!

Love this thing!!!!


----------



## bbsingao

hi,all . 
is there a way to show multiple RESULT in one app ? 
like say , show 6 datafields in one app .
i thinks the origin 3 datafiled in a page is so limited.


----------



## Tronen

Hi, it is my first time in this forum, hi everybody.

My problem is that when I used one app then* I don't see the RESULT value in the screen*. Instead of the value the name of the app is displayed. I don't know why.

Curiously, when the moves are uploaded to Movescount the app data are well displayed like a graph provided that the app was logged. What's happening?

I have made this public app:

INSTANT_STEP_LENGTH_IN_METERS

I works fine when the graph is seen in Movescount but I can't see the RESULT value in the Ambit 3 screen (the name of the app is displayed instead).

Please, help.


----------



## Tronen

Tronen said:


> Hi, it is my first time in this forum, hi everybody.
> 
> My problem is that when I used one app then* I don't see the RESULT value in the screen*. Instead of the value the name of the app is displayed. I don't know why.
> 
> Curiously, when the moves are uploaded to Movescount the app data are well displayed like a graph provided that the app was logged. What's happening?
> 
> I have made this public app:
> 
> INSTANT_STEP_LENGTH_IN_METERS
> 
> I works fine when the graph is seen in Movescount but I can't see the RESULT value in the Ambit 3 screen (the name of the app is displayed instead).
> 
> Please, help.


I reply myself. I've discovered that the problem happened *when **autoscroll **screen mode is selected in the settings*. When autoscroll is selected then the RESULT value is not displayed (in the screen in which the app is set). It's necessary to change manually with the buttons and then it works fine.

I don't know why when autoscroll screen mode is selected the RESULT value is not displayed but it would be a possible improve for a new firmware in the future for Ambit 3 series.


----------



## pjc3

Sorry you had to reply to yourself. It is a known issue as the 1sec default autoscroll coincides with the 1sec app name. Suunto was made aware of this a while ago. Can't find the previous discussions but they are in her somewhere. If you want autoscroll try changing the duration to something longer.


----------



## Tronen

pjc3 said:


> Sorry you had to reply to yourself. It is a known issue as the 1sec default autoscroll coincides with the 1sec app name. Suunto was made aware of this a while ago. Can't find the previous discussions but they are in her somewhere. If you want autoscroll try changing the duration to something longer.


Ok, thanks. Don't worry.

Now I change the screens manually with buttons. This is not to much confortable but I would not like an autoscroll duration longer than 4 seconds because when I look to the watch a lot of good look is needed to find the screen I`m expecting to see.

I wish Suunto took care of this issue.

Thanks again.


----------



## Carel

Hi All,

I am about to start programming an App for my Ambit 2S. For indoor rowing I want to record the distance that I am rowing. The variable SUUNTO_DISTANCE is not used for this sport activity. I would thus like to use this variable SUUNTO_DISTANCE and program it for instance by SUUNTO_DISTANCE = SUUNTO_DURATION * 0.038333.

Would that be possible?


----------



## danielp27

Carel said:


> Hi All,
> 
> I am about to start programming an App for my Ambit 2S. For indoor rowing I want to record the distance that I am rowing. The variable SUUNTO_DISTANCE is not used for this sport activity. I would thus like to use this variable SUUNTO_DISTANCE and program it for instance by SUUNTO_DISTANCE = SUUNTO_DURATION * 0.038333.
> 
> Would that be possible?


Hi Carel, unfortunately i dont think you can do that. 
but if your app is called lets say "ROWING DISTANCE", you can write in the app RESULT = SUUNTO_DURATION * 0.038333; 
and it wil calculate the value. 
you can add the app to a sport mode, and check the box so that data is recorded, and you can watch the graph in movescount , for instance .

one tip regarding your app. i dont do rowing. but most probably, you will get cadence information from watch if you use an sport mode whose activity is for instance "treadmill", instead of "rowing". cadence is only enabled for run related activities. using cadence info (actually would be "stroke rate") you might write a smarter app. you can add some meters for each stroke, for instance. not 100% sure that the movement will be detected by the accelerometer. but might be worth to try.


----------



## pa7a7oz

Hello, 
I'm french and i have found a guys (nakan blog) who has designed a app for garmin watches to calculate the W' value (used with power meter on a bike)
here the link of the app with a very nice video
Afficher la balance de W' sur son guidon - nakan.ch
and here how the calculus are be done.
40 Goals: W'bal its implementation and optimisation (golden cheetah developper)
I'am not developer, but any people could be develop it on movescount?
Look at the video to understand how the app works

Sorry for my english

Julien,


----------



## danielp27

pa7a7oz said:


> and here how the calculus are be done.
> 40 Goals: W'bal its implementation and optimisation


hi, i have taken a look at golden cheetah source code and i think this one does the trick
W'bal - App at Movescount.com

i have used SUUNTO_BIKE_POWER_AVG[3] instead of SUUNTO_BIKE_POWER because for me the 2nd one seems not to work in movescount: at least it is not shown in the emulator. 
i dont own a powermeter nor i know anything about this model. but comparing with the video, the apps seems to behave in a similar way.
all the credit to Dr. Skiba and Mark Liversedge, the man behind golden cheetah
the app asumes
CP = 250;
WPRIME = 20000;

once you know your values, you can create a copy of the app and modify them in the source code. maybe @pa7a7oz can give a hint how to obtain them.


----------



## PabloAlarcon

Hi you all! straigt to the point. I just got a new Ambit 3 Peak Sapphire an I set mi apps I was using in my Ambit 2 Sapphire; the thing is I got weird result for the same app, I wonder what could be. I guess the variables in the apps are the same regardless of the Ambit model. Here are the 2 moves so you can se how the app looks like in Ambit 2 and how it looks in Ambit 3. This is the app: Heart Rate Zone and % - App at Movescount.com

here are the moves:

Ambit 2: PabloAlarcon's 1:40 h Trail running Move

Ambit3: PabloAlarcon's 0:54 h Trail running Move

also the ap: Lap Ascent doesn't work correctly since it doesnt' show ascent per laps even though i pressed lap button I just shows a continuos ascent

I hope someone could tellme what could be wrong.

Thanks a lot!!


----------



## danielp27

PabloAlarcon said:


> Hi you all! straigt to the point. I just got a new Ambit 3 Peak Sapphire an I set mi apps I was using in my Ambit 2 Sapphire; the thing is I got weird result for the same app, I wonder what could be. I guess the variables in the apps are the same regardless of the Ambit model. Here are the 2 moves so you can se how the app looks like in Ambit 2 and how it looks in Ambit 3. This is the app: Heart Rate Zone and % - App at Movescount.com
> also the ap: Lap Ascent doesn't work correctly since it doesnt' show ascent per laps even though i pressed lap button I just shows a continuos ascent


hi pablo, 
this is weird! also the running power app makes no sense either.

i bet, the problem is not the watch, but movescount. I bet they have changed something in app parsing, and recently synced apps are not syncing fine. 
are you using the public apps, or creating your own copies of them?


----------



## crawler2040

Well i think i kinda figured it out, i think it is a movescount issue, if you look results for app RUNNING P3 you will see a graph result that corresponds to the app LAP ASCENT with his values, if see app LAP ASCENT results youll see the graph for TRIMP V2 and so on for the other app results. Does anyone have this same issue?

Enviado desde mi GT-P5100 mediante Tapatalk


----------



## crawler2040

danielp27 said:


> hi pablo,
> this is weird! also the running power app makes no sense either.
> 
> i bet, the problem is not the watch, but movescount. I bet they have changed something in app parsing, and recently synced apps are not syncing fine.
> are you using the public apps, or creating your own copies of them?


Hi daniel yes i figured it out just now, didnt know that there were issues with app syncing, but it is definitly movescount I hope they fix it sooon , i just posted what i found out about the issue just seconds ago.

Enviado desde mi GT-P5100 mediante Tapatalk


----------



## mondoshawan

crawler2040 said:


> Hi daniel yes i figured it out just now, didnt know that there were issues with app syncing, but it is definitly movescount I hope they fix it sooon , i just posted what i found out about the issue just seconds ago.
> 
> Enviado desde mi GT-P5100 mediante Tapatalk


i just figured out 2 days ago that it is definitely not the watch. If you are logging more than one app, then movescount is now mixing up the results and formats of those 2 apps! This happened first time 2 weeks ago, as suunto updated movescount. i informed them about this issue, but nothing happened till now.

edit: my workaround for now is only logging one app


----------



## crawler2040

mondoshawan said:


> i just figured out 2 days ago that it is definitely not the watch. If you are logging more than one app, then movescount is now mixing up the results and formats of those 2 apps! This happened first time 2 weeks ago, as suunto updated movescount. i informed them about this issue, but nothing happened till now.
> 
> edit: my workaround for now is only logging one app


Yes, as you said, I'm loggin 5 apps and it's a mess I just hope the fix comes soon since logging more than one app was suppose to be an improvement since ambit2 series and this is a mayor step backwards, for me at least.

Enviado desde mi GT-P5100 mediante Tapatalk


----------



## crawler2040

Does anyone know if the issue when logging more than 1 app is gone? Havent tried yet to check it 

Enviado desde mi GT-P5100 mediante Tapatalk


----------



## Tronen

I think there is a problem with the definition of *Tail Diff variables*.

I copy this definition form the Dev. Manual:
TAIL VALUES
"Diff: difference between first and last value, that is, the value at the first second of the tailcompared to the value at the last second of the tail"

Lets suppose than we have a 130 bpm heart rate values at the first second of a 30seconds tail and we have 123 bpm at the last second. Then 130 - 123 = 7 bpm and that would be the result of SUUNTO_HR_DIFF[30] but the problem is that the result of any Tail Diff variables couldn't be less than 30 when we are dealing with heart rate issues.

What's wrong or is there anything that I don't understand about Tail Diff variables?

Thanks


----------



## Tronen

I'm a 50 years old man with 107 kg bodyweight. I like bodybuilding and I'm trying to make *an app to count the series done during a training session*. I know that it could be achived pressing the LAP button but I want the app analyzes the heart rate and it would find automatically each HR peak that correspond each serie.

For example, here is an image of my today legs training. The first 5 minutes are to prepare the legs (370 W average in a static bicycle). After that, each squat serie is easily identified but a huge HR increase.









I think the goal is to identify when a rapid HR increase occurs.

Any ideas???


----------



## Tronen

OK, I've tried this code:

/* While in sport mode do this once per second */
Count = Count + 1;
if (Count < 20){
if (Count == 1){
HR1 = SUUNTO_HR;
..
if (Count == 2){
HR2 = SUUNTO_HR;
..
if (Count == 3){
HR3 = SUUNTO_HR;
..
if (Count == 4){
HR4 = SUUNTO_HR;
..
if (Count == 5){
HR5 = SUUNTO_HR;
..
if (Count == 6){
HR6 = SUUNTO_HR;
..
if (Count == 7){
HR7 = SUUNTO_HR;
..
if (Count == 8){
HR8 = SUUNTO_HR;
..
if (Count == 9){
HR9 = SUUNTO_HR;
..
if (Count == 10){
HR10 = SUUNTO_HR;
..
if (Count == 11){
HR11 = SUUNTO_HR;
..
if (Count == 12){
HR12 = SUUNTO_HR;
..
if (Count == 13){
HR13 = SUUNTO_HR;
..
if (Count == 14){
HR14 = SUUNTO_HR;
..
if (Count == 15){
HR15 = SUUNTO_HR;
..
if (Count == 16){
HR16 = SUUNTO_HR;
..
if (Count == 17){
HR17 = SUUNTO_HR;
..
if (Count == 18){
HR18 = SUUNTO_HR;
..
if (Count == 19){
HR19 = SUUNTO_HR;
..
if (Count == 20){
HR20 = SUUNTO_HR;
..
INCR = HR20 - HR1;
if ((HR1 <= HR2) && (HR2 <= HR3) && (HR3 <= HR4) && (HR4 <= HR5) && (HR5 <= HR6) && (HR6 <= HR7) && (HR7 <= HR8) && (HR8 <= HR9) && (HR9 <= HR10) && (HR10 <= HR11) && (HR11 <= HR12) && (HR12 <= HR13) && (HR13 <= HR14) && (HR14 <= HR15) && (HR15 <= HR16) && (HR16 <= HR17) && (HR17 <= HR18) && (HR18 <= HR19) && (HR19 <= HR20) && (INCR > 10)){
SERIES = SERIES + 1; 
..
..
else if (Count >= 20){
HR1 = HR2;
HR2 = HR3;
HR3 = HR4;
HR4 = HR5;
HR5 = HR6;
HR6 = HR7;
HR7 = HR8;
HR8 = HR9;
HR9 = HR10;
HR10 = HR11;
HR11 = HR12;
HR12 = HR13;
HR13 = HR14;
HR14 = HR15;
HR15 = HR16;
HR16 = HR17;
HR17 = HR18;
HR18 = HR19;
HR19 = HR20;
HR20 = SUUNTO_HR;
INCR = HR20 - HR1;
if ((HR1 <= HR2) && (HR2 <= HR3) && (HR3 <= HR4) && (HR4 <= HR5) && (HR5 <= HR6) && (HR6 <= HR7) && (HR7 <= HR8) && (HR8 <= HR9) && (HR9 <= HR10) && (HR10 <= HR11) && (HR11 <= HR12) && (HR12 <= HR13) && (HR13 <= HR14) && (HR14 <= HR15) && (HR15 <= HR16) && (HR16 <= HR17) && (HR17 <= HR18) && (HR18 <= HR19) && (HR19 <= HR20) && (INCR > 10)){
SERIES = SERIES + 1; 
..
..
RESULT = SERIES;

Of course, all the used variables are correctly declared and initialized at first.

The idea is to have 20 Heart rate memories as variables. They will rename in order each second. The first now will be the second, the second the third and so on. The 20th one will be the new HR given by the watch and so on.

When an explosive bodybuilding serie is done an increase of the heart rate at least in 20 seconds is expected. Is permitted a non constant HR increase (that's the reason why a <= is permitted between HRs in the conditional. In my case, an increase of 10 bpm is expected in this serie between the last and the first bpm values. (I'm sure that I will need verify this parameter of 10 bmp increase).

When these conditions are passed then SERIES = SERIES + 1.

The app is well verified by the online Suunto compiler and no error is given. But a Whoops! Please check the formula. is given. Why??? The Test simulator doesn't work well. The Counter really works automatically and it increases by one each second but it only arrives just to 20 and it stops. The HR variables are not well self-actualized from HR values and only it moves only to just HR6 and no more.

I will test this code in my watch but I have not too much hope that it works.

I'm lost in the darkness.


----------



## richard1102ho

Can someone can help me to build a suunto app that can show moon phase & moon rise/set time? thx for help,

( the current moon age in app zone only show moon phase in % )


----------



## martowl

richard1102ho said:


> Can someone can help me to build a suunto app that can show moon phase & moon rise/set time? thx for help,
> 
> ( the current moon age in app zone only show moon phase in % )


This one is good enough for me and has what you want except for the rise/set times. Maybe you can build off of this one.

Moon - App at Movescount.com


----------



## mondoshawan

richard1102ho said:


> Can someone can help me to build a suunto app that can show moon phase & moon rise/set time? thx for help,
> 
> ( the current moon age in app zone only show moon phase in % )


this app would use 2 different formats: time and integer. Apps can only be build at one format, we can't mix them up in one app. So you would need 2 different apps running at the same time. But i'm no help to build the requested Moon rise/set time app.


----------



## krazyeone

Hi
I have two small questions:

1.I put an basic app to calculate Heart rate reserve in % , what happens when I tick Log App? I will have an graph in movescount? I remember that before last FW I tick log app and I had an message with Memory full but don't know if that was the problem

2.Can I change an field name from Suunto defaults fields? For Lap avg pace and Average pace is the same name field = Avg , and I want somehow to distinguish faster if I change display page ,
If can be renamed , they use only 3 characters or it can be more?

Thank you


----------

