Rev 266 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 266 | Rev 381 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | 32 | ||
33 | public byte resend_timeout=0; |
33 | public byte resend_timeout=0; |
Line -... | Line 34... | ||
- | 34 | int last_count=0; |
|
- | 35 | ||
34 | int last_count=0; |
36 | |
35 | 37 | ||
36 | 38 | int last_fm_send=-1; |
|
37 | public boolean resend_check(int ref_count) |
39 | public boolean resend_check(int ref_count) |
38 | { |
40 | { |
Line 53... | Line 55... | ||
53 | // public final static int BASE_SLEEP=50; |
55 | // public final static int BASE_SLEEP=50; |
54 | //#else |
56 | //#else |
55 | public final static int BASE_SLEEP=10; |
57 | public final static int BASE_SLEEP=10; |
56 | //#endif |
58 | //#endif |
Line -... | Line 59... | ||
- | 59 | ||
57 | 60 | int intitial_paramset_try=0; |
|
58 | public void run() |
61 | public void run() |
59 | { |
62 | { |
60 | mk.log("starting Watchdog"); |
63 | mk.log("starting Watchdog"); |
61 | // get all params |
64 | // get all params |
Line 64... | Line 67... | ||
64 | while(true) |
67 | while(true) |
65 | { |
68 | { |
66 | try { |
69 | try { |
67 | Thread.sleep(BASE_SLEEP); |
70 | Thread.sleep(BASE_SLEEP); |
68 | // sleeper=BASE_SLEEP; |
71 | // sleeper=BASE_SLEEP; |
69 | if (mk.connected&&(!mk.force_disconnect)) |
72 | if (mk.connected&&(!mk.force_disconnect))//&&(mk.bootloader_stage==BOOTLOADER_STAGE_NONE)) |
70 | { |
73 | { |
71 | - | ||
72 | // mk.log("watchdog pre main loop"); |
74 | // // mk.log("watchdog pre main loop"); |
73 | if (mk.init_bootloader) |
75 | // if (mk.init_bootloader) |
74 | { |
76 | // { |
75 | mk.jump_bootloader(); |
77 | // mk.jump_bootloader(); |
76 | mk.init_bootloader=false; |
78 | // mk.init_bootloader=false; |
77 | } |
79 | // } |
- | 80 | //else |
|
78 | else if ( mk.version.major==-1 ) |
81 | if ( mk.version.major==-1 ) |
79 | mk.get_version(); |
82 | mk.get_version(); |
80 | else if (mk.ufo_prober.is_navi()&&(mk.error_str==null)) |
83 | else if (mk.is_navi()&&(mk.error_str==null)) |
81 | mk.get_error_str(); |
84 | mk.get_error_str(); |
Line 82... | Line 85... | ||
82 | 85 | ||
83 | else if (mk.ufo_prober.is_mk()&&(mk.params.last_parsed_paramset==-1)) |
86 | else if (mk.is_mk()&&(mk.params.last_parsed_paramset==-1)&&(intitial_paramset_try<7)) |
84 | { |
87 | { |
85 | mk.get_params(0xFF-1); |
88 | mk.get_params(0xFF-1); |
86 | Thread.sleep(150); |
- | |
- | 89 | Thread.sleep(150); |
|
87 | 90 | intitial_paramset_try++; |
|
88 | act_paramset=0; // warning - if dropped problem |
91 | act_paramset=0; // warning - if dropped problem |
89 | } |
92 | } |
90 | else switch (mk.user_intent) |
93 | else switch (mk.user_intent) |
91 | { |
94 | { |
Line 163... | Line 166... | ||
163 | mk.LCD.trigger_LCD(); |
166 | mk.LCD.trigger_LCD(); |
Line 164... | Line 167... | ||
164 | 167 | ||
Line 165... | Line 168... | ||
165 | break; |
168 | break; |
166 | 169 | ||
167 | case USER_INTENT_GPSOSD: |
170 | case USER_INTENT_GPSOSD: |
168 | mk.set_gpsosd_interval(1); |
171 | mk.set_gpsosd_interval(mk.primary_abo); |
169 | break; |
172 | break; |
- | 173 | case USER_INTENT_GRAPH: |
|
- | 174 | mk.set_debug_interval(mk.primary_abo); |
|
- | 175 | break; |
|
- | 176 | ||
- | 177 | case USER_INTENT_FOLLOWME: |
|
- | 178 | ||
- | 179 | // once a second |
|
- | 180 | if (last_fm_send!=(System.currentTimeMillis()/1000)) |
|
- | 181 | { |
|
- | 182 | last_fm_send=(int)(System.currentTimeMillis()/1000); |
|
- | 183 | mk.send_follow_me(60); |
|
- | 184 | } |
|
- | 185 | ||
170 | case USER_INTENT_GRAPH: |
186 | |
171 | mk.set_debug_interval(1); |
187 | |
172 | break; |
188 | break; |
173 | 189 | ||
174 | default: |
190 | default: |
175 | // mk.log("uncactched intent " +mk.root.canvas.user_intent ); |
191 | // mk.log("uncactched intent " +mk.root.canvas.user_intent ) |
Line -... | Line 192... | ||
- | 192 | break; |
|
176 | break; |
193 | } |
Line 177... | Line 194... | ||
177 | } |
194 | |
178 | 195 | ||
179 | 196 | ||
180 | 197 | ||
181 | if (bytes_in_count_buff==mk.stats.bytes_in) |
198 | if (bytes_in_count_buff==mk.stats.bytes_in) |
182 | if ((conn_check_timeout++)*BASE_SLEEP>3000) |
199 | if ((conn_check_timeout++)*BASE_SLEEP>3000) |
183 | { |
200 | { |
184 | conn_check_timeout=0; |
201 | conn_check_timeout=0; |
185 | mk.close_connections(false); |
202 | mk.close_connections(false); |
186 | 203 | ||
187 | } |
204 | } |
Line 188... | Line 205... | ||
188 | else |
205 | else |
Line 189... | Line 206... | ||
189 | conn_check_timeout=0; |
206 | conn_check_timeout=0; |