Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
210 ligi 1
/*********************************************************************************************************************************
2
 *                                                                                                                                *
3
 * Handling of MK LCD                                                                                                             *
4
 *                                                                                                                                *
5
 * Author:        Marcus -LiGi- Bueschleb                                                                                         *
6
 * Project-Start: 9/2007                                                                                                          *
7
 * Mailto:        ligi@smart4mobile.de                                                                                            *
8
 * Licence:       Creative Commons / Non Commercial                                                                               *
9
 * Big Up:        Holger&Ingo                                                                                                     *
10
 *********************************************************************************************************************************/
11
 
12
public class MKLCD
13
   implements Runnable
14
{
15
 
16
    MKCommunicator mk=null;
17
 
18
    public String[] LCD_str;
19
 
20
    public MKLCD(MKCommunicator _mk)
21
    {
22
        LCD_str=new String[4];
23
        mk=_mk;
24
        new Thread( this ).start(); // fire up main Thread 
25
    }
26
 
27
    public void run()
28
    {
29
        while(true)
30
            {
31
 
32
                if (mk.connected)
33
                    {
34
                        trigger_LCD();
35
 
36
                    }
37
                else
38
                    {
39
 
40
                    }
41
                try { Thread.sleep(100); }
42
                catch (Exception e)  {   }
43
            }
44
    }
45
 
46
 
47
    public void handle_lcd_data(int[] data,int row)
48
    {
49
        LCD_str[row]="";
50
        for(int foo=0;foo<20;foo++)
51
            LCD_str[row]+=(char)data[foo];
52
    }
53
 
54
    public void trigger_LCD()
55
    {
56
        int[] params=new int[3];
57
        params[0]=act_key;
58
        params[1]=0;
59
        params[2]=0;
60
 
61
        mk.send_command(0,'h',params);
62
        act_key=0;
63
    }
64
 
65
    int act_key=0;
66
 
67
 
68
    public void LCD_NEXTPAGE()
69
    {
70
        act_key=2;
71
    }
72
 
73
    public void LCD_PREVPAGE()
74
    {
75
        act_key=1;
76
    }
77
 
78
}