Subversion Repositories NaviCtrl

Rev

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

Rev 490 Rev 491
Line 67... Line 67...
67
 
67
 
68
Point_t PointList[MAX_LIST_LEN];
68
Point_t PointList[MAX_LIST_LEN];
69
u8 WPIndex = 0;         // list index of GPS point representig the current WP, can be maximal WPCount
69
u8 WPIndex = 0;         // list index of GPS point representig the current WP, can be maximal WPCount
70
u8 POIIndex = 0;        // list index of GPS Point representing the current POI, can be maximal WPCount
70
u8 POIIndex = 0;        // list index of GPS Point representing the current POI, can be maximal WPCount
71
u8 WPCount = 0;         // number of waypoints
71
u8 WPCount = 0;         // number of waypoints
72
u8 PointCount = 0;              // number of wp in the list can be maximal equal to MAX_LIST_LEN
72
u8 PointCount = 0;      // number of points in the list can be maximal equal to MAX_LIST_LEN
Line 73... Line 73...
73
u8 POICount = 0;
73
u8 POICount = 0;        // number of point of interest in the list
Line 74... Line 74...
74
 
74
 
75
u8 WPActive = FALSE;
75
u8 WPActive = FALSE;
Line 336... Line 336...
336
void PointList_WPActive(u8 set)
336
void PointList_WPActive(u8 set)
337
{
337
{
338
        if(set)
338
        if(set)
339
        {      
339
        {      
340
                WPActive = TRUE;
340
                WPActive = TRUE;
341
                PointList_WPBegin(); // uopdates POI index
341
                PointList_WPBegin(); // updates POI index
342
        }
342
        }
343
        else
343
        else
344
        {
344
        {
345
                WPActive = FALSE;
345
                WPActive = FALSE;
346
                POIIndex = 0;  // disable POI also
346
                POIIndex = 0;  // disable POI also
Line 658... Line 658...
658
                UART1_PutString("ok\r\n");
658
                UART1_PutString("ok\r\n");
659
                retval = 1;                              
659
                retval = 1;                              
660
        } // EOF if(Fat16_IsValid())
660
        } // EOF if(Fat16_IsValid())
661
        else UART1_PutString("no file system found!\r\n");     
661
        else UART1_PutString("no file system found!\r\n");     
662
        return(retval);
662
        return(retval);
663
}
663
}
-
 
664
 
-
 
665
// move actual point list to ref pos., the point in the list marked by index gets the RefPos afterwards
-
 
666
u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos)
-
 
667
{
-
 
668
        u8 retval = 0;
-
 
669
        GPS_Pos_t RefPos_old;
-
 
670
        GPS_Pos_Deviation_t RefDeviation;
-
 
671
         
-
 
672
        // check inputs for plausibility;
-
 
673
        if((RefIndex == 0) || (RefIndex > PointCount)) return(retval); 
-
 
674
        if(pRefPos == NULL) return(retval);
-
 
675
        if(pRefPos->Status == INVALID) return(retval);
-
 
676
 
-
 
677
        // try to copy the old reference in point list to a local buffer
-
 
678
        if(GPSPos_Copy(&(PointList[RefIndex-1].Position), &RefPos_old))
-
 
679
        {
-
 
680
                u8 i;
-
 
681
                // for each point position in the list
-
 
682
                for(i = 0; i < PointCount; i++)
-
 
683
                {
-
 
684
                        retval = 0;
-
 
685
                    // calculate deviation form old ref, i.e the north and east shift of each point in the list from the reference position
-
 
686
                        if(!GPSPos_Deviation(&(PointList[i].Position), &RefPos_old, &RefDeviation)) break;
-
 
687
                        // copy of the new reference position into this list place
-
 
688
                        if(!GPSPos_Copy(pRefPos, &(PointList[i].Position))) break;
-
 
689
                        // move new reference according to the deviation of the old reference
-
 
690
                        retval = GPSPos_ShiftCartesian(&(PointList[i].Position), RefDeviation.North, RefDeviation.East);
-
 
691
                        if(!retval) break;             
-
 
692
                }
-
 
693
        } // else ref pos old not copied!
-
 
694
        if(!retval) PointList_Clear();
-
 
695
        return(retval);
-
 
696
}
-
 
697
 
-
 
698