Rev 403 |
Blame |
Last modification |
View Log
| RSS feed
/*********************************************
*
* class representing the DebugData Structure
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
********************************************/
public class MKDebugData
{
public int[] analog;
public int motor_complete=-1;
private int i;
public int motor_val(int id) { return analog[12+id]; }
public int nick_int() { return analog[1]; }
public int roll_int() { return analog[2]; }
public int accnick() { return analog[3]; }
public int accroll() { return analog[4]; }
public int UBatt() { return analog[9]; }
public int SenderOkay() { return analog[10]; }
public MKDebugData()
{
analog=new int[32];
for (i=0;i<32;i++)
analog[i]=-1;
}
public void set_by_mk_data(int[] in_arr,MKVersion version)
{
if (version.compare(-1,-1)==version.VERSION_EQUAL)
return;
if (version.compare(0,60)==version.VERSION_PREVIOUS)
{
for (i=0;i<32;i++)
{
analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]);
if ((analog[i]&(2<<14))!=0)
analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1);
}
}
else
{
for (i=0;i<16;i++)
{
analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]);
if ((analog[i]&(2<<14))!=0)
analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1);
}
}
motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3);
}
}