Subversion Repositories Projects

Rev

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

Rev 224 Rev 229
Line 51... Line 51...
51
    private MKParamsEditor settings_editor=null;
51
    private MKParamsEditor settings_editor=null;
52
    public DUBwiseDebug debug=null;
52
    public DUBwiseDebug debug=null;
Line 53... Line 53...
53
   
53
   
54
 
54
 
55
//#if voice_mode!="no_voice"
55
//#if voice_mode!="no_voice"
Line 56... Line 56...
56
    private MKStatusVoice status_voice;
56
    public MKStatusVoice status_voice;
57
//#endif
57
//#endif
Line 94... Line 94...
94
 
94
 
95
    int rawdebug_cursor_y=0;    
95
    int rawdebug_cursor_y=0;    
Line 96... Line 96...
96
    int rawdebug_off_y=0;
96
    int rawdebug_off_y=0;
-
 
97
 
-
 
98
    public int line_middle_y;
Line 97... Line 99...
97
 
99
    public int graph_height;
Line 98... Line 100...
98
    public int line_middle_y;
100
 
Line 144... Line 146...
144
                tmp_actions[setup_pos]=ACTIONID_DEBUG;
146
                tmp_actions[setup_pos]=ACTIONID_DEBUG;
145
                tmp_items[setup_pos++]  ="Debug";
147
                tmp_items[setup_pos++]  ="Debug";
Line 146... Line 148...
146
 
148
 
Line 147... Line -...
147
            }
-
 
148
 
-
 
149
 
149
            }
150
 
150
 
151
        if (mk.ufo_prober.is_mk()  )
151
        if (mk.ufo_prober.is_mk()  )
152
            {
152
            {
Line 213... Line 213...
213
                tmp_items[setup_pos++]  ="switch to Navi";
213
                tmp_items[setup_pos++]  ="switch to Navi";
214
            }
214
            }
Line 215... Line 215...
215
 
215
 
-
 
216
 
-
 
217
        //if ((settings.expert_mode)&& ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag()||mk.ufo_prober.is_incompatible()   ))
216
 
218
         
217
        //if ((settings.expert_mode)&& ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag()||mk.ufo_prober.is_incompatible()   ))
219
        if (settings.expert_mode)
218
            {
220
        {
219
                tmp_actions[setup_pos]=ACTIONID_FLASH;
221
            tmp_actions[setup_pos]=ACTIONID_FLASH;
220
                tmp_items[setup_pos++]  ="Flash Firmware";
222
            tmp_items[setup_pos++]  ="Flash Firmware";
221
            }
223
        }
222
 
224
           
223
        if ((settings.expert_mode)&& ( mk.ufo_prober.is_mk()   ))
225
        if ((settings.expert_mode)&& ( mk.ufo_prober.is_mk()   ))
224
            {
226
        {
225
                tmp_actions[setup_pos]=ACTIONID_CAM;
227
            tmp_actions[setup_pos]=ACTIONID_CAM;
226
                tmp_items[setup_pos++]  ="Remote Cam";
-
 
Line -... Line 228...
-
 
228
            tmp_items[setup_pos++]  ="Remote Cam";
-
 
229
        }
227
            }
230
 
228
 
231
 
-
 
232
        if (!settings.expert_mode)
Line 229... Line 233...
229
 
