Rev 339 | Rev 360 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 339 | Rev 342 | ||
---|---|---|---|
Line 231... | Line 231... | ||
231 | // polling of version info |
231 | // polling of version info |
232 | repeat = 0; |
232 | repeat = 0; |
233 | do |
233 | do |
234 | { |
234 | { |
235 | MK3MAG_SendCommand(MK3MAG_CMD_VERSION); |
235 | MK3MAG_SendCommand(MK3MAG_CMD_VERSION); |
- | 236 | if(Version_HW > 11) timeout = SetDelay(100); |
|
236 | timeout = SetDelay(250); |
237 | else timeout = SetDelay(250); |
- | 238 | ||
237 | do |
239 | do |
238 | { |
240 | { |
239 | if (MK3MAG_Version.Major != 0xFF) break; // break loop on success |
241 | if (MK3MAG_Version.Major != 0xFF) break; // break loop on success |
240 | }while (!CheckDelay(timeout)); |
242 | }while (!CheckDelay(timeout)); |
241 | UART1_PutString("."); |
243 | UART1_PutString("."); |
Line 289... | Line 291... | ||
289 | { |
291 | { |
290 | case 1: |
292 | case 1: |
291 | if(last_state != Compass_CalState) |
293 | if(last_state != Compass_CalState) |
292 | { |
294 | { |
293 | UART1_PutString("\r\nMK3Mag calibration\n\r"); |
295 | UART1_PutString("\r\nMK3Mag calibration\n\r"); |
- | 296 | if(EarthMagneticStrengthTheoretic) |
|
- | 297 | { |
|
- | 298 | MinCaclibration = (MinCaclibration * EarthMagneticStrengthTheoretic) / 50; |
|
- | 299 | sprintf(msg, "Earth field on your location should be: %iuT\r\n",EarthMagneticStrengthTheoretic); |
|
- | 300 | UART1_PutString(msg); |
|
- | 301 | } |
|
- | 302 | else UART1_PutString("without GPS\n\r"); |
|
294 | } |
303 | } |
295 | - | ||
296 | x_max = -30000; y_max = -30000; z_max = -30000; |
304 | x_max = -30000; y_max = -30000; z_max = -30000; |
297 | x_min = 30000; y_min = 30000; z_min = 30000; |
305 | x_min = 30000; y_min = 30000; z_min = 30000; |
298 | break; |
306 | break; |
Line 299... | Line 307... | ||
299 | 307 | ||
Line 311... | Line 319... | ||
311 | case 5: |
319 | case 5: |
312 | if(last_state == Compass_CalState) break; |
320 | if(last_state == Compass_CalState) break; |
313 | if(((x_max - x_min) > MinCaclibration) && ((y_max - y_min) > MinCaclibration) && ((z_max - z_min) > MinCaclibration)) |
321 | if(((x_max - x_min) > MinCaclibration) && ((y_max - y_min) > MinCaclibration) && ((z_max - z_min) > MinCaclibration)) |
314 | { |
322 | { |
315 | BeepTime = 2500; |
323 | BeepTime = 2500; |
316 | UART1_PutString("\r\n Calibration okay\n\r"); |
324 | UART1_PutString("\r\n-> Calibration okay <-\n\r"); |
317 | } |
325 | } |
318 | else |
326 | else |
319 | { |
327 | { |
320 | UART1_PutString("\r\nCalibration FAILED - Values too low: "); |
328 | UART1_PutString("\r\nCalibration FAILED - Values too low: "); |
321 | if((x_max - x_min) < MinCaclibration) UART1_PutString("X! "); |
329 | if((x_max - x_min) < MinCaclibration) UART1_PutString("X! "); |
322 | if((y_max - y_min) < MinCaclibration) UART1_PutString("y! "); |
330 | if((y_max - y_min) < MinCaclibration) UART1_PutString("Y! "); |
323 | if((z_max - z_min) < MinCaclibration) UART1_PutString("Z! "); |
331 | if((z_max - z_min) < MinCaclibration) UART1_PutString("Z! "); |
324 | UART1_PutString("\r\n"); |
332 | UART1_PutString("\r\n"); |
325 | sprintf(msg, "Minimum is: %i \r\n",MinCaclibration); |
- | |
326 | } |
333 | } |
327 | UART1_PutString(msg); |
334 | UART1_PutString(msg); |
328 | sprintf(msg, "\r\nX: (%i - %i = %i)\r\n",x_max,x_min,x_max - x_min); |
335 | sprintf(msg, "\r\nX: (%i - %i = %i)\r\n",x_max,x_min,x_max - x_min); |
329 | UART1_PutString(msg); |
336 | UART1_PutString(msg); |
330 | sprintf(msg, "Y: (%i - %i = %i)\r\n",y_max,y_min,y_max - y_min); |
337 | sprintf(msg, "Y: (%i - %i = %i)\r\n",y_max,y_min,y_max - y_min); |
331 | UART1_PutString(msg); |
338 | UART1_PutString(msg); |
332 | sprintf(msg, "Z: (%i - %i = %i)\r\n",z_max,z_min,z_max - z_min); |
339 | sprintf(msg, "Z: (%i - %i = %i)\r\n",z_max,z_min,z_max - z_min); |
333 | UART1_PutString(msg); |
340 | UART1_PutString(msg); |
334 | - | ||
- | 341 | sprintf(msg, "(Minimum ampilitude is: %i)\r\n",MinCaclibration); |
|
- | 342 | UART1_PutString(msg); |
|
335 | break; |
343 | break; |
336 | default: |
344 | default: |
337 | break; |
345 | break; |
338 | } |
346 | } |
339 | last_state = Compass_CalState; |
347 | last_state = Compass_CalState; |