Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 488 → Rev 505

/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);
 
}