Subversion Repositories Projects

Rev

Rev 229 | Rev 269 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 229 Rev 265
Line 105... Line 105...
105
               
105
               
Line 106... Line 106...
106
 
106
 
-
 
107
    }
-
 
108
 
-
 
109
    int info_from_debug_set=-1;
-
 
110
    int volt_timeout=0;
107
    }
111
 
108
 
112
    public int last_alt=-1;
109
    int info_from_debug_set=-1;
113
 
110
    public void run()
114
    public void run()
111
    {
115
    {
112
        while(true)
116
        while(true)
113
            {
-
 
Line 114... Line 117...
114
                if (mk.connected&&(canvas.settings.do_sound)&&(mk.debug_data.UBatt()!=-1)&&(!mk.force_disconnect))
117
            {
-
 
118
                if (mk.connected&&(canvas.settings.do_sound)&&(mk.UBatt()!=-1)&&(!mk.force_disconnect))
-
 
119
                    {
-
 
120
       
115
                    {
121
                        if (info_from_debug_set!=mk.stats.debug_data_count)
-
 
122
                            { // only when newdata
-
 
123
                               
116
                        int ubatt=mk.debug_data.UBatt();
124
                                if (canvas.settings.do_volts_sound&&(volt_timeout--<0))
117
               
125
                                    {
118
                        if (info_from_debug_set!=mk.stats.debug_data_count)
126
                                        volt_timeout=delay*10;
Line 119... Line 127...
119
                            {
127
                                        int ubatt=mk.UBatt();
Line 127... Line 135...
127
                                        wait_for_end();
135
                                                wait_for_end();
128
                                        start_playing(""+(ubatt%10));
136
                                                start_playing(""+(ubatt%10));
129
                                        wait_for_end();
137
                                                wait_for_end();
130
                                    }
138
                                            }
131
                                start_playing("volt");
139
                                        start_playing("volt");
-
 
140
                                        wait_for_end();
-
 
141
                                    }
-
 
142
 
-
 
143
                               
-
 
144
 
-
 
145
                                if (canvas.settings.do_altimeter_sound)
-
 
146
                                    {
-
 
147
                                        if (last_alt==-1) last_alt=mk.Alt();
-
 
148
                                        int alt_diff=10;
-
 
149
                               
-
 
150
                                        if (last_alt>mk.Alt()+alt_diff)
-
 
151
                                            {
-
 
152
                                                start_playing("down");
-
 
153
                                                wait_for_end();
-
 
154
                                                last_alt-=alt_diff;
-
 
155
                                            }
-
 
156
                                        if (last_alt<mk.Alt()-alt_diff)
-
 
157
                                           
-
 
158
                                            {
-
 
159
                                                start_playing("up");
-
 
160
                                                wait_for_end();
-
 
161
                                                last_alt+=alt_diff;
-
 
162
                                            }
-
 
163
                                    }
-
 
164
                                else
-
 
165
                                    last_alt=-1;
132
                            }
166
                            }
Line 133... Line 167...
133
       
167
       
Line 134... Line 168...
134
                    }
168
                    }
-
 
169
 
-
 
170
                try {
135
 
171
                    Thread.sleep(100);
136
                try {
172
                    /*
137
                    if (delay<1)
173
                    if (delay<1)
138
                        Thread.sleep(1000);
174
                        Thread.sleep(1000);
-
 
175
                    else
139
                    else
176
                        Thread.sleep(delay*1000);
140
                        Thread.sleep(delay*1000);
177
                    */
Line 141... Line 178...
141
                }
178
                }
142
                catch (Exception e)  {   }
179
                catch (Exception e)  {   }