107,37 → 107,74 |
} |
|
int info_from_debug_set=-1; |
int volt_timeout=0; |
|
public int last_alt=-1; |
|
public void run() |
{ |
while(true) |
{ |
if (mk.connected&&(canvas.settings.do_sound)&&(mk.debug_data.UBatt()!=-1)&&(!mk.force_disconnect)) |
if (mk.connected&&(canvas.settings.do_sound)&&(mk.UBatt()!=-1)&&(!mk.force_disconnect)) |
{ |
int ubatt=mk.debug_data.UBatt(); |
|
|
if (info_from_debug_set!=mk.stats.debug_data_count) |
{ |
info_from_debug_set=mk.stats.debug_data_count; |
start_playing(""+(ubatt/10)); |
wait_for_end(); |
{ // only when newdata |
|
if((ubatt%10)!=0) |
if (canvas.settings.do_volts_sound&&(volt_timeout--<0)) |
{ |
start_playing("komma"); |
volt_timeout=delay*10; |
int ubatt=mk.UBatt(); |
info_from_debug_set=mk.stats.debug_data_count; |
start_playing(""+(ubatt/10)); |
wait_for_end(); |
start_playing(""+(ubatt%10)); |
|
if((ubatt%10)!=0) |
{ |
start_playing("komma"); |
wait_for_end(); |
start_playing(""+(ubatt%10)); |
wait_for_end(); |
} |
start_playing("volt"); |
wait_for_end(); |
} |
start_playing("volt"); |
|
|
|
if (canvas.settings.do_altimeter_sound) |
{ |
if (last_alt==-1) last_alt=mk.Alt(); |
int alt_diff=10; |
|
if (last_alt>mk.Alt()+alt_diff) |
{ |
start_playing("down"); |
wait_for_end(); |
last_alt-=alt_diff; |
} |
if (last_alt<mk.Alt()-alt_diff) |
|
{ |
start_playing("up"); |
wait_for_end(); |
last_alt+=alt_diff; |
} |
} |
else |
last_alt=-1; |
} |
|
} |
|
try { |
try { |
Thread.sleep(100); |
/* |
if (delay<1) |
Thread.sleep(1000); |
else |
Thread.sleep(delay*1000); |
*/ |
} |
catch (Exception e) { } |
|