Rev 509 | Rev 514 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 509 | Rev 513 | ||
---|---|---|---|
Line 91... | Line 91... | ||
91 | u8 ErrorCode = 0; |
91 | u8 ErrorCode = 0; |
92 | u16 BeepTime; |
92 | u16 BeepTime; |
93 | u8 NCFlags = 0; |
93 | u8 NCFlags = 0; |
94 | s16 GeoMagDec = 0; // local magnetic declination in 0.1 deg |
94 | s16 GeoMagDec = 0; // local magnetic declination in 0.1 deg |
95 | u8 ErrorGpsFixLost = 0; |
95 | u8 ErrorGpsFixLost = 0; |
96 | u8 FromFC_LoadWP_List = 0, FromFC_Load_SingePoint = 0, FromFC_Store_SingePoint = 0; |
96 | u8 FromFC_LoadWP_List = 0, FromFC_Load_SinglePoint = 0, FromFC_Save_SinglePoint = 0; |
97 | u8 ToFC_MaxWpListIndex = 3; |
97 | u8 ToFC_MaxWpListIndex = 3; |
98 | u8 ClearFCStatusFlags = 0; |
98 | u8 ClearFCStatusFlags = 0; |
99 | u8 StopNavigation = 0; |
99 | u8 StopNavigation = 0; |
100 | volatile u32 PollingTimeout = 10000; |
100 | volatile u32 PollingTimeout = 10000; |
101 | Param_t Parameter; |
101 | Param_t Parameter; |
Line 596... | Line 596... | ||
596 | if(FromFC_LoadWP_List) |
596 | if(FromFC_LoadWP_List) |
597 | { |
597 | { |
598 | WPL_Store.Index = (FromFC_LoadWP_List & ~0x80); |
598 | WPL_Store.Index = (FromFC_LoadWP_List & ~0x80); |
599 | if(WPL_Store.Index <= ToFC_MaxWpListIndex) |
599 | if(WPL_Store.Index <= ToFC_MaxWpListIndex) |
600 | { |
600 | { |
601 | if(PointList_ReadFromFile(&WPL_Store) == WPL_OK) |
601 | if(PointList_ReadFromFile(&WPL_Store) == WPL_OK) |
602 | { |
602 | { |
603 | if(FromFC_LoadWP_List & 0x80)// -> load relative |
603 | if(FromFC_LoadWP_List & 0x80)// -> load relative |
604 | { |
604 | { |
605 | if(NCFlags & NC_FLAG_FREE || NaviData.TargetPositionDeviation.Distance > 7*10) |
605 | if(NCFlags & NC_FLAG_FREE || NaviData.TargetPositionDeviation.Distance > 7*10) |
606 | { // take actual position |
606 | { // take actual position |
607 | if(!PointList_Move(1,&(GPSData.Position),NaviData.CompassHeading)) PointList_Clear(); // try to move wp-list so that 1st entry matches the current position |
607 | if(!PointList_Move(1,&(GPSData.Position),NaviData.CompassHeading)) PointList_Clear(); // try to move wp-list so that 1st entry matches the current position |
608 | } |
608 | } |
609 | else |
609 | else |
610 | { // take last target position |
610 | { // take last target position |
611 | if(!PointList_Move(1, &(NaviData.TargetPosition),NaviData.CompassHeading)) PointList_Clear(); // try to move wp-list so that 1st entry matches the current position |
611 | if(!PointList_Move(1, &(NaviData.TargetPosition),NaviData.CompassHeading)) PointList_Clear(); // try to move wp-list so that 1st entry matches the current position |
612 | } |
612 | } |
- | 613 | } |
|
- | 614 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
|
- | 615 | GPS_pWaypoint = PointList_WPBegin(); // updates POI index |
|
- | 616 | BeepTime = 150; |
|
613 | } |
617 | } |
- | 618 | } |
|
- | 619 | FromFC_LoadWP_List = 0; |
|
- | 620 | } |
|
- | 621 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 622 | if(FromFC_Save_SinglePoint) |
|
- | 623 | { |
|
- | 624 | WPL_Store.Index = FromFC_Save_SinglePoint; |
|
- | 625 | if(PointList_SaveSinglePoint(&WPL_Store) == WPL_OK) BeepTime = 150; |
|
- | 626 | FromFC_Save_SinglePoint = 0; |
|
- | 627 | } |
|
- | 628 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 629 | if(FromFC_Load_SinglePoint) |
|
- | 630 | { |
|
- | 631 | WPL_Store.Index = FromFC_Load_SinglePoint; |
|
- | 632 | if(PointList_LoadSinglePoint(&WPL_Store) == WPL_OK) |
|
- | 633 | { |
|
614 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
634 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
615 | GPS_pWaypoint = PointList_WPBegin(); // updates POI index |
635 | GPS_pWaypoint = PointList_WPBegin(); // updates POI index |
616 | BeepTime = 150; |
636 | BeepTime = 150; |
617 | } |
637 | } |
618 | } |
- | |
619 | FromFC_LoadWP_List = 0; |
638 | FromFC_Load_SinglePoint = 0; |
620 | } |
639 | } |
621 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
640 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
622 | if(FromFC_Store_SingePoint) |
- | |
623 | { |
- | |
624 | FromFC_Store_SingePoint = 0; |
- | |
625 | } |
- | |
626 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
- | |
627 | if(FromFC_Load_SingePoint) |
- | |
628 | { |
- | |
629 | FromFC_Load_SingePoint = 0; |
- | |
630 | } |
- | |
631 | // ++++++++++++++++++++++++++++++++++++++++++++++ |
- | |
632 | // ---------------- Logging --------------------------------------- |
641 | // ---------------- Logging --------------------------------------- |
633 | if(SD_WatchDog) |
642 | if(SD_WatchDog) |
634 | { |
643 | { |
635 | SD_WatchDog = 30000; |
644 | SD_WatchDog = 30000; |
636 | if(SDCardInfo.Valid == 1) Logging_Update(); // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1 |
645 | if(SDCardInfo.Valid == 1) Logging_Update(); // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1 |