Subversion Repositories Projects

Rev

Rev 212 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
212 ligi 1
package org.ligi.android;
2
 
3
 
4
import android.app.Activity;
5
import android.os.Bundle;
6
 
7
import android.app.Activity;
8
import android.os.Bundle;
9
 
10
import android.view.View;
11
import android.widget.TextView;
12
 
13
 
14
import android.app.Activity;
15
import android.content.Context;
16
import android.graphics.*;
17
import android.os.Bundle;
18
import android.os.*;
19
import android.view.View;
20
import android.util.Log;
21
import android.media.*;
22
import java.util.Random;
23
import java.net.*;
24
import java.io.*;
25
 
26
 
27
import android.view.*;
28
 
29
import android.graphics.Region.Op;
30
import android.graphics.Bitmap.*;
31
 
32
// not working atm - import org.bluez.*;
33
import org.ligi.ufo.*;
34
public class DUBwiseView
35
    extends View
36
    implements DUBwiseDefinitions,DUBwiseUIDefinitions
37
 
38
{
39
 
40
 
41
    int state=0;
42
 
43
 
44
    int state_intro_frame=0;
45
 
46
    boolean do_sound=true;
47
    boolean do_vibra=true;
48
    boolean do_graph=true;
49
    boolean menu_active=true;
50
 
51
    public final int SKINID_DARK=0;
52
    public final int SKINID_LIGHT=0;
53
    int act_skin=0;
54
    boolean keep_lighton=true;
55
 
56
    private Paint   mPaint = new Paint();
57
 
58
    // chars in bitmap
59
    public static int LCD_CHAR_COUNT=222;
60
 
61
    // some images we need
62
    private Bitmap  icon_img,bg_img,lcd_tiles_img,bt_on_img,bt_off_img;
63
    private Bitmap lcd_img=null;
64
    // pos for scrolling
65
    private int pos=0;
66
 
67
    String str1="";
68
    String[] lcd_lines;
69
    String[] menu_items;
70
    long last_run=0;
71
    int last_key=0;
72
 
73
 
74
    int auto_next_state=-1;
75
 
76
    int wi,he;
77
    //     Activity context;
78
 
79
    DUBwise root;
80
    MKParamEditor param_editor;
81
    //    Activity root;
82
    int lcd_top;
83
    int act_menu_select=0;
84
    int[] motortest_vals={0,0,0,0};
85
 
86
    public DUBwiseView(DUBwise context) {
87
        super(context);
88
        root=context;
89
        param_editor=new MKParamEditor(root);
90
        chg_state_(STATEID_MAINMENU);
91
 
92
        // needed to get Key Events
93
        setFocusable(true);
94
 
95
 
96
    }
97
 
98
 
99
    public void chg_state(int next_state)
100
    {
101
        auto_next_state=next_state;
102
 
103
    }
104
 
105
    public void chg_state_(int next_state)
106
    {
107
        auto_next_state=-1;
108
        menu_active=false;
109
        state_intro_frame=0;
110
        if (next_state!=state)act_menu_select=0;
111
        // prepare next state
112
        switch(next_state)
113
            {
114
            case STATEID_STICKVIEW:
115
                //              root.mk.user_intent=USER_INTENT_RCDATA;
116
                break;
117
            case STATEID_FLIGHTVIEW:
118
                //root.mk.user_intent=USER_INTENT_LCD;
119
                break;
120
            case STATEID_EDIT_PARAMS:
121
                lcd_lines=param_editor.public_lcd_lines;
122
                calc_lcd();
123
                break;
124
 
125
            case STATEID_HANDLE_PARAMS:
126
                menu_items=new String[2];
127
                menu_items[0]="write to MK";
128
                menu_items[1]="Discard";
129
                lcd_lines=new String[2];
130
 
131
                break;
132
 
133
            case STATEID_SELECT_PARAMSET:
134
                menu_items=new String[5];
135
                for (int i=0;i<5;i++)
136
                    menu_items[i]=root.mk.params.names[i];
137
 
138
                lcd_lines=new String[5];
139
                break;
140
 
141
            case STATEID_MAINMENU:
142
                menu_active=true;
143
                menu_items=main_menu_items;
144
                lcd_lines=new String[menu_items.length];
145
 
146
 
147
                for (int y=0;y<main_menu_items.length;y++)
148
                    lcd_lines[y]=" " + main_menu_items[y];
149
 
150
                break;
151
 
152
            case STATEID_SETTINGSMENU:
153
 
154
                menu_items=new String[settings_menu_items.length];
155
                for(int cnt=0;cnt<settings_menu_items.length;cnt++)
156
                    menu_items[cnt]=settings_menu_items[cnt];
157
 
158
                menu_items[0]+=(act_skin==SKINID_DARK)?"Dark":"Light";
159
                menu_items[1]+=(!do_sound)?"Off":"On";
160
                menu_items[2]+=(!do_vibra)?"Off":"On";
161
                menu_items[3]+=(!do_graph)?"Off":"On";
162
                menu_items[4]+=(!root.fullscreen)?"Off":"On";
163
                menu_items[5]+=(!keep_lighton)?"Off":"On";
164
 
165
                lcd_lines=new String[menu_items.length];
166
                break;
167
 
168
            }
169
 
170
        // switch state
171
        if (lcd_img!=null)calc_lcd();
172
        state=next_state;
173
    }
174
 
175
 
176
    public Bitmap resize_to_screen(Bitmap orig,float x_scale_,float y_scale_)
177
    {
178
        // createa matrix for the manipulation
179
        Matrix matrix = new Matrix();
180
        float x_scale,y_scale;
181
        if (y_scale_!=0f)
182
            y_scale= (getHeight()*y_scale_ )/orig.getHeight();
183
        else // take x_scale
184
            y_scale=(getWidth()*x_scale_ )/orig.getWidth();
185
 
186
        if (x_scale_!=0f)
187
            x_scale= (getWidth()*x_scale_ )/orig.getWidth();
188
        else
189
            x_scale= (getHeight()*y_scale_ )/orig.getHeight();
190
 
191
        matrix.postScale(x_scale , y_scale);
192
        return Bitmap.createBitmap(orig, 0, 0,(int)( orig.getWidth()),(int)( orig.getHeight()), matrix,true);//BitmapContfig.ARGB_8888 ); 
193
    }
194
 
195
 
196
    public boolean onKeyDown(int keyCode, KeyEvent event)
197
    {
198
 
199
 
200
        if ( keyCode==KeyEvent.KEYCODE_BACK)
201
            {
202
                if ( state==STATEID_MAINMENU)
203
                    root.finish();
204
                else
205
                    chg_state(STATEID_MAINMENU);
206
            }
207
        switch (state)
208
            {
209
            case STATEID_EDIT_PARAMS:
210
                param_editor.keypress(keyCode,keyCode);
211
                lcd_lines=param_editor.public_lcd_lines;
212
                calc_lcd();
213
                break;
214
            case STATEID_MAINMENU:
215
                switch ( keyCode)
216
                    {
217
                    case KeyEvent.KEYCODE_DPAD_DOWN :
218
                        act_menu_select++;
219
                        break;
220
 
221
                    case KeyEvent.KEYCODE_DPAD_UP :
222
                        act_menu_select--;
223
                        break;
224
 
225
                    case KeyEvent.KEYCODE_DPAD_CENTER :
226
                        menu_reaction();
227
                        break;
228
 
229
                    }
230
                break;
231
 
232
            case STATEID_FLIGHTVIEW:
233
 
234
                switch ( keyCode)
235
                    {
236
 
237
                    case KeyEvent.KEYCODE_DPAD_DOWN :
238
                        root.mk.LCD.LCD_NEXTPAGE();
239
                        lcd_lines=root.mk.LCD.get_act_page();
240
 
241
                        break;
242
 
243
                    case KeyEvent.KEYCODE_DPAD_UP :
244
                        root.mk.LCD.LCD_PREVPAGE();
245
                        lcd_lines=root.mk.LCD.get_act_page();
246
 
247
                        break;
248
 
249
 
250
                    }
251
                calc_lcd();
252
                break;
253
            }
254
 
255
        //      last_key=keyCode;
256
        //      if(lcd_img!=null)
257
        calc_lcd();
258
        invalidate();
259
        return true;
260
    }
261
 
262
    public void menu_reaction()
263
    {
264
        switch (act_menu_select)
265
            {
266
 
267
            case MAINMENU_PARAMS:
268
                chg_state(STATEID_EDIT_PARAMS);
269
                break;
270
 
271
            case MAINMENU_STICKS:
272
                chg_state(STATEID_STICKVIEW);
273
                break;
274
 
275
            case MAINMENU_TELEMETRY:
276
                                chg_state(STATEID_FLIGHTVIEW);
277
                //              root.setContentView(new DUBwiseMapView(root));
278
                break;
279
 
280
            case MAINMENU_RAWDEBUG:
281
                chg_state(STATEID_RAWDEBUG);
282
                break;
283
 
284
            case MAINMENU_KEYCONTROL:
285
                chg_state(STATEID_KEYCONTROL);
286
                break;
287
 
288
 
289
            case MAINMENU_MOTORTEST:
290
                //              root.mk.motor_test( motortest_vals);
291
                chg_state(STATEID_MOTORTEST);
292
                break;
293
 
294
            case MAINMENU_QUIT:
295
                root.mk.close_connections(true);
296
                root.quit();
297
                break;
298
            }
299
    }
300
 
301
 
302
 
303
 
304
    int flight_x,flight_y;
305
 
306
    @Override public boolean onTouchEvent(MotionEvent event) {
307
 
308
 
309
        if ((event.getAction() ==MotionEvent.ACTION_UP)&&(event.getY()<bt_on_img.getHeight()))
310
            {
311
                if ( state==STATEID_MAINMENU)
312
                    root.finish();
313
                else
314
                    chg_state(STATEID_MAINMENU);
315
            }
316
 
317
        switch(state)
318
            {
319
            case STATEID_KEYCONTROL:
320
                if (event.getAction() ==MotionEvent.ACTION_UP)
321
                    {
322
                                flight_x=getWidth()/2-getWidth()/8;
323
                                flight_y=getHeight()/2-getWidth()/8;
324
                    }
325
                else
326
                    {
327
                        if(new RectF(getWidth()/8,(getHeight()-getWidth())/2-getWidth()/8,getWidth()-getWidth()/8,getHeight()-getWidth()/8).contains(event.getX(),event.getY()))
328
                            {
329
 
330
                                flight_x=(int)event.getX();
331
                                flight_y=(int)event.getY();
332
 
333
                            }
334
                    }
335
                break;
336
            case STATEID_MAINMENU:
337
                if ((event.getAction() ==MotionEvent.ACTION_DOWN)||(event.getAction() ==MotionEvent.ACTION_MOVE))
338
                    {
339
                        if (event.getY()>lcd_top)
340
                            {
341
                                act_menu_select=(int)((event.getY()-lcd_top)/lcd_tiles_img.getHeight());
342
                                calc_lcd();
343
                            }
344
                    }
345
 
346
                if (event.getAction() ==MotionEvent.ACTION_UP)
347
 
348
                    {
349
                        if (event.getY()>lcd_top)
350
                            {
351
                                act_menu_select=(int)((event.getY()-lcd_top)/lcd_tiles_img.getHeight());
352
                                menu_reaction();
353
                            }
354
                    }
355
                calc_lcd();
356
 
357
                break;
358
 
359
 
360
            case STATEID_MOTORTEST:
361
                if (new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - (getWidth()/2 - getWidth()/8),getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8).contains(event.getX(),event.getY()))
362
                    motortest_vals[0]= (int)(event.getY()-getHeight()/2+getWidth()/8)*(-1)-5;
363
 
364
                if (new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 +  (getWidth()/2 - getWidth()/8)).contains(event.getX(),event.getY()))
365
                    motortest_vals[1]= (int)(event.getY()-getHeight()/2-getWidth()/8)-5;
366
 
367
                // left
368
                if (new RectF(0,getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8).contains(event.getX(),event.getY()))
369
                    motortest_vals[2]= (int)(event.getX()-getWidth()/2+getWidth()/8)*(-1)-5;
370
 
371
                if (new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth(),getHeight()/2+getWidth()/8).contains(event.getX(),event.getY()))
