Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 46 → Rev 47

/Riddim/riddim.c
18,6 → 18,14
 
#define MAX_BT_DEVICES 3
 
 
#define STATEID_SCANNING 0
#define STATEID_CONNECTING 1
 
#define BUTTON_SELECT 26
#define BUTTON_DOWN 28
#define BUTTON_UP 27
 
int bt_device_count=0;
 
char names[MAX_BT_DEVICES][248];
27,13 → 35,34
unsigned char TxBuffer[150];
unsigned char _TxBuffer[150];
 
#define STATEID_SCANNING 0
#define STATEID_CONNECTING 1
int x52_input_fd, *axis=NULL, num_of_axis=0, num_of_buttons=0, x;
char *button=NULL,*button_trigger=NULL, name_of_joystick[80];
 
struct js_event x52_event_struct;
 
struct
{
char val[4];
} MotortestParam;
 
struct
{
unsigned char Digital[2]; // (noch unbenutzt)
unsigned char RemoteTasten; //(gab es schon für das virtuelle Display)
signed char Nick;
signed char Roll;
signed char Gier;
unsigned char Gas; //(es wird das Stick-Gas auf diesen Wert begrenzt; --> StickGas ist das Maximum)
signed char Hight; //(Höhenregler)
unsigned char free; // (unbenutzt)
unsigned char Frame; // (Bestätigung)
unsigned char Config;
} ExternControl;
 
 
 
int state=STATEID_SCANNING;
 
#define BUTTON_SELECT 26
#define BUTTON_DOWN 27
#define BUTTON_UP 28
 
struct x52 *x52_output;
 
81,11 → 110,7
close( sock );
}
 
int x52_input_fd, *axis=NULL, num_of_axis=0, num_of_buttons=0, x;
char *button=NULL,*button_trigger=NULL, name_of_joystick[80];
 
struct js_event x52_event_struct;
 
void connect_joy()
{
 
114,10 → 139,6
}
 
 
struct
{
char val[4];
} MotortestParam;
 
 
void AddCRC(unsigned int wieviele)
235,63 → 256,11
//int tmp=2;
// connect_mk("00:0B:CE:01:6B:4F");
/*
 
{
// send a message
 
MotortestParam.val[0]=tmp;
MotortestParam.val[1]=tmp;
MotortestParam.val[2]=tmp;
MotortestParam.val[3]=tmp;
 
engines_on=1;
else
engines_on=0;
if (engines_on!=old_engines_on)
{
int c;
if( 0 == status )for (c=0;c<10;c++)
int c;
for (c=0;c<2;c++)
SendOutData('t', 0, &MotortestParam, sizeof(MotortestParam));
 
sleep(1);
}
*/
 
 
if( status < 0 ) perror("uh oh");
printf ("send status %d",status);
// close(s);
int i;
/*
 
MotortestParam.val[0]=2;
MotortestParam.val[1]=2;
MotortestParam.val[2]=2;
MotortestParam.val[3]=2;
 
 
 
 
while(1)
{
initSerial("/dev/rfcomm0");
sleep(2);
SendOutData('t', 0, &MotortestParam, sizeof(MotortestParam));
sleep(1);
}
*/
 
 
printf("\nInitializing X-52 input ..\n");
connect_joy();
printf(".. done");
310,12 → 279,9
else
printf(" not found \n");
 
 
 
printf("Scanning for Bluetooth Devices ..\n");
write_display(1,"Bluetooth Scan");
 
 
scan_bt();
printf(" done \n");
printf(" %d Devices found \n",bt_device_count);
334,7 → 300,7
while( 1 )
{
int polls=0;
for (polls=0;polls<1000;polls++)
for (polls=0;polls<1000;polls++) // FIXME - better Polling
{
read(x52_input_fd, &x52_event_struct, sizeof(struct js_event));
350,11 → 316,7
break;
}
}
if (1)
{
 
}
 
for( x=0 ; x<num_of_buttons ; ++x )
if( button[x]==0)
button_trigger[x]=0;
422,28 → 384,18
break;
}
/*
 
*/
printf("\r");
fflush(stdout);
/*
if( read( x52_input_fd, &x52_input_struct, JS_RETURN ) != JS_RETURN )
{
printf( "\nFailed to read from Joystick\n" );
}
 
 
if (x52_output) x52_setbri(x52_output, 1,x52_input_struct.y );
// if (x52_output) x52_setbri(x52_output, 2,x52_input_struct.x );
/******************** Cleanup **********************/
close(x52_input_fd);
close(s);
 
 
*/
}
 
close(x52_input_fd); /* too bad we never get here */
if (x52_output) x52_close(x52_output);
return 0;
}