Rev 497 | Rev 503 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 497 | Rev 498 | ||
---|---|---|---|
Line 498... | Line 498... | ||
498 | 498 | ||
499 | u8 IsGeneralSection = 0; |
499 | u8 IsGeneralSection = 0; |
500 | u8 IsPointSection = 0; |
500 | u8 IsPointSection = 0; |
Line -... | Line 501... | ||
- | 501 | u8 WPNumber = 0; |
|
- | 502 | ||
- | 503 | ||
- | 504 | // clear point list first |
|
- | 505 | PointList_Clear(); |
|
501 | u8 WPNumber = 0; |
506 | pWPL_Store->Name[0] = 0; // clear current list name |
502 | 507 | ||
503 | // user absolute path, i.e. leading / |
508 | // user absolute path, i.e. leading / |
504 | if(pWPL_Store->Index == 0) // index 0 looks for a default WPL file in the root |
509 | if(pWPL_Store->Index == 0) // index 0 looks for a default WPL file in the root |
505 | { |
510 | { |
Line 520... | Line 525... | ||
520 | if(fp == NULL) |
525 | if(fp == NULL) |
521 | { |
526 | { |
522 | UART1_PutString("ERROR: Reading waypoint file!\r\n"); |
527 | UART1_PutString("ERROR: Reading waypoint file!\r\n"); |
523 | return(retval); |
528 | return(retval); |
524 | } |
529 | } |
525 | // clear point list first |
- | |
526 | PointList_Clear(); |
- | |
527 | // read all lines from file |
530 | // read all lines from file |
528 | while(fgets_(wpline, LINE_MAX, fp) != 0) |
531 | while(fgets_(wpline, LINE_MAX, fp) != 0) |
529 | { |
532 | { |
530 | if ( // ignorelines starting with \r,\n,' ',';','#' |
533 | if ( // ignorelines starting with \r,\n,' ',';','#' |
531 | (wpline[0] != '\n') && |
534 | (wpline[0] != '\n') && |
Line 671... | Line 674... | ||
671 | } |
674 | } |
672 | } |
675 | } |
673 | else if (strcmp(name, "NAME") == 0) |
676 | else if (strcmp(name, "NAME") == 0) |
674 | { |
677 | { |
675 | u8 len = strlen(value); |
678 | u8 len = strlen(value); |
676 | if(len > 11) |
679 | if(value[len-1] == '\r') |
- | 680 | { |
|
677 | value[11] = 0; |
681 | value[len-1] = 0; |
- | 682 | len--; |
|
- | 683 | } |
|
- | 684 | if(len > 11) value[11] = 0; |
|
678 | memcpy(pWPL_Store->Name, value, 12); |
685 | memcpy(pWPL_Store->Name, value, 12); |
679 | } |
686 | } |
680 | else |
687 | else |
681 | { |
688 | { |
682 | UART1_PutString("Unknown key: "); |
689 | UART1_PutString("Unknown key: "); |