DRONE/dronecommunication.c
void collect_serial_frame(serial_data_struct* pdata_package_collect){
	pdata_package_collect->position_package++; 																							//first character: #
	pdata_package_collect->address = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - 'a'; 	//address
	pdata_package_collect->cmdID = pdata_package_collect->collecting_data[pdata_package_collect->position_package++]; 			//cmdID
	u8 a, b, c, d;
	u16 datacpy = 0;
	while(pdata_package_collect->position_package < pdata_package_collect->dataLength-3){
		a = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		b = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		c = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		d = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';

		pdata_package_collect->data[datacpy++] = (a << 2) | (b >> 4);
		pdata_package_collect->data[datacpy++] = ((b & 0x0f) << 4) | (c >> 2);
		pdata_package_collect->data[datacpy++] = ((c & 0x03) << 6) | d;
	}
	pdata_package_collect->dataLength = datacpy;
	pdata_package_collect->position_package = 0;
	

	//printf("Decoded data \n%s\n", pdata_package_collect->collecting_data);
	//fprintf (fp,"Decoded data \n%s\n", pdata_package_collect->collecting_data);
	/*
	for (int i = 0; i < datacpy; ++i)
	{
		//printf("|%d|: %d ", i, pdata_package_collect->data[i]);
		fprintf (fp,"|%d|: %d ", i, pdata_package_collect->data[i]);
	}

	//printf("\nData as String \n%s\n", pdata_package_collect->data);
	/**/
	
}
//>> Decoding Data and retrieving address and cmdID
//------------------------------------------------------------------------------------------------------
>> Decoding Data and retrieving address and cmdID
>> Decoding Data and retrieving address and cmdID
void collect_serial_frame(serial_data_struct* pdata_package_collect){
	pdata_package_collect->position_package++; 																							
	pdata_package_collect->address = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - 'a'; 	
	pdata_package_collect->cmdID = pdata_package_collect->collecting_data[pdata_package_collect->position_package++]; 			
	u8 a, b, c, d;
	u16 datacpy = 0;
	while(pdata_package_collect->position_package < pdata_package_collect->dataLength-3){
		a = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		b = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		c = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		d = pdata_package_collect->collecting_data[pdata_package_collect->position_package++] - '=';
		pdata_package_collect->data[datacpy++] = (a << 2) | (b >> 4);
		pdata_package_collect->data[datacpy++] = ((b & 0x0f) << 4) | (c >> 2);
		pdata_package_collect->data[datacpy++] = ((c & 0x03) << 6) | d;
	}
	pdata_package_collect->dataLength = datacpy;
	pdata_package_collect->position_package = 0;
}
void collect_serial_frame ( serial_data_struct * pdata_package_collect ) { pdata_package_collect -> position_package ++ ; pdata_package_collect -> address = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] - ' ' ; pdata_package_collect -> cmdID = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] ; u8 a , b , c , d ; u16 datacpy = 0 ; while ( pdata_package_collect -> position_package < pdata_package_collect -> dataLength - 3 ) { a = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] - ' ' ; b = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] - ' ' ; c = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] - ' ' ; d = pdata_package_collect -> collecting_data [ pdata_package_collect -> position_package ++ ] - ' ' ; pdata_package_collect -> data [ datacpy ++ ] = ( a << 2 ) | ( b >> 4 ) ; pdata_package_collect -> data [ datacpy ++ ] = ( ( b & 0x0f ) << 4 ) | ( c >> 2 ) ; pdata_package_collect -> data [ datacpy ++ ] = ( ( c & 0x03 ) << 6 ) | d ; } pdata_package_collect -> dataLength = datacpy ; pdata_package_collect -> position_package = 0 ; }
>> Decoding Data and retrieving address and cmdID
>> Decoding Data and retrieving address and cmdID
//first character: # //address //cmdID //printf("Decoded data \n%s\n", pdata_package_collect->collecting_data); //fprintf (fp,"Decoded data \n%s\n", pdata_package_collect->collecting_data); /*
	for (int i = 0; i < datacpy; ++i)
	{
		//printf("|%d|: %d ", i, pdata_package_collect->data[i]);
		fprintf (fp,"|%d|: %d ", i, pdata_package_collect->data[i]);
	}

	//printf("\nData as String \n%s\n", pdata_package_collect->data);
	/**/