Subversion Repositories NaviCtrl

Rev

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

Rev 291 Rev 295
Line 89... Line 89...
89
u8 UART1_Request_Display1               = FALSE;
89
u8 UART1_Request_Display1               = FALSE;
90
u8 UART1_Request_DebugData              = FALSE;
90
u8 UART1_Request_DebugData              = FALSE;
91
u8 UART1_Request_DebugLabel             = 255;
91
u8 UART1_Request_DebugLabel             = 255;
92
u8 UART1_Request_NaviData               = FALSE;
92
u8 UART1_Request_NaviData               = FALSE;
93
u8 UART1_Request_ErrorMessage   = FALSE;
93
u8 UART1_Request_ErrorMessage   = FALSE;
94
u8 UART1_Request_NewPoint               = FALSE;
94
u8 UART1_Request_WritePoint             = 0xFF;
95
u8 UART1_Request_ReadPoint              = 0;
95
u8 UART1_Request_ReadPoint              = 0;
96
u8 UART1_Request_Data3D             = FALSE;
96
u8 UART1_Request_Data3D             = FALSE;
97
u8 UART1_Request_Echo               = FALSE;
97
u8 UART1_Request_Echo               = FALSE;
98
u8 UART1_Request_ParameterId    = 0;
98
u8 UART1_Request_ParameterId    = 0;
99
u8 UART1_Request_Parameter              = FALSE;
99
u8 UART1_Request_Parameter              = FALSE;
Line 402... Line 402...
402
 
402
 
403
                        case 's'://  new target position
403
                        case 's'://  new target position
404
                                pPoint = (Point_t*)SerialMsg.pData;
404
                                pPoint = (Point_t*)SerialMsg.pData;
405
                                if(pPoint->Position.Status == NEWDATA)
405
                                if(pPoint->Position.Status == NEWDATA)
406
                                {
-
 
407
                                        if(pPoint->Type == POINT_TYPE_POI)
-
 
408
                                        {
406
                                {
409
                                                PointList_Clear(); // empty List
407
                                        //PointList_Clear(); // flush the list  
410
                                                pPoint->Index = 1; // must be one after empty list
-
 
411
                                                POICount = 0;
-
 
412
                                                PointList_Append(pPoint);
-
 
413
                                                PointCount = 2;
-
 
414
                                                BeepTime = 50;
-
 
415
                                        }
-
 
416
                                        else
-
 
417
                                        if(pPoint->Type == POINT_TYPE_WP)
-
 
418
                                        {
-
 
419
                                                PointList_Clear(); // empty List
-
 
420
                                                PointCount = 1;
-
 
421
                                                pPoint->Index = 2; // No. 1 could be the POI
-
 
422
                                                WPCount = 0;
408
                                        pPoint->Index = 1; // must be one after empty list
423
                                                PointList_Append(pPoint);
-
 
424
                                                PointCount = 2;
-
 
425
                                                BeepTime = 50;
409
                                        PointList_SetAt(pPoint); // 
426
                                                GPS_pWaypoint = PointList_WPBegin();
-
 
427
                                        }
-
 
428
                                        else
-
 
429
                                        if(pPoint->Type == POINT_TYPE_BOTH)
-
 
430
                                        {
-
 
431
                                                PointList_Clear(); // empty List
-
 
432
                                                pPoint->Index = 1;
-
 
433
                                                pPoint->Type = POINT_TYPE_POI;
-
 
434
                                                PointList_Append(pPoint);
-
 
435
                                                pPoint->Index = 2;
-
 
436
                                                pPoint->Type = POINT_TYPE_WP;
-
 
437
                                                PointList_Append(pPoint);
410
                                        GPS_pWaypoint = PointList_WPBegin(); // updates POI index
438
                                                BeepTime = 50;
-
 
439
                                                GPS_pWaypoint = PointList_WPBegin();
-
 
440
                                        }
-
 
441
                                        else
-
 
442
                                        {
-
 
443
                                         PointList_Clear(); // empty List
-
 
444
                                         GPS_pWaypoint = PointList_WPBegin();
-
 
445
                                        }
411
                                        BeepTime = 50;
446
                                }
412
                                }
Line 447... Line 413...
447
                                break;
413
                                break;
448
 
414
 
Line 473... Line 439...
473
                                        default:
439
                                        default:
474
                                                break;
440
                                                break;
475
                                }
441
                                }
476
                                break;
442
                                break;
Line 477... Line 443...
477
 
443
 
478
                        case 'w'://  Append Point to List
444
                        case 'w'://  Set point in list at index
479
                                {
445
                                {
Line 480... Line 446...
480
                                        pPoint = (Point_t*)SerialMsg.pData;
446
                                        pPoint = (Point_t*)SerialMsg.pData;
481
 
447
 
482
                                        if((pPoint->Position.Status == INVALID) && (pPoint->Index == 0))
448
                                        if((pPoint->Position.Status == INVALID) && (pPoint->Index == 0))
483
                                        {
449
                                        {
484
                                                PointList_Clear();
450
                                                PointList_Clear();
485
                                                GPS_pWaypoint = PointList_WPBegin();
451
                                                GPS_pWaypoint = PointList_WPBegin();
486
                                                UART1_Request_NewPoint = TRUE; // return new point count        
452
                                                UART1_Request_WritePoint = 0; // return new point count 
487
                                        }
453
                                        }
-
 
454
                                        else
488
                                        else
455
                                        {  // update WP in list at index
489
                                        {  // app current WP to the list
456
                                                UART1_Request_WritePoint = PointList_SetAt(pPoint);
490
                                                if(PointList_Append(pPoint))
457
                                                if(UART1_Request_WritePoint == pPoint->Index)
491
                                                {
-
 
492
                                                        BeepTime = 500;
458
                                                {
493
                                                        UART1_Request_NewPoint = TRUE; // return new WP number
459
                                                        BeepTime = 500;
494
                                                }
460
                                                }
495
                                        }
461
                                        }
Line 675... Line 641...
675
        {
641
        {
676
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request
642
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request
677
                Echo = 0; // reset echo value
643
                Echo = 0; // reset echo value
678
                UART1_Request_Echo = FALSE;
644
                UART1_Request_Echo = FALSE;
679
        }
645
        }
680
        else if(UART1_Request_NewPoint && (UART1_tx_buffer.Locked == FALSE))
646
        else if((UART1_Request_WritePoint!= 0xFF) && (UART1_tx_buffer.Locked == FALSE))
681
        {
647
        {
682
                u8 PointCount = PointList_GetCount();
-
 
683
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &PointCount, sizeof(PointCount));
648
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &UART1_Request_WritePoint, sizeof(UART1_Request_WritePoint));
684
                UART1_Request_NewPoint = FALSE;
649
                UART1_Request_WritePoint = 0xFF;
685
        }
650
        }
686
        else if((UART1_Request_ReadPoint) && (UART1_tx_buffer.Locked == FALSE))
651
        else if((UART1_Request_ReadPoint) && (UART1_tx_buffer.Locked == FALSE))
687
        {
652
        {
688
                u8 PointCount = PointList_GetCount();
653
                u8 PointCount = PointList_GetCount();
689
                if (UART1_Request_ReadPoint <= PointCount)
654
                if (UART1_Request_ReadPoint <= PointCount)