Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 213 → Rev 214

/DUBwise/trunk/j2me/src/DUBwiseCanvas.java
48,8 → 48,6
int file_list_length=0;
//#endif
 
 
String act_input_str=" ";
 
boolean ipinput4proxy;
60,8 → 58,6
int canvas_height=100;
 
 
 
 
// public String ip_digit_zeroes(int digit)
//{ return "" + digit/100 + "" + (digit/10)%10 + "" + (digit)%10; }
 
150,6 → 146,130
String[] lcd_lines =null;
 
 
 
// boolean expert_mode=false;
 
public void setup_main_menu()
{
byte setup_pos=0;
byte[] tmp_actions=new byte[20];
String[] tmp_items=new String[20];
 
 
tmp_actions[setup_pos]=ACTIONID_SETTINGS;
tmp_items[setup_pos++] ="Tool Settings";
 
 
tmp_actions[setup_pos]=ACTIONID_CONN_DETAILS;
tmp_items[setup_pos++] ="Connection";
 
if (settings.expert_mode)
{
tmp_actions[setup_pos]=ACTIONID_DEBUG;
tmp_items[setup_pos++] ="Debug";
 
}
 
 
 
if (mk.ufo_prober.is_mk() )
{
tmp_actions[setup_pos]=ACTIONID_MOTORTEST;
tmp_items[setup_pos++] ="Motor Test";
 
tmp_actions[setup_pos]=ACTIONID_KEYCONTROL;
tmp_items[setup_pos++] ="Key-Control";
 
tmp_actions[setup_pos]=ACTIONID_RCDATA;
tmp_items[setup_pos++] ="view RC-data";
 
tmp_actions[setup_pos]=ACTIONID_EDIT_PARAMS;
tmp_items[setup_pos++] ="Flight Settings";
}
 
 
 
if (( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk() ))
{
tmp_actions[setup_pos]=ACTIONID_LCD;
tmp_items[setup_pos++] ="LCD";
}
 
if (( mk.ufo_prober.is_mk() ))
{
tmp_actions[setup_pos]=ACTIONID_GRAPH;
tmp_items[setup_pos++] ="Graph";
}
 
 
 
 
if (( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() ))
{
tmp_actions[setup_pos]=ACTIONID_RAWDEBUG;
tmp_items[setup_pos++] ="Debug Values";
}
 
 
 
if ( mk.ufo_prober.is_navi())
{
tmp_actions[setup_pos]=ACTIONID_GPSDATA;
tmp_items[setup_pos++] ="view GPS-Data";
 
tmp_actions[setup_pos]=ACTIONID_NC_ERRORS;
tmp_items[setup_pos++] ="view Errors";
 
 
tmp_actions[setup_pos]=ACTIONID_SWITCH_FC;
tmp_items[setup_pos++] ="switch to FC";
 
tmp_actions[setup_pos]=ACTIONID_SWITCH_MK3MAG;
tmp_items[setup_pos++] ="switch to MK3MAG";
 
}
 
if ((mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag() ))
{
tmp_actions[setup_pos]=ACTIONID_SWITCH_NC;
tmp_items[setup_pos++] ="switch to Navi";
}
 
 
if ((settings.expert_mode)&& ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()||mk.ufo_prober.is_mk3mag()||mk.ufo_prober.is_incompatible() ))
{
tmp_actions[setup_pos]=ACTIONID_FLASH;
tmp_items[setup_pos++] ="Flash Firmware";
}
 
if ((settings.expert_mode)&& ( mk.ufo_prober.is_mk() ))
{
tmp_actions[setup_pos]=ACTIONID_CAM;
tmp_items[setup_pos++] ="Remote Cam";
}
 
 
 
tmp_actions[setup_pos]=ACTIONID_ABOUT;
tmp_items[setup_pos++] ="About";
 
