Bonjour,
j'avais publié une app "Virtual Race" il y a qques mois , optimisée par SiRoB1 .
On est encore assez loin d'un ghost race/virtual race mais on s'en approche un peu .
son principe est de définir un rythme moyen en s/km pour des sections de course.
Ci-dessous, ce sont des sections de 2km et le rythme est fixé a 360 ( 10km/h ).
Mais on peut faire varier la longueur et le rythme de chaque section
( un peu plus fin que "Virtual Pace" qui affiche l’écart vs un rythme moyen pour toute la course ).
Bon, c'est un peu rébarbatif / il faut découper sa course en sections et calculer le rythme moyen de chacune d'elles.
- Code: Tout sélectionner
if ( startDuration == 0 || SUUNTO_DURATION == 0) {
section = 1; Comp = 0; NextWP = 0; WPpace = 0; WPpaceCurr = 0; D = 0; GHOST_DURATION = 0;
lastDuration = 0; display = 0;
lastDistance = SUUNTO_DISTANCE; startDuration = SUUNTO_DURATION; }
if ((section < 12) && (SUUNTO_DISTANCE > lastDistance + D)) {
GHOST_DURATION = GHOST_DURATION + WPpace * D;
lastDistance = lastDistance + D;
lastDuration = SUUNTO_DURATION;
section = section + 1;
}
if (section == 1) { WPpace = 360; D = 2.0; prefix = "WP1 "; }
if (section == 2) { WPpace = 360; D = 2.0; prefix = "WP2 "; }
if (section == 3) { WPpace = 360; D = 2.0; prefix = "WP3 "; }
if (section == 4) { WPpace = 360; D = 2.0; prefix = "WP4 "; }
if (section == 5) { WPpace = 360; D = 2.0; prefix = "WP5 "; }
if (section == 6) { WPpace = 360; D = 2.0; prefix = "WP6 "; }
if (section == 7) { WPpace = 360; D = 2.0; prefix = "WP7 "; }
if (section == 8) { WPpace = 360; D = 2.0; prefix = "WP8 "; }
if (section == 9) { WPpace = 360; D = 2.0; prefix = "WP9 "; }
if (section == 10) { WPpace = 360; D = 2.0; prefix = "WP10"; }
if (section == 11) { WPpace = 360; D = 2.0; prefix = "WP11"; }
if (section == 12) { WPpace = 360; D = 50.0; prefix = "WP12"; }
Comp = (SUUNTO_DISTANCE - lastDistance);
NextWP = D - Comp;
WPpaceCurr = ( SUUNTO_DURATION - lastDuration)/Comp;
disp = 0; if ((NextWP < 0) || (disp > 2)) { disp = 0; }
if (disp==1) {
postfix="km";
RESULT = NextWP;
} else {
if (disp==2) {
RESULT = NextWP*WPpaceCurr;
} else if (disp==0) {
prefix ="Gap ";
RESULT = SUUNTO_DURATION-startDuration-GHOST_DURATION-WPpace*Comp;
}
postfix="ms";
if (RESULT < 0) {
RESULT = -RESULT;
Comp = -1;
}
RESULT = Suunto.floor(RESULT/60)+Suunto.mod(Suunto.floor(RESULT),60)/100;
if (Comp==-1) {
RESULT = -RESULT;
}
}