Subversion Repositories FlightCtrl

Rev

Rev 221 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 221 Rev 303
Line 1... Line 1...
1
/**********************************************************************************************************************************
1
/**************************************
2
 *      Statistics from MK-Connection ( needed for 2. Thread and Readability of Code )                                            *
-
 
3
 *                                                                                                                                *
-
 
-
 
2
 *                      
4
 * Author:        Marcus -LiGi- Bueschleb                                                                                         *
3
 * Author:        Marcus -LiGi- Bueschleb
5
 * Project-Start: 9/2007                                                                                                          *
4
 * Project-Start: 9/2007              
6
 * Version:       0.07                                                                                                            *            
-
 
7
 * Mailto:        ligi@smart4mobile.de                                                                                            *
5
 * Mailto:        ligi@smart4mobile.de
8
 * Licence:       Creative Commons / Non Commercial                                                                               *
-
 
9
 * Big Up:        Holger&Ingo                                                                                                     *
-
 
-
 
6
 *
10
 *********************************************************************************************************************************/
7
 **************************************/
Line 11... Line 8...
11
 
8
 
12
public class MKWatchDog
9
public class MKWatchDog
13
   implements Runnable
10
   implements Runnable
Line 14... Line 11...
14
{
11
{
Line 15... Line 12...
15
 
12
 
-
 
13
    MKCommunicator mk=null;
Line 16... Line 14...
16
    MKCommunicator mk=null;
14
 
17
 
15
    int debug_data_count_buff=-123;
18
    int debug_data_count_buff=-123;
16
    int lcd_data_count_buff=-123;
19
 
17
 
Line 25... Line 23...
25
 
23
 
26
    public void run()
24
    public void run()
27
    {
25
    {
28
        while(true)
26
        while(true)
29
            {
27
            {
30
                try { Thread.sleep(1500); }
28
                try { Thread.sleep(1000); }
Line 31... Line 29...
31
                catch (Exception e)  {   }
29
                catch (Exception e)  {   }
32
               
30
               
33
                if (mk.connected)
31
                if (mk.connected&&(!mk.force_disconnect))
34
                    {
32
                    {
-
 
33
                        if (debug_data_count_buff==mk.debug_data_count)
-
 
34
                            mk.close_connections(false);
-
 
35
 
-
 
36
                        if ((lcd_data_count_buff==mk.lcd_data_count)||(mk.lcd_data_count==0))
35
                        if (debug_data_count_buff==mk.debug_data_count)
37
                            mk.LCD.trigger_LCD();
-
 
38
               
-
 
39
                        debug_data_count_buff=mk.debug_data_count;
36
                            mk.close_connections(false);
40
                        lcd_data_count_buff=mk.lcd_data_count;
37
                        debug_data_count_buff=mk.debug_data_count;
41
                       
38
                        if (mk.version.major==-1)
-
 
39
                            mk.get_version();
-
 
Line 40... Line -...
40
                        if (mk.lcd_data_count==0)
-
 
41
                            mk.LCD.trigger_LCD();
42
                        if (mk.version.major==-1)
42
                       
43
                            mk.get_version();
Line 43... Line 44...
43
                    }
44
                       
-
 
45
                        if (mk.params.field[0]==-1)
Line 44... Line 46...
44
                else
46
                            mk.get_params(1);
45
                    {
47