Rev 213 | Rev 219 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 213 | Rev 214 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | 46 | ||
47 | String[] file_list; |
47 | String[] file_list; |
48 | int file_list_length=0; |
48 | int file_list_length=0; |
Line 49... | Line -... | ||
49 | //#endif |
- | |
50 | - | ||
51 | 49 | //#endif |
|
Line 52... | Line 50... | ||
52 | 50 | ||
53 | String act_input_str=" "; |
51 | String act_input_str=" "; |
54 | 52 | ||
Line 55... | Line 53... | ||
55 | boolean ipinput4proxy; |
53 | boolean ipinput4proxy; |
56 | byte ipinput_pos=0; |
54 | byte ipinput_pos=0; |
Line 57... | Line -... | ||
57 | int[] act_edit_ip; |
- | |
58 | - | ||
59 | int canvas_width=100; |
55 | int[] act_edit_ip; |
60 | int canvas_height=100; |
56 | |
Line 148... | Line 144... | ||
148 | int act_menu_select=0; |
144 | int act_menu_select=0; |
Line 149... | Line 145... | ||
149 | 145 | ||
Line -... | Line 146... | ||
- | 146 | String[] lcd_lines =null; |
|
- | 147 | ||
- | 148 | ||
- | 149 | ||
- | 150 | // boolean expert_mode=false; |
|
- | 151 | ||
- | 152 | public void setup_main_menu() |
|
- | 153 | { |
|
- | 154 | byte setup_pos=0; |
|
- | 155 | byte[] tmp_actions=new byte[20]; |
|
- | 156 | String[] tmp_items=new String[20]; |
|
- | 157 | ||
- | 158 | ||
- | 159 | ||
- | 160 | tmp_actions[setup_pos]=ACTIONID_SETTINGS; |
|
- | 161 | tmp_items[setup_pos++] ="Tool Settings"; |
|
- | 162 | ||
- | 163 | ||
- | 164 | tmp_actions[setup_pos]=ACTIONID_CONN_DETAILS; |
|
- | 165 | tmp_items[setup_pos++] ="Connection"; |
|
- | 166 | ||
- | 167 | if (settings.expert_mode) |
|
- | 168 | { |
|
- | 169 | tmp_actions[setup_pos]=ACTIONID_DEBUG; |
|
- | 170 | tmp_items[setup_pos++] ="Debug"; |
|
- | 171 | ||
- | 172 | } |
|
- | 173 | ||
- | 174 | ||
- | 175 | ||
- | 176 | if (mk.ufo_prober.is_mk() ) |
|
- | 177 | { |
|
- | 178 | tmp_actions[setup_pos]=ACTIONID_MOTORTEST; |
|
- | 179 | tmp_items[setup_pos++] ="Motor Test"; |
|
- | 180 | ||
- | 181 | tmp_actions[setup_pos]=ACTIONID_KEYCONTROL; |
|
- | 182 | tmp_items[setup_pos++] ="Key-Control"; |
|
- | 183 | ||
- | 184 | tmp_actions[setup_pos]=ACTIONID_RCDATA; |
|
- | 185 | tmp_items[setup_pos++] ="view RC-data"; |
|
- | 186 | ||
- | 187 | tmp_actions[setup_pos]=ACTIONID_EDIT_PARAMS; |
|
- | 188 | tmp_items[setup_pos++] ="Flight Settings"; |
|
- | 189 | } |
|
- | 190 | ||
- | 191 | ||
- | 192 | ||
- | 193 | if (( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk() )) |
|
- | 194 | { |
|
- | 195 | tmp_actions[setup_pos]=ACTIONID_LCD; |
|
- | 196 | tmp_items[setup_pos++] ="LCD"; |
|
- | 197 | } |
|
- | 198 | ||
- | 199 | if (( mk.ufo_prober.is_mk() )) |
|
- | 200 | { |
|
- | 201 | tmp_actions[setup_pos]=ACTIONID_GRAPH; |
|
- | 202 | tmp_items[setup_pos++] ="Graph"; |
|
- | 203 | } |
|
- | 204 | ||
- | 205 | ||
- | 206 | ||
- | 207 | ||
- | 208 | if (( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() )) |
|
- | 209 | { |
|
- | 210 | tmp_actions[setup_pos]=ACTIONID_RAWDEBUG; |
|
- | 211 | tmp_items[setup_pos++] ="Debug Values"; |
|
- | 212 | } |
|
- | 213 | ||
- | 214 | ||
- | 215 | ||
- | 216 | if ( mk.ufo_prober.is_navi()) |
|
- | 217 | { |
|
- | 218 | tmp_actions[setup_pos]=ACTIONID_GPSDATA; |
|
- | 219 | tmp_items[setup_pos++] ="view GPS-Data"; |
|
- | 220 | ||
- | 221 | tmp_actions[setup_pos]=ACTIONID_NC_ERRORS; |
|
- | 222 | tmp_items[setup_pos++] ="view Errors"; |
|
- | 223 | ||
- | 224 | ||
- | 225 | tmp_actions[setup_pos]=ACTIONID_SWITCH_FC; |
|
- | 226 | tmp_items[setup_pos++] ="switch to FC"; |
|
- | 227 | ||
- | 228 | tmp_actions[setup_pos]=ACTIONID_SWITCH_MK3MAG; |
|
- | 229 | tmp_items[setup_pos++] ="switch to MK3MAG"; |
|
- | 230 | ||
- | 231 | } |
|
- | 232 | ||
- | 233 | if ((mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() )) |
|
- | 234 | { |
|
- | 235 | tmp_actions[setup_pos]=ACTIONID_SWITCH_NC; |
|
- | 236 | tmp_items[setup_pos++] ="switch to Navi"; |
|
- | 237 | } |
|
- | 238 | ||
- | 239 | ||
- | 240 | if ((settings.expert_mode)&& ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag()||mk.ufo_prober.is_incompatible() )) |
|
- | 241 | { |
|
- | 242 | tmp_actions[setup_pos]=ACTIONID_FLASH; |
|
- | 243 | tmp_items[setup_pos++] ="Flash Firmware"; |
|
- | 244 | } |
|
- | 245 | ||
- | 246 | if ((settings.expert_mode)&& ( mk.ufo_prober.is_mk() )) |
|
- | 247 | { |
|
- | 248 | tmp_actions[setup_pos]=ACTIONID_CAM; |
|
- | 249 | tmp_items[setup_pos++] ="Remote Cam"; |
|
- | 250 | } |
|
- | 251 | ||
- | 252 | ||
- | 253 | ||
- | 254 | tmp_actions[setup_pos]=ACTIONID_ABOUT; |
|
- | 255 | tmp_items[setup_pos++] ="About"; |
|
- | 256 | ||
- | 257 | tmp_actions[setup_pos]=ACTIONID_QUIT; |
|
- | 258 | tmp_items[setup_pos++] ="Quit"; |
|
- | 259 | ||
- | 260 | ||
- | 261 | byte[] tmp_actions_fin=new byte[setup_pos]; |
|
- | 262 | String[] tmp_items_fin=new String[setup_pos]; |
|
- | 263 | ||
- | 264 | for ( int tmp_p=0;tmp_p<setup_pos;tmp_p++) |
|
- | 265 | { |
|
- | 266 | tmp_actions_fin[tmp_p]=tmp_actions[tmp_p]; |
|
- | 267 | tmp_items_fin[tmp_p] =tmp_items[tmp_p]; |
|
- | 268 | } |
|
- | 269 | setup_menu(tmp_items_fin,tmp_actions_fin); |
|
150 | String[] lcd_lines =null; |
270 | } |
151 | 271 | ||
152 | 272 | ||
153 | public void setup_menu(String[] items , byte[] actions) |
273 | public void setup_menu(String[] items , byte[] actions) |
154 | { |
274 | { |
Line 270... | Line 390... | ||
270 | graph_data=new int[GRAPH_COUNT][this.getWidth()*2]; |
390 | graph_data=new int[GRAPH_COUNT][this.getWidth()*2]; |
Line 271... | Line 391... | ||
271 | 391 | ||
272 | for (int c=0;c<graph_data[0].length;c++) |
392 | for (int c=0;c<graph_data[0].length;c++) |
273 | for (int d=0;d<GRAPH_COUNT;d++) |
393 | for (int d=0;d<GRAPH_COUNT;d++) |
274 | graph_data[d][c]=-1; |
- | |
275 | /* |
- | |
276 | nick_line_pos_data=new int[graph_data[0].length]; |
- | |
277 | roll_line_pos_data=new int[graph_data[0].length]; |
- | |
278 | accnick_line_pos_data=new int[graph_data[0].length]; |
- | |
Line 279... | Line -... | ||
279 | accroll_line_pos_data=new int[graph_data[0].length]; |
- | |
280 | |
- | |
281 | for (int c=0;c<graph_data[0].length;c++) |
- | |
282 | { |
- | |
283 | nick_line_pos_data[c]=-1; |
- | |
284 | roll_line_pos_data[c]=-1; |
- | |
285 | accnick_line_pos_data[c]=-1; |
- | |
286 | accroll_line_pos_data[c]=-1; |
- | |
287 | } |
394 | graph_data[d][c]=-1; |
288 | */ |
395 | |
289 | try { |
396 | try { |
290 | err_img=null; |
397 | err_img=null; |
291 | if (settings.do_scrollbg) err_img=Image.createImage("/preflight.jpg"); |
398 | err_img=Image.createImage("/preflight.jpg"); |
Line 292... | Line 399... | ||
292 | } |
399 | } |
Line 743... | Line 850... | ||
743 | g.drawString(mk.get_buff(pos_y) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
850 | g.drawString(mk.get_buff(pos_y) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
744 | y_off-=spacer1; |
851 | y_off-=spacer1; |
745 | } |
852 | } |
746 | break; |
853 | break; |
747 | case STATEID_NC_ERRORS: |
854 | case STATEID_NC_ERRORS: |
748 | if (settings.do_scrollbg) |
855 | if (err_img!=null) |
749 | { |
856 | { |
750 | int err_img_left=(canvas_width-err_img.getWidth()/2)/2; |
857 | int err_img_left=(canvas_width-err_img.getWidth()/2)/2; |
751 | int err_img_top=(canvas_height-err_img.getHeight())/2; |
858 | int err_img_top=(canvas_height-err_img.getHeight())/2; |
752 | g.setClip(err_img_left,err_img_top,err_img.getWidth()/2,err_img.getHeight()); |
859 | g.setClip(err_img_left,err_img_top,err_img.getWidth()/2,err_img.getHeight()); |
753 | g.drawImage(err_img,err_img_left-err_img.getWidth()/2,err_img_top, g.TOP | g.LEFT); |
860 | g.drawImage(err_img,err_img_left-err_img.getWidth()/2,err_img_top, g.TOP | g.LEFT); |
Line 1451... | Line 1558... | ||
1451 | 1558 | ||
1452 | break; |
1559 | break; |
Line 1453... | Line 1560... | ||
1453 | //#endif |
1560 | //#endif |
1454 | - | ||
1455 | case STATEID_MAINMENU: |
- | |
1456 | if (mk.ufo_prober.is_navi()) |
- | |
1457 | setup_menu(main_menu_items_navi,main_menu_actions_navi); |
- | |
1458 | else if (mk.ufo_prober.is_mk()) |
- | |
1459 | setup_menu(main_menu_items_mk,main_menu_actions_mk); |
- | |
1460 | else if (mk.ufo_prober.is_mk3mag()) |
- | |
1461 | setup_menu(main_menu_items_mk3mag,main_menu_actions_mk3mag); |
- | |
1462 | else if (mk.ufo_prober.is_incompatible()) |
1561 | |
1463 | setup_menu(main_menu_items_incompatible,main_menu_actions_incompatible); |
- | |
- | 1562 | case STATEID_MAINMENU: |
|
1464 | else // no connection |
1563 | setup_main_menu(); |
Line 1465... | Line 1564... | ||
1465 | setup_menu(main_menu_items_no_connection,main_menu_actions_no_connection); |
1564 | |
Line 1466... | Line 1565... | ||
1466 | break; |
1565 | break; |
Line 1480... | Line 1579... | ||
1480 | menu_items[6]+=(mk.gps_position.act_speed_format==0)?" KM/H":((mk.gps_position.act_speed_format==1)?" MP/H":"CM/S"); |
1579 | menu_items[6]+=(mk.gps_position.act_speed_format==0)?" KM/H":((mk.gps_position.act_speed_format==1)?" MP/H":"CM/S"); |
Line 1481... | Line 1580... | ||
1481 | 1580 | ||
1482 | //#if devicecontrol=="on" |
1581 | //#if devicecontrol=="on" |
1483 | menu_items[7]+=(!settings.keep_lighton)?"Off":"On"; |
1582 | menu_items[7]+=(!settings.keep_lighton)?"Off":"On"; |
- | 1583 | //#endif |
|
1484 | //#endif |
1584 | menu_items[8]+=(!settings.expert_mode)?" Off":" On"; |
1485 | menu_actions=settings_menu_actions; |
1585 | menu_actions=settings_menu_actions; |
1486 | lcd_lines=new String[menu_items.length]; |
1586 | lcd_lines=new String[menu_items.length]; |
Line 1487... | Line 1587... | ||
1487 | break; |
1587 | break; |
Line 1962... | Line 2062... | ||
1962 | if ( getGameAction (keyCode)==FIRE ) |
2062 | if ( getGameAction (keyCode)==FIRE ) |
1963 | { |
2063 | { |
1964 | switch(menu_actions[act_menu_select]) |
2064 | switch(menu_actions[act_menu_select]) |
1965 | { |
2065 | { |
Line -... | Line 2066... | ||
- | 2066 | ||
- | 2067 | case ACTIONID_TOGGLE_EXPERT: |
|
- | 2068 | settings.expert_mode=!settings.expert_mode; |
|
- | 2069 | chg_state(STATEID_SETTINGSMENU); |
|
1966 | 2070 | break; |
|
1967 | case ACTIONID_RENAME_PARAMS: |
2071 | case ACTIONID_RENAME_PARAMS: |
1968 | act_input_str=mk.params.names[mk.params.act_paramset]; |
2072 | act_input_str=mk.params.names[mk.params.act_paramset]; |
1969 | ipinput_pos=0; |
2073 | ipinput_pos=0; |
1970 | chg_state(STATEID_STRINGINPUT); |
2074 | chg_state(STATEID_STRINGINPUT); |