Go to most recent revision |
Blame |
Last modification |
View Log
| RSS feed
/**************************************
*
* WatchDog for MK-Connection
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
*
**************************************/
public class MKWatchDog
implements Runnable
{
MKCommunicator mk=
null;
int debug_data_count_buff=-
123;
int lcd_data_count_buff=-
123;
public MKWatchDog
(MKCommunicator _mk
)
{
mk=_mk
;
new Thread( this ).
start(); // fire up main Thread
}
public void run
()
{
while(true)
{
try { Thread.
sleep(1000); }
catch (Exception e
) { }
if (mk.
connected&&(!mk.
force_disconnect))
{
if (debug_data_count_buff==mk.
debug_data_count)
{
mk.
close_connections(false);
}
if ((lcd_data_count_buff==mk.
lcd_data_count)||
(mk.
lcd_data_count==
0))
mk.
LCD.
trigger_LCD();
debug_data_count_buff=mk.
debug_data_count;
lcd_data_count_buff=mk.
lcd_data_count;
if (mk.
version.
major==-
1)
mk.
get_version();
if (mk.
params.
field[0][0]==-
1)
mk.
get_params(1);
else if (mk.
params.
field[1][0]==-
1)
mk.
get_params(2);
else if (mk.
params.
field[2][0]==-
1)
mk.
get_params(3);
else if (mk.
params.
field[3][0]==-
1)
mk.
get_params(4);
else if (mk.
params.
field[4][0]==-
1)
mk.
get_params(5);
for (int c=
0;c
<32;c++
)
if (!mk.
debug_data.
got_name[c
])
{
mk.
get_debug_name(c
);
break;
}
}
}
}
}