/DUBwise/trunk/shared/src/DUBwiseLangDefs.java |
---|
183,5 → 183,13 |
public final static int STRINGID_WRITINGPARAMS=179; |
public final static int STRINGID_GRAPHINTERVAL=180; |
public final static int STRINGID_ALTIMETER=181; |
public final static int STRING_COUNT=182; |
public final static int STRINGID_COCKPIT=182; |
public final static int STRINGID_INVERTNICK=183; |
public final static int STRINGID_INVERTROLL=184; |
public final static int STRINGID_SHOWFLIGHTTIME=185; |
public final static int STRINGID_SHOWALTITUDE=186; |
public final static int STRINGID_UNITS=187; |
public final static int STRINGID_DEVMODE=188; |
public final static int STRINGID_DISCONNECT=189; |
public final static int STRING_COUNT=190; |
} |
/DUBwise/trunk/shared/src/MKCommunicator.java |
---|
35,9 → 35,13 |
public byte bl_retrys=0; |
public boolean init_bootloader=false; |
public boolean disconnect_notify=false; |
public byte lib_version_major=0; |
public byte lib_version_minor=6; |
public byte lib_version_minor=7; |
public byte last_navi_error=0; |
public String lib_version_str() |
{ |
return "V"+lib_version_major+"."+lib_version_minor; |
462,8 → 466,8 |
public void switch_todo() |
{ |
sleep(150); |
version=new MKVersion(); |
LCD= new MKLCD(this); |
version.reset(); |
// LCD= new MKLCD(this); |
debug_data=new MKDebugData(); |
} |
760,7 → 764,10 |
debug_data.set_by_mk_data(Decode64(data,3,len-3),version); |
if (ufo_prober.is_mk()) |
stats.process_mkflags(debug_data.motor_val(0)); // TODO remove dirty hack |
{ |
stats.process_mkflags(debug_data.motor_val(0)); // TODO remove dirty hack |
stats.process_alt(Alt()); |
} |
if (debug_buff_targets!=null) |
{ |
for (int sp=0;sp<debug_buff_targets.length;sp++) |
769,8 → 776,6 |
debug_buff_lastset=debug_buff_off; |
debug_buff_off=(debug_buff_off+1)%debug_buff_len; |
} |
log("processed debug data"); |
844,6 → 849,8 |
stats.process_mkflags(gps_position.MKFlags); |
stats.process_compas(gps_position.CompasHeading); |
stats.process_speed(gps_position.GroundSpeed); |
stats.process_alt(Alt()); |
log("long:" + gps_position.Longitude); |
log("lat:" + gps_position.Latitude); |
867,6 → 874,7 |
public void close_connections(boolean force) |
{ |
// if ((!force)&&root.canvas.do_vibra) root.vibrate(500); |
force_disconnect=force; |
try{ reader.close(); } |
882,7 → 890,8 |
ufo_prober.set_to_none(); |
stats.reset(); |
connected=false; |
version=new MKVersion(); |
version.reset(); |
disconnect_notify=true; |
} |
// Thread to recieve data from Connection |
1197,10 → 1206,6 |
while(true) |
{ |
data_buff[data_buff_pos]="ct-l" +data_buff_pos + "" + connected ; |
data_buff_pos++; |
data_buff_pos%=DATA_BUFF_LEN; |
if (!connected) |
{ |
if (!force_disconnect) connect(); |
1215,30 → 1220,19 |
catch (Exception e) { } |
} |
*/ |
recieving=true; |
int read_count ; |
if (reader.available()<DATA_IN_BUFF_SIZE) |
read_count =reader.read(data_in_buff,0,reader.available()); |
else |
read_count =reader.read(data_in_buff,0,DATA_IN_BUFF_SIZE); |
if ( read_count!=0) |
{ |
data_buff[data_buff_pos]="avail:" + reader.available(); |
data_buff_pos++; |
data_buff_pos%=DATA_BUFF_LEN; |
} |
// log("Connected - reading data " + read_count); |
// pos=0; |
input=0; |
//data_buff[data_buff_pos]=""; |
// recieve data-set |
if (read_count==0) sleep(20); |
// int read_count =reader.read(data_in_buff,0,reader.available()); |
stats.bytes_in+=read_count; |
1299,7 → 1293,10 |
} |
else |
sleep(5); |
{ |
recieving=false; |
sleep(20); |
} |
/* |
while ((input != 13)) //&&(input!=-1)) |
{ |
/DUBwise/trunk/shared/src/MKGPSPosition.java |
---|
64,7 → 64,7 |
public int SenderOkay = -1; |
public int MKFlags= -1; |
public int NCFlags= -1; |
public int ErrorCode= -1; |
public int ErrorCode= 0; |
233,7 → 233,7 |
case GPS_FORMAT_MINSEC: |
return "" + val/10000000 + "^" + ((val%10000000)*60)/10000000 + "'" + ((((val%10000000)*60)%10000000)*60)/10000000 + "." + ((((val%10000000)*60)%10000000)*60)%10000000; |
default: |
return "invalid format"; |
return "invalid format" + act_gps_format; |
} |
} |
397,7 → 397,7 |
MKFlags=in_arr[66]; |
NCFlags=in_arr[67]; |
ErrorCode=in_arr[67]; |
ErrorCode=in_arr[68]; |
} |
/DUBwise/trunk/shared/src/MKLCD.java |
---|
67,7 → 67,7 |
public void LCD_NEXTPAGE() |
{ |
if (act_page!=pages) |
if (act_page<pages) |
act_page++; |
else |
act_page=0; |
76,7 → 76,7 |
public void LCD_PREVPAGE() |
{ |
if (act_page!=0) |
if (act_page>0) |
act_page--; |
else |
act_page=pages; |
/DUBwise/trunk/shared/src/MKStatistics.java |
---|
47,7 → 47,32 |
public int heading_start=0; |
public int last_heading=0; |
public int max_speed=0; |
public long speed_sum=0; |
public int speed_cnt=1; |
public int max_alt=0; |
public int avg_speed() |
{ |
return (int)(speed_sum/speed_cnt); |
} |
public void process_speed(int speed) |
{ |
if (speed>max_speed) |
max_speed=speed; |
speed_sum+=speed; |
speed_cnt++; |
} |
public void process_alt(int alt) |
{ |
if (alt>max_alt) |
max_alt=alt; |
} |
public void process_mkflags(int flags) |
{ |
if (flags==0) |
/DUBwise/trunk/shared/src/MKVersion.java |
---|
20,6 → 20,18 |
public String version_str=""; |
public String proto_str=""; |
public void reset() |
{ |
major=-1; |
minor=-1; |
proto_major=-1; |
proto_minor=-1; |
patch=-1; |
version_str=""; |
proto_str=""; |
} |
// version known? |
/DUBwise/trunk/shared/src/MKWatchDog.java |
---|
16,7 → 16,7 |
{ |
MKCommunicator mk=null; |
int debug_data_count_buff=-123; |
int bytes_in_count_buff=-123; |
public MKWatchDog(MKCommunicator _mk) |
{ |
176,72 → 176,20 |
break; |
} |
// if ((!mk.ufo_prober.is_incompatible())) |
{/* |
mk.log("watchdog after main loop"); |
if (debug_data_count_buff==mk.stats.debug_data_count) |
{ |
mk.log("timeout:" +conn_check_timeout ); |
conn_check_timeout++; |
if (conn_check_timeout==1000) |
{ |
mk.log("disconnecting"); |
mk.close_connections(false); |
conn_check_timeout=0; |
} |
debug_data_count_buff=mk.stats.debug_data_count; |
} |
else |
conn_check_timeout=0; |
*/ |
/*else if ((mk.root.canvas.user_intent==USER_INTENT_RAWDEBUG) || (mk.root.canvas.user_intent==USER_INTENT_GRAPH) ) |
{ |
mk.trigger_debug(); |
try { Thread.sleep(100); } |
catch (Exception e) { } |
} |
*/ |
if (bytes_in_count_buff==mk.stats.bytes_in) |
if ((conn_check_timeout++)*BASE_SLEEP>3000) |
{ |
conn_check_timeout=0; |
mk.close_connections(false); |
} |
else |
conn_check_timeout=0; |
bytes_in_count_buff=mk.stats.debug_data_count; |
/* |
if (debug_data_count_buff==mk.debug_data_count) |
{ |
// mk.close_connections(false); |
} |
*/ |
/*if (mk.version.major==-1) |
mk.get_version(); |
else |
*/ |
/*for ( int cnt=0;cnt<5;cnt++) |
if (mk.params.field[cnt]==null) |
{ |
mk.get_params(cnt+1); |
break; |
}*/ |
/* |
for (int c=0;c<32;c++) |
if (!mk.debug_data.got_name[c]) |
{ |
mk.get_debug_name(c); |
break; |
} |
*/ |
} |
} |