Rev 23 | Rev 26 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 23 | Rev 25 | ||
---|---|---|---|
Line 195... | Line 195... | ||
195 | } |
195 | } |
Line 196... | Line 196... | ||
196 | 196 | ||
197 | // calibration state machine |
197 | // calibration state machine |
198 | switch(cal) |
198 | switch(cal) |
199 | { |
- | |
200 | case 0: // no calibration |
- | |
201 | break; |
- | |
202 | 199 | { |
|
203 | case 1: // 1st step of calibration |
200 | case 1: // 1st step of calibration |
204 | // initialize ranges |
201 | // initialize ranges |
205 | // used to change the orientation of the MK3MAG in the horizontal plane |
202 | // used to change the orientation of the MK3MAG in the horizontal plane |
206 | Xmin = 10000; |
203 | Xmin = 10000; |
Line 229... | Line 226... | ||
229 | if(UncalMagnetZ > Zmax) Zmax = UncalMagnetZ; |
226 | if(UncalMagnetZ > Zmax) Zmax = UncalMagnetZ; |
230 | break; |
227 | break; |
Line 231... | Line 228... | ||
231 | 228 | ||
232 | case 5: |
229 | case 5: |
233 | // Save values |
230 | // Save values |
234 | if(cal != calold) // avoid continously wrinting of eeprom! |
231 | if(cal != calold) // avoid continously writing of eeprom! |
235 | { |
232 | { |
236 | Calibration.X.Range = Xmax - Xmin; |
233 | Calibration.X.Range = Xmax - Xmin; |
237 | Calibration.X.Offset = (Xmin + Xmax) / 2; |
234 | Calibration.X.Offset = (Xmin + Xmax) / 2; |
238 | Calibration.Y.Range = Ymax - Ymin; |
235 | Calibration.Y.Range = Ymax - Ymin; |