Ambit Apps Compilation
-
We’ll, this is just plain wonderfull!
-
@sebchastang said in Ambit Apps Compilation:
Is it possible to create new apps with this method?
I assume so, though as it lacks proper error handling n etc I’d rather see it as a tool for existing apps users to adjust existing app settings than developing app from scratch.
How to declare new variables?
See “detailed instructions” section on user variables and sample request. Is that what you are asking for or something else?
How can we set the output format (0 decimal, 1 decimal, time, …)?
Do we set prefix and postfix values just like other variables?I just added info about that int “detailed instructions” section
It is definitely a great step forward to be able to edit Suunto Apps using a command line but it would be much more easy in a graphical way. Any plan for such a user interface?
Well, it’s not difficult to create simple UI for that (like editor form & compilation output, not trying to copy Movescount UI) but not sure if I have time to do that and when. Also may be even better to integrate such UI into SL, but we’re unlikely have resources to do that soon.
-
@pavel-samokha Thanks for the clarification and answers.
I also think it is more a way to modify an existing app than creating a new ones.
I asked for new variables because there was a specific section to declare them in movescount but I understand I have to declare and set variable values at the same time in the header section now.
-
Added Simple UI for Compiler
-
Now I have learned more old watches internal names
-
Hi,
I have compilation error when I set prefix and postfix values in the header section.
I have tried:
prefix = “xxx”
prefix = ‘xxx’
prefix = xxxformat is OK. Only prefix and postfix give errors.
Can anybody help me?
Thanks. -
@sebchastang did you put prefix/postfix in the header?
yes (sorry I’ve just relized you wrote that). I moved those in the code . -
@sebchastang I’ll check on the weekend
-
@G-Q @pavel-samokha thanks for your answers.
-
@sebchastang
prefix = xxx
should work now -
@pavel-samokha Thanks a lot!
It’s all good nowDo you think there is a possibility (in a near future) to give access to the app simulator we had in movescount to test the apps?
-
@sebchastang Unfortunately, I think it’s unlikely
-
The trial is OK, thank you!
-
@pavel-samokha Thank you for the implementation!
I’ve created the below app, but when trying to create or edit a sport mode, displays are not loading.
curl --location --request POST 'https://ambitappscompiler.azurewebsites.net/api/compile' \ --header 'x-functions-key: qakj8vb/62VgzmSl19mDQzRmW7nCSDv0zAo2A1aC3ldfd8U8r5jksA==' \ --header 'Content-Type: text/plain' \ --data-raw '/* Duration App */ /* Interval 1 */ /* Initialize variables */ if (SUUNTO_DURATION == 0) { RESULT = 0; } /* Lap 1, 2 is step type Interval with duration type Time */ if (SUUNTO_LAP_NUMBER == 1 || SUUNTO_LAP_NUMBER == 2) { prefix = "int"; postfix = "s"; RESULT = 5 - SUUNTO_LAP_DURATION; } /* Lap 3 is step type Interval with duration type Time */ if (SUUNTO_LAP_NUMBER == 3) { prefix = "int"; postfix = "s"; RESULT = 10 - SUUNTO_LAP_DURATION; } /* Lap 4, 5, 6 is step type Interval with duration type Time */ if (SUUNTO_LAP_NUMBER == 4 || SUUNTO_LAP_NUMBER == 5 || SUUNTO_LAP_NUMBER == 6) { prefix = "int"; postfix = "s"; RESULT = 15 - SUUNTO_LAP_DURATION; } /* Lap 7 is step type Interval with duration type Time */ if (SUUNTO_LAP_NUMBER == 7) { prefix = "int"; postfix = "s"; RESULT = 20 - SUUNTO_LAP_DURATION; } /* Check if duration is reached */ if (RESULT < 0) { RESULT = 0; /* Alert that duration is reached */ Suunto.alarmBeep(); Suunto.light(); }'
-
@christos-palikaras I guess corrupted index.json may be cause this. I’ll try to update doc with more detailed instructions.
-
@pavel-samokha It seems that the output of the Compiler UI should be an array of json objects. That fixed my issue.
-
@christos-palikaras yes, in index.json it’s an JSON array, but compiler output is one json object with assumption that user might want to add it to existing array of apps, not replacing it completely with one.
-
share Power_Zone:
/FTP=SUUNTO_USER_HEIGHT+100; Because SUUNTO_USER_HEIGHT≤250;of course you can +200 or +300//*FTP=SUUNTO_USER_HEIGHT+100; Because SUUNTO_USER_HEIGHT≤250;*/ RESULT = 0; FTP=SUUNTO_USER_HEIGHT+100; if(SUUNTO_BIKE_POWER_AVG[3] < FTP * 25/100) { RESULT=( 0 + (SUUNTO_BIKE_POWER_AVG[3] / (FTP * 25/100)) );postfix="Rest"; } else if (SUUNTO_BIKE_POWER_AVG[3] < FTP * 55/100) { RESULT=(1 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 25/100) ) / ( (FTP * 55/100) - (FTP * 25/100) ) ) ) ;postfix="Rec"; } else if (SUUNTO_BIKE_POWER_AVG[3]>FTP * 55/100 && SUUNTO_BIKE_POWER_AVG[3]< FTP * 75/100) {RESULT=(2 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 55/100) ) / ( (FTP * 75/100) - (FTP * 55/100) ) ) );postfix="End"; } else if (SUUNTO_BIKE_POWER_AVG[3]>FTP * 75/100 && SUUNTO_BIKE_POWER_AVG[3] < FTP * 90/100) {RESULT=(3 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 75/100) ) / ( (FTP * 90/100) - (FTP * 75/100) ) ) ) ;postfix="Temp"; } else if (SUUNTO_BIKE_POWER_AVG[3]> FTP * 90/100 && SUUNTO_BIKE_POWER_AVG[3]< FTP* 105/100 ) {RESULT=(4 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 90/100) ) / ( (FTP * 105/100) - (FTP * 90/100) ) ) );postfix="Thresh"; } else if(SUUNTO_BIKE_POWER_AVG[3]> FTP * 105/100 && SUUNTO_BIKE_POWER_AVG[3]< FTP * 120/100) {RESULT=(5 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 105/100) ) / ( (FTP * 120/100) - (FTP * 105/100) ) ) ) ;postfix="VO2M"; } else if(SUUNTO_BIKE_POWER_AVG[3]> FTP * 120/100 && SUUNTO_BIKE_POWER_AVG[3]< FTP * 150/100) {RESULT=(6 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 120/100) ) / ( (FTP * 150/100) - (FTP * 120/100) ) ) );postfix="Anaer"; } else if (SUUNTO_BIKE_POWER_AVG[3] > FTP * 150/100 ) {RESULT=(7 + ( ( SUUNTO_BIKE_POWER_AVG[3] - (FTP * 150/100) ) / ( 2000 - (FTP * 150/100) ) ) ) ;postfix="SPRINT"; }
[json]
{"ruleId":11000004,"name":"Power_Zone","categoryId":0,"activityId":1,"userCount":1,"binary":[73,65,77,82,85,76,69,0,8,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,130,0,0,0,42,0,50,0,60,0,70,0,80,0,88,0,110,0,0,0,114,117,108,101,48,0,255,191,82,69,83,85,76,84,0,0,255,63,112,111,115,116,102,105,120,0,255,63,112,114,101,102,105,120,0,0,255,63,116,105,116,108,101,0,85,0,83,85,85,78,84,79,95,85,83,69,82,95,72,69,73,71,72,84,0,0,69,0,83,85,85,78,84,79,95,66,73,75,69,95,80,79,87,69,82,0,4,0,2,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,1,0,0,0,0,0,2,0,0,0,32,0,7,0,0,0,0,0,6,0,0,0,32,0,1,0,0,0,0,0,14,0,0,0,32,0,1,0,0,0,0,0,16,0,0,0,4,0,1,0,0,0,0,0,18,0,0,0,4,0,4,0,0,0,0,0,22,0,0,0,4,0,0,0,0,0,0,0,38,0,0,0,4,0,0,0,0,0,0,0,42,0,0,0,160,0,1,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,46,0,0,0,4,0,0,0,0,0,0,0,50,0,0,0,4,0,0,0,0,0,0,0,54,0,0,0,160,0,5,0,0,0,0,0,2,0,0,0,160,0,4,0,0,0,0,0,8,0,0,0,160,0,4,0,0,0,0,0,12,0,0,0,160,0,5,0,0,0,0,0,16,0,0,0,160,0,7,0,0,0,0,0,22,0,0,0,160,0,5,0,0,0,0,0,30,0,0,0,160,0,6,0,0,0,0,0,36,0,0,0,160,0,7,0,0,0,0,0,42,0,0,0,58,0,50,0,0,0,82,101,115,116,0,0,82,101,99,0,69,110,100,0,84,101,109,112,0,0,84,104,114,101,115,104,0,0,86,79,50,77,0,0,65,110,97,101,114,0,83,80,82,73,78,84,0,0,52,3,28,7,0,22,32,0,144,0,0,0,0,21,8,0,25,16,9,24,89,2,0,25,16,9,24,89,3,0,25,16,9,24,89,4,0,16,1,21,7,0,28,5,0,28,6,0,12,22,6,0,13,0,3,18,252,2,144,0,0,64,64,21,10,0,20,10,0,144,0,0,0,0,7,22,48,0,20,10,0,144,0,0,128,191,1,144,0,0,128,63,1,84,6,0,20,10,0,144,0,0,128,63,1,85,6,0,20,10,0,144,0,0,128,191,1,21,10,0,13,202,255,144,0,0,0,0,21,11,0,144,0,0,128,63,21,10,0,20,10,0,144,0,0,128,64,5,22,61,0,20,11,0,20,10,0,144,0,0,128,63,1,84,6,0,1,21,11,0,20,10,0,144,0,0,64,64,9,22,15,0,20,11,0,144,171,170,170,62,3,21,8,0,20,10,0,144,0,0,128,63,1,21,10,0,13,189,255,144,0,0,0,0,21,1,0,20,5,0,144,0,0,200,66,1,21,12,0,20,8,0,20,12,0,144,0,0,128,62,3,5,22,35,0,20,8,0,20,12,0,144,0,0,128,62,3,4,144,0,0,0,0,1,21,1,0,25,16,13,24,89,2,0,13,30,2,20,8,0,20,12,0,144,205,204,12,63,3,5,22,55,0,20,8,0,20,12,0,144,0,0,128,62,3,2,20,12,0,144,205,204,12,63,3,20,12,0,144,0,0,128,62,3,2,4,144,0,0,128,63,1,21,1,0,25,16,14,24,89,2,0,13,218,1,20,8,0,20,12,0,144,205,204,12,63,3,7,20,8,0,20,12,0,144,0,0,64,63,3,5,11,22,55,0,20,8,0,20,12,0,144,205,204,12,63,3,2,20,12,0,144,0,0,64,63,3,20,12,0,144,205,204,12,63,3,2,4,144,0,0,0,64,1,21,1,0,25,16,15,24,89,2,0,13,136,1,20,8,0,20,12,0,144,0,0,64,63,3,7,20,8,0,20,12,0,144,102,102,102,63,3,5,11,22,55,0,20,8,0,20,12,0,144,0,0,64,63,3,2,20,12,0,144,102,102,102,63,3,20,12,0,144,0,0,64,63,3,2,4,144,0,0,64,64,1,21,1,0,25,16,16,24,89,2,0,13,54,1,20,8,0,20,12,0,144,102,102,102,63,3,7,20,8,0,20,12,0,144,102,102,134,63,3,5,11,22,55,0,20,8,0,20,12,0,144,102,102,102,63,3,2,20,12,0,144,102,102,134,63,3,20,12,0,144,102,102,102,63,3,2,4,144,0,0,128,64,1,21,1,0,25,16,17,24,89,2,0,13,228,0,20,8,0,20,12,0,144,102,102,134,63,3,7,20,8,0,20,12,0,144,154,153,153,63,3,5,11,22,55,0,20,8,0,20,12,0,144,102,102,134,63,3,2,20,12,0,144,154,153,153,63,3,20,12,0,144,102,102,134,63,3,2,4,144,0,0,160,64,1,21,1,0,25,16,18,24,89,2,0,13,146,0,20,8,0,20,12,0,144,154,153,153,63,3,7,20,8,0,20,12,0,144,0,0,192,63,3,5,11,22,55,0,20,8,0,20,12,0,144,154,153,153,63,3,2,20,12,0,144,0,0,192,63,3,20,12,0,144,154,153,153,63,3,2,4,144,0,0,192,64,1,21,1,0,25,16,19,24,89,2,0,13,64,0,20,8,0,20,12,0,144,0,0,192,63,3,7,22,48,0,20,8,0,20,12,0,144,0,0,192,63,3,2,144,0,0,250,68,20,12,0,144,0,0,192,63,3,2,4,144,0,0,224,64,1,21,1,0,25,16,20,24,89,2,0,13,4,0,19,31,0],"compatibleVariants":["Colibri","Duck","Emu","Finch","Kaka"]}
-
-
-
-
-
-
@@pavel.samokha
Hi! This looks great, but I don’t understand a lot of this. I allways created my apps with the intervall designer: http://www.ambitintervals.com/#!/ and movescount web was the way to get it into the Ambit.I was wondering how to get this apps now into the list of apps in suuntolink and someone told me that I should have a look at this posts. Well, the app generator produces the app I paste under this lines. But the result is this:
This is the app pasted in the compiler. Is there any way to get it worked?
/* Target App *//* Interval 1 */
/* Initialize variables */
if (SUUNTO_DURATION == 0) {
ACTUAL = 0;
TO = 0;
FROM = 0;
FORMATPACE = 0;
TARGET = 0;
TARGETSEC = 0;
TARGETMIN = 0;
RESULT = 0;
}
/* Lap 1 is step type WarmUp with target type None */
if (SUUNTO_LAP_NUMBER == 1) {
ACTUAL = SUUNTO_PACE * 60;
FROM = ACTUAL;
TO = ACTUAL;
FORMATPACE = 1;
postfix = “/km”;
}
/* Lap 2, 3, 4 is step type Interval with target type Pace */
if (SUUNTO_LAP_NUMBER == 2 || SUUNTO_LAP_NUMBER == 3 || SUUNTO_LAP_NUMBER == 4) {
ACTUAL = SUUNTO_PACE * 60;
FROM = 320;
TO = 310;
FORMATPACE = 1;
postfix = “/km”;
}
/* Lap 5 is step type Recovery with target type None */
if (SUUNTO_LAP_NUMBER == 5) {
ACTUAL = SUUNTO_PACE * 60;
FROM = ACTUAL;
TO = ACTUAL;
FORMATPACE = 1;
postfix = “/km”;
}
/* Lap 6, 8, 10, 12 is step type Interval with target type Pace */
if (SUUNTO_LAP_NUMBER == 6 || SUUNTO_LAP_NUMBER == 8 || SUUNTO_LAP_NUMBER == 10 || SUUNTO_LAP_NUMBER == 12) {
ACTUAL = SUUNTO_PACE * 60;
FROM = 295;
TO = 305;
FORMATPACE = 1;
postfix = “/km”;
}
/* Lap 7, 9, 11, 13 is step type Recovery with target type None */
if (SUUNTO_LAP_NUMBER == 7 || SUUNTO_LAP_NUMBER == 9 || SUUNTO_LAP_NUMBER == 11 || SUUNTO_LAP_NUMBER == 13) {
ACTUAL = SUUNTO_PACE * 60;
FROM = ACTUAL;
TO = ACTUAL;
FORMATPACE = 1;
postfix = “/km”;
}
/* Lap 14 is step type CoolDown with target type None */
if (SUUNTO_LAP_NUMBER == 14) {
ACTUAL = SUUNTO_PACE * 60;
FROM = ACTUAL;
TO = ACTUAL;
FORMATPACE = 1;
postfix = “/km”;
}
/* Set target value */
if (ACTUAL > TO) {
TARGET = TO;
} else if (ACTUAL < FROM) {
TARGET = FROM;
} else {
TARGET = ACTUAL;
}
/* Check if result should be formatted as pace and lables reversed */
if (FORMATPACE == 1) {
if (ACTUAL > TO) {
prefix ="up";
} else if (ACTUAL < FROM) {
prefix = "dwn";
} else {
prefix = "ok";
}
TARGETSEC = Suunto.mod(TARGET, 60);
TARGETMIN = (TARGET - TARGETSEC) / 60;
RESULT = TARGETMIN + TARGETSEC/100;
} else {
if (ACTUAL > TO) {
prefix ="dwn";
} else if (ACTUAL < FROM) {
prefix = "up";
} else {
prefix = "ok";
}
RESULT = TARGET;
}
-
The same result happens with the app that started this threat. No display in Suuntolink.
I only paste the result of the Ambit App Compiler into index.json opened in the note pad in windows. What I’m doing wrong?