Subversion Repositories Projects

Rev

Rev 130 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 130 Rev 140
Line 2... Line 2...
2
 
2
 
3
 
3
 
Line 4... Line 4...
4
unsigned char TxBuffer[150];
4
unsigned char TxBuffer[150];
5
unsigned char _TxBuffer[150];
5
unsigned char _TxBuffer[150];
Line 6... Line 6...
6
 
6
 
Line 81... Line 81...
81
}
81
}
Line 82... Line 82...
82
 
82
 
Line -... Line 83...
-
 
83
 
-
 
84
int rx_last_length;
-
 
85
 
-
 
86
 
-
 
87
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max)
-
 
88
{
-
 
89
 unsigned char a,b,c,d;
-
 
90
 unsigned char ptr = 0;
-
 
91
 unsigned char x,y,z;
-
 
92
 while(len)
-
 
93
  {
-
 
94
   a = RxBuffer[ptrIn++] - '=';
-
 
95
   b = RxBuffer[ptrIn++] - '=';
-
 
96
   c = RxBuffer[ptrIn++] - '=';
-
 
97
   d = RxBuffer[ptrIn++] - '=';
-
 
98
   if(ptrIn > max - 2) break;    
-
 
99
 
-
 
100
   x = (a << 2) | (b >> 4);
-
 
101
   y = ((b & 0x0f) << 4) | (c >> 2);
-
 
102
   z = ((c & 0x03) << 6) | d;
-
 
103
 
-
 
104
   if(len--) ptrOut[ptr++] = x; else break;
-
 
105
   if(len--) ptrOut[ptr++] = y; else break;
-
 
106
   if(len--) ptrOut[ptr++] = z; else break;
-
 
107
  }
83
 
108
 
84
int rx_last_length;
109
}
85
 
110
 
86
int read_from_mk()
111
int read_from_mk()
87
{      
112
{      
-
 
113
  char in_char='#';
88
  char in_char='#';
114
  int count=0;
89
  int count=0;
115
  int r=0;
90
  int r=0;
116
  int i=0;
91
 
117
 
92
  printf("starting read\n");
118
  printf("starting read\n");
93
  while(in_char!='\n')
119
  while(in_char!='\n')
Line 110... Line 136...
110
  rx_last_length=r;
136
  rx_last_length=r;
111
  PrintableRxBuffer[r++]='\0'; // terminate 
137
  PrintableRxBuffer[r++]='\0'; // terminate 
112
  printf("done --->%s\n",PrintableRxBuffer);
138
  printf("done --->%s\n",PrintableRxBuffer);
Line 113... Line 139...
113
 
139
 
-
 
140
  if (RxBuffer[2]=='D')
114
  if (RxBuffer[2]=='D')
141
    {
-
 
142
      debug_sets++;
-
 
143
      Decode64((unsigned char *) &DebugOut,sizeof(DebugOut),3,rx_last_length);
115
    debug_sets++;
144
      printf("decoded FC Debug data height:%d\n",DebugOut.Analog[5]);
116
 
145
    }
117
  return 1;
146
  return 1;
Line 118... Line 147...
118
}
147
}