372
                    motortest_vals[3]=  (int)(event.getX()-getWidth()/2-getWidth()/8)-5;
373
 
374
                for (int tmp=0;tmp<4;tmp++)
375
                    if (motortest_vals[tmp]<0)motortest_vals[tmp]=0;
376
 
377
                root.mk.motor_test( motortest_vals);
378
                break;
379
            }
380
 
381
 
382
        return true;
383
 
384
 
385
        }
386
 
387
 
388
 
389
 
390
    @Override protected void onSizeChanged(int w, int h, int oldw, int oldh)
391
    {
392
 
393
        bg_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.starfield),0f,1f);
394
        lcd_tiles_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.lcd_green),0.05f*LCD_CHAR_COUNT,0f);
395
        icon_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.icon),0.15f,0f);
396
 
397
        bt_off_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.bt_off),0.06f,0f);
398
        bt_on_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.bt_on),0.06f,0f);
399
        calc_lcd();    
400
 
401
    }
402
 
403
 
404
    public void calc_lcd()
405
    {
406
 
407
        lcd_top=getHeight()-lcd_lines.length*lcd_tiles_img.getHeight();
408
        Paint paint = mPaint;
409
        lcd_img= Bitmap.createBitmap(getWidth(),lcd_lines.length*lcd_tiles_img.getHeight()+100,Bitmap.Config.ARGB_8888);
410
        Canvas lcd_canvas=new Canvas();
411
 
412
        lcd_canvas.setBitmap(lcd_img);
413
        lcd_canvas.drawColor(Color.WHITE);
414
        int char_width=(int)(lcd_tiles_img.getWidth()/LCD_CHAR_COUNT);
415
        for ( int lcd_line=0 ; lcd_line < lcd_lines.length ; lcd_line++)
416
            for (int char_pos=0;char_pos<20;char_pos++)
417
                {
418
                    int act_char=0;
419
 
420
                    if (char_pos<lcd_lines[lcd_line].length())
421
                        act_char=lcd_lines[lcd_line].charAt(char_pos)-32;
422
 
423
                    if ((menu_active)&&(act_menu_select==lcd_line)&& (char_pos==0))
424
                        act_char=30;
425
 
426
                    lcd_canvas.clipRect(new RectF(char_pos*char_width,lcd_tiles_img.getHeight()*lcd_line,(char_pos+1)*char_width,lcd_tiles_img.getHeight()*(lcd_line+1)),Op.REPLACE );
427
 
428
                    lcd_canvas.drawBitmap(lcd_tiles_img,(char_pos-act_char)*(char_width),lcd_tiles_img.getHeight()*(lcd_line) , paint);
429
 
430
 
431
                }
432
    }
