4,7 → 4,7 |
unsigned char TxBuffer[150]; |
unsigned char _TxBuffer[150]; |
|
unsigned char RxBuffer[150]; |
char RxBuffer[150]; |
char PrintableRxBuffer[150]; |
|
|
83,38 → 83,12 |
|
int rx_last_length; |
|
|
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) |
{ |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
unsigned char x,y,z; |
while(len) |
{ |
a = RxBuffer[ptrIn++] - '='; |
b = RxBuffer[ptrIn++] - '='; |
c = RxBuffer[ptrIn++] - '='; |
d = RxBuffer[ptrIn++] - '='; |
if(ptrIn > max - 2) break; |
|
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
|
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
} |
|
} |
|
int read_from_mk() |
{ |
char in_char='#'; |
int count=0; |
int r=0; |
int i=0; |
|
|
printf("starting read\n"); |
while(in_char!='\n') |
{ |
138,11 → 112,8 |
printf("done --->%s\n",PrintableRxBuffer); |
|
if (RxBuffer[2]=='D') |
{ |
debug_sets++; |
Decode64((unsigned char *) &DebugOut,sizeof(DebugOut),3,rx_last_length); |
printf("decoded FC Debug data height:%d\n",DebugOut.Analog[5]); |
} |
debug_sets++; |
|
return 1; |
} |
|