Rev 411 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 411 | Rev 475 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | 10 | ||
Line 11... | Line 11... | ||
11 | import javax.microedition.lcdui.*; |
11 | import javax.microedition.lcdui.*; |
12 | - | ||
- | 12 | ||
13 | 13 | ||
Line 14... | Line 14... | ||
14 | public class MKParamsEditor |
14 | public class MKParamsEditor |
Line 15... | Line -... | ||
15 | - | ||
16 | { |
- | |
17 | - | ||
Line -... | Line 15... | ||
- | 15 | implements MKParamDefinitions |
|
- | 16 | { |
|
- | 17 | ||
- | 18 | public final static int TAB_COUNT=9; |
|
- | 19 | ||
- | 20 | ||
- | 21 | ||
- | 22 | public final static int TABID_CONFIGURATION=0; |
|
- | 23 | public final static int TABID_CHANNELS=1; |
|
18 | public final static int TAB_COUNT=9; |
24 | public final static int TABID_STICK=2; |
- | 25 | public final static int TABID_ALTITUDE=3; |
|
- | 26 | public final static int TABID_GYRO=4; |
|
- | 27 | public final static int TABID_LOOPING=5; |
|
- | 28 | public final static int TABID_CAMMERA=6; |
|
- | 29 | public final static int TABID_OTHER=7; |
|
- | 30 | public final static int TABID_USER=8; |
|
19 | 31 | public String[] tab_names={"Configuration","Channels","Stick","Altitude","Gyro","Looping","Camera","Other","User"}; |
|
Line 20... | Line 32... | ||
20 | public final static int PARAMTYPE_BOOLEAN=0; |
32 | |
21 | public final static int PARAMTYPE_BYTE=1; |
33 | |
22 | 34 | public String[] param_names; |
|
23 | 35 | ||
- | 36 | ||
- | 37 | ||
24 | 38 | public int[] tab_entrys_count={6,8,3,6,4,6,6,6,4}; |
|
25 | public String[] tab_names={"Configuration","Channels","Stick","Altitude","Gyro","Looping","Camera","Other","User"}; |
39 | |
26 | public int[] tab_entrys_count={6,8,3,6,4,6,6,6,4}; |
40 | public String[][] tab_entrys={{"Altitude Contol","Switch for setpoint","Heading Hold","Compass","Orientation fixed","GPS"} |
27 | 41 | , |
|
Line 28... | Line 42... | ||
28 | public String[][] tab_entrys={{"Altitude Contol","Switch for setpoint","Heading Hold","Compass","Orientation fixed","GPS"} |
42 | {"Accelerate","Gier","Nick","Roll","POTI1","POTI2","POTI3","POTI4"}, |
29 | , |
43 | {"Nick/Roll P-Rate","Nick/Roll D-Rate","Gier P-Rate"}, |
30 | {"Accelerate","Gier","Nick","Roll","POTI1","POTI2","POTI3","POTI4"}, |
44 | |
31 | {"Nick/Roll P-Rate","Nick/Roll D-Rate","Gier P-Rate"}, |
- | |
32 | {"SetPoint","Min. Accelerate","Altitude P","Barometric D","Z-ACC effect ","Gain"}, |
- | |
33 | {"Gyro P-Rate","Gyro I-Rate","ACC Gyro Factor","Main I"}, |
- | |
34 | {"Up","Down","Left","Right","Gas Limit","Response threshold"}, |
45 | |
Line 35... | Line 46... | ||
35 | {"Servo Ctrl","Nick compensation","Invert direction","Servo min","Servo max","Servo refresh Rate"}, |
46 | {"SetPoint","Min. Accelerate","Altitude P","Barometric D","Z-ACC effect ","Gain"}, |
Line 36... | Line 47... | ||
36 | 47 | {"Gyro P-Rate","Gyro I-Rate","ACC Gyro Factor","Main I"}, |
|
Line 52... | Line 63... | ||
52 | {PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
63 | {PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
53 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
64 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
54 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
65 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, |
55 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE} |
66 | {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE} |
Line 56... | Line 67... | ||
56 | 67 | ||
Line 57... | Line 68... | ||
57 | }; |
68 | }; |
Line 58... | Line 69... | ||
58 | 69 | ||
59 | 70 | ||
60 | public int[][][] tab_entry_src={ |
71 | public int[][][] tab_entry_src={ |
61 | 72 | ||
62 | { {8,0} ,{8,1},{8,2},{8,3},{8,4},{8,5} }, |
73 | { {8,0} ,{8,1},{8,2},{8,3},{8,4},{8,5} }, |
63 | { {2,0} ,{3,0},{0,0},{1,0},{4,0},{5,0},{6,0},{7,0} }, |
74 | { {2,0} ,{3,0},{0,0},{1,0},{4,0},{5,0},{6,0},{7,0} }, |
64 | { {15,0} ,{16,0},{17,0} }, |
75 | { {15,0} ,{16,0},{17,0} }, |
65 | { {0,0} ,{9,0},{12,0},{10,0},{14,0},{13,0} }, //! |
76 | { {11,0} ,{9,0},{12,0},{10,0},{14,0},{13,0} }, //! |
66 | { {22,0} ,{23,0},{20,0},{28,0} }, |
77 | { {22,0} ,{23,0},{20,0},{28,0} }, |
Line 89... | Line 100... | ||
89 | 100 | ||
90 | 101 | ||
91 | public void paint ( Graphics g) |
102 | public void paint ( Graphics g) |
92 | { |
- | |
93 | refresh_lcd(); |
- | |
94 | // for ( int i=0;i<act_lcd_lines;i++) |
103 | { |
95 | // canvas.draw_lcd_line(g,lcd_lines[i] ,0,i*canvas.lcd_char_height); |
- | |
96 | canvas.paint_lcd(g,false); |
104 | refresh_lcd(); |
Line 97... | Line 105... | ||
97 | 105 | canvas.paint_lcd(g,false); |
|
98 | } |
106 | } |
99 | 107 | ||
100 | 108 | ||
101 | public void refresh_lcd() |
109 | public void refresh_lcd() |
102 | { |
110 | { |
103 | if (canvas.mk!=null) |
111 | if (canvas.mk!=null) |
104 | { |
112 | { |
105 | act_lcd_lines=tab_entrys_count[act_tab]*2+1; |
113 | act_lcd_lines=tab_entrys_count[act_tab]*2+1; |
106 | for ( int i=0;i<act_lcd_lines;i++) |
114 | for ( int i=0;i<act_lcd_lines;i++) |
107 | lcd_lines[i]=""; |
115 | lcd_lines[i]=""; |
108 | - | ||
109 | lcd_lines[0]=(act_tab==0?" ":"< ") + tab_names[act_tab] + (act_tab==(TAB_COUNT-1)?" ":" >"); |
- | |
110 | - | ||
111 | for (int i=0;i<tab_entrys_count[act_tab];i++) |
- | |
112 | { |
- | |
113 | lcd_lines[1+2*i]=tab_entrys[act_tab][i]; |
116 | |
- | 117 | lcd_lines[0]=(act_tab==0?" ":"< ") + tab_names[act_tab] + (act_tab==(TAB_COUNT-1)?" ":" >"); |
|
- | 118 | ||
- | 119 | for (int i=0;i<tab_entrys_count[act_tab];i++) |
|
- | 120 | { |
|
- | 121 | lcd_lines[1+2*i]=tab_entrys[act_tab][i]; |
|
114 | if (tab_entry_types[act_tab][i]== PARAMTYPE_BOOLEAN) |
122 | if (tab_entry_types[act_tab][i]== PARAMTYPE_BOOLEAN) |
115 | lcd_lines[2+2*i]=(((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])&(1<<tab_entry_src[act_tab][i][1]))==0)?"off":"on" ) ; |
123 | lcd_lines[2+2*i]=(((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])&(1<<tab_entry_src[act_tab][i][1]))==0)?"off":"on" ) ; |
116 | if (tab_entry_types[act_tab][i]== PARAMTYPE_BYTE) |
124 | if (tab_entry_types[act_tab][i]== PARAMTYPE_BYTE) |
- | 125 | { |
|
- | 126 | lcd_lines[2+2*i]=""+canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0]); |
|
117 | { |
127 | if ((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])>250)&&(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])<256)) |
Line 118... | Line -... | ||
118 | lcd_lines[2+2*i]=""+canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0]); |
- | |
119 | if ((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])>250)&&(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])<256)) |
- | |
120 | lcd_lines[2+2*i]+="[Poti"+(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])-250) +"]"; |
128 | lcd_lines[2+2*i]+="[Poti"+(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])-250) +"]"; |
121 | } |
129 | } |
122 | 130 | ||
123 | } |
131 | } |
124 | - | ||
125 | for (int i=0;i<act_lcd_lines;i++) |
- | |
126 | { |
- | |
127 | lcd_lines[i]=(act_y==i?"#":" ")+lcd_lines[i]; |
- | |
128 | } |
- | |
129 | - | ||
130 | for ( int i=0;i<act_lcd_lines;i++) |
- | |
131 | while(lcd_lines[i].length()<20) |
- | |
132 | { |
- | |
133 | lcd_lines[i]+=" "; |
- | |
Line -... | Line 132... | ||
- | 132 | ||
- | 133 | for (int i=0;i<act_lcd_lines;i++) |
|
- | 134 | { |
|
- | 135 | lcd_lines[i]=(act_y==i?"#":" ")+lcd_lines[i]; |
|
- | 136 | } |
|
- | 137 | ||
- | 138 | for ( int i=0;i<act_lcd_lines;i++) |
|
- | 139 | while(lcd_lines[i].length()<20) |
|
- | 140 | { |
|
- | 141 | lcd_lines[i]+=" "; |
|
134 | } |
142 | } |
135 | 143 | ||
136 | canvas.lcd_lines=new String[act_lcd_lines]; |
144 | canvas.lcd_lines=new String[act_lcd_lines]; |
137 | for(int i=0;i<act_lcd_lines;i++) |
145 | for(int i=0;i<act_lcd_lines;i++) |
138 | canvas.lcd_lines[i]=lcd_lines[i]; |
146 | canvas.lcd_lines[i]=lcd_lines[i]; |