Hello,
I need some advices. I have this problem with my app but no idea to solve it. My app allows to make a trail or hiking and it’s possible to display the current map. For that, I store in 2 arrays latitude and longitude (each 15 positions, it’s adjustable). When it’s requested by user during running/hiking, the map is displayed, each position in the arrays are displayed with the following code:
for(var i = iNbPosInArray-1; i > 0; i-- ) {
//segment N,N-1 centered on current position
var x1 = GetXPos(ArrayLong[i-1],dc.getWidth()/2);
var y1 = GetYPos(ArrayLat[i-1],dc.getHeight()/2);
var x2 = GetXPos(ArrayLong[i],dc.getWidth()/2);
var y2 = GetYPos(ArrayLat[i],dc.getHeight()/2);
//draw segment
ShowTrajectLine(dc,x1,y1,x2,y2,Gfx.COLOR_WHITE);
}
//to draw a line between to point
function ShowTrajectLine(dc,x1,y1,x2,y2,cColor) {
dc.setColor(cColor,Gfx.COLOR_TRANSPARENT);
dc.setPenWidth(2);
dc.drawLine(x1,y1,x2,y2);
}
//to get the X position (in pixels)
function GetXPos(long,iWShift) {
return zoom*scalefactor_pixel_longlat*(long-GetXCenter())+iWShift;
}
That operates very well! But when the number of points is too high (for a long hiking for example), that takes time to redraw all points and watchdog tripped error is activated and then crash!
How “cut” this part of the code in order to reset the watchdog counter? I have no idea except with multithreading but it’s not possible with Garmin SDK. I imagine that there are some ways to manage such a problem.
Thanks’ for your help and advices!
Sylvain