Subversion Repositories FlightCtrl

Rev

Rev 303 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 303 Rev 314
Line 56... Line 56...
56
 
56
 
Line -... Line 57...
-
 
57
    public int state=-1;
57
    public int state=-1;
58
   
58
   
59
 
59
 
60
 
60
 
61
    // id  for each state - must just be uniq - order dont matter
61
    public final static int STATEID_SCANNING=0;
62
    public final static int STATEID_SCANNING         =0;
62
    public final static int STATEID_DEVICESELECT=1;
63
    public final static int STATEID_DEVICESELECT     =1;
-
 
64
    public final static int STATEID_MAINMENU         =2;
63
    public final static int STATEID_MAINMENU=2;
65
    public final static int STATEID_MOTORTEST        =3;
Line -... Line 66...
-
 
66
    public final static int STATEID_SELECT_PARAMSET  =4;
-
 
67
    public final static int STATEID_EDIT_PARAMS      =5;
-
 
68
    public final static int STATEID_HANDLE_PARAMS    =6;
-
 
69
    public final static int STATEID_FLIGHTVIEW       =7;
-
 
70
 
-
 
71
 
-
 
72
    public boolean fullscreen=false;
-
 
73
    public int act_motor=0;
-
 
74
    public int act_motor_increase=0;
-
 
75
    public boolean motor_test_sel_all=false;
-
 
76
 
-
 
77
    public String[] main_menu_items={"Telemetry" , "Motor Test" , "Flight Settings","(NA)Tool Settings","Proxy","Change Device" , "Quit " };
-
 
78
    public final static int MAINMENU_TELEMETRY     =0;
-
 
79
    public final static int MAINMENU_MOTORTES      =1;
Line 64... Line 80...
64
    public final static int STATEID_MOTORTEST=3;
80
    public final static int MAINMENU_PARAMS        =2;
Line 65... Line 81...
65
    public final static int STATEID_SELECT_PARAMSET=4;
81
    public final static int MAINMENU_SETTINGS      =3;
66
    public final static int STATEID_EDIT_PARAMS=5;
82
    public final static int MAINMENU_PROXY         =4;
Line 490... Line 506...
490
        else
506
        else
491
            g.fillRect(x,line_middle_y-y2,2,y2-y1);
507
            g.fillRect(x,line_middle_y-y2,2,y2-y1);
492
    }
508
    }
Line 493... Line 509...
493
 
509
 
494
    /*********************************************** input Section **********************************************/
-
 
495
    // keys
-
 
496
    public boolean fullscreen=false;
-
 
497
    public int act_motor=0;
-
 
498
    public int act_motor_increase=0;
-
 
Line 499... Line -...
499
    public boolean motor_test_sel_all=false;
-
 
-
 
510
    /*********************************************** input Section **********************************************/
-
 
511
 
500
 
512
 
501
    public String[] main_menu_items={"Telemetry" , "Motor Test" , "Flight Settings","(NA)Tool Settings","Change Device" , "Quit " };
513
 
502
    public void chg_state(int next_state)
514
    public void chg_state(int next_state)
503
    {
515
    {
504
        act_menu_select=0;
516
        act_menu_select=0;
505
        // prepare next state
517
        // prepare next state
506
        switch(next_state)
518
        switch(next_state)
507
            {
519
            {
508
            case STATEID_SCANNING:
520
            case STATEID_SCANNING:
509
                lcd_lines=new String[3];
521
                lcd_lines=new String[3];
510
                lcd_lines[0]="Scanning for Devices";
522
                lcd_lines[0]="Scanning for Devices";
511
                lcd_lines[1]="                    ";
523
                lcd_lines[1]="                    ";
Line 512... Line 524...
512
                lcd_lines[2]="DUBwise v0.34       ";
524
                lcd_lines[2]="DUBwise v0.36       ";
513
                mk.close_connections(true);
525
                mk.close_connections(true);
Line 514... Line 526...
514
               
526
               
515
                bt_scanner.search();
527
                bt_scanner.search();
516
                break;
-
 
517
 
528
                break;
518
            case STATEID_SELECT_PARAMSET:
529
 
519
                menu_items=new String[5];
-
 
520
                menu_items[0]="ParamSet No 1";
-
 
-
 
530
            case STATEID_SELECT_PARAMSET:
521
                menu_items[1]="ParamSet No 2";
531
                menu_items=new String[5];
522
                menu_items[2]="ParamSet No 3";
532
                for (int i=0;i<5;i++)
Line 523... Line 533...
523
                menu_items[3]="ParamSet No 4";
533
                    menu_items[i]=mk.params.names[i];
524
                menu_items[4]="ParamSet No 5";
534
 
Line 601... Line 611...
601
                break;
611
                break;
602
            case STATEID_MAINMENU:
612
            case STATEID_MAINMENU:
603
                if ( getGameAction (keyCode)==FIRE )
613
                if ( getGameAction (keyCode)==FIRE )
604
                    switch(act_menu_select)
614
                    switch(act_menu_select)
605
                        {
615
                        {
-
 
616
 
606
                        case 0:
617
                        case MAINMENU_TELEMETRY :
607
                            chg_state(STATEID_FLIGHTVIEW);
618
                            chg_state(STATEID_FLIGHTVIEW);
608
                            break;
619
                            break;
Line 609... Line 620...
609
 
620
 
610
                        case 1:
621
                        case  MAINMENU_MOTORTES :
611
                            chg_state(STATEID_MOTORTEST);
622
                            chg_state(STATEID_MOTORTEST);
Line 612... Line 623...
612
                            break;
623
                            break;
613
 
624
 
614
                        case 2:
625
                        case MAINMENU_PARAMS :
-
 
626
                            chg_state(STATEID_SELECT_PARAMSET);
615
                            chg_state(STATEID_SELECT_PARAMSET);
627
                            break;
-
 
628
                        case MAINMENU_SETTINGS:
-
 
629
                            break;
616
                            break;
630
                        case MAINMENU_PROXY:
Line 617... Line 631...
617
                        case 3:
631
                            mk.do_proxy("socket://192.168.1.42:2323");
618
                            break;
632
                            break;
619
 
633
 
Line 620... Line 634...
620
                        case 4:
634
                        case MAINMENU_DEVICESELECT:
621
                            chg_state(STATEID_SCANNING);
635
                            chg_state(STATEID_SCANNING);
622
                            break;
636
                            break;
Line 623... Line 637...
623
 
637
 
624
                        case 5:
638
                        case  MAINMENU_QUIT:
625
                            quit=true;
639
                            quit=true;
Line 626... Line 640...
626
                            break;
640
                            break;
627
                           
641
                           
628
                        }
642
                        }
-
 
643
                else menu_keypress(keyCode);
629
                else menu_keypress(keyCode);
644
                break;
630
                break;
645
 
631
 
646
            case STATEID_SELECT_PARAMSET:
632
            case STATEID_SELECT_PARAMSET:
647
                if ( getGameAction (keyCode)==FIRE )
633
                if ( getGameAction (keyCode)==FIRE )
648
                    {