276,7 → 276,7 |
// returns the pointer to the first waypoint within the list |
Point_t* PointList_WPBegin(u32 start) |
{ |
u8 i; |
u8 i, wp_nr = 0; |
WPIndex = 0; // set list position invalid |
|
if(WPActive == FALSE) return(NULL); |
285,24 → 285,18 |
if(PointCount > start) |
{ |
// search for first wp in list |
for(i = start; i <MAX_LIST_LEN; i++) |
for(i = 0; i <MAX_LIST_LEN; i++) |
{ |
if(((PointList[i].Type == POINT_TYPE_WP)||(PointList[i].Type == POINT_TYPE_LAND)) && (PointList[i].Position.Status != INVALID)) // jump over POIs and FS-Positions |
{ |
WPIndex = i + 1; |
break; |
wp_nr++; // count the number of scipped WPs to make sure that the Index in the NaviData is correct |
if(i >= start) break; |
} |
/* |
else |
if((PointList[i].Type == POINT_TYPE_FS) && (PointList[i].Position.Status != INVALID)) |
{ |
GPSPos_Copy(&(PointList[i].Position), &GPS_FailsafePosition); |
} |
*/ |
} |
if(WPIndex) // found a WP in the list |
{ |
NaviData.WaypointIndex = 1; |
NaviData.WaypointIndex = wp_nr; |
NewWaypointsReceived = 1; // activates the Waypoint list as soon as CH is started |
// update index to POI |
if(PointList[WPIndex-1].Heading < 0) POIIndex = (u8)(-PointList[WPIndex-1].Heading); |