Rev 150 | Rev 153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 150 | Rev 151 | ||
---|---|---|---|
Line 527... | Line 527... | ||
527 | { |
527 | { |
528 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request |
528 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request |
529 | Echo = 0; // reset echo value |
529 | Echo = 0; // reset echo value |
530 | UART1_Request_Echo = FALSE; |
530 | UART1_Request_Echo = FALSE; |
531 | } |
531 | } |
532 | if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
532 | else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
533 | { |
533 | { |
534 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16); |
534 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16); |
535 | UART1_Request_DebugLabel = 0xFF; |
535 | UART1_Request_DebugLabel = 0xFF; |
536 | } |
536 | } |
537 | if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE)) |
537 | else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE)) |
538 | { |
538 | { |
539 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame)); |
539 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame)); |
540 | UART1_ConfirmFrame = 0; |
540 | UART1_ConfirmFrame = 0; |
541 | } |
541 | } |
- | 542 | else if(( ((UART1_NaviData_Interval > 0) && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE)) |
|
- | 543 | { |
|
- | 544 | NaviData.Errorcode = ErrorCode; |
|
- | 545 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData)); |
|
- | 546 | UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval); |
|
- | 547 | UART1_Request_NaviData = FALSE; |
|
- | 548 | } |
|
542 | if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE)) |
549 | else if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE)) |
543 | { |
550 | { |
544 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'D', NC_ADDRESS, 1,(u8 *)&DebugOut, sizeof(DebugOut)); |
551 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'D', NC_ADDRESS, 1,(u8 *)&DebugOut, sizeof(DebugOut)); |
545 | UART1_DebugData_Timer = SetDelay(UART1_DebugData_Interval); |
552 | UART1_DebugData_Timer = SetDelay(UART1_DebugData_Interval); |
546 | UART1_Request_DebugData = FALSE; |
553 | UART1_Request_DebugData = FALSE; |
547 | } |
554 | } |
548 | - | ||
549 | if((( (UART1_Data3D_Interval > 0) && CheckDelay(UART1_Data3D_Timer) ) || UART1_Request_Data3D) && (UART1_tx_buffer.Locked == FALSE)) |
555 | else if((( (UART1_Data3D_Interval > 0) && CheckDelay(UART1_Data3D_Timer) ) || UART1_Request_Data3D) && (UART1_tx_buffer.Locked == FALSE)) |
550 | { |
556 | { |
551 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D)); |
557 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D)); |
552 | UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval); |
558 | UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval); |
553 | UART1_Request_Data3D = FALSE; |
559 | UART1_Request_Data3D = FALSE; |
554 | } |
560 | } |
Line 555... | Line 561... | ||
555 | 561 | ||
556 | if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE)) |
562 | else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE)) |
557 | { |
563 | { |
558 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl)); |
564 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl)); |
559 | UART1_Request_ExternalControl = FALSE; |
565 | UART1_Request_ExternalControl = FALSE; |
560 | } |
566 | } |
561 | if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE)) |
567 | else if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE)) |
562 | { |
568 | { |
563 | LCD_PrintMenu(); |
569 | LCD_PrintMenu(); |
564 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20); |
570 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20); |
565 | UART1_DisplayLine++; |
571 | UART1_DisplayLine++; |
566 | if(UART1_DisplayLine >= 4) UART1_DisplayLine = 0; |
572 | if(UART1_DisplayLine >= 4) UART1_DisplayLine = 0; |
567 | UART1_Request_Display = FALSE; |
573 | UART1_Request_Display = FALSE; |
568 | } |
574 | } |
569 | if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE)) |
575 | else if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE)) |
570 | { |
576 | { |
571 | LCD_PrintMenu(); |
577 | LCD_PrintMenu(); |
572 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'L', NC_ADDRESS, 3, (u8*)&MenuItem, sizeof(MenuItem), (u8*)&MaxMenuItem, sizeof(MaxMenuItem),(u8*)DisplayBuff, sizeof(DisplayBuff)); |
578 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'L', NC_ADDRESS, 3, (u8*)&MenuItem, sizeof(MenuItem), (u8*)&MaxMenuItem, sizeof(MaxMenuItem),(u8*)DisplayBuff, sizeof(DisplayBuff)); |
573 | UART1_Request_Display1 = FALSE; |
579 | UART1_Request_Display1 = FALSE; |
574 | } |
580 | } |
575 | if(UART1_Request_VersionInfo && (UART1_tx_buffer.Locked == FALSE)) |
581 | else if(UART1_Request_VersionInfo && (UART1_tx_buffer.Locked == FALSE)) |
576 | { |
582 | { |
577 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'V', NC_ADDRESS,1, (u8 *)&UART_VersionInfo, sizeof(UART_VersionInfo)); |
583 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'V', NC_ADDRESS,1, (u8 *)&UART_VersionInfo, sizeof(UART_VersionInfo)); |
578 | UART1_Request_VersionInfo = FALSE; |
584 | UART1_Request_VersionInfo = FALSE; |
579 | } |
- | |
580 | if(( (UART1_NaviData_Interval && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE)) |
- | |
581 | { |
- | |
582 | NaviData.Errorcode = ErrorCode; |
- | |
583 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData)); |
- | |
584 | UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval); |
- | |
585 | UART1_Request_NaviData = FALSE; |
- | |
586 | } |
585 | } |
587 | if(UART1_Request_ErrorMessage && (UART1_tx_buffer.Locked == FALSE)) |
586 | else if(UART1_Request_ErrorMessage && (UART1_tx_buffer.Locked == FALSE)) |
588 | { |
587 | { |
589 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'E', NC_ADDRESS, 1, (u8 *)&ErrorMSG, sizeof(ErrorMSG)); |
588 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'E', NC_ADDRESS, 1, (u8 *)&ErrorMSG, sizeof(ErrorMSG)); |
590 | UART1_Request_ErrorMessage = FALSE; |
589 | UART1_Request_ErrorMessage = FALSE; |
591 | } |
590 | } |
592 | if(UART1_Request_SendFollowMe && (UART1_tx_buffer.Locked == FALSE) && (GPSData.NumOfSats >= 4)) // sending for "Follow me" |
591 | else if(UART1_Request_SendFollowMe && (UART1_tx_buffer.Locked == FALSE) && (GPSData.NumOfSats >= 4)) // sending for "Follow me" |
593 | { |
592 | { |
594 | GPS_CopyPosition(&(GPSData.Position),&(FollowMe.Position)); |
593 | GPS_CopyPosition(&(GPSData.Position),&(FollowMe.Position)); |
595 | FollowMe.Position.Status = NEWDATA; |
594 | FollowMe.Position.Status = NEWDATA; |
596 | FollowMe.Heading = -1; |
595 | FollowMe.Heading = -1; |
Line 602... | Line 601... | ||
602 | FollowMe.reserve[2] = 0; // reserve |
601 | FollowMe.reserve[2] = 0; // reserve |
603 | FollowMe.reserve[3] = 0; // reserve |
602 | FollowMe.reserve[3] = 0; // reserve |
604 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe)); |
603 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe)); |
605 | UART1_Request_SendFollowMe = FALSE; |
604 | UART1_Request_SendFollowMe = FALSE; |
606 | } |
605 | } |
607 | if(UART1_Request_NewWaypoint && (UART1_tx_buffer.Locked == FALSE)) |
606 | else if(UART1_Request_NewWaypoint && (UART1_tx_buffer.Locked == FALSE)) |
608 | { |
607 | { |
609 | u8 WPNumber = WPList_GetCount(); |
608 | u8 WPNumber = WPList_GetCount(); |
610 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber)); |
609 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber)); |
611 | UART1_Request_NewWaypoint = FALSE; |
610 | UART1_Request_NewWaypoint = FALSE; |
612 | } |
611 | } |
613 | if((UART1_Request_ReadWaypoint != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
612 | else if((UART1_Request_ReadWaypoint != 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
614 | { |
613 | { |
615 | u8 WPNumber = WPList_GetCount(); |
614 | u8 WPNumber = WPList_GetCount(); |
616 | if (UART1_Request_ReadWaypoint < WPNumber) |
615 | if (UART1_Request_ReadWaypoint < WPNumber) |
617 | { |
616 | { |
618 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &WPNumber, 1, &UART1_Request_ReadWaypoint, 1, WPList_GetAt(UART1_Request_ReadWaypoint), sizeof(Waypoint_t)); |
617 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'X', NC_ADDRESS, 3, &WPNumber, 1, &UART1_Request_ReadWaypoint, 1, WPList_GetAt(UART1_Request_ReadWaypoint), sizeof(Waypoint_t)); |