Subversion Repositories NaviCtrl

Rev

Rev 295 | Rev 351 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 295 Rev 296
Line 68... Line 68...
68
u8 POIIndex = 0;        // list index of GPS Point representing the current POI, can be maximal WPCount
68
u8 POIIndex = 0;        // list index of GPS Point representing the current POI, can be maximal WPCount
69
u8 WPCount = 0;         // number of waypoints
69
u8 WPCount = 0;         // number of waypoints
70
u8 PointCount = 0;              // number of wp in the list can be maximal equal to MAX_LIST_LEN
70
u8 PointCount = 0;              // number of wp in the list can be maximal equal to MAX_LIST_LEN
71
u8 POICount = 0;
71
u8 POICount = 0;
Line 72... Line 72...
72
 
72
 
Line 73... Line 73...
73
u8 WPActive = TRUE;
73
u8 WPActive = FALSE;
74
 
74
 
75
u8 PointList_Init(void)
75
u8 PointList_Init(void)
76
{
76
{
Line 83... Line 83...
83
        WPIndex = 0;    // real list position are 1 ,2, 3 ...
83
        WPIndex = 0;    // real list position are 1 ,2, 3 ...
84
        POIIndex = 0;   // real list position are 1 ,2, 3 ...
84
        POIIndex = 0;   // real list position are 1 ,2, 3 ...
85
        WPCount = 0;    // no waypoints
85
        WPCount = 0;    // no waypoints
86
    POICount = 0;
86
    POICount = 0;
87
        PointCount = 0; // no contents
87
        PointCount = 0; // no contents
88
        WPActive = TRUE;
88
        WPActive = FALSE;
89
        NaviData.WaypointNumber = WPCount;
89
        NaviData.WaypointNumber = WPCount;
90
        NaviData.WaypointIndex = 0;
90
        NaviData.WaypointIndex = 0;
Line 91... Line 91...
91
 
91
 
92
        for(i = 0; i < MAX_LIST_LEN; i++)
92
        for(i = 0; i < MAX_LIST_LEN; i++)
Line 117... Line 117...
117
}
117
}
Line 118... Line 118...
118
 
118
 
119
u8 PointList_SetAt(Point_t* pPoint)
119
u8 PointList_SetAt(Point_t* pPoint)
120
{
120
{
121
        // if index is in range
121
        // if index is in range
122
        if((pPoint->Index > 0) && (pPoint->Index < MAX_LIST_LEN))
122
        if((pPoint->Index > 0) && (pPoint->Index <= MAX_LIST_LEN))
123
        {
123
        {
124
                // check list entry before update
-
 
125
                if(PointList[pPoint->Index-1].Type)
124
                // check list entry before update
126
                switch(PointList[pPoint->Index-1].Type)
125
                switch(PointList[pPoint->Index-1].Type)
127
                {
126
                {
128
                        case POINT_TYPE_INVALID: // was invalid
127
                        case POINT_TYPE_INVALID: // was invalid
129
                                switch(pPoint->Type)
128
                                switch(pPoint->Type)
Line 187... Line 186...
187
                }
186
                }
188
                memcpy(&PointList[pPoint->Index-1], pPoint, sizeof(Point_t)); // copy data to list entry                                                                                
187
                memcpy(&PointList[pPoint->Index-1], pPoint, sizeof(Point_t)); // copy data to list entry                                                                                
189
                NaviData.WaypointNumber = WPCount;
188
                NaviData.WaypointNumber = WPCount;
190
                return pPoint->Index;
189
                return pPoint->Index;
191
        }
190
        }
192
        else return 0;
191
        else return(0);
193
}
192
}
Line 194... Line 193...
194
 
193
 
195
// returns the pointer to the first waypoint within the list
194
// returns the pointer to the first waypoint within the list
196
Point_t* PointList_WPBegin(void)
195
Point_t* PointList_WPBegin(void)
Line 215... Line 214...
215
                if(WPIndex) // found a WP in the list
214
                if(WPIndex) // found a WP in the list
216
                {
215
                {
217
                        NaviData.WaypointIndex = 1;
216
                        NaviData.WaypointIndex = 1;
218
                        // update index to POI
217
                        // update index to POI
219
                        if(PointList[WPIndex-1].Heading < 0) POIIndex = (u8)(-PointList[WPIndex-1].Heading);
218
                        if(PointList[WPIndex-1].Heading < 0) POIIndex = (u8)(-PointList[WPIndex-1].Heading);
220
                        else POIIndex = 0;     
219
                        else POIIndex = 0;                     
221
                        return(&(PointList[WPIndex-1])); // if list is not empty return pointer to first waypoint in the list           
-
 
222
                }
220
                }
223
                else // some points in the list but no WP found
221
                else // some points in the list but no WP found
224
                {
222
                {
225
                        NaviData.WaypointIndex = 0;
223
                        NaviData.WaypointIndex = 0;
226
                        //Check for an existing POI
224
                        //Check for an existing POI