Subversion Repositories NaviCtrl

Rev

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

Rev 224 Rev 225
Line 88... Line 88...
88
u8 UART1_Request_DebugData              = FALSE;
88
u8 UART1_Request_DebugData              = FALSE;
89
u8 UART1_Request_DebugLabel             = 255;
89
u8 UART1_Request_DebugLabel             = 255;
90
u8 UART1_Request_NaviData               = FALSE;
90
u8 UART1_Request_NaviData               = FALSE;
91
u8 UART1_Request_ErrorMessage   = FALSE;
91
u8 UART1_Request_ErrorMessage   = FALSE;
92
u8 UART1_Request_NewWaypoint    = FALSE;
92
u8 UART1_Request_NewWaypoint    = FALSE;
93
u8 UART1_Request_ReadWaypoint   = 255;
93
u8 UART1_Request_ReadWaypoint   = 0;
94
u8 UART1_Request_Data3D             = FALSE;
94
u8 UART1_Request_Data3D             = FALSE;
95
u8 UART1_Request_Echo               = FALSE;
95
u8 UART1_Request_Echo               = FALSE;
96
u8 UART1_Request_ParameterId    = 0;
96
u8 UART1_Request_ParameterId    = 0;
97
u8 UART1_Request_Parameter              = FALSE;
97
u8 UART1_Request_Parameter              = FALSE;
98
u8 UART1_DisplayKeys                    = 0;
98
u8 UART1_DisplayKeys                    = 0;
Line 435... Line 435...
435
                                }
435
                                }
436
                                break;
436
                                break;
Line 437... Line 437...
437
 
437
 
438
                        case 'w'://  Append Waypoint to List
438
                        case 'w'://  Append Waypoint to List
439
                                {
439
                                {
Line 440... Line 440...
440
                                        static u8 nextIndex = 0x00;
440
                                        static u8 nextIndex = 0x01;
-
 
441
 
-
 
442
                                        pWaypoint = (Waypoint_t*)SerialMsg.pData;
Line 441... Line 443...
441
 
443
                                        sprintf(text, "\r\nI=%d, S=%d,T=%d\r\n",pWaypoint->Index, pWaypoint->Position.Status, pWaypoint->Type);
442
                                        pWaypoint = (Waypoint_t*)SerialMsg.pData;
444
                                        UART1_PutString(text);
443
 
-
 
444
                                        if (pWaypoint->Index == 0) // is the POI
445
 
445
                                        {
446
                                        if(pWaypoint->Position.Status == INVALID)
446
                                                WPList_SetPOI(pWaypoint); //update POI  also when invalid
447
                                        {
447
                                                WPList_Clear();                   //delete the WP List
-
 
448
                                                GPS_pWaypoint = WPList_Begin();
448
                                                WPList_Clear();
449
                                                nextIndex = 0x01;
-
 
450
                                                BeepTime = 300;
-
 
451
                                                UART1_Request_NewWaypoint = TRUE;
449
                                                GPS_pWaypoint = WPList_Begin();
452
                                                // the POI is not a WP therefore the WPNumber is not increased
-
 
453
                                                // and the command returns a 0 as WP number
-
 
454
                                        }
450
                                                nextIndex = 0x01;
455
                                        else // normal WP
451
                                                UART1_Request_NewWaypoint = TRUE; // return new WP number       
456
                                        {
452
                                        }
457
                                                if (pWaypoint->Position.Status == NEWDATA)
453
                                        else if(pWaypoint->Position.Status == NEWDATA)
458
                                                {  // app current WP to the list
454
                                        {  // app current WP to the list
459
                                                        if (pWaypoint->Index == nextIndex)
455
                                                if (pWaypoint->Index == nextIndex)
460
                                                        {
456
                                                {
461
                                                                WPList_Append(pWaypoint);
457
                                                        WPList_Append(pWaypoint);
462
                                                                BeepTime = 500;
-
 
463
                                                                nextIndex = pWaypoint->Index+1;
458
                                                        BeepTime = 500;
464
                                                                UART1_Request_NewWaypoint = TRUE; // return new WP number
459
                                                        nextIndex = pWaypoint->Index+1;
465
                                                        }
460
                                                        UART1_Request_NewWaypoint = TRUE; // return new WP number
466
                                                }
461
                                                }
Line 657... Line 652...
657
        {
652
        {
658
                u8 WPNumber = WPList_GetCount();
653
                u8 WPNumber = WPList_GetCount();
659
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber));
654
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber));
660
                UART1_Request_NewWaypoint = FALSE;
655
                UART1_Request_NewWaypoint = FALSE;
661
        }
656
        }
662
        else if((UART1_Request_ReadWaypoint != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
657
        else if((UART1_Request_ReadWaypoint) && (UART1_tx_buffer.Locked == FALSE))
663
        {
658
        {
664
                u8 WPNumber = WPList_GetCount();
659
                u8 WPNumber = WPList_GetCount();
665
                if (UART1_Request_ReadWaypoint < WPNumber)
660
                if (UART1_Request_ReadWaypoint <= WPNumber)
666
                {
661
                {
667
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &WPNumber, 1, &UART1_Request_ReadWaypoint, 1, WPList_GetAt(UART1_Request_ReadWaypoint), sizeof(Waypoint_t));
662
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &WPNumber, 1, &UART1_Request_ReadWaypoint, 1, WPList_GetAt(UART1_Request_ReadWaypoint), sizeof(Waypoint_t));
668
                }
663
                }
669
                else
664
                else
670
                {
665
                {
671
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer,'X', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber));
666
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer,'X', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber));
672
                }
667
                }
673
                UART1_Request_ReadWaypoint = 0xFF;
668
                UART1_Request_ReadWaypoint = 0;
674
        }
669
        }
675
        else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
670
        else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
676
        {
671
        {
677
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16);
672
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16);
678
                UART1_Request_DebugLabel = 0xFF;
673
                UART1_Request_DebugLabel = 0xFF;