tmp_actions[setup_pos]=ACTIONID_QUIT;
tmp_items[setup_pos++] ="Quit";
 
 
byte[] tmp_actions_fin=new byte[setup_pos];
String[] tmp_items_fin=new String[setup_pos];
for ( int tmp_p=0;tmp_p<setup_pos;tmp_p++)
{
tmp_actions_fin[tmp_p]=tmp_actions[tmp_p];
tmp_items_fin[tmp_p] =tmp_items[tmp_p];
}
setup_menu(tmp_items_fin,tmp_actions_fin);
}
 
 
public void setup_menu(String[] items , byte[] actions)
{
menu_items=items;
272,23 → 392,10
for (int c=0;c<graph_data[0].length;c++)
for (int d=0;d<GRAPH_COUNT;d++)
graph_data[d][c]=-1;
/*
nick_line_pos_data=new int[graph_data[0].length];
roll_line_pos_data=new int[graph_data[0].length];
accnick_line_pos_data=new int[graph_data[0].length];
accroll_line_pos_data=new int[graph_data[0].length];
for (int c=0;c<graph_data[0].length;c++)
{
nick_line_pos_data[c]=-1;
roll_line_pos_data[c]=-1;
accnick_line_pos_data[c]=-1;
accroll_line_pos_data[c]=-1;
}
*/
 
try {
err_img=null;
if (settings.do_scrollbg) err_img=Image.createImage("/preflight.jpg");
err_img=Image.createImage("/preflight.jpg");
}
catch (Exception e) { }
 
745,7 → 852,7
}
break;
case STATEID_NC_ERRORS:
if (settings.do_scrollbg)
if (err_img!=null)
{
int err_img_left=(canvas_width-err_img.getWidth()/2)/2;
int err_img_top=(canvas_height-err_img.getHeight())/2;
1453,16 → 1560,8
//#endif
 
case STATEID_MAINMENU:
if (mk.ufo_prober.is_navi())
setup_menu(main_menu_items_navi,main_menu_actions_navi);
else if (mk.ufo_prober.is_mk())
setup_menu(main_menu_items_mk,main_menu_actions_mk);
else if (mk.ufo_prober.is_mk3mag())
setup_menu(main_menu_items_mk3mag,main_menu_actions_mk3mag);
else if (mk.ufo_prober.is_incompatible())
setup_menu(main_menu_items_incompatible,main_menu_actions_incompatible);
else // no connection
setup_menu(main_menu_items_no_connection,main_menu_actions_no_connection);
setup_main_menu();
 
break;
 
case STATEID_SETTINGSMENU:
1482,6 → 1581,7
//#if devicecontrol=="on"
menu_items[7]+=(!settings.keep_lighton)?"Off":"On";
//#endif
menu_items[8]+=(!settings.expert_mode)?" Off":" On";
menu_actions=settings_menu_actions;
lcd_lines=new String[menu_items.length];
break;
1964,6 → 2064,10
switch(menu_actions[act_menu_select])
{
 
case ACTIONID_TOGGLE_EXPERT:
settings.expert_mode=!settings.expert_mode;
chg_state(STATEID_SETTINGSMENU);
break;
case ACTIONID_RENAME_PARAMS:
act_input_str=mk.params.names[mk.params.act_paramset];
ipinput_pos=0;
/DUBwise/trunk/j2me/src/DUBwiseSettings.java
29,6 → 29,7
public boolean do_sound=true;
public boolean fullscreen=false;
public boolean do_scrollbg=false;
public boolean expert_mode=false;
 
 
public byte gps_format=GPS_FORMAT_DECIMAL;
75,10 → 76,11
gps_format=din.readByte();
speed_format=din.readByte();
 
expert_mode=din.readBoolean();
// reserve
 
din.readBoolean();
din.readBoolean();
din.readBoolean();
din.readByte();
din.readByte();
din.readByte();
133,9 → 135,9
dout.writeByte(gps_format);
dout.writeByte(speed_format);
 
dout.writeBoolean( expert_mode);
dout.writeBoolean(false);
dout.writeBoolean(false);
dout.writeBoolean(false);
dout.writeByte(0);
dout.writeByte(0);
dout.writeByte(0);
/DUBwise/trunk/j2me/src/DUBwiseUIDefinitions.java
93,57 → 93,30
public final static byte ACTIONID_SET_SPEED_FORMAT_CMS=43;
 
public final static byte ACTIONID_RENAME_PARAMS=44;
public final static byte ACTIONID_TOGGLE_EXPERT=45;
 
 
public final static byte ACTIONID_QUIT = 100;
 
 
public final static String[] main_menu_items_no_connection = { "Tool Settings" , "Connection" , "Debug DUBwise" , "About","Quit " };
public final static byte[] main_menu_actions_no_connection= { ACTIONID_SETTINGS , ACTIONID_CONN_DETAILS, ACTIONID_DEBUG , ACTIONID_ABOUT, ACTIONID_QUIT};
 
 
public final static String[] main_menu_items_incompatible = { "Tool Settings" , "Connection" , "Debug DUBwise" ,"Flash Firmware", "About","Quit " };
public final static byte[] main_menu_actions_incompatible= { ACTIONID_SETTINGS , ACTIONID_CONN_DETAILS, ACTIONID_DEBUG ,ACTIONID_FLASH , ACTIONID_ABOUT, ACTIONID_QUIT};
 
 
 
public final static String[] main_menu_items_mk3mag = { "Tool Settings" , "Connection" , "Flash Firmware" , "switch to NC","Debug DUBwise" , "About","Quit " };
public final static byte[] main_menu_actions_mk3mag= { ACTIONID_SETTINGS , ACTIONID_CONN_DETAILS, ACTIONID_FLASH, ACTIONID_SWITCH_NC, ACTIONID_DEBUG , ACTIONID_ABOUT, ACTIONID_QUIT};
 
 
public final static String[] main_menu_items_mk ={"Connection", "switch to NC","Sensor Graph" , "LCD","Raw Debug", "view RC-data", "MK-KeyControl", "Motor Test" , "Flight Settings","Flash Firmware","Tool Settings","Remote Cam", "Debug" ,"About", "Quit" };
 
public final static byte[] main_menu_actions_mk = { ACTIONID_CONN_DETAILS , ACTIONID_SWITCH_NC , ACTIONID_GRAPH , ACTIONID_LCD , ACTIONID_RAWDEBUG , ACTIONID_RCDATA , ACTIONID_KEYCONTROL , ACTIONID_MOTORTEST , ACTIONID_EDIT_PARAMS,ACTIONID_FLASH , ACTIONID_SETTINGS , ACTIONID_CAM , ACTIONID_DEBUG , ACTIONID_ABOUT , ACTIONID_QUIT};
 
 
public final static String[] main_menu_items_navi={"Connection" , "view Errors", "switch to FC","switch to MK3MAG","LCD","Raw Debug", "view GPS-Data" ,"Flash Firmware","Tool Settings", "Debug" ,"About", "Quit" };
 
public final static byte[] main_menu_actions_navi = { ACTIONID_CONN_DETAILS , ACTIONID_NC_ERRORS , ACTIONID_SWITCH_FC , ACTIONID_SWITCH_MK3MAG, ACTIONID_LCD , ACTIONID_RAWDEBUG , ACTIONID_GPSDATA , ACTIONID_FLASH , ACTIONID_SETTINGS , ACTIONID_DEBUG , ACTIONID_ABOUT, ACTIONID_QUIT};
 
 
 
public final static String[] handle_params_menu_items={"write to MK","don't write to MK","discard/read again","rename","all to default"};
public final static byte[] handle_params_menu_actions={ACTIONID_WRITE_PARAMS,ACTIONID_MAINMENU,ACTIONID_UNDO_PARAMS,ACTIONID_RENAME_PARAMS,ACTIONID_RESET_PARAMS};
 
 
public final static String[] conn_details_menu_items={ "packet Traffic","view Data","connect via TCP/IP","connect via BT","connect via COM","set Proxy","back" };
 
 
public final static String[] conn_details_menu_items={ "packet Traffic","view Data","connect via TCP/IP","connect via BT","connect via COM","set Proxy","back" };
public final static byte[] conn_details_menu_actions={ ACTIONID_TRAFFIC,ACTIONID_DATABUFF,ACTIONID_CONNECT_TCP,ACTIONID_SCAN_BT, ACTIONID_SELECT_COM,ACTIONID_PROXY_INPUT,ACTIONID_MAINMENU};
 
 
 
public final static String[] set_gps_format_menu_items={ "Decimal" , "Min/Sec","Back" };
 
 
public final static byte[] set_gps_format_menu_actions={ ACTIONID_SET_GPS_FORMAT_DECIMAL , ACTIONID_SET_GPS_FORMAT_MINSEC,ACTIONID_MAINMENU};
 
 
 
public final static String[] set_speed_format_menu_items={ "Kilometers/Hour" , "Miles/Hour", "CM/Sec","Back" };
 
 
public final static byte[] set_speed_format_menu_actions={ ACTIONID_SET_SPEED_FORMAT_KMH , ACTIONID_SET_SPEED_FORMAT_MPH , ACTIONID_SET_SPEED_FORMAT_CMS,ACTIONID_SETTINGS};
 
 
152,7 → 125,7
//#if devicecontrol=="on"
"Keep BGLight " ,
//#endif
"Expert Mode",
"Back" };
 
 
160,6 → 133,7
//#if devicecontrol=="on"
ACTIONID_LIGHTTOGGLE,
//#endif
ACTIONID_TOGGLE_EXPERT,
ACTIONID_MAINMENU };