Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 505 → Rev 504

/Riddim/config.c
48,7 → 48,6
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),
59,7 → 58,6
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),
66,9 → 64,6
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()
};
 
140,7 → 135,6
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");
149,8 → 143,6
 
 
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");
163,12 → 155,8
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,20 → 46,19
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;
 
66,8 → 65,6
int roll_left_btn;
int roll_right_btn;
 
int engine_switch_btn;
 
char name[255];
char fname[255];
 
74,6 → 71,8
 
int evdev_id;
 
 
 
int evdev_out_fd;
int evdev_in_fd;
 
/Riddim/evdev_handler.c
134,8 → 134,6
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);
/Riddim/fc.h
24,13 → 24,6
unsigned char Config;
};
 
struct ExternEvent_s
{
unsigned char key;
unsigned char value[4];
 
};
 
struct str_DebugOut
{
unsigned char Digital[2];
43,7 → 36,6
 
 
struct ExternControl_s ExternControl;
struct ExternEvent_s ExternEvent;
 
extern int mk_socket;
 
/Riddim/riddim.c
11,6 → 11,7
 
#include "riddim.h"
 
 
int state=STATEID_SCANNING;
 
 
215,13 → 216,12
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,8 → 394,6
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)
{
404,7 → 402,6
}
 
 
if (inputs[act_input].nick_down_btn!=-1)
{
if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0)
412,7 → 409,6
}
 
 
if (inputs[act_input].roll_left_btn!=-1)
{
if (inputs[act_input].evdev_button[inputs[act_input].roll_left_btn]!=0)
425,7 → 421,6
if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0)
act_roll=-100;
 
}
 
// process axis
446,42 → 441,8
 
 
 
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)
{
case INPUT_EVDEV:
550,7 → 511,7
ExternControl.Digital[0]=0;
ExternControl.Digital[1]=0;
ExternControl.RemoteTasten=0;
ExternControl.Higt=act_alt;
ExternControl.Higt=0;
ExternControl.free=0;
ExternControl.Frame='t';
ExternControl.Config=1;
564,7 → 525,7
 
 
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);
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);
 
if (connected)
{
572,7 → 533,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");
}
604,11 → 565,6
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 8
#define RIDDIM_VERSION_MINOR 7
 
// for config file parsing
#include <confuse.h>
68,11 → 68,8
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,8 → 1,5
#include "statistics.h"
 
struct timeval loop_start_time;
struct timeval loop_end_time;
 
struct timeval time_struct1;
struct timeval time_struct2;
 
11,4 → 8,3
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 loop_start_time;
extern struct timeval loop_end_time;
extern struct timeval time_struct1;
extern struct timeval time_struct2;
 
 
extern int debug_sets;
9,5 → 9,4
extern int confirm_sets;
extern int version_sets;
 
extern unsigned long last_trip_time;