Rev 517 | Rev 521 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 517 | Rev 519 | ||
---|---|---|---|
Line 94... | Line 94... | ||
94 | POICount = 0; |
94 | POICount = 0; |
95 | PointCount = 0; // no contents |
95 | PointCount = 0; // no contents |
96 | WPActive = FALSE; |
96 | WPActive = FALSE; |
97 | NaviData.WaypointNumber = WPCount; |
97 | NaviData.WaypointNumber = WPCount; |
98 | NaviData.WaypointIndex = 0; |
98 | NaviData.WaypointIndex = 0; |
99 | - | ||
100 | for(i = 0; i < MAX_LIST_LEN; i++) |
99 | for(i = 0; i < MAX_LIST_LEN; i++) |
101 | { |
100 | { |
102 | PointList[i].Position.Status = INVALID; |
101 | PointList[i].Position.Status = INVALID; |
103 | PointList[i].Position.Latitude = 0; |
102 | PointList[i].Position.Latitude = 0; |
104 | PointList[i].Position.Longitude = 0; |
103 | PointList[i].Position.Longitude = 0; |
Line 479... | Line 478... | ||
479 | retval = WPL_NO_SDCARD_FOUND; |
478 | retval = WPL_NO_SDCARD_FOUND; |
480 | } |
479 | } |
481 | return(retval); |
480 | return(retval); |
482 | } |
481 | } |
Line 483... | Line 482... | ||
483 | 482 | ||
484 | u8 PointList_Load(u8 * filename, u8* listname, u8 listnamelen) |
483 | u8 PointList_Load(u8 * filename, u8* listname, u8 listnamelen, u8 use_preset_speed) |
485 | { |
484 | { |
486 | File_t *fp; |
485 | File_t *fp; |
487 | s8 wpline[LINE_MAX]; |
486 | s8 wpline[LINE_MAX]; |
Line 592... | Line 591... | ||
592 | { |
591 | { |
593 | PointList[IsPointSection-1].Heading = (s16)atoi(value); |
592 | PointList[IsPointSection-1].Heading = (s16)atoi(value); |
594 | } |
593 | } |
595 | else if(strcmp(name, "SPEED") == 0) |
594 | else if(strcmp(name, "SPEED") == 0) |
596 | { |
595 | { |
- | 596 | if(use_preset_speed) PointList[IsPointSection-1].Speed = use_preset_speed; |
|
597 | PointList[IsPointSection-1].Speed = (u8)atoi(value); |
597 | else PointList[IsPointSection-1].Speed = (u8)atoi(value); |
598 | } |
598 | } |
599 | else if(strcmp(name, "CAM-NICK") == 0) |
599 | else if(strcmp(name, "CAM-NICK") == 0) |
600 | { |
600 | { |
601 | PointList[IsPointSection-1].CamAngle = (u8)atoi(value); |
601 | PointList[IsPointSection-1].CamAngle = (u8)atoi(value); |
602 | } |
602 | } |
Line 715... | Line 715... | ||
715 | } |
715 | } |
716 | else |
716 | else |
717 | { |
717 | { |
718 | sprintf(filename, "/WPL/list_%03d.wpl", pWPL_Store->Index); |
718 | sprintf(filename, "/WPL/list_%03d.wpl", pWPL_Store->Index); |
719 | } |
719 | } |
720 | return PointList_Load(filename, pWPL_Store->Name, sizeof(pWPL_Store->Name)); |
720 | return PointList_Load(filename, pWPL_Store->Name, sizeof(pWPL_Store->Name),0); |
721 | } |
721 | } |
Line 722... | Line 722... | ||
722 | 722 | ||
723 | // save actual point list to SD card |
723 | // save actual point list to SD card |
724 | u8 PointList_WriteToFile(WPL_Store_t * pWPL_Store) |
724 | u8 PointList_WriteToFile(WPL_Store_t * pWPL_Store) |
Line 755... | Line 755... | ||
755 | } |
755 | } |
Line 756... | Line 756... | ||
756 | 756 | ||
757 | // clear current point list |
757 | // clear current point list |
758 | PointList_Clear(); |
758 | PointList_Clear(); |
- | 759 | // prepare WP at current position |
|
- | 760 | ||
- | 761 | if(NCFlags & NC_FLAG_FREE || NaviData.TargetPositionDeviation.Distance > 7*10) |
|
- | 762 | { // take actual position |
|
- | 763 | GPSPos_Copy(&GPSData.Position, &(WP.Position)); |
|
- | 764 | } |
|
- | 765 | else |
|
- | 766 | { // take last target position |
|
- | 767 | GPSPos_Copy(&NaviData.TargetPosition, &(WP.Position)); |
|
- | 768 | } |
|
759 | // prepare WP at current position |
769 | |
760 | GPSPos_Copy(&GPSData.Position, &(WP.Position)); |
770 | GPSPos_Copy(&GPSData.Position, &(WP.Position)); |
761 | // set heading |
771 | // set heading |
762 | WP.Heading = CompassSetpointCorrected/10; |
772 | WP.Heading = CompassSetpointCorrected/10; |
763 | if(WP.Heading == 0) WP.Heading = 360; |
773 | if(WP.Heading == 0) WP.Heading = 360; |
764 | WP.ToleranceRadius = 15; |
774 | WP.ToleranceRadius = 120; // 12m |
765 | WP.HoldTime = 5; |
775 | WP.HoldTime = 2; |
766 | WP.Index = 1; |
776 | WP.Index = 1; |
767 | WP.Type = POINT_TYPE_WP; |
777 | WP.Type = POINT_TYPE_WP; |
768 | WP.WP_EventChannelValue = 0; |
778 | WP.WP_EventChannelValue = 0; |
769 | if(FC.StatusFlags & FC_STATUS_FLY) |
779 | if(FC.StatusFlags & FC_STATUS_FLY && (FromFC_VarioCharacter != ' ')) // only in flight and if the Altitude control is enabled |
770 | { |
780 | { |
771 | WP.AltitudeRate = 15; |
781 | WP.AltitudeRate = 255; // Auto |
- | 782 | // WP.Position.Altitude = NaviData.Altimeter / 2; |
|
772 | WP.Position.Altitude = NaviData.Altimeter / 2; |
783 | WP.Position.Altitude = NaviData.SetpointAltitude / 2; |
773 | } |
784 | } |
774 | else |
785 | else |
775 | { |
786 | { |
776 | WP.AltitudeRate = 0; |
787 | WP.AltitudeRate = 0; |
777 | WP.Position.Altitude = 0; |
788 | WP.Position.Altitude = 0; |
778 | } |
789 | } |
779 | WP.Speed = SD_ComingHomeSpeed; |
790 | WP.Speed = 50; // beim Laden wird der Wert nochmal neu gesetzt |
780 | WP.CamAngle = 0; |
791 | WP.CamAngle = 0; |
781 | WP.Name[0] = 'P'; |
792 | WP.Name[0] = 'P'; |
782 | WP.Name[1] = 0; |
793 | WP.Name[1] = 0; |
783 | // add this point to wp list |
794 | // add this point to wp list |
Line 787... | Line 798... | ||
787 | UART1_PutString(filename); |
798 | UART1_PutString(filename); |
788 | sprintf(pWPL_Store->Name, "POINT%03d ", pWPL_Store->Index); |
799 | sprintf(pWPL_Store->Name, "POINT%03d ", pWPL_Store->Index); |
789 | retval = PointList_Save(filename, pWPL_Store->Name, 1); |
800 | retval = PointList_Save(filename, pWPL_Store->Name, 1); |
Line 790... | Line 801... | ||
790 | 801 | ||
- | 802 | // clear current point list |
|
- | 803 | if((NC_GPS_ModeCharacter != 'w') && (NC_GPS_ModeCharacter != 'W')) PointList_Clear(); |
|
- | 804 | else |
|
- | 805 | { |
|
791 | // clear current point list |
806 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
- | 807 | GPS_pWaypoint = PointList_WPBegin(); // updates POI index |
|
- | 808 | } |
|
792 | PointList_Clear(); |
809 | |
793 | return(retval); |
810 | return(retval); |
794 | } |
811 | } |
795 | // load target gps posititon and heading from file |
812 | // load target gps posititon and heading from file |
796 | u8 PointList_LoadSinglePoint(WPL_Store_t * pWPL_Store) |
813 | u8 PointList_LoadSinglePoint(WPL_Store_t * pWPL_Store) |
797 | { |
814 | { |
Line 798... | Line 815... | ||
798 | u8 filename[30]; |
815 | u8 filename[30], result = 0; |
799 | 816 | ||
800 | sprintf(filename, "/POINT/POINT%03d.wpl", pWPL_Store->Index); |
817 | sprintf(filename, "/POINT/POINT%03d.wpl", pWPL_Store->Index); |
- | 818 | pWPL_Store->Name[0] = 0; // clear current list name |
|
- | 819 | result = PointList_Load(filename, pWPL_Store->Name, sizeof(pWPL_Store->Name),Parameter.SingleWpSpeed); |
|
801 | pWPL_Store->Name[0] = 0; // clear current list name |
820 | if(result) UART1_Request_ReadPoint = 1; // Sends Point 1 to the PC |
Line 802... | Line 821... | ||
802 | return PointList_Load(filename, pWPL_Store->Name, sizeof(pWPL_Store->Name)); |
821 | return(result); |