Rev 4 |
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();
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;
}
}
}
}
}