Rev 206 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
206 | ligi | 1 | /******************************************* |
2 | * |
||
3 | * Handling of MK LCD |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * see README for further Infos |
||
7 | * |
||
8 | * |
||
9 | *******************************************/ |
||
10 | |||
11 | package org.ligi.ufo; |
||
12 | |||
13 | public class MKLCD |
||
14 | // implements Runnable |
||
15 | { |
||
16 | |||
17 | MKCommunicator mk=null; |
||
18 | |||
19 | int last_recieved_page=0; |
||
20 | int act_page=0; |
||
21 | public int pages=-1; |
||
22 | |||
23 | private String[] lcd_buf; |
||
24 | private String[] lcd_buf_; |
||
25 | |||
26 | public String[] get_act_page() |
||
27 | { return lcd_buf; } |
||
28 | |||
29 | public MKLCD(MKCommunicator _mk) |
||
30 | { |
||
31 | lcd_buf=new String[4]; |
||
32 | |||
33 | lcd_buf[0]="no "; |
||
34 | lcd_buf[1]="DisplayData " ; |
||
35 | lcd_buf[2]="read "; |
||
36 | lcd_buf[3]="yet "; |
||
37 | mk=_mk; |
||
38 | } |
||
39 | |||
40 | public void set_page(int page) |
||
41 | { |
||
42 | act_page=page; |
||
43 | } |
||
44 | |||
45 | public void handle_lcd_data(int[] data) |
||
46 | { |
||
47 | |||
48 | lcd_buf_=new String[4]; |
||
49 | last_recieved_page=data[0]; |
||
50 | pages=data[1]; |
||
51 | |||
52 | for(int row=0;row<4;row++) |
||
53 | { |
||
54 | lcd_buf_[row]=""; |
||
55 | for(int col=0;col<20;col++) |
||
56 | lcd_buf_[row]+=(char)data[row*20+col+2]; |
||
57 | } |
||
58 | lcd_buf=lcd_buf_; |
||
59 | } |
||
60 | |||
61 | public void trigger_LCD() |
||
62 | { |
||
63 | mk.trigger_LCD_by_page(act_page); |
||
64 | } |
||
65 | |||
66 | |||
67 | |||
68 | public void LCD_NEXTPAGE() |
||
69 | { |
||
266 | ligi | 70 | if (act_page<pages) |
206 | ligi | 71 | act_page++; |
72 | else |
||
73 | act_page=0; |
||
74 | |||
75 | } |
||
76 | |||
77 | public void LCD_PREVPAGE() |
||
78 | { |
||
266 | ligi | 79 | if (act_page>0) |
206 | ligi | 80 | act_page--; |
81 | else |
||
82 | act_page=pages; |
||
83 | } |
||
84 | |||
85 | } |