433
 
434
    boolean init_bootloader;
435
    int user_intent;
436
    // fixme -> put in own timed thread - not in draw invalidate loop
437
    public void tick()
438
    {
439
        pos--;
440
        pos%=bg_img.getWidth();
441
        //SystemClock.sleep(50);
442
 
443
        if (auto_next_state==-1)
444
            switch(state)
445
                {
446
                case STATEID_FLIGHTVIEW:
447
                    //              root.mk.trigger_debug_data();
448
                    lcd_lines=root.mk.LCD.get_act_page();
449
                    calc_lcd();
450
                    if (state_intro_frame<200)
451
                        state_intro_frame+=5;
452
                    break;
453
                case STATEID_EDIT_PARAMS:
454
 
455
 
456
                case STATEID_MAINMENU:
457
                    if (state_intro_frame<200)
458
                        state_intro_frame+=5;
459
                    break;
460
 
461
                case STATEID_RAWDEBUG:
462
                case STATEID_MOTORTEST:
463
                    if (state_intro_frame<150)
464
                        state_intro_frame+=5;
465
                    break;
466
 
467
                case STATEID_KEYCONTROL:
468
                case STATEID_STICKVIEW:
469
                    if (state_intro_frame<100)
470
                        state_intro_frame+=3;
471
                    break;
472
 
473
                }
474
        else
475
            {
476
                if (state_intro_frame>10)
477
                    state_intro_frame-=7;
478
                else
479
                   {
480
                       state_intro_frame=0;
481
                       chg_state_(auto_next_state);
482
                   }
483
 
484
 
485
 
486
            }
487
 
488
    }
