Rev 269 | Rev 493 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 269 | Rev 382 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | * |
7 | * |
8 | ***************************************************************/ |
8 | ***************************************************************/ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line -... | Line 10... | ||
- | 10 | import javax.microedition.lcdui.*; |
|
10 | import javax.microedition.lcdui.*; |
11 | |
11 | 12 | //#if j2memap=="on" |
|
- | 13 | import com.eightmotions.map.*; |
|
Line -... | Line 14... | ||
- | 14 | import com.eightmotions.util.UtilMidp; |
|
- | 15 | //#endif |
|
- | 16 | ||
- | 17 | //#if jsr179=="on" |
|
- | 18 | import javax.microedition.location.*; |
|
- | 19 | //#endif |
|
- | 20 | ||
Line 12... | Line 21... | ||
12 | import javax.microedition.media.*; |
21 | //#if openlapi=="on" |
13 | import javax.microedition.media.control.*; |
22 | import com.openlapi.*; |
Line -... | Line 23... | ||
- | 23 | //#endif |
|
- | 24 | ||
- | 25 | import javax.microedition.rms.*; |
|
- | 26 | import java.io.*; |
|
- | 27 | ||
- | 28 | ||
- | 29 | import org.ligi.ufo.MKFirmwareFlasher; |
|
- | 30 | import org.ligi.ufo.DUBwiseDefinitions; |
|
14 | 31 | import org.ligi.ufo.DUBwiseLangDefs; |
|
15 | 32 | import org.ligi.ufo.MKCommunicator; |
|
16 | import javax.microedition.rms.*; |
33 | import org.ligi.ufo.MKFirmwareHelper; |
- | 34 | ||
- | 35 | ||
- | 36 | public class DUBwiseCanvas |
|
- | 37 | extends Canvas |
|
17 | import java.io.*; |
38 | implements Runnable,DUBwiseDefinitions , DUBwiseUIDefinitions,DUBwiseLangDefs |
Line -... | Line 39... | ||
- | 39 | ||
- | 40 | //#if (location=="on")&&(cldc11=="on") |
|
- | 41 | ,LocationListener |
|
- | 42 | //#endif |
|
- | 43 | { |
|
- | 44 | ||
- | 45 | //#if (location=="on")&&(cldc11=="on") |
|
- | 46 | public void providerStateChanged(javax.microedition.location.LocationProvider p ,int i ) |
|
- | 47 | { |
|
- | 48 | } |
|
- | 49 | ||
- | 50 | public void locationUpdated(LocationProvider lp, Location loc) |
|
- | 51 | { |
|
- | 52 | try |
|
- | 53 | { |
|
- | 54 | Coordinates coords = loc.getQualifiedCoordinates(); |
|
- | 55 | if (coords != null) |
|
- | 56 | { |
|
- | 57 | phone_long = coords.getLongitude(); |
|
- | 58 | phone_lat = coords.getLatitude(); |
|
- | 59 | ||
- | 60 | if (mk!=null) |
|
- | 61 | { |
|
- | 62 | mk.lat=(long)phone_lat*10000000; |
|
- | 63 | mk.lon=(long)phone_long*10000000; |
|
- | 64 | ||
- | 65 | } |
|
- | 66 | // Start thread for handling the new coordinates |
|
- | 67 | // (...) |
|
- | 68 | } |
|
- | 69 | else |
|
- | 70 | { |
|
- | 71 | phone_lat=-1.0; |
|
- | 72 | phone_long=-1.0; |
|
- | 73 | ||
- | 74 | ||
- | 75 | ||
- | 76 | } |
|
- | 77 | } |
|
- | 78 | catch (Exception e) |
|
- | 79 | { |
|
- | 80 | // handle the exception |
|
- | 81 | // (...) |
|
- | 82 | } |
|
- | 83 | } |
|
- | 84 | ||
- | 85 | //#endif |
|
- | 86 | //#expand public final static byte version_patch=%VERSION_PATCH%; |
|
18 | 87 | //#expand public final static byte version_minor=%VERSION_MINOR%; |
|
19 | public class DUBwiseCanvas |
88 | //#expand public final static byte version_major=%VERSION_MAJOR%; |
Line 20... | Line 89... | ||
20 | extends Canvas |
89 | |
21 | implements Runnable,org.ligi.ufo.DUBwiseDefinitions , DUBwiseUIDefinitions,org.ligi.ufo.DUBwiseLangDefs |
90 | public final static String version_str="" +version_major + "." + version_minor +"" +(char)('a'+version_patch) ; |
Line 34... | Line 103... | ||
34 | 103 | ||
35 | public final static int[] onlyback_menu_items={STRINGID_BACK }; |
104 | public final static int[] onlyback_menu_items={STRINGID_BACK }; |
Line -... | Line 105... | ||
- | 105 | public final static byte[] back_to_conndetails_actions={ACTIONID_BACK_TO_CONNDETAILS}; |
|
- | 106 | ||
- | 107 | ||
- | 108 | ||
- | 109 | public int[] beta_unlock_code={Canvas.KEY_NUM2,Canvas.KEY_NUM3,Canvas.KEY_NUM8,Canvas.KEY_NUM2}; |
|
36 | public final static byte[] back_to_conndetails_actions={ACTIONID_BACK_TO_CONNDETAILS}; |
110 | |
37 | 111 | int beta_unlock_pos=0; |
|
38 | 112 | ||
Line -... | Line 113... | ||
- | 113 | //#if fileapi=="on" |
|
- | 114 | DUBwiseFileAccess file_access; |
|
- | 115 | //#endif |
|
- | 116 | ||
- | 117 | ||
- | 118 | ||
39 | //#if fileapi=="on" |
119 | MixerManager mixer_manager; |
40 | DUBwiseFileAccess file_access; |
120 | MotorTester motor_tester; |
41 | //#endif |
121 | |
Line -... | Line 122... | ||
- | 122 | ||
- | 123 | String act_input_str=" "; |
|
Line -... | Line 124... | ||
- | 124 | // for dual use of states |
|
- | 125 | boolean select_paramset4edit; |
|
Line 42... | Line 126... | ||
42 | 126 | ||
43 | String act_input_str=" "; |
- | |
44 | // for dual use of states |
- | |
45 | boolean select_paramset4edit; |
- | |
Line 46... | Line -... | ||
46 | - | ||
47 | - | ||
Line 48... | Line 127... | ||
48 | 127 | //#if (location=="on")&&(cldc11=="on") |
|
49 | - | ||
Line 50... | Line 128... | ||
50 | //#if jsr179=="on" |
128 | Criteria cr= null; |
51 | 129 | ||
Line 68... | Line 146... | ||
68 | 146 | ||
69 | int canvas_width=100; |
147 | int canvas_width=100; |
Line -... | Line 148... | ||
- | 148 | int canvas_height=100; |
|
70 | int canvas_height=100; |
149 | |
71 | 150 | ||
Line -... | Line 151... | ||
- | 151 | ||
- | 152 | int heading_offset=0; |
|
- | 153 | int act_wp; |
|
- | 154 | ||
- | 155 | long key_bitfield=0; |
|
- | 156 | ||
- | 157 | ||
- | 158 | boolean debug_overlay=false; |
|
- | 159 | ||
- | 160 | public long keyCode2mask(int keyCode) |
|
- | 161 | { |
|
- | 162 | if ((keyCode>=KEY_NUM0)&&(keyCode<=KEY_NUM9)) |
|
- | 163 | return 1<<(keyCode-KEY_NUM0); |
|
- | 164 | else |
|
- | 165 | switch (getGameAction( keyCode )) |
|
- | 166 | { |
|
- | 167 | case UP: |
|
- | 168 | return 1<<10; |
|
- | 169 | case DOWN: |
|
- | 170 | return 1<<11; |
|
- | 171 | case LEFT: |
|
- | 172 | return 1<<12; |
|
- | 173 | case RIGHT: |
|
- | 174 | return 1<<13; |
|
- | 175 | case FIRE: |
|
- | 176 | return 1<<14; |
|
- | 177 | } |
|
72 | 178 | // log("unmapped key"); |
|
73 | int heading_offset=0; |
179 | return 0; // cant translate |
74 | int act_wp; |
180 | } |
Line 75... | Line 181... | ||
75 | 181 | ||
76 | //#if bluetooth=="on" |
182 | //#if bluetooth=="on" |
- | 183 | private BTSearcher bt_scanner; |
|
- | 184 | //#endif |
|
- | 185 | ||
- | 186 | public MKCommunicator mk=null; |
|
77 | private BTSearcher bt_scanner; |
187 | // private MKStatistics mk_stat=null; |
78 | //#endif |
188 | |
- | 189 | private MKParamsEditor act_editor=null; |
|
- | 190 | ||
- | 191 | /* |
|
- | 192 | private MKParamsEditor params_editor=null; |
|
- | 193 | private MKParamsEditor settings_editor=null; |
|
79 | 194 | private MKParamsEditor motor_tester=null; |
|
80 | public org.ligi.ufo.MKCommunicator mk=null; |
195 | |
Line 81... | Line 196... | ||
81 | // private MKStatistics mk_stat=null; |
196 | */ |
Line 93... | Line 208... | ||
93 | //#endif |
208 | //#endif |
Line 94... | Line 209... | ||
94 | 209 | ||
95 | 210 | ||
96 | private DUBwise root; |
- | |
- | 211 | private DUBwise root; |
|
Line 97... | Line 212... | ||
97 | public DUBwiseSettings settings; |
212 | public DUBwiseSettings settings; |
98 | // public UFOProber mk.ufo_prober; |
213 | |
99 | 214 | ||
Line 106... | Line 221... | ||
106 | 221 | ||
Line 107... | Line 222... | ||
107 | 222 | ||
- | 223 | private Image err_img; |
|
Line -... | Line 224... | ||
- | 224 | ||
Line -... | Line 225... | ||
- | 225 | ||
- | 226 | private Image icon_img; |
|
108 | private Image err_img; |
227 | |
109 | 228 | ||
110 | 229 | byte max_lines; |
|
111 | int max_lines; |
230 | |
Line 112... | Line 231... | ||
112 | 231 | ||
113 | 232 | /* |
|
114 | public byte act_motor=0; |
233 | public byte act_motor=0; |
115 | public byte act_motor_increase=0; |
234 | public byte act_motor_increase=0; |
Line 154... | Line 273... | ||
154 | int y_off=0; |
273 | int y_off=0; |
155 | int spacer_small=0; |
274 | int spacer_small=0; |
156 | int spacer_medium=0; |
275 | int spacer_medium=0; |
157 | int spacer_large=0; |
276 | int spacer_large=0; |
Line 158... | Line 277... | ||
158 | 277 | ||
Line 159... | Line 278... | ||
159 | int[] motor_test = {0,0,0,0}; |
278 | // int[] motor_test = {0,0,0,0}; |
160 | 279 | ||
161 | 280 | ||
162 | String[] menu_items; |
281 | String[] menu_items; |
163 | byte[] menu_actions; |
282 | byte[] menu_actions; |
Line 164... | Line 283... | ||
164 | int act_menu_select=0; |
283 | byte act_menu_select=0; |
165 | int[] act_menu_select_bak; |
284 | byte[] act_menu_select_bak; |
Line 216... | Line 335... | ||
216 | setup_menu(tmp_items_fin,tmp_actions_fin); |
335 | setup_menu(tmp_items_fin,tmp_actions_fin); |
217 | } |
336 | } |
Line 218... | Line 337... | ||
218 | 337 | ||
219 | public void setup_conn_menu() |
338 | public void setup_conn_menu() |
220 | { |
339 | { |
Line 221... | Line 340... | ||
221 | tmp_menu_init(7); |
340 | tmp_menu_init(10); |
222 | 341 | ||
223 | if (mk.connected) |
342 | if (mk.connected) |
224 | { |
343 | { |
Line 240... | Line 359... | ||
240 | } |
359 | } |
Line 241... | Line 360... | ||
241 | 360 | ||
242 | 361 | ||
243 | public void setup_main_menu() |
362 | public void setup_main_menu() |
Line -... | Line 363... | ||
- | 363 | { |
|
244 | { |
364 | tmp_menu_init(30); |
245 | tmp_menu_init(20); |
365 | |
Line -... | Line 366... | ||
- | 366 | ||
246 | 367 | tmp_menu_add(l(STRINGID_SETTINGS),ACTIONID_SETTING_OPTIONS); |
|
247 | tmp_menu_add(l(STRINGID_SETTINGS),ACTIONID_SETTING_OPTIONS); |
368 | tmp_menu_add(l(STRINGID_CONN),ACTIONID_CONN_DETAILS); |
248 | tmp_menu_add(l(STRINGID_CONN),ACTIONID_CONN_DETAILS); |
369 | |
249 | 370 | ||
- | 371 | if (settings.dev_mode) |
|
- | 372 | { |
|
- | 373 | // tmp_menu_add(l(STRINGID_SELECT_FIRMWARE),ACTIONID_SELECT_FIRMWARE); |
|
- | 374 | // tmp_menu_add("UPDATE_DUBWISE",ACTIONID_UPDATE_DUBWISE); |
|
- | 375 | ||
250 | if (settings.dev_mode) |
376 | // tmp_menu_add("Follow Me",ACTIONID_SHOWPHONEGPS); |
Line 251... | Line -... | ||
251 | { |
- | |
252 | tmp_menu_add(l(STRINGID_SELECT_FIRMWARE),ACTIONID_SELECT_FIRMWARE); |
- | |
- | 377 | ||
- | 378 | tmp_menu_add("File Open",ACTIONID_SELECT_DUBWISEDIR); |
|
Line 253... | Line 379... | ||
253 | tmp_menu_add("UPDATE_DUBWISE",ACTIONID_UPDATE_DUBWISE); |
379 | tmp_menu_add(l(STRINGID_DEBUG),ACTIONID_DEBUG); |
254 | } |
380 | } |
255 | 381 | ||
256 | - | ||
257 | if (settings.expert_mode) |
382 | |
258 | tmp_menu_add(l(STRINGID_DEBUG),ACTIONID_DEBUG); |
383 | |
259 | 384 | ||
260 | // only mk |
385 | |
261 | if (mk.ufo_prober.is_mk()) |
386 | // only mk |
- | 387 | if (mk.is_mk()) |
|
- | 388 | { |
|
262 | { |
389 | tmp_menu_add(l(STRINGID_MOTORTEST),ACTIONID_MOTORTEST); |
Line -... | Line 390... | ||
- | 390 | tmp_menu_add(l(STRINGID_KEYCONTROL),ACTIONID_KEYCONTROL); |
|
- | 391 | tmp_menu_add(l(STRINGID_RCDATA),ACTIONID_RCDATA); |
|
- | 392 | tmp_menu_add(l(STRINGID_FLIGHTSETTINGS),ACTIONID_PARAM_MENU); |
|
- | 393 | tmp_menu_add(l(STRINGID_GRAPH),ACTIONID_GRAPH); |
|
- | 394 | ||
Line 263... | Line 395... | ||
263 | 395 | tmp_menu_add("Mixer",ACTIONID_SELECT_MIXER); |
|
- | 396 | } |
|
264 | tmp_menu_add(l(STRINGID_MOTORTEST),ACTIONID_MOTORTEST); |
397 | |
265 | tmp_menu_add(l(STRINGID_KEYCONTROL),ACTIONID_KEYCONTROL); |
398 | if ( mk.is_rangeextender()|| mk.is_followme() ) |
- | 399 | { |
|
266 | tmp_menu_add(l(STRINGID_RCDATA),ACTIONID_RCDATA); |
400 | tmp_menu_add(l(STRINGID_LCD),ACTIONID_LCD); |
267 | tmp_menu_add(l(STRINGID_FLIGHTSETTINGS),ACTIONID_PARAM_MENU); |
401 | tmp_menu_add(l(STRINGID_DEBUG_VALUES),ACTIONID_RAWDEBUG); |
268 | tmp_menu_add(l(STRINGID_GRAPH),ACTIONID_GRAPH); |
402 | } |
Line 269... | Line 403... | ||
269 | } |
403 | |
270 | 404 | // mk & navi |
|
Line -... | Line 405... | ||
- | 405 | ||
Line 271... | Line 406... | ||
271 | 406 | if ( mk.is_navi()||mk.is_mk() ) |
|
272 | // mk & navi |
407 | { |
273 | if ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk() ) |
408 | |
- | 409 | tmp_menu_add(l(STRINGID_COCKPIT),ACTIONID_HORIZON); |
|
- | 410 | tmp_menu_add(l(STRINGID_LCD),ACTIONID_LCD); |
|
- | 411 | } |
|
- | 412 | ||
- | 413 | ||
- | 414 | ||
- | 415 | if (( mk.is_navi()||mk.is_mk()||mk.is_mk3mag() )) |
|
- | 416 | tmp_menu_add(l(STRINGID_DEBUG_VALUES),ACTIONID_RAWDEBUG); |
|
274 | { |
417 | |
- | 418 | ||
- | 419 | ||
275 | tmp_menu_add(l(STRINGID_COCKPIT),ACTIONID_HORIZON); |
420 | // only navi |
276 | tmp_menu_add(l(STRINGID_LCD),ACTIONID_LCD); |
421 | if ( mk.is_navi()) |
277 | } |
422 | { |
278 | 423 | ||
Line 279... | Line 424... | ||
279 | 424 | ||
Line 280... | Line 425... | ||
280 | 425 | //#if j2memap=="on" |
|
281 | if (( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() )) |
426 | tmp_menu_add("Map",ACTIONID_MAP); |
Line 282... | Line 427... | ||
282 | tmp_menu_add(l(STRINGID_DEBUG_VALUES),ACTIONID_RAWDEBUG); |
427 | //#endif |
Line 283... | Line 428... | ||
283 | 428 | ||
284 | 429 | ||
Line 285... | Line 430... | ||
285 | // only navi |
430 | //#if (location=="on")&&(cldc11=="on") |
286 | if ( mk.ufo_prober.is_navi()) |
431 | tmp_menu_add("Follow Me",ACTIONID_SHOWPHONEGPS); |
Line 287... | Line 432... | ||
287 | { |
432 | //#endif |
288 | if (settings.dev_mode) tmp_menu_add("Follow Me",ACTIONID_SHOWPHONEGPS); |
433 | |
Line 289... | Line 434... | ||
289 | tmp_menu_add(l(STRINGID_VIEW_GPS),ACTIONID_GPSDATA); |
434 | tmp_menu_add(l(STRINGID_VIEW_GPS),ACTIONID_GPSDATA); |
Line 290... | Line 435... | ||
290 | if (mk.gps_position.ErrorCode!=0) tmp_menu_add(l(STRINGID_VIEW_ERRORS),ACTIONID_NC_ERRORS); |
435 | if (mk.gps_position.ErrorCode!=0) tmp_menu_add(l(STRINGID_VIEW_ERRORS),ACTIONID_NC_ERRORS); |
291 | tmp_menu_add(l(STRINGID_SWITCH_FC),ACTIONID_SWITCH_FC); |
436 | tmp_menu_add(l(STRINGID_SWITCH_FC),ACTIONID_SWITCH_FC); |
Line 292... | Line -... | ||
292 | tmp_menu_add(l(STRINGID_SWITCH_MK3MAG),ACTIONID_SWITCH_MK3MAG); |
- | |
293 | 437 | tmp_menu_add(l(STRINGID_SWITCH_MK3MAG),ACTIONID_SWITCH_MK3MAG); |
|
294 | } |
438 | |
295 | 439 | } |
|
296 | if (mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() ) |
440 | |
297 | tmp_menu_add(l(STRINGID_SWITCH_NAVI),ACTIONID_SWITCH_NC); |
441 | if (mk.is_mk()||mk.is_mk3mag() ) |
Line 353... | Line 497... | ||
353 | 497 | ||
354 | } |
498 | } |
355 | paint_lcd(g); |
499 | paint_lcd(g); |
Line -... | Line 500... | ||
- | 500 | } |
|
- | 501 | ||
- | 502 | ||
356 | } |
503 | // int selected_fw= |
357 | 504 | ||
358 | public void menu_keypress(int keyCode) |
505 | public void menu_keypress(int keyCode) |
359 | { |
506 | { |
360 | debug.log("Menu with KeyCode:"+keyCode); |
507 | debug.log("Menu with KeyCode:"+keyCode); |
361 | switch (getGameAction (keyCode)) |
508 | switch (getGameAction (keyCode)) |
362 | { |
509 | { |
363 | case UP: |
510 | case UP: |
364 | if (act_menu_select!=0) |
511 | if (act_menu_select!=0) |
365 | act_menu_select--; |
512 | act_menu_select--; |
366 | else |
513 | else |
Line 367... | Line 514... | ||
367 | act_menu_select=menu_items.length-1; |
514 | act_menu_select=(byte)(menu_items.length-1); |
368 | break; |
515 | break; |
369 | 516 | ||
Line 376... | Line 523... | ||
376 | 523 | ||
377 | case FIRE: |
524 | case FIRE: |
378 | switch(state) |
525 | switch(state) |
Line -... | Line 526... | ||
- | 526 | { |
|
- | 527 | ||
- | 528 | case STATEID_SELECT_MIXER: |
|
- | 529 | if (act_menu_select<menu_items.length-1) |
|
- | 530 | mk.set_mixer_table(mixer_manager.bytes(act_menu_select)); |
|
- | 531 | else |
|
- | 532 | chg_state(STATEID_MAINMENU); |
|
- | 533 | ||
- | 534 | break; |
|
- | 535 | ||
- | 536 | case STATEID_SELECT_FIRMWARE: |
|
- | 537 | ||
- | 538 | fw_loader.menu_fire(act_menu_select); |
|
379 | { |
539 | |
380 | 540 | break; |
|
381 | case STATEID_SELECT_COMPORT: |
541 | case STATEID_SELECT_COMPORT: |
Line 382... | Line 542... | ||
382 | if (act_menu_select<menu_items.length) |
542 | if (act_menu_select<menu_items.length) |
Line 409... | Line 569... | ||
409 | if (select_paramset4edit) |
569 | if (select_paramset4edit) |
410 | // if ( mk.params.field[act_menu_select]!=null) |
570 | // if ( mk.params.field[act_menu_select]!=null) |
411 | { |
571 | { |
412 | mk.params.act_paramset=act_menu_select; |
572 | mk.params.act_paramset=act_menu_select; |
413 | chg_state(STATEID_HANDLE_PARAMS); |
573 | chg_state(STATEID_HANDLE_PARAMS); |
414 | //success_msg="Params saved"; |
574 | //act_msg="Params saved"; |
415 | } |
575 | } |
416 | else |
576 | else |
417 | { |
577 | { |
418 | mk.write_params(act_menu_select); |
578 | mk.write_params(act_menu_select); |
419 | nextstate=STATEID_HANDLE_PARAMS; |
579 | nextstate=STATEID_HANDLE_PARAMS; |
420 | success_msg="saved in slot " + (act_menu_select+1) ; |
580 | act_msg="saved in slot " + (act_menu_select+1) ; |
421 | chg_state(STATEID_SUCCESS_MSG); // TODO - ground too optimistic way ;-) |
581 | chg_state(STATEID_SUCCESS_MSG); // TODO - ground too optimistic way ;-) |
422 | } |
582 | } |
Line 423... | Line 583... | ||
423 | 583 | ||
Line 465... | Line 625... | ||
465 | public void paint_lcd(Graphics g) |
625 | public void paint_lcd(Graphics g) |
466 | { |
626 | { |
467 | int y; |
627 | int y; |
468 | // int lcd_top= (state==STATEID_EDIT_PARAMS?0:25); |
628 | // int lcd_top= (state==STATEID_EDIT_PARAMS?0:25); |
469 | //int lcd_top= 25; |
629 | //int lcd_top= 25; |
470 | max_lines=(canvas_height-25/*lcd_top*/)/lcd_char_height; |
630 | max_lines=(byte)((canvas_height-25/*lcd_top*/)/lcd_char_height); |
471 | int spacer_left_right=(canvas_width-(20*(lcd_img.getWidth()/222)))/2; |
631 | int spacer_left_right=(canvas_width-(20*(lcd_img.getWidth()/222)))/2; |
472 | // for(int i=0;i<lcd_lines.length;i++) |
632 | // for(int i=0;i<lcd_lines.length;i++) |
Line 473... | Line 633... | ||
473 | 633 | ||
Line 474... | Line 634... | ||
474 | int display_lines=(lcd_lines.length>max_lines?max_lines:lcd_lines.length); |
634 | int display_lines=(lcd_lines.length>max_lines?max_lines:lcd_lines.length); |
- | 635 | ||
- | 636 | ||
- | 637 | lcd_off=act_menu_select-display_lines+1; |
|
475 | 638 | if (((act_editor!=null)&&(!act_editor.select_mode))) |
|
Line 476... | Line 639... | ||
476 | 639 | lcd_off=act_editor.act_y-display_lines+1; |
|
477 | lcd_off= (((state==STATEID_EDIT_PARAMS)&&(!params_editor.select_mode))?params_editor.act_y:act_menu_select)-display_lines+1; |
640 | |
478 | if ( lcd_off<0) lcd_off=0; |
641 | if ( lcd_off<0) lcd_off=0; |
Line 523... | Line 686... | ||
523 | } |
686 | } |
524 | public void load_global_images() |
687 | public void load_global_images() |
525 | { |
688 | { |
526 | try |
689 | try |
527 | { |
690 | { |
- | 691 | icon_img=Image.createImage("/i.png"); |
|
528 | symbols_img=Image.createImage("/symbols.png"); |
692 | symbols_img=Image.createImage("/symbols.png"); |
529 | symbols_img_tile_height=symbols_img.getHeight()/3; |
693 | symbols_img_tile_height=symbols_img.getHeight()/3; |
530 | symbols_img_tile_width=symbols_img.getWidth()/10; |
694 | symbols_img_tile_width=symbols_img.getWidth()/10; |
Line 531... | Line 695... | ||
531 | 695 | ||
Line 544... | Line 708... | ||
544 | } |
708 | } |
Line 545... | Line 709... | ||
545 | 709 | ||
546 | 710 | ||
547 | public void load_strings() |
711 | public void load_strings() |
548 | { |
712 | { |
Line 549... | Line 713... | ||
549 | System.out.println("loading strings"); |
713 | // System.out.println("loading strings"); |
550 | localized_strings=new String[STRING_COUNT]; |
714 | localized_strings=new String[STRING_COUNT]; |
Line 551... | Line 715... | ||
551 | 715 | ||
552 | try { |
716 | try { |
553 | InputStream in=this.getClass().getResourceAsStream("/l"); |
- | |
554 | 717 | InputStream in=this.getClass().getResourceAsStream("/l"); |
|
555 | for (int i=0;i<STRING_COUNT;i++) |
718 | |
556 | { |
719 | for (int i=0;i<STRING_COUNT;i++) |
Line 557... | Line 720... | ||
557 | System.out.println("s"+i); |
720 | { |
558 | String tmp_s=""; |
721 | String tmp_s=""; // temp string to use |
559 | String tmp_b=""; |
722 | String tmp_b=""; // backup string ( if string isnt present in selected lang - e.g. same as in english ) |
560 | char ch=0; |
723 | char ch=0; |
561 | - | ||
562 | int act_l=0; |
724 | |
563 | while ( (ch=(char)in.read())!='\n') |
- | |
564 | { |
- | |
565 | if (ch==';') |
725 | int act_l=0; |
566 | { |
726 | while ( (ch=(char)in.read())!='\n') |
- | 727 | { |
|
567 | act_l++; |
728 | if (ch==';') |
568 | tmp_s=""; |
729 | act_l++; |
Line -... | Line 730... | ||
- | 730 | else |
|
- | 731 | { |
|
569 | } |
732 | // "backup" str |
570 | else |
733 | if (act_l==0) |
571 | { |
734 | tmp_b+=ch; |
Line 572... | Line 735... | ||
572 | if (act_l==0) |
735 | |
Line -... | Line 736... | ||
- | 736 | ||
573 | tmp_b+=ch; |
737 | // normal str |
574 | 738 | if (act_l==act_lang) |
|
575 | if (act_l==act_lang) |
739 | tmp_s+=ch; |
576 | tmp_s+=ch; |
740 | } |
577 | } |
- | |
- | 741 | ||
578 | 742 | } |
|
579 | } |
743 | |
580 | 744 | ||
581 | if (tmp_s.equals("")) |
745 | if (tmp_s.equals("")) |
Line 582... | Line 746... | ||
582 | localized_strings[i]=tmp_b; |
746 | localized_strings[i]=tmp_b; |
583 | else |
747 | else |
584 | localized_strings[i]=tmp_s; |
748 | localized_strings[i]=tmp_s; |
- | 749 | ||
- | 750 | } |
|
- | 751 | } |
|
- | 752 | catch (Exception e) { System.out.println("str_load err"+e);} |
|
585 | System.out.println("s"+localized_strings[i]); |
753 | } |
- | 754 | ||
Line 586... | Line 755... | ||
586 | } |
755 | |
- | 756 | // construct |
|
587 | } |
757 | public DUBwiseCanvas(DUBwise _root) |
588 | catch (Exception e) { System.out.println("str_load err"+e);} |
758 | { |
- | 759 | ||
589 | } |
760 | int foo=0; |
590 | 761 | ||
591 | 762 | // |
|
Line 592... | Line -... | ||
592 | // construct |
- | |
Line 593... | Line 763... | ||
593 | public DUBwiseCanvas(DUBwise _root) |
763 | load_strings(); |
Line -... | Line 764... | ||
- | 764 | ||
- | 765 | ||
Line -... | Line 766... | ||
- | 766 | act_menu_select_bak=new byte[STATEID_COUNT]; |
|
594 | { |
767 | |
- | 768 | for (int i=0;i<STATEID_COUNT;i++) |
|
595 | load_strings(); |
769 | act_menu_select_bak[i]=0; |
596 | - | ||
Line 597... | Line -... | ||
597 | act_menu_select_bak=new int[STATEID_COUNT]; |
- | |
598 | for (int i=0;i<STATEID_COUNT;i++) |
- | |
599 | act_menu_select_bak[i]=0; |
770 | |
- | 771 | //#if fileapi=="on" |
|
600 | //#if fileapi=="on" |
772 | file_access=new DUBwiseFileAccess(this); |
Line 601... | Line -... | ||
601 | file_access=new DUBwiseFileAccess(this); |
- | |
602 | //#endif |
- | |
603 | - | ||
Line 604... | Line -... | ||
604 | root=_root; |
- | |
Line -... | Line 773... | ||
- | 773 | //#endif |
|
- | 774 | ||
605 | 775 | ||
Line 606... | Line 776... | ||
606 | mk = new org.ligi.ufo.MKCommunicator(); |
776 | root=_root; |
607 | 777 | ||
Line 608... | Line 778... | ||
608 | 778 | mixer_manager = new MixerManager(); |
|
609 | //#if voice_mode!="no_voice" |
779 | settings = new DUBwiseSettings(this); |
610 | status_voice=new MKStatusVoice(mk,this); |
780 | |
Line 611... | Line -... | ||
611 | //#endif |
- | |
612 | - | ||
613 | settings = new DUBwiseSettings(this); |
781 | try { |
Line 614... | Line 782... | ||
614 | settings.load(); |
782 | settings.load(); |
615 | load_global_images(); |
783 | } |
616 | debug = new DUBwiseDebug(this); |
784 | catch ( Exception e) {} |
617 | 785 | ||
618 | //#if bluetooth=="on" |
786 | load_global_images(); |
619 | bt_scanner = new BTSearcher(); |
787 | |
620 | //#endif |
788 | debug = new DUBwiseDebug(this); |
- | 789 | ||
- | 790 | ||
- | 791 | ||
Line 621... | Line 792... | ||
621 | 792 | //#if voice_mode!="no_voice" |
|
622 | 793 | status_voice=new MKStatusVoice(this); |
|
623 | 794 | //#endif |
|
624 | 795 | ||
625 | 796 | // mk.gps_position.act_speed_format=settings.speed_format; |
|
626 | // mk.gps_position.act_speed_format=settings.speed_format; |
797 | /// mk.gps_position.act_gps_format= settings.gps_format; |
- | 798 | ||
- | 799 | ||
- | 800 | chg_state(STATEID_MAINMENU); |
|
- | 801 | ||
- | 802 | new Thread(this).start(); |
|
- | 803 | ||
- | 804 | } |
|
- | 805 | ||
- | 806 | public void refresh_dynamic_menues() |
|
- | 807 | { |
|
- | 808 | if (state==STATEID_MAINMENU) |
|
- | 809 | chg_state(STATEID_MAINMENU); // reload mainmenu ( changed content ) |
|
- | 810 | if (state==STATEID_CONN_DETAILS) |
|
- | 811 | chg_state(STATEID_CONN_DETAILS); // reload con details ( changed content ) |
|
627 | /// mk.gps_position.act_gps_format= settings.gps_format; |
812 | } |
Line 628... | Line 813... | ||
628 | 813 | ||
629 | 814 | ||
Line 660... | Line 845... | ||
660 | long sleeptime=0; |
845 | long sleeptime=0; |
661 | // ticked thing |
846 | // ticked thing |
Line 662... | Line 847... | ||
662 | 847 | ||
Line 663... | Line -... | ||
663 | frame_pos++; |
- | |
664 | 848 | frame_pos++; |
|
665 | // handle Device Change |
849 | |
666 | if (mk.ufo_prober.change_notify) |
850 | if (mk!=null) |
667 | { |
- | |
668 | mk.ufo_prober.change_notify=false; |
851 | { |
- | 852 | if (mk.mixer_change_notify) |
|
- | 853 | { |
|
- | 854 | nextstate=STATEID_MAINMENU; |
|
- | 855 | if (mk.mixer_change_success) |
|
669 | if ((mk.ufo_prober.is_incompatible())&&(settings.instant_error_show)) |
856 | { |
- | 857 | act_msg="Mixer Write OK"; |
|
- | 858 | chg_state(STATEID_SUCCESS_MSG); |
|
- | 859 | } |
|
- | 860 | else |
|
- | 861 | ||
670 | { |
862 | { |
- | 863 | act_msg="Mixer Write Fail"; |
|
- | 864 | chg_state(STATEID_ERROR_MSG); |
|
671 | mk.error_str=l(STRINGID_INCOMPATIBLEDEVICE); |
865 | } |
672 | chg_state(STATEID_ERROR_MSG); |
- | |
673 | } |
- | |
Line 674... | Line -... | ||
674 | else |
- | |
675 | refresh_dynamic_menues(); |
- | |
676 | - | ||
677 | 866 | mk.mixer_change_notify=false; |
|
678 | } |
- | |
679 | 867 | } |
|
680 | if (mk.disconnect_notify) |
- | |
681 | { |
- | |
682 | mk.disconnect_notify=false; |
868 | |
- | 869 | // handle Device Change |
|
- | 870 | if (mk.change_notify) |
|
- | 871 | { |
|
- | 872 | mk.change_notify=false; |
|
683 | 873 | if ((mk.is_incompatible())&&(settings.instant_error_show)) |
|
- | 874 | { |
|
- | 875 | act_msg=l(STRINGID_INCOMPATIBLEDEVICE); |
|
684 | if (settings.instant_error_show) |
876 | chg_state(STATEID_ERROR_MSG); |
- | 877 | } |
|
685 | { |
878 | else |
- | 879 | refresh_dynamic_menues(); |
|
- | 880 | ||
686 | nextstate=STATEID_MAINMENU; |
881 | if (state==STATEID_ERROR_MSG) |
- | 882 | chg_state(STATEID_MAINMENU); |
|
- | 883 | ||
- | 884 | } |
|
- | 885 | ||
- | 886 | if (mk.disconnect_notify) |
|
- | 887 | { |
|
- | 888 | mk.disconnect_notify=false; |
|
- | 889 | ||
- | 890 | if (!mk.mk_url.equals("")&&(settings.instant_error_show)) |
|
- | 891 | { |
|
- | 892 | if (settings.instant_error_show) |
|
- | 893 | { |
|
- | 894 | nextstate=STATEID_MAINMENU; |
|
687 | mk.error_str=l(STRINGID_DISCONNECT); |
895 | act_msg=l(STRINGID_DISCONNECT); |
- | 896 | chg_state( STATEID_ERROR_MSG); |
|
- | 897 | } |
|
- | 898 | if (settings.do_vibra) |
|
- | 899 | root.vibrate(100); |
|
- | 900 | } |
|
- | 901 | } |
|
- | 902 | ||
- | 903 | if (mk.is_navi()) |
|
- | 904 | { |
|
- | 905 | if ((last_navi_error==0)&&(mk.gps_position.ErrorCode!=0)) |
|
- | 906 | { |
|
- | 907 | if (settings.instant_error_show) |
|
- | 908 | { |
|
- | 909 | nextstate=state; |
|
- | 910 | ||
- | 911 | act_msg=null; |
|
688 | chg_state( STATEID_ERROR_MSG); |
912 | chg_state( STATEID_ERROR_MSG); |
- | 913 | } |
|
- | 914 | if (settings.do_vibra) |
|
- | 915 | root.vibrate(100); |
|
- | 916 | } |
|
- | 917 | else |
|
- | 918 | if ((last_navi_error!=0)&&(mk.gps_position.ErrorCode==0)&&(state== STATEID_ERROR_MSG)) |
|
- | 919 | chg_state(nextstate); |
|
- | 920 | else if (last_navi_error!=mk.gps_position.ErrorCode) |
|
- | 921 | act_msg=null; |
|
689 | } |
922 | last_navi_error=(byte)mk.gps_position.ErrorCode; |
Line 690... | Line 923... | ||
690 | if (settings.do_vibra) |
923 | } |
691 | root.vibrate(100); |
924 | |
- | 925 | } |
|
- | 926 | ||
- | 927 | switch(state) |
|
- | 928 | { |
|
- | 929 | ||
- | 930 | //#if fileapi=="on" |
|
- | 931 | case STATEID_FILEOPEN: |
|
- | 932 | file_access.refresh_if_dirty(); |
|
- | 933 | break; |
|
692 | } |
934 | //#endif |
693 | 935 | ||
- | 936 | ||
- | 937 | case STATEID_GET_AVRSIG: |
|
- | 938 | if (firmware_flasher.job_done) |
|
- | 939 | { |
|
- | 940 | fw_loader=new FirmwareLoader(firmware_flasher.avr_sig,this); |
|
- | 941 | firmware_flasher.exit_bootloader(); |
|
Line -... | Line 942... | ||
- | 942 | firmware_flasher=null; |
|
- | 943 | chg_state(STATEID_SELECT_FIRMWARE); |
|
- | 944 | } |
|
- | 945 | break; |
|
694 | if (mk.ufo_prober.is_navi()) |
946 | |
695 | { |
947 | case STATEID_FLASHING: |
696 | if ((last_navi_error==0)&&(mk.gps_position.ErrorCode!=0)) |
948 | if (firmware_flasher.job_done) |
697 | { |
- | |
698 | 949 | { |
|
699 | if (settings.instant_error_show) |
950 | |
700 | { |
951 | if (firmware_flasher.success) |
- | 952 | { |
|
- | 953 | nextstate=STATEID_MAINMENU; |
|
701 | nextstate=state; |
954 | act_msg="Flashing OK"; |
702 | 955 | chg_state(STATEID_SUCCESS_MSG); |
|
- | 956 | } |
|
- | 957 | else |
|
- | 958 | { |
|
703 | mk.error_str=null; |
959 | nextstate=STATEID_MAINMENU; |
704 | chg_state( STATEID_ERROR_MSG); |
960 | act_msg="Flashing Fail"; |
705 | } |
- | |
706 | if (settings.do_vibra) |
- | |
707 | root.vibrate(100); |
- | |
708 | } |
- | |
709 | else |
- | |
- | 961 | chg_state(STATEID_ERROR_MSG); |
|
710 | if ((last_navi_error!=0)&&(mk.gps_position.ErrorCode==0)&&(state== STATEID_ERROR_MSG)) |
962 | } |
Line 711... | Line 963... | ||
711 | chg_state(nextstate); |
963 | |
712 | else if (last_navi_error!=mk.gps_position.ErrorCode) |
- | |
Line 713... | Line -... | ||
713 | mk.error_str=null; |
- | |
714 | last_navi_error=(byte)mk.gps_position.ErrorCode; |
- | |
715 | } |
964 | } |
Line 716... | Line 965... | ||
716 | 965 | ||
717 | 966 | ||
718 | switch(state) |
967 | break; |
Line -... | Line 968... | ||
- | 968 | ||
719 | { |
969 | |
720 | 970 | //#if (location=="on")&&(cldc11=="on") |
|
721 | 971 | ||
722 | //#if jsr179=="on" |
972 | case STATEID_SHOWPHONEGPS: |
Line 723... | Line 973... | ||
723 | case STATEID_SHOWPHONEGPS: |
973 | |
724 | 974 | try |
|
- | 975 | { |
|
- | 976 | // Class.forName("javax.microedition.location.LocationProvider"); |
|
- | 977 | ||
725 | try |
978 | if ((lp==null)) |
726 | { |
979 | // if ((cr==null)||(lp==null)) |
727 | Class.forName("javax.microedition.location.LocationProvider"); |
- | |
Line -... | Line 980... | ||
- | 980 | { |
|
- | 981 | //Criteria cr= new Criteria(); |
|
728 | 982 | //cr.setHorizontalAccuracy(500); |
|
729 | if ((cr==null)||(lp==null)) |
983 | |
Line 730... | Line 984... | ||
730 | { |
984 | // Get an instance of the provider |
Line 762... | Line 1016... | ||
762 | 1016 | ||
763 | phone_lat= c.getLatitude(); |
1017 | phone_lat= c.getLatitude(); |
764 | phone_long = c.getLongitude(); |
1018 | phone_long = c.getLongitude(); |
765 | //#endif |
1019 | //#endif |
- | 1020 | } |
|
766 | } |
1021 | } |
767 | } |
1022 | } |
768 | catch (Exception e) |
1023 | catch (Exception e) |
- | 1024 | { |
|
- | 1025 | debug.log("Follow ME Err" ); |
|
- | 1026 | debug.log("-" + e ); |
|
769 | { |
1027 | debug.log("-" + e.getMessage() ); |
770 | mk.error_str="Phone GPS Problem"; |
1028 | // act_msg="Phone GPS Problem"; |
Line 771... | Line 1029... | ||
771 | chg_state(STATEID_ERROR_MSG); |
1029 | // chg_state(STATEID_ERROR_MSG); |
Line 772... | Line 1030... | ||
772 | 1030 | ||
Line 773... | Line 1031... | ||
773 | } |
1031 | } |
774 | 1032 | ||
775 | break; |
- | |
776 | - | ||
777 | //#endif |
- | |
778 | case STATEID_SELECT_FIRMWARE: |
- | |
779 | if ((menu_items.length==0)&&(fw_loader.got_list)) |
- | |
Line -... | Line 1033... | ||
- | 1033 | break; |
|
- | 1034 | ||
- | 1035 | //#endif |
|
- | 1036 | case STATEID_SELECT_FIRMWARE: |
|
Line -... | Line 1037... | ||
- | 1037 | ||
- | 1038 | ||
- | 1039 | // if ((menu_items.length==0)&&(fw_loader.got_list)) |
|
780 | setup_menu(fw_loader.names,null); |
1040 | // setup_menu(fw_loader.names,null); |
- | 1041 | ||
781 | break; |
1042 | |
782 | 1043 | break; |
|
783 | case STATEID_RESET_PARAMS: |
1044 | |
784 | 1045 | case STATEID_RESET_PARAMS: |
|
785 | 1046 | // if (mk.bootloader_finish_ok) |
|
- | 1047 | if (firmware_flasher.job_done) |
|
- | 1048 | { |
|
786 | if (mk.bootloader_finish_ok) |
1049 | // mk.params.reset(); |
787 | { |
1050 | //mk.watchdog.act_paramset=0; |
788 | mk.params.reset(); |
1051 | nextstate=STATEID_PARAM_MENU; |
Line 789... | Line 1052... | ||
789 | mk.watchdog.act_paramset=0; |
1052 | act_msg=l(STRINGID_PARAMRESETOK); |
Line 808... | Line 1071... | ||
808 | { |
1071 | { |
809 | if(cam_condition()) |
1072 | if(cam_condition()) |
810 | { |
1073 | { |
811 | cam_img=null; |
1074 | cam_img=null; |
812 | debug.log("get snap\n"); |
1075 | debug.log("get snap\n"); |
813 | cam_raw = mVideoControl.getSnapshot(null); |
1076 | //xda cam_raw = mVideoControl.getSnapshot(null); |
Line 814... | Line 1077... | ||
814 | 1077 | ||
815 | 1078 | ||
816 | try { Thread.sleep(4000); } |
1079 | try { Thread.sleep(4000); } |
Line 836... | Line 1099... | ||
836 | //mk.send_keys(keycontrol_bitfield); |
1099 | //mk.send_keys(keycontrol_bitfield); |
837 | break; |
1100 | break; |
Line 838... | Line 1101... | ||
838 | 1101 | ||
839 | 1102 | ||
840 | case STATEID_ERROR_MSG: |
1103 | case STATEID_ERROR_MSG: |
Line 841... | Line 1104... | ||
841 | lcd_lines[0]=""+mk.error_str; |
1104 | lcd_lines[0]=""+act_msg; |
Line 842... | Line 1105... | ||
842 | break; |
1105 | break; |
843 | 1106 | ||
844 | 1107 | ||
845 | case STATEID_PARAM_MASSWRITE: |
1108 | case STATEID_PARAM_MASSWRITE: |
846 | 1109 | ||
847 | if (param_masswrite_write_pos==5) |
1110 | if (param_masswrite_write_pos==5) |
848 | { |
1111 | { |
849 | nextstate=STATEID_PARAM_MENU; |
1112 | nextstate=STATEID_PARAM_MENU; |
850 | success_msg=l(STRINGID_PARAMWRITEOK); |
1113 | act_msg=l(STRINGID_PARAMWRITEOK); |
Line 905... | Line 1168... | ||
905 | catch (Exception e) |
1168 | catch (Exception e) |
906 | { } |
1169 | { } |
907 | // chg_state(STATEID_COPY_PARAMS); |
1170 | // chg_state(STATEID_COPY_PARAMS); |
Line 908... | Line 1171... | ||
908 | 1171 | ||
909 | nextstate=STATEID_PARAM_MENU; |
1172 | nextstate=STATEID_PARAM_MENU; |
910 | success_msg="Parameter Copy OK"; |
1173 | act_msg="Parameter Copy OK"; |
Line 911... | Line 1174... | ||
911 | chg_state(STATEID_SUCCESS_MSG); |
1174 | chg_state(STATEID_SUCCESS_MSG); |
912 | 1175 | ||
913 | } |
1176 | } |
Line 925... | Line 1188... | ||
925 | lcd_lines[1]=DUBwiseHelper.pound_progress(mk.watchdog.act_paramset,5); |
1188 | lcd_lines[1]=DUBwiseHelper.pound_progress(mk.watchdog.act_paramset,5); |
Line 926... | Line 1189... | ||
926 | 1189 | ||
927 | 1190 | ||
928 | if (mk.params.found_incompatible) |
1191 | if (mk.params.found_incompatible) |
929 | { |
1192 | { |
930 | mk.error_str="incompatible params"; |
1193 | act_msg="incompatible params"; |
Line 931... | Line 1194... | ||
931 | chg_state(STATEID_ERROR_MSG); |
1194 | chg_state(STATEID_ERROR_MSG); |
932 | } |
1195 | } |
Line 933... | Line 1196... | ||
933 | 1196 | ||
934 | } |
1197 | } |
935 | break; |
1198 | break; |
936 | 1199 | ||
937 | 1200 | ||
938 | case STATEID_MOTORTEST: |
1201 | case STATEID_MOTORTEST: |
939 | 1202 | /* |
|
Line 949... | Line 1212... | ||
949 | motor_test[act_motor]+=act_motor_increase; |
1212 | motor_test[act_motor]+=act_motor_increase; |
950 | if (motor_test[act_motor]<0) motor_test[act_motor]=0; |
1213 | if (motor_test[act_motor]<0) motor_test[act_motor]=0; |
951 | if (motor_test[act_motor]>255) motor_test[act_motor]=255; |
1214 | if (motor_test[act_motor]>255) motor_test[act_motor]=255; |
952 | } |
1215 | } |
Line 953... | Line 1216... | ||
953 | 1216 | ||
- | 1217 | mk.motor_test(motor_test);*/ |
|
954 | mk.motor_test(motor_test); |
1218 | mk.motor_test(motor_tester.engine_field); |
Line 955... | Line 1219... | ||
955 | break; |
1219 | break; |
Line 956... | Line 1220... | ||
956 | 1220 | ||
Line 1029... | Line 1293... | ||
1029 | 1293 | ||
1030 | - | ||
1031 | 1294 | ||
1032 | - | ||
1033 | //#if devicecontrol=="on" |
1295 | |
Line 1034... | Line 1296... | ||
1034 | 1296 | ||
1035 | try { |
1297 | //#if devicecontrol=="on" |
- | 1298 | try { |
|
- | 1299 | if (mk.connected&&settings.keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
|
- | 1300 | ||
1036 | Class.forName("com.nokia.mid.ui.DeviceControl"); |
1301 | } |
Line 1037... | Line 1302... | ||
1037 | if (settings.keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
1302 | catch (Exception e) |
Line 1038... | Line 1303... | ||
1038 | 1303 | { |
|
Line 1111... | Line 1376... | ||
1111 | g.setClip(x,0,(symbols_img_tile_width),symbols_img_tile_height);; |
1376 | g.setClip(x,0,(symbols_img_tile_width),symbols_img_tile_height);; |
1112 | g.drawImage(symbols_img,x+(-tile)*(symbols_img_tile_width),row*(-symbols_img_tile_height), g.TOP | g.LEFT); |
1377 | g.drawImage(symbols_img,x+(-tile)*(symbols_img_tile_width),row*(-symbols_img_tile_height), g.TOP | g.LEFT); |
1113 | } |
1378 | } |
Line -... | Line 1379... | ||
- | 1379 | ||
- | 1380 | ||
Line -... | Line 1381... | ||
- | 1381 | Font font_medium,font_small,font_large; |
|
1114 | 1382 | ||
1115 | 1383 | ||
Line 1116... | Line 1384... | ||
1116 | 1384 | ||
1117 | 1385 | boolean regenerate_fonts=true; |
|
Line 1118... | Line -... | ||
1118 | // drawing sections |
- | |
1119 | public void paint(Graphics g) { |
1386 | // drawing sections |
1120 | 1387 | public void paint(Graphics g) { |
|
1121 | canvas_width=this.getWidth(); |
1388 | |
1122 | canvas_height=this.getHeight(); |
1389 | canvas_width=this.getWidth(); |
1123 | 1390 | canvas_height=this.getHeight(); |
|
Line 1124... | Line 1391... | ||
1124 | 1391 | ||
1125 | if (debug.showing) |
1392 | if (debug.showing) |
1126 | { |
1393 | { |
1127 | debug.paint(g); |
1394 | debug.paint(g); |
1128 | return; |
1395 | return; |
1129 | } |
1396 | } |
- | 1397 | ||
- | 1398 | ||
- | 1399 | if (firstrun) |
|
- | 1400 | { |
|
- | 1401 | if (settings.fullscreen) setFullScreenMode(settings.fullscreen); |
|
- | 1402 | firstrun=false; |
|
- | 1403 | } |
|
- | 1404 | ||
- | 1405 | if (regenerate_fonts) |
|
- | 1406 | { |
|
- | 1407 | if (settings.big_fonts) |
|
- | 1408 | { |
|
- | 1409 | font_small = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE); |
|
- | 1410 | font_medium = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE); |
|
- | 1411 | font_large = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE); |
|
- | 1412 | ||
- | 1413 | } |
|
- | 1414 | else |
|
- | 1415 | { |
|
- | 1416 | font_small = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); |
|
- | 1417 | font_medium = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); |
|
- | 1418 | font_large = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE); |
|
- | 1419 | } |
|
1130 | 1420 | ||
Line 1131... | Line 1421... | ||
1131 | 1421 | spacer_medium=(font_medium.getHeight()); |
|
Line 1132... | Line -... | ||
1132 | if (firstrun) |
- | |
1133 | { |
- | |
1134 | if (settings.fullscreen) setFullScreenMode(settings.fullscreen); |
- | |
1135 | firstrun=false; |
- | |
1136 | } |
- | |
1137 | y_off=0; |
- | |
1138 | - | ||
1139 | try { |
- | |
1140 | - | ||
1141 | 1422 | spacer_small=(font_small.getHeight()); |
|
1142 | 1423 | spacer_large=(font_large.getHeight()); |
|
Line 1143... | Line 1424... | ||
1143 | Font font_medium = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); |
1424 | regenerate_fonts=false; |
1144 | Font font_small = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); |
1425 | } |
1145 | Font font_large = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE); |
1426 | |
1146 | 1427 | y_off=0; |
|
1147 | spacer_medium=(font_medium.getHeight()); |
1428 | |
1148 | spacer_small=(font_small.getHeight()); |
1429 | try { |
Line 1178... | Line 1459... | ||
1178 | if (settings.do_scrollbg) |
1459 | if (settings.do_scrollbg) |
1179 | for ( int bar=0;bar<canvas_width/(symbols_img.getWidth()/10)+1;bar++) |
1460 | for ( int bar=0;bar<canvas_width/(symbols_img.getWidth()/10)+1;bar++) |
1180 | { |
1461 | { |
1181 | g.setClip(bar*(symbols_img_tile_width),0,(symbols_img_tile_width),symbols_img_tile_height);; |
1462 | g.setClip(bar*(symbols_img_tile_width),0,(symbols_img_tile_width),symbols_img_tile_height);; |
1182 | g.drawImage(symbols_img,bar*(symbols_img_tile_width),0, g.TOP | g.LEFT); |
1463 | g.drawImage(symbols_img,bar*(symbols_img_tile_width),0, g.TOP | g.LEFT); |
1183 | } |
- | |
1184 | - | ||
1185 | int symbol_left=0; |
- | |
1186 | int symbol_spacer=5; |
- | |
1187 | - | ||
1188 | g.setClip(symbol_left,0,symbols_img_tile_width,symbols_img_tile_height);; |
- | |
1189 | if (mk.connected) |
- | |
1190 | symbol_paint(g,symbol_left,(((mk.stats.bytes_in>>3)&1)==1)?2:3,0); |
- | |
1191 | - | ||
1192 | else |
- | |
1193 | { |
- | |
1194 | if (mk.mk_url.startsWith("btspp://")) |
- | |
1195 | symbol_paint(g,symbol_left,1,0); |
- | |
1196 | - | ||
1197 | - | ||
1198 | } |
- | |
1199 | // g.drawImage(symbols_img,(-1)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
- | |
1200 | - | ||
1201 | - | ||
1202 | - | ||
1203 | symbol_left+=6*(symbols_img_tile_width)/4; |
- | |
Line -... | Line 1464... | ||
- | 1464 | ||
Line 1204... | Line 1465... | ||
1204 | 1465 | } |
|
1205 | 1466 | ||
- | 1467 | if (mk!=null) |
|
- | 1468 | { |
|
Line -... | Line 1469... | ||
- | 1469 | int symbol_left=0; |
|
- | 1470 | int symbol_spacer=5; |
|
- | 1471 | ||
1206 | if ((mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk())) |
1472 | |
1207 | { |
1473 | |
Line 1208... | Line 1474... | ||
1208 | 1474 | g.setClip(symbol_left,0,symbols_img_tile_width,symbols_img_tile_height);; |
|
1209 | symbol_paint(g,symbol_left,4,0); |
1475 | if (mk.connected) |
1210 | symbol_left+=5 *(symbols_img_tile_width)/4; |
1476 | symbol_paint(g,symbol_left,(((mk.stats.bytes_in>>3)&1)==1)?2:3,0); |
1211 | 1477 | ||
- | 1478 | else |
|
- | 1479 | { |
|
1212 | if ((mk.UBatt()/100)!=0) |
1480 | if (mk.mk_url.startsWith("btspp://")) |
- | 1481 | symbol_paint(g,symbol_left,1,0); |
|
1213 | { |
1482 | |
1214 | symbol_paint(g,symbol_left,(mk.UBatt()/100),1); |
- | |
1215 | symbol_left+=(symbols_img_tile_width); |
- | |
1216 | } |
- | |
1217 | - | ||
1218 | symbol_paint(g,symbol_left,(mk.UBatt()/10)%10,1); |
- | |
- | 1483 | ||
- | 1484 | } |
|
1219 | symbol_left+=(2*symbols_img_tile_width/3); |
1485 | // g.drawImage(symbols_img,(-1)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
- | 1486 | ||
1220 | symbol_paint(g,symbol_left,9,0); |
1487 | |
- | 1488 | ||
- | 1489 | symbol_left+=6*(symbols_img_tile_width)/4; |
|
- | 1490 | ||
- | 1491 | ||
- | 1492 | if (mk.UBatt()!=-1) |
|
- | 1493 | { |
|
- | 1494 | ||
- | 1495 | symbol_paint(g,symbol_left,4,0); |
|
- | 1496 | symbol_left+=5 *(symbols_img_tile_width)/4; |
|
- | 1497 | ||
- | 1498 | if ((mk.UBatt()/100)!=0) |
|
- | 1499 | { |
|
- | 1500 | symbol_paint(g,symbol_left,(mk.UBatt()/100),1); |
|
- | 1501 | symbol_left+=(symbols_img_tile_width); |
|
- | 1502 | } |
|
- | 1503 | ||
- | 1504 | symbol_paint(g,symbol_left,(mk.UBatt()/10)%10,1); |
|
- | 1505 | symbol_left+=(2*symbols_img_tile_width/3); |
|
- | 1506 | symbol_paint(g,symbol_left,9,0); |
|
1221 | symbol_left+=(2*symbols_img_tile_width/3); |
1507 | symbol_left+=(2*symbols_img_tile_width/3); |
1222 | symbol_paint(g,symbol_left,(mk.UBatt())%10,1); |
1508 | symbol_paint(g,symbol_left,(mk.UBatt())%10,1); |
1223 | symbol_left+=6*(symbols_img_tile_width)/4; |
1509 | symbol_left+=6*(symbols_img_tile_width)/4; |
1224 | 1510 | ||
1225 | 1511 | ||
1226 | // g.drawString("" + (mk.UBatt()/10) + "," +(mk.UBatt()%10)+"V" , symbol_left,y_off,Graphics.TOP | Graphics.LEFT); |
1512 | // g.drawString("" + (mk.UBatt()/10) + "," +(mk.UBatt()%10)+"V" , symbol_left,y_off,Graphics.TOP | Graphics.LEFT); |
1227 | 1513 | ||
1228 | 1514 | ||
1229 | //symbol_left+= g.getFont().stringWidth("88,8V");//; |
1515 | //symbol_left+= g.getFont().stringWidth("88,8V");//; |
- | 1516 | /* |
|
1230 | /* |
1517 | symbol_paint(g,symbol_left,6,0); |
1231 | symbol_paint(g,symbol_left,6,0); |
1518 | symbol_left+=5*(symbols_img_tile_width)/4; |
1232 | symbol_left+=5*(symbols_img_tile_width)/4; |
1519 | */ |
1233 | */ |
1520 | } |
1234 | if (mk.SenderOkay()>0) |
1521 | if (mk.SenderOkay()>0) |
1235 | { |
1522 | { |
1236 | symbol_paint(g,symbol_left,6,0); |
1523 | symbol_paint(g,symbol_left,6,0); |
1237 | symbol_left+=5*(symbols_img_tile_width)/4; |
1524 | symbol_left+=5*(symbols_img_tile_width)/4; |
1238 | 1525 | ||
1239 | /*symbol_paint(g,symbol_left,(mk.SenderOkay())/100,1); |
1526 | /*symbol_paint(g,symbol_left,(mk.SenderOkay())/100,1); |
1240 | symbol_left+=(symbols_img_tile_width); |
1527 | symbol_left+=(symbols_img_tile_width); |
1241 | 1528 | |
|
1242 | symbol_paint(g,symbol_left,(mk.SenderOkay()/10)%10,1); |
1529 | symbol_paint(g,symbol_left,(mk.SenderOkay()/10)%10,1); |
1243 | symbol_left+=(symbols_img_tile_width);*/ |
1530 | symbol_left+=(symbols_img_tile_width);*/ |
1244 | } |
1531 | } |
1245 | // symbol_paint(g,symbol_left,(mk.SenderOkay())%10,1); |
1532 | // symbol_paint(g,symbol_left,(mk.SenderOkay())%10,1); |
1246 | //symbol_left+=6*(symbols_img_tile_width)/4; |
1533 | //symbol_left+=6*(symbols_img_tile_width)/4; |
1247 | 1534 | ||
1248 | // g.drawString(""+mk.SenderOkay() ,symbol_left,y_off,Graphics.TOP | Graphics.LEFT); |
1535 | // g.drawString(""+mk.SenderOkay() ,symbol_left,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1249... | Line 1536... | ||
1249 | 1536 | ||
1250 | 1537 | ||
1251 | //symbol_left+= g.getFont().stringWidth("8")+symbol_spacer_medium; //,0,(symbols_img.getWidth()/10)+2; |
1538 | //symbol_left+= g.getFont().stringWidth("8")+symbol_spacer_medium; //,0,(symbols_img.getWidth()/10)+2; |
1252 | 1539 | ||
1253 | 1540 | ||
1254 | 1541 | ||
1255 | 1542 | ||
1256 | if (mk.ufo_prober.is_navi()) |
1543 | if (mk.is_navi()) |
1257 | { |
1544 | { |
1258 | if (mk.gps_position.ErrorCode!=0) |
1545 | if (mk.gps_position.ErrorCode!=0) |
1259 | { |
1546 | { |
1260 | symbol_paint(g,symbol_left,7,0); |
1547 | symbol_paint(g,symbol_left,7,0); |
1261 | symbol_left+=5*(symbols_img_tile_width)/4; |
1548 | symbol_left+=5*(symbols_img_tile_width)/4; |
1262 | } |
1549 | } |
1263 | 1550 | ||
1264 | if ((mk.gps_position.NCFlags&2)!=0) |
1551 | if ((mk.gps_position.NCFlags&2)!=0) |
1265 | { |
1552 | { |
1266 | symbol_paint(g,symbol_left,8,0); |
1553 | symbol_paint(g,symbol_left,8,0); |
1267 | symbol_left+=5*(symbols_img_tile_width)/4; |
1554 | symbol_left+=5*(symbols_img_tile_width)/4; |
1268 | } |
1555 | } |
1269 | 1556 | ||
1270 | 1557 | ||
1271 | if ((mk.gps_position.NCFlags&4)!=0) |
1558 | if ((mk.gps_position.NCFlags&4)!=0) |
1272 | { |
1559 | { |
1273 | symbol_paint(g,symbol_left,0,2); |
1560 | symbol_paint(g,symbol_left,0,2); |
1274 | symbol_left+=5*(symbols_img_tile_width)/4; |
1561 | symbol_left+=5*(symbols_img_tile_width)/4; |
1275 | 1562 | ||
1276 | } |
1563 | } |
- | 1564 | ||
1277 | 1565 | if ((mk.gps_position.NCFlags&8)!=0) |
|
- | 1566 | { |
|
- | 1567 | symbol_paint(g,symbol_left,0,2); |
|
- | 1568 | symbol_left+=5*(symbols_img_tile_width)/4; |
|
- | 1569 | ||
- | 1570 | } |
|
1278 | if ((mk.gps_position.NCFlags&8)!=0) |
1571 | |
1279 | { |
1572 | |
1280 | symbol_paint(g,symbol_left,0,2); |
1573 | } |
1281 | symbol_left+=5*(symbols_img_tile_width)/4; |
1574 | |
1282 | 1575 | ||
1283 | } |
- | |
1284 | 1576 | if (mk.SatsInUse()!=-1) |
|
1285 | symbol_paint(g,symbol_left,5,0); |
- | |
1286 | symbol_left+=5*(symbols_img_tile_width)/4; |
1577 | { |
Line 1287... | Line -... | ||
1287 | - | ||
1288 | symbol_paint(g,symbol_left,(mk.gps_position.SatsInUse)%10,1); |
- | |
Line -... | Line 1578... | ||
- | 1578 | symbol_paint(g,symbol_left,5,0); |
|
1289 | symbol_left+=6*(symbols_img_tile_width)/4; |
1579 | symbol_left+=5*(symbols_img_tile_width)/4; |
1290 | 1580 | ||
1291 | 1581 | symbol_paint(g,symbol_left,(mk.SatsInUse())%10,1); |
|
1292 | 1582 | symbol_left+=6*(symbols_img_tile_width)/4; |
|
1293 | } |
1583 | |
1294 | 1584 | } |
|
1295 | } |
1585 | |
Line 1296... | Line 1586... | ||
1296 | 1586 | ||
1297 | 1587 | } // if mk!=null |
|
- | 1588 | // unclip |
|
- | 1589 | g.setClip(0,0,canvas_width,canvas_height); |
|
- | 1590 | ||
- | 1591 | y_off+=symbols_img_tile_height; |
|
- | 1592 | graph_height=(canvas_height-y_off)/2; |
|
- | 1593 | line_middle_y=graph_height+y_off; |
|
1298 | // unclip |
1594 | g.setColor(skin_fg_color()); |
Line 1299... | Line 1595... | ||
1299 | g.setClip(0,0,canvas_width,canvas_height); |
1595 | |
1300 | 1596 | switch(state) |
|
Line 1351... | Line 1647... | ||
1351 | 1647 | ||
Line 1352... | Line 1648... | ||
1352 | 1648 | ||
1353 | g.fillArc((canvas_width-nick_size)/2- nick_pixels_x, horizon_middle-nick_size/2+ nick_pixels_y, nick_size, nick_size, 0,360); |
1649 | g.fillArc((canvas_width-nick_size)/2- nick_pixels_x, horizon_middle-nick_size/2+ nick_pixels_y, nick_size, nick_size, 0,360); |
1354 | 1650 | ||
1355 | 1651 | ||
1356 | if (mk.ufo_prober.is_navi()) |
1652 | if (mk.is_navi()) |
Line 1399... | Line 1695... | ||
1399 | y_off=canvas_height-5; |
1695 | y_off=canvas_height-5; |
Line 1400... | Line 1696... | ||
1400 | 1696 | ||
1401 | 1697 | ||
1402 | 1698 | ||
Line 1403... | Line 1699... | ||
1403 | g.setFont(font_small); |
1699 | g.setFont(font_small); |
Line 1404... | Line 1700... | ||
1404 | if (mk.ufo_prober.is_navi()) |
1700 | if (mk.is_navi()) |
Line 1405... | Line 1701... | ||
1405 | g.drawString("avg:" + mk.stats.avg_speed() + " max:"+ mk.stats.max_speed,10-c,y_off-c,Graphics.BOTTOM | Graphics.LEFT); |
1701 | g.drawString("avg:" + mk.stats.avg_speed() + " max:"+ mk.stats.max_speed,10-c,y_off-c,Graphics.BOTTOM | Graphics.LEFT); |
Line 1406... | Line 1702... | ||
1406 | 1702 | ||
1407 | g.drawString(" max:"+ mk.stats.max_alt/10,canvas_width-10-c,y_off-c,Graphics.BOTTOM | Graphics.RIGHT); |
1703 | g.drawString(" max:"+ mk.stats.max_alt/10,canvas_width-10-c,y_off-c,Graphics.BOTTOM | Graphics.RIGHT); |
1408 | 1704 | ||
1409 | y_off-=spacer_small; |
1705 | y_off-=spacer_small; |
Line 1410... | Line 1706... | ||
1410 | 1706 | ||
Line 1411... | Line 1707... | ||
1411 | g.setFont(font_large); |
1707 | g.setFont(font_large); |
1412 | 1708 | ||
1413 | 1709 | ||
1414 | if (mk.ufo_prober.is_navi()) |
1710 | if (mk.is_navi()) |
1415 | g.drawString("" + mk.gps_position.GroundSpeed_str() ,10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.LEFT); |
1711 | g.drawString("" + mk.gps_position.GroundSpeed_str() ,10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.LEFT); |
1416 | else |
1712 | else |
Line 1417... | Line 1713... | ||
1417 | if (settings.horizon_display_flytime) g.drawString("" + mk.stats.flying_time()+"s" ,10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.LEFT); |
1713 | if (settings.horizon_display_flytime) g.drawString("" + mk.stats.flying_time()+"s" ,10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.LEFT); |
Line 1418... | Line 1714... | ||
1418 | 1714 | ||
Line -... | Line 1715... | ||
- | 1715 | if (settings.horizon_display_altitude) g.drawString( mk.Alt_formated()/* + "/"+status_voice.last_alt*/ ,canvas_width-10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.RIGHT); |
|
- | 1716 | ||
- | 1717 | y_off-=spacer_large; |
|
- | 1718 | if (mk.is_navi()&&(settings.horizon_display_flytime)) |
|
- | 1719 | { |
|
- | 1720 | g.setFont(font_medium); |
|
- | 1721 | g.drawString("" + mk.stats.flying_time()+"s" ,10-c*2,y_off-c*2,Graphics.BOTTOM | Graphics.LEFT); |
|
- | 1722 | } |
|
- | 1723 | ||
- | 1724 | } |
|
- | 1725 | ||
- | 1726 | break; |
|
- | 1727 | ||
- | 1728 | case STATEID_DUBWISE_VALUES: |
|
- | 1729 | ||
1419 | if (settings.horizon_display_altitude) g.drawString( mk.Alt_formated()/* + "/"+status_voice.last_alt*/ ,canvas_width-10-c*3,y_off-c*3,Graphics.BOTTOM | Graphics.RIGHT); |
1730 | g.setFont(font_small); |
- | 1731 | ||
1420 | 1732 | //#if voice_mode!="no_voice" |
|
Line 1421... | Line 1733... | ||
1421 | y_off-=spacer_large; |
1733 | g.drawString("voice_loop_cnt"+status_voice.loop_cnt ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1422 | if (mk.ufo_prober.is_navi()&&(settings.horizon_display_flytime)) |
1734 | y_off+=spacer_small; |
Line 1555... | Line 1867... | ||
1555 | */ |
1867 | */ |
Line 1556... | Line 1868... | ||
1556 | 1868 | ||
Line -... | Line 1869... | ||
- | 1869 | ||
1557 | 1870 | break; |
|
1558 | break; |
1871 | |
1559 | 1872 | case STATEID_GET_AVRSIG: |
|
1560 | case STATEID_RESET_PARAMS: |
1873 | case STATEID_RESET_PARAMS: |
- | 1874 | case STATEID_FLASHING: |
|
- | 1875 | g.setFont(font_small); |
|
- | 1876 | int msg_pos=0; |
|
- | 1877 | g.drawString("Initializing Bootloader" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 1878 | y_off+=spacer_small; |
|
- | 1879 | ||
1561 | case STATEID_FLASHING: |
1880 | if ((frame_pos%3)!=0) g.drawString("Please Wait!" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1562 | g.setFont(font_small); |
1881 | y_off+=spacer_small; |
1563 | int msg_pos=0; |
1882 | |
1564 | while (mk.flash_msgs[msg_pos]!=null) |
1883 | while (firmware_flasher.flash_msgs[msg_pos]!=null) |
1565 | { |
1884 | { |
1566 | g.drawString(mk.flash_msgs[msg_pos] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1885 | g.drawString(firmware_flasher.flash_msgs[msg_pos] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
- | 1886 | y_off+=spacer_small; |
|
- | 1887 | msg_pos++; |
|
- | 1888 | } |
|
- | 1889 | ||
1567 | y_off+=spacer_small; |
1890 | g.drawString("mk:" + (mk==null) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1568... | Line 1891... | ||
1568 | msg_pos++; |
1891 | y_off+=spacer_small; |
Line 1569... | Line 1892... | ||
1569 | } |
1892 | |
1570 | break; |
1893 | break; |
1571 | 1894 | ||
- | 1895 | case STATEID_CAMMODE: |
|
- | 1896 | ||
- | 1897 | if (cam_img!=null) |
|
- | 1898 | g.drawImage(cam_img,0,0,g.TOP | g.LEFT); |
|
1572 | case STATEID_CAMMODE: |
1899 | g.drawString("condition: stick" +settings.remote_cam_stick + " (act:" +mk.stick_data.stick[settings.remote_cam_stick] +",thres:100) =>" + cam_condition() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1573 | 1900 | y_off+=spacer_medium; |
|
1574 | if (cam_img!=null) |
1901 | |
1575 | g.drawImage(cam_img,0,0,g.TOP | g.LEFT); |
1902 | |
1576 | g.drawString("condition: " + cam_condition() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1903 | |
Line 1618... | Line 1945... | ||
1618 | // g.drawString("bfont_medium:"+ keycontrol_bitfield[0] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1945 | // g.drawString("bfont_medium:"+ keycontrol_bitfield[0] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1619 | //g.drawString("bfont_small:"+ keycontrol_bitfield[1] ,canvas_width/2,y_off,Graphics.TOP | Graphics.LEFT); |
1946 | //g.drawString("bfont_small:"+ keycontrol_bitfield[1] ,canvas_width/2,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1620... | Line 1947... | ||
1620 | 1947 | ||
Line 1621... | Line 1948... | ||
1621 | break; |
1948 | break; |
- | 1949 | ||
- | 1950 | // case STATEID_MOTORTEST: |
|
- | 1951 | ||
- | 1952 | // motor_tester.paint(g); |
|
- | 1953 | ||
- | 1954 | ||
1622 | 1955 | /* |
|
Line 1623... | Line 1956... | ||
1623 | case STATEID_MOTORTEST: |
1956 | |
1624 | for (int bar=0;bar<4;bar++) |
1957 | for (int bar=0;bar<4;bar++) |
1625 | 1958 | ||
Line 1630... | Line 1963... | ||
1630 | g.drawString(""+motor_test[bar] ,canvas_width/8+bar*2*canvas_width/8,y_off+10,Graphics.TOP | Graphics.HCENTER); |
1963 | g.drawString(""+motor_test[bar] ,canvas_width/8+bar*2*canvas_width/8,y_off+10,Graphics.TOP | Graphics.HCENTER); |
1631 | g.drawString(""+mk.debug_data.motor_val(bar) ,canvas_width/8+bar*2*canvas_width/8,y_off+25,Graphics.TOP | Graphics.HCENTER); |
1964 | g.drawString(""+mk.debug_data.motor_val(bar) ,canvas_width/8+bar*2*canvas_width/8,y_off+25,Graphics.TOP | Graphics.HCENTER); |
1632 | } |
1965 | } |
1633 | g.setColor(skin_fg_color()); |
1966 | g.setColor(skin_fg_color()); |
1634 | g.drawString(""+mk.debug_data.analog[2]+"<->"+mk.debug_data.analog[3] ,0,canvas_height-30,Graphics.TOP | Graphics.LEFT); |
1967 | g.drawString(""+mk.debug_data.analog[2]+"<->"+mk.debug_data.analog[3] ,0,canvas_height-30,Graphics.TOP | Graphics.LEFT); |
1635 | break; |
- | |
Line -... | Line 1968... | ||
- | 1968 | ||
- | 1969 | ||
- | 1970 | ||
- | 1971 | break; |
|
1636 | 1972 | */ |
|
- | 1973 | case STATEID_EDIT_PARAMS: |
|
- | 1974 | case STATEID_SETTINGSMENU: |
|
- | 1975 | case STATEID_MOTORTEST: |
|
1637 | case STATEID_EDIT_PARAMS: |
1976 | |
- | 1977 | act_editor.paint(g); |
|
1638 | params_editor.paint(g); |
1978 | |
Line 1639... | Line 1979... | ||
1639 | break; |
1979 | break; |
Line 1647... | Line 1987... | ||
1647 | paint_menu(g); |
1987 | paint_menu(g); |
1648 | break; |
1988 | break; |
1649 | //#endif |
1989 | //#endif |
Line -... | Line 1990... | ||
- | 1990 | ||
- | 1991 | ||
- | 1992 | //#if (location=="on")&&(cldc11=="on") |
|
1650 | 1993 | ||
1651 | - | ||
- | 1994 | ||
1652 | case STATEID_SHOWPHONEGPS: |
1995 | case STATEID_SHOWPHONEGPS: |
1653 | //#if cldc11=="on" |
1996 | |
1654 | y_off+=spacer_medium; |
1997 | y_off+=spacer_medium; |
1655 | g.drawString("lat" + phone_lat ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1998 | g.drawString("lat" + phone_lat ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1656 | y_off+=spacer_medium; |
- | |
1657 | g.drawString("long" + phone_long ,0,y_off,Graphics.TOP | Graphics.LEFT); |
- | |
Line -... | Line 1999... | ||
- | 1999 | y_off+=spacer_medium; |
|
- | 2000 | g.drawString("long" + phone_long ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 2001 | ||
- | 2002 | ||
- | 2003 | y_off+=spacer_medium; |
|
- | 2004 | g.drawString("cr" + (cr!=null) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 2005 | ||
- | 2006 | y_off+=spacer_medium; |
|
- | 2007 | g.drawString("LocationProvider" + (lp!=null) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 2008 | ||
- | 2009 | y_off+=spacer_medium; |
|
- | 2010 | g.drawString("Coordinates" + (c!=null) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 2011 | ||
1658 | //#endif |
2012 | break; |
1659 | break; |
2013 | |
1660 | 2014 | //#endif |
|
1661 | 2015 | case STATEID_SELECT_MIXER: |
|
1662 | case STATEID_SELECT_FIRMWARE: |
2016 | case STATEID_SELECT_FIRMWARE: |
Line 1715... | Line 2069... | ||
1715 | y_off+=spacer_small; |
2069 | y_off+=spacer_small; |
Line 1716... | Line 2070... | ||
1716 | 2070 | ||
1717 | g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
2071 | g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1718... | Line 2072... | ||
1718 | y_off+=spacer_small; |
2072 | y_off+=spacer_small; |
1719 | 2073 | ||
1720 | g.drawString(" "+mk.ufo_prober.extended_name()+ " (" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"closed")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
2074 | g.drawString(" "+mk.extended_name()+ " (" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"closed")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
1721 | y_off+=spacer_small; |
2075 | y_off+=spacer_small; |
Line 1722... | Line 2076... | ||
1722 | g.drawString(" Software Version:" + mk.version.version_str ,0,y_off,Graphics.TOP | Graphics.LEFT); |
2076 | g.drawString(" Software Version:" + mk.version.version_str ,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1737... | Line 2091... | ||
1737 | y_off+=spacer_medium; |
2091 | y_off+=spacer_medium; |
1738 | g.setFont(font_small); |
2092 | g.setFont(font_small); |
1739 | g.drawString( ">>in:"+mk.stats.bytes_in+ " bytes => " + mk.stats.bytes_in/mk.conn_time_in_s() + " bytes/s",0,y_off,Graphics.TOP | Graphics.LEFT); |
2093 | g.drawString( ">>in:"+mk.stats.bytes_in+ " bytes => " + mk.stats.bytes_in/mk.conn_time_in_s() + " bytes/s",0,y_off,Graphics.TOP | Graphics.LEFT); |
1740 | y_off+=spacer_small; |
2094 | y_off+=spacer_small; |
Line 1741... | Line -... | ||
1741 | - | ||
- | 2095 | ||
- | 2096 | g.drawString( " crcFail:"+mk.stats.crc_fail +" unknown:" +mk.stats.other_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
Line 1742... | Line 2097... | ||
1742 | 2097 | y_off+=spacer_small; |
|
1743 | 2098 | ||
1744 | 2099 | ||
1745 | g.drawString( " debug:"+mk.stats.debug_data_count+ " LCD:" + mk.stats.lcd_data_count + " vers:" + mk.stats.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
2100 | g.drawString( " debug:"+mk.stats.debug_data_count+ " LCD:" + mk.stats.lcd_data_count + " vers:" + mk.stats.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
1746 | y_off+=spacer_small; |
2101 | y_off+=spacer_small; |
Line 1747... | Line 2102... | ||
1747 | g.drawString( " rc:"+mk.stats.stick_data_count+" params:"+mk.stats.params_data_count + " GPS:"+mk.stats.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
2102 | g.drawString( " rc:"+mk.stats.stick_data_count+" params:"+mk.stats.params_data_count + " GPS:"+mk.stats.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1748 | y_off+=spacer_small; |
2103 | y_off+=spacer_small; |
Line 1749... | Line 2104... | ||
1749 | g.drawString( " debug_names:" + mk.stats.debug_names_count + " angles:" + mk.stats.angle_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
2104 | g.drawString( " debug_names:" + mk.stats.debug_names_count + " angles:" + mk.stats.angle_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1750 | 2105 | ||
1751 | y_off+=spacer_small; |
2106 | //y_off+=spacer_small; |
1752 | g.drawString( " other:"+mk.stats.other_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
2107 | // g.drawString( " other:"+mk.stats.other_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 1775... | Line 2130... | ||
1775 | 2130 | ||
Line 1776... | Line -... | ||
1776 | - | ||
1777 | - | ||
1778 | break; |
- | |
1779 | - | ||
Line 1780... | Line 2131... | ||
1780 | case STATEID_SETTINGSMENU: |
2131 | |
1781 | 2132 | ||
1782 | settings_editor.paint(g); |
2133 | break; |
1783 | break; |
2134 | |
Line 1887... | Line 2238... | ||
1887 | p%=(mk.debug_buff_len-2); |
2238 | p%=(mk.debug_buff_len-2); |
Line 1888... | Line 2239... | ||
1888 | 2239 | ||
Line 1889... | Line 2240... | ||
1889 | 2240 | ||
Line -... | Line 2241... | ||
- | 2241 | if (p<mk.debug_buff_lastset) |
|
1890 | if (p<mk.debug_buff_lastset) |
2242 | |
Line 1891... | Line 2243... | ||
1891 | 2243 | // draw_graph_part(g,x,mk.debug_buff[p][gr]/line_scaler,mk.debug_buff[p+1][gr]/line_scaler); |
|
1892 | draw_graph_part(g,x,mk.debug_buff[p][gr]/line_scaler,mk.debug_buff[p+1][gr]/line_scaler); |
2244 | |
Line 1972... | Line 2324... | ||
1972 | 2324 | ||
Line -... | Line 2325... | ||
- | 2325 | ||
- | 2326 | ||
- | 2327 | } catch (Exception e) { System.out.println("error in paint " + e);} |
|
- | 2328 | ||
- | 2329 | ||
- | 2330 | if (debug_overlay) |
|
- | 2331 | { |
|
- | 2332 | ||
- | 2333 | for(int debug_line=0;debug_line<5;debug_line++) |
|
- | 2334 | for ( int bar=0;bar<canvas_width/(symbols_img.getWidth()/10)+1;bar++) |
|
- | 2335 | { |
|
- | 2336 | g.setClip(bar*(symbols_img_tile_width),canvas_height-(debug_line+1)*symbols_img_tile_height,(symbols_img_tile_width),symbols_img_tile_height);; |
|
- | 2337 | g.drawImage(symbols_img,bar*(symbols_img_tile_width),canvas_height-(debug_line+1)*symbols_img_tile_height, g.TOP | g.LEFT); |
|
- | 2338 | ||
- | 2339 | } |
|
- | 2340 | ||
- | 2341 | g.setColor(0); |
|
- | 2342 | g.setClip(0,0,canvas_width,canvas_height); |
|
- | 2343 | g.drawString("freeMemory:" + Runtime.getRuntime().freeMemory() ,0,canvas_height-spacer_small,Graphics.TOP | Graphics.LEFT); |
|
- | 2344 | g.drawString("totalMemory:" + Runtime.getRuntime().totalMemory() ,0,canvas_height-2*spacer_small,Graphics.TOP | Graphics.LEFT); |
|
- | 2345 | ||
- | 2346 | g.drawString("state:" + state ,0,canvas_height-3*spacer_small,Graphics.TOP | Graphics.LEFT); |
|
- | 2347 | g.drawString("key_bitfield:" + key_bitfield ,0,canvas_height-4*spacer_small,Graphics.TOP | Graphics.LEFT); |
|
1973 | 2348 | ||
1974 | 2349 | } |
|
1975 | } catch (Exception e) { System.out.println("error in paint " + e);} |
2350 | |
1976 | 2351 | ||
1977 | } |
2352 | } |
1978 | Player mPlayer; |
2353 | //xda Player mPlayer; |
1979 | VideoControl mVideoControl; |
2354 | //xda VideoControl mVideoControl; |
Line 1988... | Line 2363... | ||
1988 | settings.connection_url=url; |
2363 | settings.connection_url=url; |
1989 | settings.connection_name=name; |
2364 | settings.connection_name=name; |
1990 | mk.connect_to(url,name); |
2365 | mk.connect_to(url,name); |
1991 | } |
2366 | } |
Line -... | Line 2367... | ||
- | 2367 | ||
1992 | 2368 | /* |
|
1993 | public void draw_graph_part(Graphics g,int x,int y1,int y2) |
2369 | public void draw_graph_part(Graphics g,int x,int y1,int y2) |
1994 | { |
- | |
1995 | 2370 | { |
|
1996 | g.drawLine(x,line_middle_y-y1,x+1,line_middle_y-y2); |
- | |
1997 | /* |
- | |
1998 | if ( canvas_width>200) |
- | |
1999 | { |
- | |
2000 | g.fillRect(x,line_middle_y-y1,1,1 ); |
- | |
2001 | if (y1>y2) |
- | |
2002 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
- | |
2003 | else |
- | |
2004 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
- | |
2005 | - | ||
2006 | } |
- | |
2007 | else |
- | |
2008 | { |
- | |
2009 | g.fillRect(x,line_middle_y-y1,1,1 ); |
- | |
2010 | if (y1>y2) |
- | |
2011 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
- | |
2012 | else |
- | |
2013 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
- | |
2014 | } |
- | |
2015 | |
- | |
2016 | */ |
2371 | g.drawLine(x,line_middle_y-y1,x+1,line_middle_y-y2); |
- | 2372 | } |
|
Line 2017... | Line 2373... | ||
2017 | } |
2373 | */ |
Line 2024... | Line 2380... | ||
2024 | // public final String intro_str=" Digital Ufo Broadcasting with intelligent service equipment by Marcus -LiGi- Bueschleb ; Big Up Holger&Ingo for the MikroKopter Project (http://www.mikrokopter.de) "; |
2380 | // public final String intro_str=" Digital Ufo Broadcasting with intelligent service equipment by Marcus -LiGi- Bueschleb ; Big Up Holger&Ingo for the MikroKopter Project (http://www.mikrokopter.de) "; |
Line 2025... | Line 2381... | ||
2025 | 2381 | ||
2026 | // int intro_str_pos=0; |
2382 | // int intro_str_pos=0; |
2027 | // int intro_str_delay=3; |
2383 | // int intro_str_delay=3; |
2028 | // boolean init_bootloader=false; |
- | |
- | 2384 | // boolean init_bootloader=false; |
|
- | 2385 | ||
- | 2386 | ||
Line 2029... | Line 2387... | ||
2029 | String success_msg=""; |
2387 | |
2030 | 2388 | ||
- | 2389 | ||
- | 2390 | public void chg_state(byte next_state) |
|
- | 2391 | { |
|
- | 2392 | //#if bluetooth=="on" |
|
- | 2393 | if (next_state!=STATEID_DEVICESELECT) |
|
- | 2394 | bt_scanner=null; |
|
- | 2395 | //#endif |
|
- | 2396 | if (firmware_flasher!=null) |
|
- | 2397 | { |
|
- | 2398 | firmware_flasher.exit_bootloader(); |
|
- | 2399 | firmware_flasher=null; |
|
- | 2400 | } |
|
2031 | 2401 | ||
- | 2402 | if ((mk==null)) |
|
- | 2403 | { |
|
- | 2404 | if ((next_state!=STATEID_SELECT_FIRMWARE)&&(next_state!=STATEID_FLASHING)) |
|
2032 | public void chg_state(byte next_state) |
2405 | { |
- | 2406 | mk = new MKCommunicator(); |
|
- | 2407 | settings.process_all_settings(); // TODO remove |
|
- | 2408 | if (settings.connection_url!="") |
|
- | 2409 | connect_mk(settings.connection_url,settings.connection_name); |
|
- | 2410 | } |
|
- | 2411 | ||
- | 2412 | } |
|
- | 2413 | else |
|
- | 2414 | { |
|
- | 2415 | mk.watchdog.resend_timeout=0; |
|
- | 2416 | ||
- | 2417 | mk.destroy_debug_buff(); |
|
- | 2418 | mk.user_intent=USER_INTENT_NONE; |
|
- | 2419 | mk.set_debug_interval(mk.default_abo); |
|
- | 2420 | mk.set_gpsosd_interval(mk.default_abo); |
|
- | 2421 | } |
|
2033 | { |
2422 | |
- | 2423 | if (next_state!=STATEID_ERROR_MSG) |
|
- | 2424 | { |
|
- | 2425 | act_editor = null; |
|
2034 | if ((next_state!=STATEID_ERROR_MSG)&&(next_state!=STATEID_SETTINGSMENU)) |
2426 | motor_tester=null; |
2035 | settings_editor = null; |
2427 | } |
2036 | params_editor = null; |
- | |
2037 | err_img=null; |
- | |
2038 | // graph_data=null; |
- | |
2039 | mk.destroy_debug_buff(); |
- | |
- | 2428 | ||
2040 | mk.user_intent=USER_INTENT_NONE; |
2429 | err_img=null; |
2041 | mk.set_debug_interval(100); |
2430 | // graph_data=null; |
Line 2056... | Line 2445... | ||
2056 | */ |
2445 | */ |
2057 | // prepare next state |
2446 | // prepare next state |
2058 | switch(next_state) |
2447 | switch(next_state) |
Line 2059... | Line 2448... | ||
2059 | 2448 | ||
- | 2449 | { |
|
2060 | { |
2450 | |
- | 2451 | case STATEID_MOTORTEST: |
|
- | 2452 | motor_tester=new MotorTester(); |
|
- | 2453 | act_editor=new MKParamsEditor(this,motor_tester,STATEID_MAINMENU); |
|
2061 | // case STATEID_COPY_PARAMS: |
2454 | break; |
- | 2455 | ||
- | 2456 | case STATEID_SELECT_MIXER: |
|
2062 | 2457 | setup_menu(DUBwiseHelper.combine_str_arr(mixer_manager.names,new String[] {"back"}),null); |
|
- | 2458 | break; |
|
- | 2459 | ||
2063 | //break; |
2460 | |
2064 | case STATEID_SETTING_OPTIONS: |
2461 | case STATEID_SETTING_OPTIONS: |
2065 | setup_menu(setting_options_menu_items,setting_options_menu_actions); |
2462 | setup_menu(setting_options_menu_items,setting_options_menu_actions); |
Line -... | Line 2463... | ||
- | 2463 | break; |
|
- | 2464 | ||
- | 2465 | case STATEID_SHOWPHONEGPS: |
|
- | 2466 | mk.user_intent=USER_INTENT_FOLLOWME; |
|
2066 | break; |
2467 | break; |
Line 2067... | Line 2468... | ||
2067 | 2468 | ||
2068 | case STATEID_GPSVIEW: |
2469 | case STATEID_GPSVIEW: |
2069 | 2470 | ||
2070 | mk.user_intent=USER_INTENT_GPSOSD; |
- | |
2071 | break; |
2471 | mk.user_intent=USER_INTENT_GPSOSD; |
2072 | case STATEID_SELECT_FIRMWARE: |
2472 | break; |
Line 2073... | Line 2473... | ||
2073 | fw_loader=new FirmwareLoader(); |
2473 | case STATEID_SELECT_FIRMWARE: |
2074 | setup_menu(new String[0],new byte[0]); |
2474 | setup_menu(fw_loader.names,null); |
2075 | break; |
2475 | break; |
Line 2076... | Line 2476... | ||
2076 | 2476 | ||
2077 | 2477 | ||
2078 | case STATEID_SUCCESS_MSG: |
2478 | case STATEID_SUCCESS_MSG: |
2079 | case STATEID_ERROR_MSG: |
2479 | case STATEID_ERROR_MSG: |
2080 | lcd_lines=new String[1]; |
2480 | lcd_lines=new String[1]; |
2081 | 2481 | ||
Line 2089... | Line 2489... | ||
2089 | debug.log("problem loading error image"); |
2489 | debug.log("problem loading error image"); |
2090 | } |
2490 | } |
Line 2091... | Line 2491... | ||
2091 | 2491 | ||
2092 | break; |
2492 | break; |
2093 | case STATEID_EDIT_PARAMS: |
2493 | case STATEID_EDIT_PARAMS: |
2094 | params_editor = new MKParamsEditor(this,mk.params,STATEID_HANDLE_PARAMS); |
2494 | act_editor = new MKParamsEditor(this,mk.params,STATEID_HANDLE_PARAMS); |
2095 | break; |
2495 | break; |
2096 | case STATEID_STRINGINPUT: |
2496 | case STATEID_STRINGINPUT: |
2097 | lcd_lines=new String[2]; |
2497 | lcd_lines=new String[2]; |
2098 | lcd_lines[0]=act_input_str; |
2498 | lcd_lines[0]=act_input_str; |
Line 2102... | Line 2502... | ||
2102 | case STATEID_LCD: |
2502 | case STATEID_LCD: |
2103 | mk.user_intent=USER_INTENT_LCD; |
2503 | mk.user_intent=USER_INTENT_LCD; |
2104 | break; |
2504 | break; |
2105 | case STATEID_RESET_PARAMS: |
2505 | case STATEID_RESET_PARAMS: |
Line -... | Line 2506... | ||
- | 2506 | ||
- | 2507 | firmware_flasher=new MKFirmwareFlasher(settings.connection_url,MKFirmwareHelper.BOOTLOADER_INTENSION_RESET_PARAMS); |
|
- | 2508 | ||
2106 | 2509 | ||
2107 | mk.bootloader_intension_flash=false; |
2510 | /* mk.bootloader_intension_flash=false; |
2108 | mk.bl_retrys=0; |
2511 | mk.bl_retrys=0; |
2109 | mk.init_bootloader=true; |
2512 | mk.init_bootloader=true;*/ |
Line 2110... | Line 2513... | ||
2110 | break; |
2513 | break; |
- | 2514 | ||
- | 2515 | case STATEID_FLASHING: |
|
- | 2516 | ||
- | 2517 | firmware_flasher=new MKFirmwareFlasher(settings.connection_url,MKFirmwareHelper.BOOTLOADER_INTENSION_FLASH_FIRMWARE); |
|
- | 2518 | firmware_flasher.in=fw_loader.get_input_str(); |
|
2111 | 2519 | ||
2112 | case STATEID_FLASHING: |
2520 | /* |
2113 | mk.bootloader_intension_flash=true; |
2521 | mk.bootloader_intension_flash=true; |
- | 2522 | mk.bl_retrys=0; |
|
- | 2523 | mk.init_bootloader=true; |
|
- | 2524 | */ |
|
- | 2525 | break; |
|
- | 2526 | ||
- | 2527 | case STATEID_GET_AVRSIG: |
|
- | 2528 | ||
- | 2529 | firmware_flasher=new MKFirmwareFlasher(settings.connection_url,MKFirmwareHelper.BOOTLOADER_INTENSION_GET_SIG); |
|
2114 | mk.bl_retrys=0; |
2530 | |
Line 2115... | Line 2531... | ||
2115 | mk.init_bootloader=true; |
2531 | |
2116 | break; |
2532 | break; |
2117 | 2533 | ||
2118 | //#if fileapi=="on" |
2534 | //#if fileapi=="on" |
2119 | case STATEID_FILEOPEN: |
2535 | case STATEID_FILEOPEN: |
Line 2120... | Line 2536... | ||
2120 | file_access.trigger(); |
2536 | file_access.dirty=true; |
2121 | break; |
2537 | break; |
Line 2130... | Line 2546... | ||
2130 | break; |
2546 | break; |
Line 2131... | Line 2547... | ||
2131 | 2547 | ||
2132 | 2548 | ||
- | 2549 | case STATEID_ABOUT: |
|
2133 | case STATEID_ABOUT: |
2550 | lcd_lines=credits; |
2134 | lcd_lines=credits; |
2551 | lcd_lines[CREDITS_VERSION]= "Version: V" + version_str; |
2135 | lcd_lines[1]=" ufo-lib: " + mk.lib_version_str(); |
2552 | lcd_lines[CREDITS_VERSION+1]="Lib Vers.: " + mk.lib_version_str(); |
- | 2553 | act_menu_select=(byte)(max_lines-1); |
|
2136 | act_menu_select=max_lines-1; |
2554 | break; |
2137 | break; |
2555 | |
2138 | case STATEID_CONN_DETAILS: |
2556 | case STATEID_CONN_DETAILS: |
Line 2145... | Line 2563... | ||
2145 | break; |
2563 | break; |
2146 | case STATEID_TRAFFIC: |
2564 | case STATEID_TRAFFIC: |
2147 | setup_menu(onlyback_menu_items,back_to_conndetails_actions); |
2565 | setup_menu(onlyback_menu_items,back_to_conndetails_actions); |
2148 | break; |
2566 | break; |
2149 | case STATEID_CAMMODE: |
2567 | case STATEID_CAMMODE: |
- | 2568 | /*xda |
|
2150 | mk.user_intent=USER_INTENT_RCDATA; |
2569 | mk.user_intent=USER_INTENT_RCDATA; |
2151 | if (mVideoControl==null) |
2570 | if (mVideoControl==null) |
2152 | try |
2571 | try |
2153 | { |
2572 | { |
2154 | debug.log("creating player\n"); |
2573 | debug.log("creating player\n"); |
Line 2170... | Line 2589... | ||
2170 | } |
2589 | } |
2171 | catch ( Exception e) |
2590 | catch ( Exception e) |
2172 | { |
2591 | { |
2173 | debug.log(e.toString()); |
2592 | debug.log(e.toString()); |
2174 | } |
2593 | } |
2175 | 2594 | */ |
|
Line 2176... | Line 2595... | ||
2176 | 2595 | ||
2177 | break; |
2596 | break; |
2178 | case STATEID_KEYCONTROL: |
2597 | case STATEID_KEYCONTROL: |
2179 | mk.user_intent= USER_INTENT_EXTERNAL_CONTROL; |
2598 | mk.user_intent= USER_INTENT_EXTERNAL_CONTROL; |
Line 2208... | Line 2627... | ||
2208 | lcd_lines[0]="Searching for"; |
2627 | lcd_lines[0]="Searching for"; |
2209 | lcd_lines[1]="Bluetooth Devices"; |
2628 | lcd_lines[1]="Bluetooth Devices"; |
2210 | lcd_lines[2]="found"; |
2629 | lcd_lines[2]="found"; |
Line 2211... | Line 2630... | ||
2211 | 2630 | ||
- | 2631 | mk.close_connections(true); |
|
2212 | mk.close_connections(true); |
2632 | |
- | 2633 | bt_scanner = new BTSearcher(); |
|
2213 | bt_scanner.search(); |
2634 | |
2214 | break; |
2635 | break; |
Line 2215... | Line 2636... | ||
2215 | //#endif |
2636 | //#endif |
2216 | 2637 | ||
Line 2245... | Line 2666... | ||
2245 | setup_main_menu(); |
2666 | setup_main_menu(); |
Line 2246... | Line 2667... | ||
2246 | 2667 | ||
Line 2247... | Line 2668... | ||
2247 | break; |
2668 | break; |
2248 | 2669 | ||
2249 | case STATEID_SETTINGSMENU: |
2670 | case STATEID_SETTINGSMENU: |
Line 2250... | Line 2671... | ||
2250 | if (settings_editor==null) |
2671 | // if (settings_editor==null) |
Line 2251... | Line 2672... | ||
2251 | settings_editor = new MKParamsEditor(this,settings,STATEID_MAINMENU); |
2672 | act_editor = new MKParamsEditor(this,settings,STATEID_MAINMENU); |
2252 | 2673 | ||
2253 | break; |
2674 | break; |
Line 2254... | Line 2675... | ||
2254 | 2675 | ||
2255 | case STATEID_RAWDEBUG: |
2676 | case STATEID_RAWDEBUG: |
2256 | mk.user_intent=USER_INTENT_RAWDEBUG; |
2677 | mk.user_intent=USER_INTENT_RAWDEBUG; |
2257 | break; |
2678 | break; |
2258 | 2679 | ||
Line 2259... | Line 2680... | ||
2259 | case STATEID_HORIZON: |
2680 | case STATEID_HORIZON: |
2260 | // mk.user_intent=USER_INTENT_GRAPH; |
2681 | // mk.user_intent=USER_INTENT_GRAPH; |
Line 2282... | Line 2703... | ||
2282 | local_max=1; |
2703 | local_max=1; |
2283 | */ |
2704 | */ |
2284 | break; |
2705 | break; |
Line 2285... | Line 2706... | ||
2285 | 2706 | ||
2286 | } |
- | |
- | 2707 | } |
|
- | 2708 | ||
Line 2287... | Line 2709... | ||
2287 | mk.watchdog.resend_timeout=0; |
2709 | |
2288 | 2710 | ||
2289 | // switch state |
2711 | // switch state |
Line 2290... | Line 2712... | ||
2290 | state=next_state; |
2712 | state=next_state; |
2291 | } // void chg_state |
2713 | } // void chg_state |
Line -... | Line 2714... | ||
- | 2714 | ||
- | 2715 | ||
- | 2716 | public void keyReleased(int keyCode) |
|
- | 2717 | { |
|
- | 2718 | ||
2292 | 2719 | if (state==STATEID_MAP) |
|
2293 | 2720 | key_bitfield=0; |
|
- | 2721 | else |
|
2294 | public void keyReleased(int keyCode) |
2722 | key_bitfield&=(0xFFFFFFFF)^keyCode2mask(keyCode); |
2295 | { |
2723 | |
2296 | 2724 | switch(state) |
|
- | 2725 | { |
|
Line 2297... | Line 2726... | ||
2297 | switch(state) |
2726 | /* |
2298 | { |
2727 | case STATEID_MOTORTEST: |
2299 | case STATEID_MOTORTEST: |
2728 | act_motor_increase=0; |
2300 | act_motor_increase=0; |
2729 | break; |
Line 2377... | Line 2806... | ||
2377 | //#if cldc11=="on" |
2806 | //#if cldc11=="on" |
2378 | double phone_lat=0.0; |
2807 | double phone_lat=0.0; |
2379 | double phone_long=0.0; |
2808 | double phone_long=0.0; |
2380 | //#endif |
2809 | //#endif |
Line -... | Line 2810... | ||
- | 2810 | ||
- | 2811 | //#if j2memap=="on" |
|
- | 2812 | ||
- | 2813 | Marker ufo_marker,home_marker; |
|
2381 | 2814 | //#endif |
|
2382 | public void process_action(byte actionid) |
2815 | public void process_action(byte actionid) |
2383 | { |
2816 | { |
2384 | switch(actionid) |
2817 | switch(actionid) |
- | 2818 | { |
|
- | 2819 | ||
- | 2820 | case ACTIONID_SELECT_MIXER: |
|
- | 2821 | chg_state(STATEID_SELECT_MIXER); |
|
- | 2822 | break; |
|
- | 2823 | ||
- | 2824 | case ACTIONID_SELECT_DUBWISEDIR: |
|
- | 2825 | chg_state(STATEID_FILEOPEN); |
|
- | 2826 | break; |
|
- | 2827 | ||
- | 2828 | //#if j2memap=="on" |
|
- | 2829 | case ACTIONID_MAP: |
|
- | 2830 | ||
- | 2831 | ||
- | 2832 | int default_zoom=14; // TODO calc of distance - kopter<>home |
|
- | 2833 | ||
- | 2834 | try { |
|
- | 2835 | ||
- | 2836 | ||
- | 2837 | ||
- | 2838 | // ufo_marker=new Marker(UtilMidp.parseFloat(""+(mk.gps_position.Longitude/10000000d)),UtilMidp.parseFloat(""+(mk.gps_position.Latitude/10000000d))); |
|
- | 2839 | ||
- | 2840 | ufo_marker=new Marker(UtilMidp.parseFloat(mk.gps_position.gps_format_str(mk.gps_position.Longitude,GPS_FORMAT_DECIMAL)),UtilMidp.parseFloat(mk.gps_position.gps_format_str(mk.gps_position.Latitude,GPS_FORMAT_DECIMAL))); |
|
- | 2841 | ufo_marker.iconImage=icon_img; |
|
- | 2842 | ufo_marker.m_type=MarkerStyle.ICON_IMAGE; |
|
- | 2843 | ufo_marker.name="Kopter"; |
|
- | 2844 | ufo_marker.description="This is the Kopter!"; |
|
- | 2845 | ||
- | 2846 | root.m_map.m_listMyPlaces.addElement(ufo_marker); |
|
- | 2847 | ||
- | 2848 | root.m_map.gotoLonLat(UtilMidp.parseFloat(mk.gps_position.gps_format_str(mk.gps_position.Longitude,GPS_FORMAT_DECIMAL)),UtilMidp.parseFloat(mk.gps_position.gps_format_str(mk.gps_position.Latitude,GPS_FORMAT_DECIMAL)) ,default_zoom); |
|
- | 2849 | } |
|
- | 2850 | catch(Exception e) {} |
|
- | 2851 | ||
- | 2852 | ||
- | 2853 | //#if location=="on" |
|
- | 2854 | //#if cldc11=="on" |
|
- | 2855 | if (!((phone_lat==0.0)&&(phone_long==0.0)))try { |
|
- | 2856 | ||
- | 2857 | home_marker=new Marker(UtilMidp.parseFloat(""+phone_long),UtilMidp.parseFloat(""+phone_lat)); |
|
- | 2858 | home_marker.name="HomePos"; |
|
- | 2859 | home_marker.description="This is home!"; |
|
- | 2860 | root.m_map.m_listMyPlaces.addElement(home_marker); |
|
- | 2861 | ||
- | 2862 | ||
- | 2863 | root.m_map.gotoLonLat(UtilMidp.parseFloat(""+phone_long) ,UtilMidp.parseFloat(""+phone_lat),default_zoom); |
|
- | 2864 | ||
- | 2865 | } |
|
- | 2866 | catch(Exception e) {} |
|
- | 2867 | //#endif |
|
- | 2868 | //#endif |
|
- | 2869 | ||
- | 2870 | chg_state(STATEID_MAP); |
|
- | 2871 | break; |
|
2385 | { |
2872 | //#endif |
2386 | case ACTIONID_SETTING_LOADFANCY: |
2873 | case ACTIONID_SETTING_LOADFANCY: |
2387 | settings.load_fancy_defaults(); |
2874 | settings.load_fancy_defaults(); |
Line 2388... | Line 2875... | ||
2388 | break; |
2875 | break; |
Line 2419... | Line 2906... | ||
2419 | 2906 | ||
2420 | 2907 | ||
2421 | // params_version |
2908 | // params_version |
2422 | if ( mk.params.params_version!=din.readInt()) |
2909 | if ( mk.params.params_version!=din.readInt()) |
2423 | { |
2910 | { |
2424 | mk.error_str=l(STRINGID_PARAMSINCOMPATIBLE); |
2911 | act_msg=l(STRINGID_PARAMSINCOMPATIBLE); |
2425 | chg_state(STATEID_ERROR_MSG); |
2912 | chg_state(STATEID_ERROR_MSG); |
Line 2426... | Line 2913... | ||
2426 | break; |
2913 | break; |
Line 2439... | Line 2926... | ||
2439 | else throw(new Exception("rms err")); |
2926 | else throw(new Exception("rms err")); |
2440 | recStore.closeRecordStore(); |
2927 | recStore.closeRecordStore(); |
2441 | } |
2928 | } |
2442 | catch (Exception e) |
2929 | catch (Exception e) |
2443 | { |
2930 | { |
2444 | mk.error_str=l(STRINGID_NOPARAMSONMOBILE); |
2931 | act_msg=l(STRINGID_NOPARAMSONMOBILE); |
2445 | chg_state(STATEID_ERROR_MSG); |
2932 | chg_state(STATEID_ERROR_MSG); |
2446 | } |
2933 | } |
Line 2447... | Line 2934... | ||
2447 | 2934 | ||
Line 2448... | Line 2935... | ||
2448 | 2935 | ||
- | 2936 | break; |
|
2449 | break; |
2937 | |
2450 | 2938 | case ACTIONID_SELECT_FIRMWARE: |
|
2451 | case ACTIONID_SELECT_FIRMWARE: |
2939 | fw_loader=new FirmwareLoader(116,this); |
2452 | chg_state(STATEID_SELECT_FIRMWARE); |
2940 | chg_state(STATEID_SELECT_FIRMWARE); |
2453 | break; |
2941 | break; |
Line 2459... | Line 2947... | ||
2459 | case ACTIONID_PARAM_MENU: |
2947 | case ACTIONID_PARAM_MENU: |
2460 | chg_state(STATEID_PARAM_MENU); |
2948 | chg_state(STATEID_PARAM_MENU); |
2461 | break; |
2949 | break; |
Line 2462... | Line 2950... | ||
2462 | 2950 | ||
2463 | case ACTIONID_PARAM_WRITE_OK: |
2951 | case ACTIONID_PARAM_WRITE_OK: |
2464 | success_msg=l(STRINGID_PARAMWRITEOK); |
2952 | act_msg=l(STRINGID_PARAMWRITEOK); |
2465 | chg_state(STATEID_SUCCESS_MSG); |
2953 | chg_state(STATEID_SUCCESS_MSG); |
2466 | break; |
2954 | break; |
2467 | case ACTIONID_HORIZON: |
2955 | case ACTIONID_HORIZON: |
2468 | chg_state(STATEID_HORIZON); |
2956 | chg_state(STATEID_HORIZON); |
Line 2479... | Line 2967... | ||
2479 | chg_state(STATEID_CONN_DETAILS); |
2967 | chg_state(STATEID_CONN_DETAILS); |
2480 | break; |
2968 | break; |
Line 2481... | Line 2969... | ||
2481 | 2969 | ||
2482 | case ACTIONID_RESET_PARAMS: |
2970 | case ACTIONID_RESET_PARAMS: |
2483 | chg_state(STATEID_RESET_PARAMS); |
- | |
2484 | // state=STATEID_FLASHING; |
- | |
2485 | 2971 | chg_state(STATEID_RESET_PARAMS); |
|
Line 2486... | Line 2972... | ||
2486 | break; |
2972 | break; |
2487 | 2973 | ||
2488 | case ACTIONID_FLASH: |
2974 | case ACTIONID_FLASH: |
Line 2489... | Line 2975... | ||
2489 | chg_state(STATEID_FLASHING); |
2975 | chg_state(STATEID_GET_AVRSIG); |
2490 | break; |
2976 | break; |
2491 | 2977 | ||
Line 2492... | Line 2978... | ||
2492 | case ACTIONID_DATABUFF: |
2978 | case ACTIONID_DATABUFF: |
2493 | chg_state(STATEID_DATABUFF); |
2979 | chg_state(STATEID_DATABUFF); |
2494 | break; |
2980 | break; |
2495 | 2981 | ||
Line 2496... | Line 2982... | ||
2496 | case ACTIONID_NC_ERRORS: |
2982 | case ACTIONID_NC_ERRORS: |
2497 | mk.error_str=null; |
2983 | act_msg=null; |
Line 2603... | Line 3089... | ||
2603 | chg_state(STATEID_SELECT_PARAMSET); |
3089 | chg_state(STATEID_SELECT_PARAMSET); |
2604 | break; |
3090 | break; |
Line 2605... | Line 3091... | ||
2605 | 3091 | ||
2606 | case ACTIONID_WRITE_PARAMS: |
3092 | case ACTIONID_WRITE_PARAMS: |
2607 | mk.write_params(mk.params.act_paramset); |
3093 | mk.write_params(mk.params.act_paramset); |
2608 | success_msg=l(STRINGID_SAVEDSETTINGS); // too optimistic |
3094 | act_msg=l(STRINGID_SAVEDSETTINGS); // too optimistic |
2609 | nextstate=STATEID_HANDLE_PARAMS; |
3095 | nextstate=STATEID_HANDLE_PARAMS; |
2610 | chg_state(STATEID_SUCCESS_MSG); |
3096 | chg_state(STATEID_SUCCESS_MSG); |
Line 2611... | Line 3097... | ||
2611 | break; |
3097 | break; |
2612 | 3098 | ||
2613 | case ACTIONID_UNDO_PARAMS: |
3099 | case ACTIONID_UNDO_PARAMS: |
2614 | mk.params.use_backup(); |
3100 | mk.params.use_backup(); |
2615 | success_msg=l(STRINGID_SETTINGSUNDOOK); // too optimistic |
3101 | act_msg=l(STRINGID_SETTINGSUNDOOK); // too optimistic |
Line 2616... | Line 3102... | ||
2616 | nextstate=STATEID_HANDLE_PARAMS; |
3102 | nextstate=STATEID_HANDLE_PARAMS; |
Line 2617... | Line 3103... | ||
2617 | chg_state(STATEID_SUCCESS_MSG); |
3103 | chg_state(STATEID_SUCCESS_MSG); |
2618 | 3104 | ||
2619 | break; |
3105 | break; |
Line 2620... | Line 3106... | ||
2620 | 3106 | ||
- | 3107 | case ACTIONID_MAINMENU: |
|
2621 | case ACTIONID_MAINMENU: |
3108 | chg_state(STATEID_MAINMENU); |
2622 | chg_state(STATEID_MAINMENU); |
3109 | break; |
Line 2623... | Line 3110... | ||
2623 | break; |
3110 | |
2624 | 3111 | case ACTIONID_DEBUG: |
|
2625 | case ACTIONID_DEBUG: |
3112 | chg_state(STATEID_DUBWISE_VALUES); |
Line 2651... | Line 3138... | ||
2651 | } |
3138 | } |
Line 2652... | Line 3139... | ||
2652 | 3139 | ||
Line -... | Line 3140... | ||
- | 3140 | } |
|
- | 3141 | ||
- | 3142 | ||
- | 3143 | ||
- | 3144 | ||
- | 3145 | ||
- | 3146 | public void pointerDragged (int pointer_x, int pointer_y) |
|
- | 3147 | { |
|
- | 3148 | if ((pointer_x>canvas_width) || (pointer_y>canvas_height)) return; // bugfix/workaround - pointer in offscreen - e.g. wtk when not in fullscreen |
|
- | 3149 | ||
- | 3150 | System.out.println("p_y: " + pointer_y + "ch:" + canvas_height); |
|
- | 3151 | byte act_pointer_row; |
|
- | 3152 | ||
- | 3153 | if (lcd_lines.length>max_lines) |
|
- | 3154 | act_pointer_row=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*max_lines))/lcd_img.getHeight() +lcd_off ); |
|
- | 3155 | else |
|
- | 3156 | act_pointer_row=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight() ); |
|
- | 3157 | ||
- | 3158 | if ((act_pointer_row>=lcd_lines.length)||(act_pointer_row<0)) return; |
|
- | 3159 | ||
- | 3160 | switch(state) |
|
- | 3161 | { |
|
- | 3162 | case STATEID_PARAM_MENU: |
|
- | 3163 | case STATEID_CONN_DETAILS: |
|
- | 3164 | case STATEID_HANDLE_PARAMS: |
|
- | 3165 | case STATEID_FILEOPEN: |
|
- | 3166 | case STATEID_TRAFFIC: |
|
- | 3167 | case STATEID_SELECT_COMPORT: |
|
- | 3168 | case STATEID_MAINMENU: |
|
- | 3169 | case STATEID_SETTING_OPTIONS: |
|
- | 3170 | case STATEID_SELECT_PARAMSET: |
|
- | 3171 | case STATEID_DEVICESELECT: |
|
- | 3172 | case STATEID_SELECT_MIXER: |
|
- | 3173 | ||
- | 3174 | act_menu_select=act_pointer_row; |
|
- | 3175 | } |
|
2653 | } |
3176 | |
2654 | 3177 | } |
|
Line -... | Line 3178... | ||
- | 3178 | ||
- | 3179 | public void pointerPressed (int pointer_x, int pointer_y) |
|
- | 3180 | { |
|
- | 3181 | ||
- | 3182 | if ((pointer_x>canvas_width) || (pointer_y>canvas_height)) return; // bugfix - pointer in offscreen - e.g. wtk when not in fullscreen |
|
- | 3183 | ||
- | 3184 | byte act_pointer_row; |
|
- | 3185 | ||
- | 3186 | if (lcd_lines.length>max_lines) |
|
- | 3187 | act_pointer_row=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*max_lines))/lcd_img.getHeight() +lcd_off ); |
|
2655 | 3188 | else |
|
2656 | public void pointerPressed (int pointer_x, int pointer_y) |
3189 | act_pointer_row=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight() ); |
2657 | { |
3190 | |
- | 3191 | ||
- | 3192 | if (pointer_y<lcd_img.getHeight()) |
|
2658 | 3193 | keyPressed(KEY_STAR); |
|
2659 | if (pointer_y<lcd_img.getHeight()) |
3194 | else |
2660 | keyPressed(KEY_STAR); |
3195 | { if (act_pointer_row<0) return; |
2661 | else |
3196 | |
- | 3197 | if (pointer_y>canvas_height-lcd_img.getHeight()*lcd_lines.length) |
|
- | 3198 | switch(state) |
|
- | 3199 | { |
|
- | 3200 | case STATEID_SETTINGSMENU: |
|
- | 3201 | case STATEID_EDIT_PARAMS: |
|
Line 2662... | Line 3202... | ||
2662 | if (pointer_y>canvas_height-lcd_img.getHeight()*lcd_lines.length) |
3202 | case STATEID_MOTORTEST: |
- | 3203 | act_editor.pointer_press(pointer_x,act_pointer_row ); |
|
2663 | switch(state) |
3204 | break; |
Line 2664... | Line -... | ||
2664 | { |
- | |
2665 | case STATEID_SETTINGSMENU: |
- | |
Line -... | Line 3205... | ||
- | 3205 | /* |
|
- | 3206 | ||
- | 3207 | // settings_editor.pointer_press(pointer_x,(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight())) ; |
|
2666 | 3208 | settings_editor.pointer_press(pointer_x,act_pointer_row ); |
|
Line -... | Line 3209... | ||
- | 3209 | break; |
|
- | 3210 | ||
- | 3211 | ||
- | 3212 | // params_editor.pointer_press(pointer_x,(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight()) ); |
|
- | 3213 | ||
- | 3214 | params_editor.pointer_press(pointer_x,act_pointer_row ); |
|
2667 | settings_editor.pointer_press(pointer_x,(pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight()) ; |
3215 | break; |
2668 | break; |
3216 | |
2669 | 3217 | ||
2670 | case STATEID_EDIT_PARAMS: |
3218 | |
2671 | params_editor.pointer_press(pointer_x,(pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight()) ; |
3219 | motor_tester.pointer_press(pointer_x,act_pointer_row ); |
2672 | 3220 | ||
- | 3221 | break; |
|
- | 3222 | */ |
|
2673 | break; |
3223 | case STATEID_LCD: |
2674 | 3224 | if (pointer_x<(canvas_width/2)) |
|
2675 | case STATEID_LCD: |
3225 | keyPressed(getKeyCode(LEFT)); |
2676 | if (pointer_x<(canvas_width/2)) |
3226 | else |
2677 | keyPressed(getKeyCode(LEFT)); |
3227 | keyPressed(getKeyCode(RIGHT)); |
2678 | else |
3228 | break; |
2679 | keyPressed(getKeyCode(RIGHT)); |
3229 | |
2680 | break; |
3230 | case STATEID_SELECT_MIXER: |
2681 | case STATEID_PARAM_MENU: |
3231 | case STATEID_PARAM_MENU: |
2682 | case STATEID_CONN_DETAILS: |
3232 | case STATEID_CONN_DETAILS: |
2683 | case STATEID_HANDLE_PARAMS: |
3233 | case STATEID_HANDLE_PARAMS: |
2684 | case STATEID_FILEOPEN: |
3234 | case STATEID_FILEOPEN: |
2685 | case STATEID_TRAFFIC: |
3235 | case STATEID_TRAFFIC: |
2686 | case STATEID_SELECT_COMPORT: |
3236 | case STATEID_SELECT_COMPORT: |
- | 3237 | case STATEID_MAINMENU: |
|
2687 | case STATEID_MAINMENU: |
3238 | case STATEID_SETTING_OPTIONS: |
2688 | case STATEID_SETTING_OPTIONS: |
3239 | case STATEID_SELECT_PARAMSET: |
2689 | case STATEID_SELECT_PARAMSET: |
3240 | case STATEID_DEVICESELECT: |
2690 | case STATEID_DEVICESELECT: |
3241 | |
- | 3242 | ||
- | 3243 | // if (pointer_y>canvas_height-lcd_img.getHeight()*menu_items.length) |
|
- | 3244 | // { |
|
- | 3245 | /* |
|
- | 3246 | if (lcd_lines.length>max_lines) |
|
- | 3247 | act_menu_select=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*max_lines))/lcd_img.getHeight() +lcd_off ); |
|
2691 | 3248 | else |
|
2692 | 3249 | act_menu_select=(byte)((pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight() ); |
|
2693 | // if (pointer_y>canvas_height-lcd_img.getHeight()*menu_items.length) |
3250 | |
2694 | // { |
3251 | */ |
Line -... | Line 3252... | ||
- | 3252 | ||
2695 | if (lcd_lines.length>max_lines) |
3253 | if (act_menu_select!=act_pointer_row) |
Line 2696... | Line 3254... | ||
2696 | act_menu_select=(pointer_y-(canvas_height-lcd_img.getHeight()*max_lines))/lcd_img.getHeight() +lcd_off ; |
3254 | act_menu_select=act_pointer_row; |
2697 | else |
3255 | else |
Line 2698... | Line 3256... | ||
2698 | act_menu_select=(pointer_y-(canvas_height-lcd_img.getHeight()*lcd_lines.length))/lcd_img.getHeight() ; |
3256 | keyPressed(getKeyCode(FIRE)); |
2699 | keyPressed(getKeyCode(FIRE)); |
3257 | //} |
- | 3258 | break; |
|
- | 3259 | } |
|
2700 | //} |
3260 | |
- | 3261 | } |
|
- | 3262 | } |
|
- | 3263 | ||
- | 3264 | ||
- | 3265 | int last_keycode=-1; |
|
- | 3266 | int repeat_keycode=0; |
|
- | 3267 | ||
- | 3268 | public void keyPressed(int keyCode) |
|
- | 3269 | { |
|
2701 | break; |
3270 | |
- | 3271 | ||
- | 3272 | key_bitfield|=keyCode2mask(keyCode); |
|
- | 3273 | ||
- | 3274 | if ((state==STATEID_MAINMENU)&&(keyCode==beta_unlock_code[beta_unlock_pos++])) |
|
- | 3275 | { |
|
- | 3276 | if (beta_unlock_pos==beta_unlock_code.length) |
|
- | 3277 | { |
|
- | 3278 | beta_unlock_pos=0; |
|
- | 3279 | nextstate=state; |
|
2702 | } |
3280 | act_msg="Hi Betatester" ; |
2703 | 3281 | chg_state(STATEID_SUCCESS_MSG); |
|
2704 | } |
3282 | settings.set_betatester(); |
2705 | 3283 | return; |
|
2706 | 3284 | } |
|
Line 2721... | Line 3299... | ||
2721 | 3299 | ||
2722 | debug.log("KeyCode:"+keyCode); |
3300 | debug.log("KeyCode:"+keyCode); |
2723 | // key-actions common in all states |
3301 | // key-actions common in all states |
Line 2724... | Line 3302... | ||
2724 | debug.process_key(keyCode); |
3302 | debug.process_key(keyCode); |
2725 | 3303 | ||
2726 | 3304 | ||
2727 | if (((keyCode==KEY_STAR) || (keyCode==settings.key_back) )&&(state!=STATEID_KEYCONTROL))//&&(state!= STATEID_STRINGINPUT)) |
3305 | if ( key_bitfield==(keyCode2mask(KEY_NUM0)|keyCode2mask(KEY_STAR))) |
2728 | { |
3306 | { |
2729 | chg_state(STATEID_MAINMENU); |
3307 | chg_state(STATEID_MAINMENU); |
Line -... | Line 3308... | ||
- | 3308 | return; |
|
- | 3309 | } |
|
- | 3310 | ||
- | 3311 | if (state!=STATEID_MAP) |
|
- | 3312 | { |
|
- | 3313 | if (((keyCode==KEY_STAR) || (keyCode==settings.key_back) )&&(state!=STATEID_KEYCONTROL))//&&(state!= STATEID_STRINGINPUT)) |
|
- | 3314 | { |
|
- | 3315 | chg_state(STATEID_MAINMENU); |
|
Line 2730... | Line 3316... | ||
2730 | return; |
3316 | return; |
2731 | } |
3317 | } |
2732 | 3318 | } |
|
Line 2739... | Line 3325... | ||
2739 | } |
3325 | } |
Line 2740... | Line 3326... | ||
2740 | 3326 | ||
2741 | // key actions per state |
3327 | // key actions per state |
2742 | switch(state) |
3328 | switch(state) |
- | 3329 | { |
|
- | 3330 | //#if j2memap=="on" |
|
- | 3331 | case STATEID_MAP: |
|
- | 3332 | root.m_map.keyPressed(keyCode); |
|
2743 | { |
3333 | break; |
2744 | 3334 | //#endif |
|
2745 | case STATEID_SUCCESS_MSG: |
3335 | case STATEID_SUCCESS_MSG: |
2746 | chg_state(nextstate); |
3336 | chg_state(nextstate); |
2747 | break; |
3337 | break; |
2748 | case STATEID_ERROR_MSG: |
3338 | case STATEID_ERROR_MSG: |
Line 2970... | Line 3560... | ||
2970 | mk.send_keys(keycontrol_bitfield); |
3560 | mk.send_keys(keycontrol_bitfield); |
2971 | */ |
3561 | */ |
2972 | break; |
3562 | break; |
Line -... | Line 3563... | ||
- | 3563 | ||
2973 | 3564 | ||
- | 3565 | /* |
|
- | 3566 | case STATEID_MOTORTEST: |
|
2974 | 3567 | motor_tester.keypress(keyCode,getGameAction (keyCode)); |
|
2975 | case STATEID_MOTORTEST: |
3568 | |
2976 | switch (getGameAction (keyCode)) |
3569 | switch (getGameAction (keyCode)) |
2977 | { |
3570 | { |
2978 | case UP: |
3571 | case UP: |
Line 2996... | Line 3589... | ||
2996 | act_motor++; |
3589 | act_motor++; |
2997 | act_motor%=4; |
3590 | act_motor%=4; |
2998 | break; |
3591 | break; |
2999 | } |
3592 | } |
Line 3000... | Line -... | ||
3000 | - | ||
Line -... | Line 3593... | ||
- | 3593 | ||
- | 3594 | ||
Line 3001... | Line 3595... | ||
3001 | break; |
3595 | break; |
3002 | 3596 | */ |
|
Line 3015... | Line 3609... | ||
3015 | else |
3609 | else |
3016 | menu_keypress(keyCode); |
3610 | menu_keypress(keyCode); |
3017 | break; |
3611 | break; |
3018 | */ |
3612 | */ |
Line -... | Line 3613... | ||
- | 3613 | ||
- | 3614 | case STATEID_SELECT_MIXER: |
|
- | 3615 | ||
3019 | 3616 | case STATEID_SELECT_FIRMWARE: |
|
3020 | case STATEID_SETTING_OPTIONS: |
3617 | case STATEID_SETTING_OPTIONS: |
3021 | case STATEID_MAINMENU: |
3618 | case STATEID_MAINMENU: |
3022 | case STATEID_SELECT_PARAMSET: |
3619 | case STATEID_SELECT_PARAMSET: |
Line 3036... | Line 3633... | ||
3036 | //#endif |
3633 | //#endif |
Line 3037... | Line 3634... | ||
3037 | 3634 | ||
3038 | menu_keypress(keyCode); |
3635 | menu_keypress(keyCode); |
Line 3039... | Line -... | ||
3039 | break; |
- | |
3040 | - | ||
- | 3636 | break; |
|
- | 3637 | ||
3041 | 3638 | case STATEID_MOTORTEST: |
|
3042 | 3639 | case STATEID_EDIT_PARAMS: |
|
3043 | case STATEID_SETTINGSMENU: |
3640 | case STATEID_SETTINGSMENU: |
Line 3044... | Line 3641... | ||
3044 | settings_editor.keypress(keyCode,getGameAction (keyCode)) ; |
3641 | act_editor.keypress(keyCode,getGameAction (keyCode)) ; |
3045 | break; |
3642 | break; |
3046 | 3643 | ||
Line 3047... | Line 3644... | ||
3047 | // handle menue |
3644 | // handle menue |
3048 | // case STATEID_SELECT_SPEED_FORMAT: |
3645 | // case STATEID_SELECT_SPEED_FORMAT: |
3049 | // case STATEID_SELECT_GPS_FORMAT: |
3646 | // case STATEID_SELECT_GPS_FORMAT: |
3050 | 3647 | ||
3051 | 3648 | /* |
|
3052 | case STATEID_EDIT_PARAMS: |
3649 | case STATEID_EDIT_PARAMS: |
Line 3053... | Line 3650... | ||
3053 | params_editor.keypress(keyCode,getGameAction (keyCode)) ; |
3650 | params_editor.keypress(keyCode,getGameAction (keyCode)) ; |
3054 | break; |
3651 | break; |
3055 | 3652 | */ |