Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 491 → Rev 505

/Riddim/config.c
48,6 → 48,7
CFG_FLOAT("roll_mul", 1.0,CFGF_NONE),
CFG_FLOAT("gier_mul", 1.0,CFGF_NONE),
CFG_FLOAT("gas_mul", 1.0,CFGF_NONE),
CFG_FLOAT("alt_mul", 1.0,CFGF_NONE),
 
CFG_FLOAT("nick_add", 0,CFGF_NONE),
CFG_FLOAT("roll_add", 0,CFGF_NONE),
58,6 → 59,7
CFG_INT("rel_axis_roll", -1,CFGF_NONE),
CFG_INT("rel_axis_gier", -1,CFGF_NONE),
CFG_INT("rel_axis_gas", -1,CFGF_NONE),
CFG_INT("rel_axis_alt", -1,CFGF_NONE),
 
CFG_INT("nick_up_btn", -1,CFGF_NONE),
CFG_INT("nick_down_btn", -1,CFGF_NONE),
64,6 → 66,9
CFG_INT("roll_left_btn", -1,CFGF_NONE),
CFG_INT("roll_right_btn", -1,CFGF_NONE),
 
 
CFG_INT("engine_switch_btn", -1,CFGF_NONE),
 
CFG_END()
};
 
135,6 → 140,7
inputs[act_input].roll_mul=cfg_getfloat(input_sect,"roll_mul");
inputs[act_input].gier_mul=cfg_getfloat(input_sect,"gier_mul");
inputs[act_input].gas_mul=cfg_getfloat(input_sect,"gas_mul");
inputs[act_input].alt_mul=cfg_getfloat(input_sect,"alt_mul");
inputs[act_input].nick_add=cfg_getfloat(input_sect,"nick_add");
inputs[act_input].roll_add=cfg_getfloat(input_sect,"roll_add");
143,6 → 149,8
 
 
inputs[act_input].nick_up_btn=cfg_getint(input_sect,"nick_up_btn");
printf("nick_up_btn %d\n" ,cfg_getint(input_sect,"nick_up_btn"));
 
inputs[act_input].nick_down_btn=cfg_getint(input_sect,"nick_down_btn");
 
inputs[act_input].roll_left_btn=cfg_getint(input_sect,"roll_left_btn");
155,8 → 163,12
inputs[act_input].rel_axis_gier=cfg_getint(input_sect,"rel_axis_gier");
inputs[act_input].rel_axis_gas=cfg_getint(input_sect,"rel_axis_gas");
 
inputs[act_input].rel_axis_alt=cfg_getint(input_sect,"rel_axis_alt");
 
inputs[act_input].engine_switch_btn=cfg_getint(input_sect,"engine_switch_btn");
 
 
 
act_input++;
}
 
/Riddim/config.h
46,19 → 46,20
double roll_mul;
double gier_mul;
double gas_mul;
double alt_mul;
 
double nick_add;
double roll_add;
double gier_add;
double gas_add;
double alt_add;
 
int rel_axis_nick;
int rel_axis_roll;
int rel_axis_gier;
int rel_axis_gas;
int rel_axis_alt;
 
 
 
int nick_up_btn;
int nick_down_btn;
 
65,6 → 66,8
int roll_left_btn;
int roll_right_btn;
 
int engine_switch_btn;
 
char name[255];
char fname[255];
 
71,8 → 74,6
 
int evdev_id;
 
 
 
int evdev_out_fd;
int evdev_in_fd;
 
/Riddim/evdev_handler.c
134,6 → 134,8
inputs[i].evdev_rel_axis = (int *) calloc( 100, sizeof( int ) );
inputs[i].evdev_button = (char *)calloc( 500, sizeof( char ) );
 
 
printf(" opening evdev %s\n",inputs[i].fname);
if ((inputs[i].evdev_out_fd = open(inputs[i].fname, O_WRONLY)) < 0)
{
printf(" cant open %s for writing\n",inputs[i].fname);
230,8 → 232,8
for (counter = 0; counter < (int) (read_bytes / sizeof(struct input_event)); counter++)
{
//print_event_str(ev[counter].type);
// printf(" code:%d val:%d \n",ev[counter].code,ev[counter].value);
// print_event_str(ev[counter].type);
// printf(" code:%d val:%d \n",ev[counter].code,ev[counter].value);
// if (ev[counter].type==EV_REL) evdev_rel_axis[ ev[counter].code]= ev[counter].value;
// for logitech problem
/Riddim/fc.h
24,6 → 24,13
unsigned char Config;
};
 
struct ExternEvent_s
{
unsigned char key;
unsigned char value[4];
 
};
 
struct str_DebugOut
{
unsigned char Digital[2];
36,6 → 43,7
 
 
struct ExternControl_s ExternControl;
struct ExternEvent_s ExternEvent;
 
extern int mk_socket;
 
/Riddim/riddim.c
11,7 → 11,6
 
#include "riddim.h"
 
 
int state=STATEID_SCANNING;
 
 
216,12 → 215,13
while( TRUE )
{
 
gettimeofday(&loop_start_time,NULL);
 
 
// blink_evdev_led();
// bt_host_tick(mk_socket);
usleep(loop_delay);
 
 
 
poll_evdev();
 
switch (input)
370,9 → 370,9
else
printf("not connected to mk\n");
gettimeofday(&time_struct2,NULL);
// gettimeofday(&time_struct2,NULL);
 
printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec));
// printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec));
// act_mode=button[24] | (button[25]<<1);
 
 
394,6 → 394,8
int act_input=0;
for (act_input=0;act_input<input_count;act_input++)
{
 
printf("process b %d\n",inputs[act_input].nick_up_btn);
//process buttons
if (inputs[act_input].nick_up_btn!=-1)
{
402,6 → 404,7
}
 
 
if (inputs[act_input].nick_down_btn!=-1)
{
if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0)
409,6 → 412,7
}
 
 
if (inputs[act_input].roll_left_btn!=-1)
{
if (inputs[act_input].evdev_button[inputs[act_input].roll_left_btn]!=0)
421,6 → 425,7
if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0)
act_roll=-100;
 
}
 
