Subversion Repositories NaviCtrl

Rev

Rev 192 | Rev 194 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 192 Rev 193
Line 164... Line 164...
164
NaviData_t NaviData;
164
NaviData_t NaviData;
165
Waypoint_t FollowMe;
165
Waypoint_t FollowMe;
166
Data3D_t Data3D;
166
Data3D_t Data3D;
167
u16 Echo; // 2 bytes recieved will be sent back as echo
167
u16 Echo; // 2 bytes recieved will be sent back as echo
Line 168... Line 168...
168
 
168
 
169
u32 UART1_DebugData_Timer;
169
u32 UART1_DebugData_Timer = 0;
170
u32 UART1_DebugData_Interval = 5000;    // in ms
170
u32 UART1_DebugData_Interval = 5000;    // in ms
171
u32 UART1_NaviData_Timer;
171
u32 UART1_NaviData_Timer = 0;
172
u32 UART1_NaviData_Interval = 5000;     // in ms
172
u32 UART1_NaviData_Interval = 5000;             // in ms
173
u32 UART1_Data3D_Timer = 0;                     // in ms
173
u32 UART1_Data3D_Timer = 0;                             // in ms
-
 
174
u32 UART1_Data3D_Interval = 0;
-
 
175
u32 UART1_Display_Timer = 0;
Line 174... Line 176...
174
u32 UART1_Data3D_Interval = 0;
176
u32 UART1_Display_Interval = 0;
175
 
177
 
176
/********************************************************/
178
/********************************************************/
177
/*            Initialization the UART1                  */
179
/*            Initialization the UART1                  */
Line 490... Line 492...
490
                {
492
                {
491
                        case 'a':// request for the labels of the analog debug outputs
493
                        case 'a':// request for the labels of the analog debug outputs
492
                                UART1_Request_DebugLabel = SerialMsg.pData[0];
494
                                UART1_Request_DebugLabel = SerialMsg.pData[0];
493
                                if(UART1_Request_DebugLabel > 31) UART1_Request_DebugLabel = 31;
495
                                if(UART1_Request_DebugLabel > 31) UART1_Request_DebugLabel = 31;
494
                                break;
496
                                break;
495
                       
497
                        /*
496
                        case 'b': // submit extern control
498
                        case 'b': // submit extern control
497
                                memcpy(&ExternControl, SerialMsg.pData, sizeof(ExternControl));
499
                                memcpy(&ExternControl, SerialMsg.pData, sizeof(ExternControl));
498
                                UART1_ConfirmFrame = ExternControl.Frame;
500
                                UART1_ConfirmFrame = ExternControl.Frame;
499
                                break;
501
                                break;
500
                       
502
                        */     
501
                        case 'd': // request for debug data;
503
                        case 'd': // request for debug data;
502
                                UART1_DebugData_Interval = (u32) SerialMsg.pData[0] * 10;
504
                                UART1_DebugData_Interval = (u32) SerialMsg.pData[0] * 10;
503
                                if(UART1_DebugData_Interval > 0) UART1_Request_DebugData = TRUE;
505
                                if(UART1_DebugData_Interval > 0) UART1_Request_DebugData = TRUE;
504
                                break;
506
                                break;
Line 505... Line 507...
505
 
507
 
506
                        case 'c': // request for 3D data;
508
                        case 'c': // request for 3D data;
507
                                UART1_Data3D_Interval = (u32) SerialMsg.pData[0] * 10;
509
                                UART1_Data3D_Interval = (u32) SerialMsg.pData[0] * 10;
508
                                if(UART1_Data3D_Interval > 0) UART1_Request_Data3D = TRUE;
510
                                if(UART1_Data3D_Interval > 0) UART1_Request_Data3D = TRUE;
509
                                break;
511
                                break;
510
                       
512
                        /*
511
                        case 'g':// request for external control data
513
                        case 'g':// request for external control data
512
                                UART1_Request_ExternalControl = TRUE;
514
                                UART1_Request_ExternalControl = TRUE;
513
                                break;
515
                                break;
514
                       
516
                        */
-
 
517
                        case 'h':// reqest for display line
-
 
518
                                if((SerialMsg.pData[0]& 0x80) == 0x00)// old format
-
 
519
                                {
-
 
520
                                        UART1_DisplayLine = 2;
-
 
521
                                        UART1_Display_Interval = 0;    
-
 
522
                                }
-
 
523
                                else
515
                        case 'h':// reqest for display line
524
                                {
-
 
525
                                        RemoteKeys |= ~SerialMsg.pData[0];
516
                                RemoteKeys |= SerialMsg.pData[0];
526
                                        UART1_Display_Interval = (u32) SerialMsg.pData[1] * 10;
-
 
527
                                        UART1_DisplayLine = 4;
517
                                if(RemoteKeys != 0) UART1_DisplayLine = 0;
528
                                }
518
                                UART1_Request_Display = TRUE;
529
                                UART1_Request_Display = TRUE;
Line 519... Line 530...
519
                                break;
530
                                break;
520
 
531
 
Line 658... Line 669...
658
        {
669
        {
659
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D));
670
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D));
660
                UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval);
671
                UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval);
661
                UART1_Request_Data3D = FALSE;
672
                UART1_Request_Data3D = FALSE;
662
        }
673
        }
663
       
674
        /*
664
        else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
675
        else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
665
        {
676
        {
666
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame));
677
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame));
667
                UART1_ConfirmFrame = 0;
678
                UART1_ConfirmFrame = 0;
668
        }
679
        }
669
       
680
        */
670
       
681
        /*
671
        else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
682
        else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
672
        {
683
        {
673
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
684
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
674
                UART1_Request_ExternalControl = FALSE;
685
                UART1_Request_ExternalControl = FALSE;
675
        }
686
        }
676
       
687
        */
677
        else if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE))
688
        else if( (( (UART1_Display_Interval > 0) && CheckDelay(UART1_Display_Timer)) || UART1_Request_Display) && (UART1_tx_buffer.Locked == FALSE))
678
        {
689
        {      
-
 
690
                if(UART1_DisplayLine > 3)
-
 
691
                {
679
                LCD_PrintMenu();
692
                        LCD_PrintMenu();
680
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20);
693
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 1, (u8*)DisplayBuff, sizeof(DisplayBuff));
-
 
694
                }
-
 
695
                else
-
 
696
                {
681
                UART1_DisplayLine++;
697
                        UART1_DisplayLine = 2;
-
 
698
                        sprintf(text,"!!! incompatible !!!");
-
 
699
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&text, 20);
682
                if(UART1_DisplayLine >= 4) UART1_DisplayLine = 0;
700
                        if(UART1_DisplayLine++ > 3) UART1_DisplayLine = 0;
-
 
701
                }
-
 
702
                UART1_Display_Timer = SetDelay(UART1_Display_Interval);
683
                UART1_Request_Display = FALSE;
703
                UART1_Request_Display = FALSE;
684
        }
704
        }
685
        else if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE))
705
        else if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE))
686
        {
706
        {
687
                LCD_PrintMenu();
707
                LCD_PrintMenu();