Subversion Repositories NaviCtrl

Rev

Rev 191 | Rev 193 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 191 Rev 192
Line 360... Line 360...
360
 
360
 
361
        // analyze header first
361
        // analyze header first
362
        MKProtocol_DecodeSerialFrameHeader(&UART1_rx_buffer, &SerialMsg);
362
        MKProtocol_DecodeSerialFrameHeader(&UART1_rx_buffer, &SerialMsg);
363
        if( (SerialMsg.Address == FC_ADDRESS) && (SerialMsg.CmdID == 'y') )
363
        if( (SerialMsg.Address == FC_ADDRESS) && (SerialMsg.CmdID == 'y') )
-
 
364
        {
-
 
365
                switch(SerialMsg.CmdID)
-
 
366
                {
-
 
367
                        case 'y': // serial poti values
364
        {
368
                        case 'b': // extern control
365
                Buffer_Copy(&UART1_rx_buffer, &UART2_tx_buffer);
369
                                Buffer_Copy(&UART1_rx_buffer, &UART2_tx_buffer); //forward to FC
366
                Buffer_Clear(&UART1_rx_buffer); // free rc buffer for next frame
370
                                Buffer_Clear(&UART1_rx_buffer); // free rc buffer for next frame
-
 
371
                                return;
-
 
372
                        break;
367
                return;
373
                }
Line 368... Line 374...
368
        }      
374
        }      
369
 
375
 
370
        MKProtocol_DecodeSerialFrameData(&UART1_rx_buffer, &SerialMsg); // decode serial frame in rxd buffer
376
        MKProtocol_DecodeSerialFrameData(&UART1_rx_buffer, &SerialMsg); // decode serial frame in rxd buffer
Line 652... Line 658...
652
        {
658
        {
653
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D));
659
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D));
654
                UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval);
660
                UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval);
655
                UART1_Request_Data3D = FALSE;
661
                UART1_Request_Data3D = FALSE;
656
        }
662
        }
-
 
663
       
657
        else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
664
        else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
658
        {
665
        {
659
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame));
666
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame));
660
                UART1_ConfirmFrame = 0;
667
                UART1_ConfirmFrame = 0;
661
        }
668
        }
-
 
669
       
-
 
670
       
662
        else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
671
        else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
663
        {
672
        {
664
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
673
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
665
                UART1_Request_ExternalControl = FALSE;
674
                UART1_Request_ExternalControl = FALSE;
666
        }
675
        }
-
 
676
       
667
        else if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE))
677
        else if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE))
668
        {
678
        {
669
                LCD_PrintMenu();
679
                LCD_PrintMenu();
670
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20);
680
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20);
671
                UART1_DisplayLine++;
681
                UART1_DisplayLine++;
Line 694... Line 704...
694
                FollowMe.Position.Status = NEWDATA;
704
                FollowMe.Position.Status = NEWDATA;
695
                FollowMe.Heading = -1;
705
                FollowMe.Heading = -1;
696
                FollowMe.ToleranceRadius = 1;
706
                FollowMe.ToleranceRadius = 1;
697
                FollowMe.HoldTime = 60;
707
                FollowMe.HoldTime = 60;
698
                FollowMe.Event_Flag = 0;
708
                FollowMe.Event_Flag = 0;
-
 
709
                FollowMe.Index = 1;
699
                FollowMe.reserve[0] = 0;                // reserve
710
                FollowMe.reserve[0] = 0;                // reserve
700
                FollowMe.reserve[1] = 0;                // reserve
711
                FollowMe.reserve[1] = 0;                // reserve
701
                FollowMe.reserve[2] = 0;                // reserve
712
                FollowMe.reserve[2] = 0;                // reserve
702
                FollowMe.reserve[3] = 0;                // reserve
713
                FollowMe.reserve[3] = 0;                // reserve
703
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe));
714
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe));