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 * |
||
403 | ligi | 6 | * |
7 | * see README for further Infos |
||
8 | * |
||
210 | ligi | 9 | *********************************************************************************************************************************/ |
10 | |||
11 | public class MKLCD |
||
12 | implements Runnable |
||
13 | { |
||
14 | |||
15 | MKCommunicator mk=null; |
||
16 | |||
17 | public String[] LCD_str; |
||
18 | |||
19 | public MKLCD(MKCommunicator _mk) |
||
20 | { |
||
21 | LCD_str=new String[4]; |
||
22 | mk=_mk; |
||
23 | new Thread( this ).start(); // fire up main Thread |
||
24 | } |
||
25 | |||
26 | public void run() |
||
27 | { |
||
28 | while(true) |
||
29 | { |
||
303 | ligi | 30 | try { |
210 | ligi | 31 | if (mk.connected) |
32 | { |
||
303 | ligi | 33 | |
210 | ligi | 34 | trigger_LCD(); |
35 | |||
36 | } |
||
37 | else |
||
38 | { |
||
39 | |||
40 | } |
||
303 | ligi | 41 | Thread.sleep(100); } |
210 | ligi | 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 | { |
||
303 | ligi | 56 | try { |
210 | ligi | 57 | |
325 | ligi | 58 | mk.trigger_LCD(act_key); |
303 | ligi | 59 | act_key=0; |
60 | } |
||
61 | catch (Exception e) { } |
||
210 | ligi | 62 | } |
325 | ligi | 63 | |
210 | ligi | 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 | } |