Rev 215 | Rev 225 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 215 | Rev 224 | ||
---|---|---|---|
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 oldIndex = 0x00; |
440 | static u8 nextIndex = 0x00; |
- | 441 | ||
441 | 442 | pWaypoint = (Waypoint_t*)SerialMsg.pData; |
|
442 | pWaypoint = (Waypoint_t*)SerialMsg.pData; |
443 | |
443 | if(pWaypoint->Position.Status == INVALID) |
444 | if (pWaypoint->Index == 0) // is the POI |
444 | { // clear WP List |
445 | { |
445 | WPList_Clear(); |
446 | WPList_SetPOI(pWaypoint); //update POI also when invalid |
- | 447 | WPList_Clear(); //delete the WP List |
|
- | 448 | GPS_pWaypoint = WPList_Begin(); |
|
446 | oldIndex = 0x00; |
449 | nextIndex = 0x01; |
- | 450 | BeepTime = 300; |
|
- | 451 | UART1_Request_NewWaypoint = TRUE; |
|
447 | 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 | } |
|
448 | UART1_Request_NewWaypoint = TRUE; |
455 | else // normal WP |
449 | } |
456 | { |
450 | else if (pWaypoint->Position.Status == NEWDATA) |
457 | if (pWaypoint->Position.Status == NEWDATA) |
451 | { // app current WP to the list |
458 | { // app current WP to the list |
452 | if (pWaypoint->Index == oldIndex + 1) |
459 | if (pWaypoint->Index == nextIndex) |
453 | { |
460 | { |
454 | WPList_Append(pWaypoint); |
461 | WPList_Append(pWaypoint); |
455 | BeepTime = 500; |
462 | BeepTime = 500; |
- | 463 | nextIndex = pWaypoint->Index+1; |
|
456 | oldIndex = pWaypoint->Index; |
464 | UART1_Request_NewWaypoint = TRUE; // return new WP number |
457 | UART1_Request_NewWaypoint = TRUE; |
465 | } |
458 | } |
466 | } |
459 | } |
467 | } |