233
        {
230
 
234
            tmp_actions[setup_pos]=ACTIONID_ABOUT;
Line 400... Line 404...
400
//#endif
404
//#endif
Line 401... Line 405...
401
 
405
 
Line 402... Line 406...
402
        root=_root;
406
        root=_root;
-
 
407
 
-
 
408
        mk      = new org.ligi.ufo.MKCommunicator();
-
 
409
 
-
 
410
 
-
 
411
//#if voice_mode!="no_voice"
-
 
412
        status_voice=new MKStatusVoice(mk,this);
403
 
413
//#endif
404
        mk      = new org.ligi.ufo.MKCommunicator();
414
 
405
        settings = new DUBwiseSettings(this);
415
        settings = new DUBwiseSettings(this);
406
        settings.load();
416
        settings.load();
Line 407... Line 417...
407
        load_global_images();
417
        load_global_images();
408
        debug   = new DUBwiseDebug(this);
418
        debug   = new DUBwiseDebug(this);
409
 
419
 
Line 410... Line -...
410
//#if bluetooth=="on"
-
 
411
        bt_scanner = new BTSearcher();
-
 
412
//#endif
-
 
413
 
-
 
Line 414... Line 420...
414
 
420
//#if bluetooth=="on"
Line 467... Line 473...
467
               
473
               
468
                switch(state)
474
                switch(state)
Line 469... Line 475...
469
                    {
475
                    {
-
 
476
                       
-
 
477
                    case STATEID_RESET_PARAMS:
470
                       
478
                        mk.watchdog.act_paramset=0;
471
                    case STATEID_RESET_PARAMS:
479
                        mk.params.reset();
472
                        if (mk.bootloader_finish_ok)
480
                        if (mk.bootloader_finish_ok)
473
                            {
481
                            {
474
                                nextstate=STATEID_PARAM_MENU;
482
                                nextstate=STATEID_PARAM_MENU;
Line 712... Line 720...
712
    public void paint(Graphics g) {
720
    public void paint(Graphics g) {
Line 713... Line 721...
713
       
721
       
714
        canvas_width=this.getWidth();
722
        canvas_width=this.getWidth();
Line 715... Line -...
715
        canvas_height=this.getHeight();
-
 
-
 
723
        canvas_height=this.getHeight();
Line 716... Line 724...
716
 
724
 
717
        line_middle_y=canvas_height/2;
725
 
718
 
726
 
719
        if (debug.showing)
727
        if (debug.showing)
Line 851... Line 859...
851
               
859
               
852
            // unclip
860
            // unclip
Line 853... Line 861...
853
            g.setClip(0,0,canvas_width,canvas_height);
861
            g.setClip(0,0,canvas_width,canvas_height);
-
 
862
 
-
 
863
            y_off+=symbols_img.getHeight();
854
 
864
            graph_height=(canvas_height-y_off)/2;
Line 855... Line 865...
855
            y_off+=symbols_img.getHeight();
865
            line_middle_y=graph_height+y_off;
856
            g.setColor(skin_fg_color());
866
            g.setColor(skin_fg_color());
857
         
867
         
Line 1313... Line 1323...
1313
   
1323
   
Line 1314... Line 1324...
1314
                    g.setClip(0,0,canvas_width,canvas_height);
1324
                    g.setClip(0,0,canvas_width,canvas_height);
1315
 
1325
 
1316
                    g.setStrokeStyle(Graphics.DOTTED);  
-
 
1317
                    g.setColor(0xe1dddd);
-
 
1318
 
-
 
-
 
1326
                    g.setStrokeStyle(Graphics.DOTTED);  
1319
 
1327
                    g.setColor(0xe1dddd);
1320
 
1328
                    g.setFont(f2);
1321
 
1329
                    // LEGEND
1322
                    for (int d=0;d<GRAPH_COUNT;d++)
1330
                    if (settings.graph_legend) for (int d=0;d<GRAPH_COUNT;d++)
1323
                        {
1331
                        {/*
1324
                            g.setColor(graph_colors[d]);               
1332
                            g.setColor(graph_colors[d]);               
1325
                            g.fillRect(0,y_off +spacer1/2-2 ,20,4);
1333
                            g.fillRect(0,y_off +spacer1/2-2 ,20,4);
1326
                            g.setColor(skin_fg_color());
1334
                            g.setColor(skin_fg_color());
Line -... Line 1335...
-
 
1335
                            g.drawString(graph_names[d] + mk.debug_data.analog[graph_sources[d]],23,y_off,Graphics.TOP | Graphics.LEFT);
-
 
1336
                            y_off+=spacer1;
-
 
1337
 
-
 
1338
                         */
-
 
1339
                            g.setColor(graph_colors[d]);               
-
 
1340
                            g.fillRect(canvas_width-20,canvas_height-spacer*(d+1)+(spacer)/2-2 ,20,4);
-
 
1341
                            g.setColor(skin_fg_color());
1327
                            g.drawString(graph_names[d],23,y_off,Graphics.TOP | Graphics.LEFT);
1342
                            g.drawString(graph_names[d] /*+ mk.debug_data.analog[graph_sources[d]]*/,canvas_width-23,canvas_height-spacer*(d+1),Graphics.TOP | Graphics.RIGHT);
Line -... Line 1343...
-
 
1343
                            //                      y_off+=spacer1; 
1328
                            y_off+=spacer1;
1344
 
-
 
1345
                        }
-
 
1346
 
-
 
1347
                    if (settings.graph_scale)
-
 
1348
                        {
-
 
1349
                           
-
 
1350
                            int scale=10;
-
 
1351
                            //                      if ((10/line_scaler)<5)scale =1;
-
 
1352
                            if (((10/line_scaler)*2)<(canvas_height/2) )scale =10;
-
 
1353
                            if (((50/line_scaler)*2)<(canvas_height/2) )scale =50;
1329
 
1354
                            if (((100/line_scaler)*2)<(canvas_height/2) )scale =100;
Line 1330... Line -...
1330
                        }
-
 
1331
 
-
 
Line -... Line 1355...
-
 
1355
                            if (((250/line_scaler)*2)<(canvas_height/2) )scale =250;
-
 
1356
                            if (((500/line_scaler)*2)<(canvas_height/2) )scale =500;
-
 
1357
                            if (((1000/line_scaler)*2)<(canvas_height/2) )scale =1000;
-
 
1358
                            if (((10000/line_scaler)*2)<(canvas_height/2) )scale =10000;
-
 
1359
 
-
 
1360
 
-
 
1361
 
-
 
1362
 
1332
                    /*
1363
                            //                      g.drawString("scale:"+scale + "line scaler" + line_scaler,0,y_off,Graphics.TOP | Graphics.LEFT);
1333
                    g.drawString("scale:"+scale + "line scaler" + line_scaler,0,y_off,Graphics.TOP | Graphics.LEFT);
1364
 
-
 
1365
 
-
 
1366
                            int jump=0;
-
 
1367
 
1334
 
1368
                            g.drawLine(0,line_middle_y,canvas_width,line_middle_y);
1335
 
1369
                           
1336
                    int jump=0;
1370
                            while ((jump/line_scaler)<graph_height)
-
 
1371
                                {
1337
                    g.drawLine(0,line_middle_y,canvas_width,line_middle_y);
1372
                                   
1338
 
-
 
Line 1339... Line 1373...
1339
                    while (jump<canvas_height/2)
1373
                                    g.drawString(""+jump,0,line_middle_y - jump/line_scaler,Graphics.TOP | Graphics.LEFT);
1340
                        {
1374
                                    if (jump!=0)g.drawString("-"+jump,0,line_middle_y + jump/line_scaler,Graphics.TOP | Graphics.LEFT);
Line 1341... Line 1375...
1341
                            g.drawLine(0,line_middle_y - jump/line_scaler,canvas_width,line_middle_y - jump/line_scaler);
1375
                                    g.drawLine(0,line_middle_y - jump/line_scaler,canvas_width,line_middle_y - jump/line_scaler);
1342
                            g.drawLine(0,line_middle_y + jump/line_scaler,canvas_width,line_middle_y + jump/line_scaler);
-
 
1343
                            jump+=scale;
-
 
1344
                        }
-
 
1345
                    */
1376
                                    g.drawLine(0,line_middle_y + jump/line_scaler,canvas_width,line_middle_y + jump/line_scaler);
Line 1346... Line 1377...
1346
 
1377
                                    jump+=scale;
Line 1347... Line 1378...
1347
 
1378
                                }
Line 1348... Line 1379...
1348
 
1379
                        }
1349
                    for (int gr=0;gr<GRAPH_COUNT;gr++)
1380
 
1350
                        {
1381
 
Line 1501... Line 1532...
1501
        err_img=null;
1532
        err_img=null;
1502
        graph_data=null;
1533
        graph_data=null;
Line 1503... Line 1534...
1503
 
1534
 
1504
        act_menu_select_bak[state]=act_menu_select;
1535
        act_menu_select_bak[state]=act_menu_select;
-
 
1536
        act_menu_select=act_menu_select_bak[next_state];
-
 
1537
 
-
 
1538
 
-
 
1539
        /*
-
 
1540
        // tasks on state exit
-
 
1541
        switch(next_state)
-
 
1542
            {
-
 
1543
            case STATEID_SETTINGSMENU:
-
 
1544
 
-
 
1545
                break;
-
 
1546
            }
1505
        act_menu_select=act_menu_select_bak[next_state];
1547
        */
1506
        // prepare next state
1548
        // prepare next state
1507
        switch(next_state)
1549
        switch(next_state)
1508
            {
1550
            {
1509
            case STATEID_SUCCESS_MSG:
1551
            case STATEID_SUCCESS_MSG:
Line 1851... Line 1893...
1851
        debug.log("KeyCode:"+keyCode);
1893
        debug.log("KeyCode:"+keyCode);
1852
        // key-actions common in all states
1894
        // key-actions common in all states
1853
        debug.process_key(keyCode);
1895
        debug.process_key(keyCode);
Line 1854... Line 1896...
1854
       
1896
       
1855
       
1897
       
1856
        if ((keyCode==KEY_STAR) || (keyCode==settings.key_back) )//&&(state!= STATEID_STRINGINPUT))
-
 
1857
            {
-
 
1858
                if (state==STATEID_EDIT_PARAMS)
-
 
1859
                    {
-
 
1860
                        chg_state(STATEID_HANDLE_PARAMS);
-
 
1861
                        return;
-
 
1862
                    }
-
 
1863
                else
-
 
1864
                    if (state!=STATEID_KEYCONTROL)
1898
        if (((keyCode==KEY_STAR) || (keyCode==settings.key_back) )&&(state!=STATEID_KEYCONTROL))//&&(state!= STATEID_STRINGINPUT))
1865
                        {
1899
            {
1866
                        chg_state(STATEID_MAINMENU);
-
 
1867
                        return;
-
 
1868
                        }
1900
                chg_state(STATEID_MAINMENU);
Line 1869... Line 1901...
1869
 
1901
                return;
1870
            }
1902
            }
Line 2312... Line 2344...
2312
                            case ACTIONID_EDIT_PARAMS:
2344
                            case ACTIONID_EDIT_PARAMS:
2313
                                chg_state(STATEID_EDIT_PARAMS);
2345
                                chg_state(STATEID_EDIT_PARAMS);
2314
                                break;
2346
                                break;
2315
                            case ACTIONID_SELECT_PARAMS:
2347
                            case ACTIONID_SELECT_PARAMS:
2316
                                select_paramset4edit=true;
2348
                                select_paramset4edit=true;
-
 
2349
                                if (settings.reload_settings)
-
 
2350
                                    {
-
 
2351
                                        mk.watchdog.act_paramset=0;
-
 
2352
                                        mk.params.reset();
-
 
2353
                                    }
-
 
2354
 
2317
                                if (mk.watchdog.act_paramset<5)
2355
                                if (mk.watchdog.act_paramset<5)
2318
                                    chg_state(STATEID_READ_PARAMS);
2356
                                    chg_state(STATEID_READ_PARAMS);
2319
                                else
2357
                                else
2320
                                    chg_state(STATEID_SELECT_PARAMSET);
2358
                                    chg_state(STATEID_SELECT_PARAMSET);