34,8 → 34,6 |
int last_count=0; |
|
|
|
int last_fm_send=-1; |
public boolean resend_check(int ref_count) |
{ |
if (( last_count!=ref_count)||(resend_timeout<0)) |
57,7 → 55,6 |
public final static int BASE_SLEEP=10; |
//#endif |
|
int intitial_paramset_try=0; |
public void run() |
{ |
mk.log("starting Watchdog"); |
69,25 → 66,25 |
try { |
Thread.sleep(BASE_SLEEP); |
// sleeper=BASE_SLEEP; |
if (mk.connected&&(!mk.force_disconnect))//&&(mk.bootloader_stage==BOOTLOADER_STAGE_NONE)) |
if (mk.connected&&(!mk.force_disconnect)) |
{ |
// // mk.log("watchdog pre main loop"); |
// if (mk.init_bootloader) |
// { |
// mk.jump_bootloader(); |
// mk.init_bootloader=false; |
// } |
//else |
if ( mk.version.major==-1 ) |
|
// mk.log("watchdog pre main loop"); |
if (mk.init_bootloader) |
{ |
mk.jump_bootloader(); |
mk.init_bootloader=false; |
} |
else if ( mk.version.major==-1 ) |
mk.get_version(); |
else if (mk.is_navi()&&(mk.error_str==null)) |
else if (mk.ufo_prober.is_navi()&&(mk.error_str==null)) |
mk.get_error_str(); |
|
else if (mk.is_mk()&&(mk.params.last_parsed_paramset==-1)&&(intitial_paramset_try<7)) |
else if (mk.ufo_prober.is_mk()&&(mk.params.last_parsed_paramset==-1)) |
{ |
mk.get_params(0xFF-1); |
Thread.sleep(150); |
intitial_paramset_try++; |
|
act_paramset=0; // warning - if dropped problem |
} |
else switch (mk.user_intent) |
168,45 → 165,31 |
break; |
|
case USER_INTENT_GPSOSD: |
mk.set_gpsosd_interval(mk.primary_abo); |
mk.set_gpsosd_interval(1); |
break; |
case USER_INTENT_GRAPH: |
mk.set_debug_interval(mk.primary_abo); |
mk.set_debug_interval(1); |
break; |
|
case USER_INTENT_FOLLOWME: |
|
// once a second |
if (last_fm_send!=(System.currentTimeMillis()/1000)) |
{ |
last_fm_send=(int)(System.currentTimeMillis()/1000); |
mk.send_follow_me(60); |
} |
|
|
|
break; |
|
|
default: |
// mk.log("uncactched intent " +mk.root.canvas.user_intent ) |
// mk.log("uncactched intent " +mk.root.canvas.user_intent ); |
break; |
} |
|
|
|
|
|
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; |
else |
conn_check_timeout=0; |
bytes_in_count_buff=mk.stats.debug_data_count; |
|
|
|
} |
|
|