Rev 277 | Rev 281 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 277 | Rev 280 | ||
---|---|---|---|
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_NewWaypoint = FALSE; |
94 | u8 UART1_Request_NewPoint = FALSE; |
95 | u8 UART1_Request_ReadWaypoint = 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; |
100 | u8 UART1_DisplayKeys = 0; |
100 | u8 UART1_DisplayKeys = 0; |
Line 363... | Line 363... | ||
363 | if(MKProtocol_CollectSerialFrame(&UART1_rx_buffer, c)) break; |
363 | if(MKProtocol_CollectSerialFrame(&UART1_rx_buffer, c)) break; |
364 | } |
364 | } |
365 | } |
365 | } |
366 | if(UART1_rx_buffer.Locked == FALSE) return; |
366 | if(UART1_rx_buffer.Locked == FALSE) return; |
Line 367... | Line 367... | ||
367 | 367 | ||
368 | Waypoint_t * pWaypoint = NULL; |
368 | Point_t * pPoint = NULL; |
Line 369... | Line 369... | ||
369 | SerialMsg_t SerialMsg; |
369 | SerialMsg_t SerialMsg; |
370 | 370 | ||
371 | // analyze header first |
371 | // analyze header first |
Line 399... | Line 399... | ||
399 | case 'e': // request for the text of the error status |
399 | case 'e': // request for the text of the error status |
400 | UART1_Request_ErrorMessage = TRUE; |
400 | UART1_Request_ErrorMessage = TRUE; |
401 | break; |
401 | break; |
Line 402... | Line 402... | ||
402 | 402 | ||
403 | case 's':// new target position |
403 | case 's':// new target position |
404 | pWaypoint = (Waypoint_t*)SerialMsg.pData; |
404 | pPoint = (Point_t*)SerialMsg.pData; |
405 | BeepTime = 300; |
405 | BeepTime = 300; |
406 | if(pWaypoint->Position.Status == NEWDATA) |
406 | if(pPoint->Position.Status == NEWDATA) |
407 | { |
407 | { |
408 | WPList_Clear(); // empty WPList |
408 | PointList_Clear(); // empty List |
409 | pWaypoint->Index = 1; // must be one after empty list |
409 | pPoint->Index = 1; // must be one after empty list |
410 | WPList_Append(pWaypoint); |
410 | PointList_Append(pPoint); |
411 | GPS_pWaypoint = WPList_Begin(); |
411 | GPS_pWaypoint = PointList_WPBegin(); |
412 | } |
412 | } |
Line 413... | Line 413... | ||
413 | break; |
413 | break; |
414 | 414 | ||
Line 439... | Line 439... | ||
439 | default: |
439 | default: |
440 | break; |
440 | break; |
441 | } |
441 | } |
442 | break; |
442 | break; |
Line 443... | Line 443... | ||
443 | 443 | ||
444 | case 'w':// Append Waypoint to List |
444 | case 'w':// Append Point to List |
445 | { |
445 | { |
Line 446... | Line 446... | ||
446 | pWaypoint = (Waypoint_t*)SerialMsg.pData; |
446 | pPoint = (Point_t*)SerialMsg.pData; |
447 | 447 | ||
448 | if((pWaypoint->Position.Status == INVALID) && (pWaypoint->Index == 0)) |
448 | if((pPoint->Position.Status == INVALID) && (pPoint->Index == 0)) |
449 | { |
449 | { |
450 | WPList_Clear(); |
450 | PointList_Clear(); |
451 | GPS_pWaypoint = WPList_Begin(); |
451 | GPS_pWaypoint = PointList_WPBegin(); |
452 | UART1_Request_NewWaypoint = TRUE; // return new WP number |
452 | UART1_Request_NewPoint = TRUE; // return new point count |
453 | } |
453 | } |
454 | else |
454 | else |
455 | { // app current WP to the list |
455 | { // app current WP to the list |
456 | if(WPList_Append(pWaypoint)) |
456 | if(PointList_Append(pPoint)) |
457 | { |
457 | { |
458 | BeepTime = 500; |
458 | BeepTime = 500; |
459 | UART1_Request_NewWaypoint = TRUE; // return new WP number |
459 | UART1_Request_NewPoint = TRUE; // return new WP number |
460 | } |
460 | } |
461 | } |
461 | } |
Line 462... | Line 462... | ||
462 | } |
462 | } |
463 | break; |
463 | break; |
464 | 464 | ||
Line 465... | Line 465... | ||
465 | case 'x':// Read Waypoint from List |
465 | case 'x':// Read Waypoint from List |
466 | UART1_Request_ReadWaypoint = SerialMsg.pData[0]; |
466 | UART1_Request_ReadPoint = SerialMsg.pData[0]; |
467 | break; |
467 | break; |
Line 641... | Line 641... | ||
641 | { |
641 | { |
642 | 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 |
643 | Echo = 0; // reset echo value |
643 | Echo = 0; // reset echo value |
644 | UART1_Request_Echo = FALSE; |
644 | UART1_Request_Echo = FALSE; |
645 | } |
645 | } |
646 | else if(UART1_Request_NewWaypoint && (UART1_tx_buffer.Locked == FALSE)) |
646 | else if(UART1_Request_NewPoint && (UART1_tx_buffer.Locked == FALSE)) |
647 | { |
647 | { |
648 | u8 WPNumber = WPList_GetCount(); |
648 | u8 PointCount = PointList_GetCount(); |
649 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber)); |
649 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &PointCount, sizeof(PointCount)); |
650 | UART1_Request_NewWaypoint = FALSE; |
650 | UART1_Request_NewPoint = FALSE; |
651 | } |
651 | } |
652 | else if((UART1_Request_ReadWaypoint) && (UART1_tx_buffer.Locked == FALSE)) |
652 | else if((UART1_Request_ReadPoint) && (UART1_tx_buffer.Locked == FALSE)) |
653 | { |
653 | { |
654 | u8 WPNumber = WPList_GetCount(); |
654 | u8 PointCount = PointList_GetCount(); |
655 | if (UART1_Request_ReadWaypoint <= WPNumber) |
655 | if (UART1_Request_ReadPoint <= PointCount) |
656 | { |
656 | { |
657 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &WPNumber, 1, &UART1_Request_ReadWaypoint, 1, WPList_GetAt(UART1_Request_ReadWaypoint), sizeof(Waypoint_t)); |
657 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &PointCount, 1, &UART1_Request_ReadPoint, 1, PointList_GetAt(UART1_Request_ReadPoint), sizeof(Point_t)); |
658 | } |
658 | } |
659 | else |
659 | else |
660 | { |
660 | { |
661 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer,'X', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber)); |
661 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer,'X', NC_ADDRESS, 1, &PointCount, sizeof(PointCount)); |
662 | } |
662 | } |
663 | UART1_Request_ReadWaypoint = 0; |
663 | UART1_Request_ReadPoint = 0; |
664 | } |
664 | } |
665 | else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
665 | else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
666 | { |
666 | { |
667 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16); |
667 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16); |
668 | UART1_Request_DebugLabel = 0xFF; |
668 | UART1_Request_DebugLabel = 0xFF; |