// process axis
441,6 → 446,40
 
 
 
if (inputs[act_input].rel_axis_alt!=-1)
{
 
if (inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_alt]>300)
act_long_alt-=last_trip_time/100;
 
if (inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_alt]<-300)
act_long_alt+=last_trip_time/100;
act_alt=act_long_alt/1000;
 
if (act_alt>120)act_alt=120;
else if (act_alt<-120)act_alt=-120;
}
// process_events
if (inputs[act_input].engine_switch_btn!=-1)
{
if ((inputs[act_input].evdev_button[inputs[act_input].engine_switch_btn]==0)&&(DebugOut.Analog[16]==1))
{
ExternEvent.key=2;
SendOutData('e', 0, (unsigned char *)&ExternEvent, sizeof(ExternEvent));
}
if ((inputs[act_input].evdev_button[inputs[act_input].engine_switch_btn]!=0)&&(DebugOut.Analog[16]==0))
{
ExternEvent.key=1;
SendOutData('e', 0, (unsigned char *)&ExternEvent, sizeof(ExternEvent));
}
 
 
 
}
 
}
 
switch(input)
511,7 → 550,7
ExternControl.Digital[0]=0;
ExternControl.Digital[1]=0;
ExternControl.RemoteTasten=0;
ExternControl.Higt=0;
ExternControl.Higt=act_alt;
ExternControl.free=0;
ExternControl.Frame='t';
ExternControl.Config=1;
525,7 → 564,7
 
 
printf("act_mode %d , act_nick %d , act_roll %d , act_gier %d , act_gas %d",act_mode , act_nick , act_roll , act_gier , act_gas);
printf("act_mode %d , act_nick %d , act_roll %d , act_gier %d , act_gas %d , act_alt %d",act_mode , act_nick , act_roll , act_gier , act_gas,act_alt);
 
if (connected)
{
533,7 → 572,7
printf("sending data\n");
SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl));
gettimeofday(&time_struct1,NULL);
// gettimeofday(&time_struct1,NULL);
printf("sent data\n");
}
564,7 → 603,12
fflush(stdout);
printf("loop fin ( confirmed:%d misses:%d | debug_sets:%d )\n",complete_matches,complete_misses,debug_sets);
printf("------------------------------------------------------------------------\n");
gettimeofday(&loop_end_time,NULL);
last_trip_time=(unsigned long)(loop_end_time.tv_usec-loop_start_time.tv_usec)+(unsigned long)(loop_end_time.tv_sec-loop_start_time.tv_sec)*1000000;
printf("last trip: %d\n",last_trip_time);
 
}
 
 
/Riddim/riddim.h
15,7 → 15,7
 
 
#define RIDDIM_VERSION_MAJOR 0
#define RIDDIM_VERSION_MINOR 7
#define RIDDIM_VERSION_MINOR 8
 
// for config file parsing
#include <confuse.h>
68,8 → 68,11
int act_gas=0;
int act_mode=0;
 
int act_alt=0;
 
 
long act_long_alt=0;
 
#define FALSE 0
#define TRUE 1
 
/Riddim/statistics.c
1,5 → 1,8
#include "statistics.h"
 
struct timeval loop_start_time;
struct timeval loop_end_time;
 
struct timeval time_struct1;
struct timeval time_struct2;
 
8,3 → 11,4
int confirm_sets=0;
int version_sets=0;
 
unsigned long last_trip_time=0;
/Riddim/statistics.h
1,8 → 1,8
#include <sys/time.h>
 
// time struct for measuring
extern struct timeval time_struct1;
extern struct timeval time_struct2;
extern struct timeval loop_start_time;
extern struct timeval loop_end_time;
 
 
extern int debug_sets;
9,4 → 9,5
extern int confirm_sets;
extern int version_sets;
 
extern unsigned long last_trip_time;