489
 
490
 
491
    @Override protected void onDraw(Canvas canvas) {
492
 
493
 
494
 
495
        tick();
496
 
497
        Paint paint = mPaint;
498
        paint.setAntiAlias(true);
499
 
500
        paint.setARGB(255,0,0,0);      
501
        canvas.drawBitmap(bg_img,pos,0 , paint);
502
 
503
        if ((bg_img.getWidth()+pos)<(getWidth()))
504
            canvas.drawBitmap(bg_img,pos+bg_img.getWidth(),0 , paint);
505
 
506
 
507
        switch ( state )
508
            {
509
            case STATEID_EDIT_PARAMS:
510
            case STATEID_FLIGHTVIEW:
511
 
512
                paint.setARGB(state_intro_frame ,0,0,0);       
513
                canvas.drawBitmap(lcd_img,0,lcd_top , paint);
514
                break;
515
 
516
            case STATEID_MOTORTEST:
517
 
518
                paint.setARGB(state_intro_frame,100,100,100);
519
 
520
 
521
                //front
522
 
523
                canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - (getWidth()/2 - getWidth()/8),getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8),5,5,paint);
524
 
525
                // back
526
                canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 +  (getWidth()/2 - getWidth()/8)),5,5,paint);
527
 
528
                // left
529
                canvas.drawRoundRect(new RectF(0,getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
530
 
531
                canvas.drawRoundRect(new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth(),getHeight()/2+getWidth()/8),5,5,paint);
532
 
533
 
534
                paint.setARGB(100,30,30,255);
535
 
536
                canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - motortest_vals[0],getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8),5,5,paint);
