Subversion Repositories NaviCtrl

Rev

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

Rev 155 Rev 156
Line 71... Line 71...
71
#include "timer2.h"
71
#include "timer2.h"
72
#include "analog.h"
72
#include "analog.h"
73
#include "main.h"
73
#include "main.h"
74
#include "waypoints.h"
74
#include "waypoints.h"
75
#include "mkprotocol.h"
75
#include "mkprotocol.h"
-
 
76
#include "params.h"
76
#include "fifo.h"
77
#include "fifo.h"
Line 77... Line 78...
77
 
78
 
78
#define FALSE   0
79
#define FALSE   0
Line 90... Line 91...
90
u8 UART1_Request_ErrorMessage   = FALSE;
91
u8 UART1_Request_ErrorMessage   = FALSE;
91
u8 UART1_Request_NewWaypoint    = FALSE;
92
u8 UART1_Request_NewWaypoint    = FALSE;
92
u8 UART1_Request_ReadWaypoint   = 255;
93
u8 UART1_Request_ReadWaypoint   = 255;
93
u8 UART1_Request_Data3D             = FALSE;
94
u8 UART1_Request_Data3D             = FALSE;
94
u8 UART1_Request_Echo               = FALSE;
95
u8 UART1_Request_Echo               = FALSE;
-
 
96
u8 UART1_Request_ParameterId    = 0;
-
 
97
u8 UART1_Request_Parameter              = TRUE;
95
u8 UART1_DisplayLine                    = 0;
98
u8 UART1_DisplayLine                    = 0;
96
u8 UART1_ConfirmFrame                   = 0;
99
u8 UART1_ConfirmFrame                   = 0;
Line 97... Line 100...
97
 
100
 
Line 429... Line 432...
429
 
432
 
430
                        case 'x'://  Read Waypoint from List
433
                        case 'x'://  Read Waypoint from List
431
                                UART1_Request_ReadWaypoint = SerialMsg.pData[0];
434
                                UART1_Request_ReadWaypoint = SerialMsg.pData[0];
Line -... Line 435...
-
 
435
                                break;
-
 
436
 
-
 
437
                        case 'p':// Set/Get NC-Parameter
-
 
438
                                switch(SerialMsg.pData[0])
-
 
439
                                {
-
 
440
                                        case 0: // get
-
 
441
                                        break;
-
 
442
                                       
-
 
443
                                        case 1: // set
-
 
444
                                        NCParams_SetValue(SerialMsg.pData[1], *(s16*)(&SerialMsg.pData[2]));
-
 
445
                                        break;
-
 
446
 
-
 
447
                                        default:
-
 
448
                                        break;
-
 
449
                                }
-
 
450
                                UART1_Request_ParameterId = SerialMsg.pData[1];
432
                                break;
451
                                UART1_Request_Parameter = TRUE;
433
 
452
                                break;
434
                        default:
453
                        default:
435
                                // unsupported command recieved
454
                                // unsupported command recieved
436
                                break;
455
                                break;
Line 553... Line 572...
553
{
572
{
554
        if(DebugUART != UART1) return;
573
        if(DebugUART != UART1) return;
555
        UART1_Transmit(); // output pending bytes in tx buffer
574
        UART1_Transmit(); // output pending bytes in tx buffer
556
        if((UART1_tx_buffer.Locked == TRUE)) return;
575
        if((UART1_tx_buffer.Locked == TRUE)) return;
Line -... Line 576...
-
 
576
 
-
 
577
        if(UART1_Request_Parameter && (UART1_tx_buffer.Locked == FALSE))
-
 
578
        {
-
 
579
                s16 ParamValue;
-
 
580
                ParamValue = NCParams_GetValue(UART1_Request_ParameterId);
-
 
581
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'P', NC_ADDRESS, 2, &UART1_Request_ParameterId, sizeof(UART1_Request_ParameterId), &ParamValue, sizeof(ParamValue)); // answer the param request
-
 
582
                UART1_Request_Parameter = FALSE;
557
 
583
        }
558
        if(UART1_Request_Echo && (UART1_tx_buffer.Locked == FALSE))
584
        else if(UART1_Request_Echo && (UART1_tx_buffer.Locked == FALSE))
559
        {
585
        {
560
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request
586
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request
561
                Echo = 0; // reset echo value
587
                Echo = 0; // reset echo value
562
                UART1_Request_Echo = FALSE;
588
                UART1_Request_Echo = FALSE;