Rev 488 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 488 | Rev 505 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | * |
9 | * |
10 | **************************************************/ |
10 | **************************************************/ |
Line 11... | Line 11... | ||
11 | 11 | ||
Line 12... | Line -... | ||
12 | #include "riddim.h" |
- | |
13 | 12 | #include "riddim.h" |
|
Line 14... | Line 13... | ||
14 | 13 | ||
Line 214... | Line 213... | ||
214 | // init_evdevstatus_led(); |
213 | // init_evdevstatus_led(); |
Line 215... | Line 214... | ||
215 | 214 | ||
216 | while( TRUE ) |
215 | while( TRUE ) |
Line -... | Line 216... | ||
- | 216 | { |
|
- | 217 | ||
- | 218 | gettimeofday(&loop_start_time,NULL); |
|
217 | { |
219 | |
218 | 220 | ||
219 | // blink_evdev_led(); |
221 | // blink_evdev_led(); |
Line 220... | Line -... | ||
220 | // bt_host_tick(mk_socket); |
- | |
221 | usleep(loop_delay); |
- | |
222 | 222 | // bt_host_tick(mk_socket); |
|
Line 223... | Line 223... | ||
223 | 223 | usleep(loop_delay); |
|
224 | 224 | ||
Line 368... | Line 368... | ||
368 | */ |
368 | */ |
369 | } |
369 | } |
370 | else |
370 | else |
371 | printf("not connected to mk\n"); |
371 | printf("not connected to mk\n"); |
Line 372... | Line 372... | ||
372 | 372 | ||
Line 373... | Line 373... | ||
373 | gettimeofday(&time_struct2,NULL); |
373 | // gettimeofday(&time_struct2,NULL); |
374 | 374 | ||
Line 375... | Line 375... | ||
375 | printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec)); |
375 | // printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec)); |
Line 392... | Line 392... | ||
392 | act_gier=0; |
392 | act_gier=0; |
Line 393... | Line 393... | ||
393 | 393 | ||
394 | int act_input=0; |
394 | int act_input=0; |
395 | for (act_input=0;act_input<input_count;act_input++) |
395 | for (act_input=0;act_input<input_count;act_input++) |
- | 396 | { |
|
- | 397 | ||
396 | { |
398 | printf("process b %d\n",inputs[act_input].nick_up_btn); |
397 | //process buttons |
399 | //process buttons |
398 | if (inputs[act_input].nick_up_btn!=-1) |
400 | if (inputs[act_input].nick_up_btn!=-1) |
399 | { |
401 | { |
400 | if (inputs[act_input].evdev_button[inputs[act_input].nick_up_btn]!=0) |
402 | if (inputs[act_input].evdev_button[inputs[act_input].nick_up_btn]!=0) |
Line 401... | Line 403... | ||
401 | act_nick=100; |
403 | act_nick=100; |
Line -... | Line 404... | ||
- | 404 | ||
402 | 405 | } |
|
403 | } |
406 | |
404 | 407 | ||
405 | if (inputs[act_input].nick_down_btn!=-1) |
408 | if (inputs[act_input].nick_down_btn!=-1) |
Line 406... | Line 409... | ||
406 | { |
409 | { |
Line -... | Line 410... | ||
- | 410 | if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0) |
|
407 | if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0) |
411 | act_nick=-100; |
408 | act_nick=-100; |
412 | |
409 | 413 | } |
|
410 | } |
414 | |
Line 419... | Line 423... | ||
419 | if (inputs[act_input].roll_right_btn!=-1) |
423 | if (inputs[act_input].roll_right_btn!=-1) |
420 | { |
424 | { |
421 | if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0) |
425 | if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0) |
422 | act_roll=-100; |
426 | act_roll=-100; |
Line -... | Line 427... | ||
- | 427 | ||
423 | 428 | ||
Line 424... | Line 429... | ||
424 | } |
429 | } |
Line 425... | Line 430... | ||
425 | 430 | ||
Line 439... | Line 444... | ||
439 | if (inputs[act_input].rel_axis_gas!=-1) |
444 | if (inputs[act_input].rel_axis_gas!=-1) |
440 | act_gas=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gas]*inputs[act_input].gas_mul; |
445 | act_gas=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gas]*inputs[act_input].gas_mul; |
Line -... | Line 446... | ||
- | 446 | ||
- | 447 | ||
- | 448 | ||
- | 449 | if (inputs[act_input].rel_axis_alt!=-1) |
|
- | 450 | { |
|
- | 451 | ||
- | 452 | if (inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_alt]>300) |
|
- | 453 | act_long_alt-=last_trip_time/100; |
|
- | 454 | ||
- | 455 | if (inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_alt]<-300) |
|
- | 456 | act_long_alt+=last_trip_time/100; |
|
- | 457 | ||
- | 458 | act_alt=act_long_alt/1000; |
|
- | 459 | ||
- | 460 | if (act_alt>120)act_alt=120; |
|
- | 461 | else if (act_alt<-120)act_alt=-120; |
|
- | 462 | } |
|
- | 463 | // process_events |
|
- | 464 | ||
- | 465 | if (inputs[act_input].engine_switch_btn!=-1) |
|
- | 466 | { |
|
- | 467 | ||
- | 468 | if ((inputs[act_input].evdev_button[inputs[act_input].engine_switch_btn]==0)&&(DebugOut.Analog[16]==1)) |
|
- | 469 | { |
|
- | 470 | ExternEvent.key=2; |
|
- | 471 | SendOutData('e', 0, (unsigned char *)&ExternEvent, sizeof(ExternEvent)); |
|
- | 472 | } |
|
- | 473 | if ((inputs[act_input].evdev_button[inputs[act_input].engine_switch_btn]!=0)&&(DebugOut.Analog[16]==0)) |
|
- | 474 | { |
|
- | 475 | ExternEvent.key=1; |
|
- | 476 | SendOutData('e', 0, (unsigned char *)&ExternEvent, sizeof(ExternEvent)); |
|
- | 477 | } |
|
- | 478 | ||
- | 479 | ||
441 | 480 | ||
Line 442... | Line 481... | ||
442 | 481 | } |
|
443 | 482 | ||
444 | } |
483 | } |
Line 509... | Line 548... | ||
509 | } |
548 | } |
510 | */ |
549 | */ |
511 | ExternControl.Digital[0]=0; |
550 | ExternControl.Digital[0]=0; |
512 | ExternControl.Digital[1]=0; |
551 | ExternControl.Digital[1]=0; |
513 | ExternControl.RemoteTasten=0; |
552 | ExternControl.RemoteTasten=0; |
514 | ExternControl.Higt=0; |
553 | ExternControl.Higt=act_alt; |
515 | ExternControl.free=0; |
554 | ExternControl.free=0; |
516 | ExternControl.Frame='t'; |
555 | ExternControl.Frame='t'; |
517 | ExternControl.Config=1; |
556 | ExternControl.Config=1; |
Line 523... | Line 562... | ||
523 | ExternControl.Gas=act_gas; // ************ |
562 | ExternControl.Gas=act_gas; // ************ |
524 | ExternControl.Gas=255; // ************ |
563 | ExternControl.Gas=255; // ************ |
Line 525... | Line 564... | ||
525 | 564 | ||
Line 526... | Line 565... | ||
526 | 565 | ||
527 | 566 | ||
528 | 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); |
567 | 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); |
529 | 568 | ||
Line 530... | Line 569... | ||
530 | if (connected) |
569 | if (connected) |
531 | { |
570 | { |
532 | complete_matches++; |
571 | complete_matches++; |
533 | printf("sending data\n"); |
572 | printf("sending data\n"); |
Line 534... | Line 573... | ||
534 | 573 | ||
535 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
574 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
Line 562... | Line 601... | ||
562 | 601 | ||
563 | printf("\n"); |
602 | printf("\n"); |
564 | fflush(stdout); |
603 | fflush(stdout); |
565 | printf("loop fin ( confirmed:%d misses:%d | debug_sets:%d )\n",complete_matches,complete_misses,debug_sets); |
604 | printf("loop fin ( confirmed:%d misses:%d | debug_sets:%d )\n",complete_matches,complete_misses,debug_sets); |
566 | printf("------------------------------------------------------------------------\n"); |
605 | printf("------------------------------------------------------------------------\n"); |
- | 606 | ||
- | 607 | gettimeofday(&loop_end_time,NULL); |
|
- | 608 | 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; |
|
- | 609 | printf("last trip: %d\n",last_trip_time); |
|
- | 610 | ||
567 | 611 | ||
Line 568... | Line 612... | ||
568 | } |
612 | } |
569 | 613 |