537
 
538
                // back
539
                canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 +  motortest_vals[1]),5,5,paint);
540
 
541
                // left
542
                canvas.drawRoundRect(new RectF(getWidth()/2-getWidth()/8- motortest_vals[2],getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
543
 
544
                canvas.drawRoundRect(new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth()/2+getWidth()/8+  motortest_vals[3],getHeight()/2+getWidth()/8),5,5,paint);
545
 
546
 
547
                paint.setARGB(state_intro_frame+70,0,250,0);
548
                paint.setTextAlign(Paint.Align.CENTER);
549
 
550
                canvas.drawText("Front:"+ motortest_vals[0],getWidth()/2 ,getHeight()/2 -getWidth()/8-10,paint);
551
 
552
                canvas.drawText("Back:"+ motortest_vals[1],getWidth()/2 ,getHeight()/2 +getWidth()/8+15,paint);
553
 
554
                canvas.drawText("Left:"+ motortest_vals[2],getWidth()/4 ,getHeight()/2 ,paint);
555
                canvas.drawText("Right:"+ motortest_vals[3],3*getWidth()/4 ,getHeight()/2 ,paint);
556
                break;
557
 
558
            case STATEID_RAWDEBUG:
559
                paint.setARGB(state_intro_frame,50,50,200);
560
 
561
 
562
                for(int y_p=0;y_p<16;y_p++)
563
                    canvas.drawRoundRect(new RectF(0,(getHeight()/32)*y_p*2,getWidth(),(getHeight()/32)*(y_p*2+1)),5,5,paint);
564
 
565
 
566
 
567
                paint.setARGB(state_intro_frame,0,250,0);
568
 
569
                for(int y_p=0;y_p<32;y_p++)
570
                    {  
571
                        canvas.drawText( root.mk.debug_data.names[y_p],0,(getHeight()/32)*(y_p+1)-2,paint);
572
                        canvas.drawText( ""+root.mk.debug_data.analog[y_p],getWidth()/3,(getHeight()/32)*(y_p+1)-2,paint);
573
                    }
574
 
575
 
576
 
577
 
578
                break;
579
 
580
            case STATEID_KEYCONTROL:
581
                canvas.rotate((root.mk.debug_data.analog[18]*(-90))/3000,getWidth()/2,getHeight()/2);
582
                paint.setARGB(state_intro_frame,177,129,0);
583
                // roll rect
584
                canvas.drawRect(-getWidth(),getHeight()/2,2*getWidth(),3*getHeight()/2,paint);
585
 
586
                int bar_height=20;
587
                // nick rect
588
                paint.setARGB(state_intro_frame,0,200,0);
589
                canvas.drawRoundRect(new RectF(getWidth()/3,getHeight()/2 -bar_height/2 + root.mk.debug_data.analog[17]*getHeight()/(3*3000) ,2*getWidth()/3, getHeight()/2+ root.mk.debug_data.analog[17]*getHeight()/(3*3000)+bar_height),5,5,paint);
590
 
591
 
592
 
593
 
594
                canvas.restore();
595
 
596
                paint.setARGB(state_intro_frame,0,0,255);
597
                //              canvas.drawRoundRect(new RectF(getWidth()/2-getWidth()/8,getHeight()/2-getWidth()/8,getWidth()/2+getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
598
 
599
                canvas.drawRoundRect(new RectF(flight_x,flight_y,flight_x+getWidth()/8,flight_y+getWidth()/8),5,5,paint);
600
                paint.setARGB(255,0,0,0);
601
                break;
602
 
603
            case STATEID_STICKVIEW:
604
                paint.setARGB(state_intro_frame,50,50,200);
605
 
606
                for(int y_p=0;y_p<10;y_p++)
607
                    canvas.drawRoundRect(new RectF(getWidth()/3 +((root.mk.stick_data.stick[y_p]<0)?(((root.mk.stick_data.stick[y_p]*getWidth()/3)/127)):0) ,(getHeight()/10)*y_p,getWidth()-getWidth()/3+((root.mk.stick_data.stick[y_p]>0)?(((root.mk.stick_data.stick[y_p]*getWidth()/3)/127)):0) ,(getHeight()/10)*(y_p+1)),15,15,paint);
608
                paint.setARGB(state_intro_frame*2+50,0,255,0);
609
                paint.setTextAlign(Paint.Align.CENTER);
610
                for(int y_p=0;y_p<10;y_p++)
611
                canvas.drawText("Chan " + (y_p+1) + "("+root.mk.stick_data.stick[y_p]+")",getWidth()/2,(getHeight()/20)*(y_p*2+1),paint);
612
                paint.setTextAlign(Paint.Align.LEFT);
613
 
614
 
615
                canvas.drawText("RC-Signal: " + root.mk.debug_data.SenderOkay(),0,10,paint);
616
                break;
617
 
618
            case STATEID_MAINMENU:
619
                paint.setARGB(state_intro_frame ,0,0,0);       
620
                canvas.drawBitmap(lcd_img,0,lcd_top , paint);
621
 
622
 
623
                int spacer=15;
624
 
625
                int y_pos=10;
626
 
627
                paint.setColor(Color.GREEN);
628
                //      canvas.drawText("LastKeyCode:"+last_key,0,10,paint);
629
                paint.setTextAlign(Paint.Align.LEFT);
630
                if (root.mk.connected)
631
                    {
632
                        canvas.drawText("Connected to MK with Version:"+root.mk.version.major+"."+root.mk.version.minor,0,y_pos,paint);
633
                        y_pos+=spacer;
634
                        canvas.drawText(" Power Source: " +( root.mk.debug_data.UBatt()/10) + "." + ( root.mk.debug_data.UBatt()%10) + " Volts | RC-Signal: " + root.mk.debug_data.SenderOkay(),0,y_pos,paint);
635
                        y_pos+=spacer;
636
                        canvas.drawText(" debug:"+root.mk.stats.debug_data_count+ " LCD:" + root.mk.stats.lcd_data_count + "(Pages:" + root.mk.LCD.pages + ") vers:" + root.mk.stats.version_data_count,0,y_pos,paint);
637
                        y_pos+=spacer;
638
                        canvas.drawText(" other:"+root.mk.stats.other_data_count+" params:"+root.mk.stats.params_data_count,0,y_pos,paint);
639
                    }
640
                else
641
                    {
642
                        canvas.drawText("No QuadroKopter Communication established.",0,y_pos,paint);
643
                        y_pos+=spacer;
644
                    }
645
                break;
646
            }
647
 
648
 
649
 
650
        paint.setARGB(255,255,255,255);
651
        // icon indicating QC is connected
652
        // !!FIXME!! -10 by screensize
653
        canvas.drawBitmap(icon_img,getWidth()-icon_img.getWidth(),-10 , paint);
654
        if (root.mk.ready())
655
            canvas.drawBitmap(bt_on_img,getWidth()-icon_img.getWidth()-bt_on_img.getWidth()-5,5 , paint);
656
        else
657
            canvas.drawBitmap(bt_off_img,getWidth()-icon_img.getWidth()-bt_on_img.getWidth()-5,5 , paint);
658
 
659
 
660
        paint.setARGB(255,0,0,0);      
661
        invalidate();
662
    }
663
}