@@ -133,91 +133,6 @@ private void Initialize()
133
133
WriteRegister ( Bmp180Register . OP_MODE_ADDR , 0x00 ) ;
134
134
}
135
135
136
- /// <summary>
137
- /// Calibrate the magnetometer.
138
- /// Please make sure you are not close to any magnetic field like magnet or phone
139
- /// Please make sure you are moving the magnetometer all over space, rotating it.
140
- /// </summary>
141
- /// <param name="numberOfMeasurements">Number of measurement for the calibration, default is 100</param>
142
- // https://platformio.org/lib/show/12697/M5_BMM150
143
- [ Obsolete ( "Not a reliable way of calibration. Use a calibration determined with MagneticDeviationCorrection instead" ) ]
144
- public void CalibrateMagnetometer ( int numberOfMeasurements = 100 )
145
- {
146
- CalibrateMagnetometer ( null , numberOfMeasurements ) ;
147
- }
148
-
149
- /// <summary>
150
- /// Calibrate the magnetometer.
151
- /// Please make sure you are not close to any magnetic field like magnet or phone
152
- /// Please make sure you are moving the magnetometer all over space, rotating it.
153
- /// </summary>
154
- /// <param name="progress">A progress provider (returns a value in percent)</param>
155
- /// <param name="numberOfMeasurements">Number of measurement for the calibration, default is 100</param>
156
- // https://platformio.org/lib/show/12697/M5_BMM150
157
- [ Obsolete ( "Not a reliable way of calibration. Use a calibration determined with MagneticDeviationCorrection instead" ) ]
158
- public void CalibrateMagnetometer ( IProgress < double > ? progress , int numberOfMeasurements )
159
- {
160
- Vector3 mag_min = new Vector3 ( ) { X = 9000 , Y = 9000 , Z = 30000 } ;
161
- Vector3 mag_max = new Vector3 ( ) { X = - 9000 , Y = - 9000 , Z = - 30000 } ;
162
- Vector3 rawMagnetometerData ;
163
- if ( numberOfMeasurements <= 0 )
164
- {
165
- throw new ArgumentOutOfRangeException ( nameof ( numberOfMeasurements ) , "The number of measurements must be > 0" ) ;
166
- }
167
-
168
- for ( int i = 0 ; i < numberOfMeasurements ; i ++ )
169
- {
170
- try
171
- {
172
- rawMagnetometerData = ReadMagnetometerWithoutCorrection ( ) ;
173
-
174
- if ( rawMagnetometerData . X != 0 )
175
- {
176
- mag_min . X = ( rawMagnetometerData . X < mag_min . X ) ? rawMagnetometerData . X : mag_min . X ;
177
- mag_max . X = ( rawMagnetometerData . X > mag_max . X ) ? rawMagnetometerData . X : mag_max . X ;
178
- }
179
-
180
- if ( rawMagnetometerData . Y != 0 )
181
- {
182
- mag_max . Y = ( rawMagnetometerData . Y > mag_max . Y ) ? rawMagnetometerData . Y : mag_max . Y ;
183
- mag_min . Y = ( rawMagnetometerData . Y < mag_min . Y ) ? rawMagnetometerData . Y : mag_min . Y ;
184
- }
185
-
186
- if ( rawMagnetometerData . Z != 0 )
187
- {
188
- mag_min . Z = ( rawMagnetometerData . Z < mag_min . Z ) ? rawMagnetometerData . Z : mag_min . Z ;
189
- mag_max . Z = ( rawMagnetometerData . Z > mag_max . Z ) ? rawMagnetometerData . Z : mag_max . Z ;
190
- }
191
-
192
- // Wait for 100ms until next reading
193
- Wait ( 100 ) ;
194
- }
195
- catch
196
- {
197
- // skip this reading
198
- }
199
-
200
- if ( progress != null )
201
- {
202
- double percentDone = ( ( double ) i / numberOfMeasurements ) * 100.0 ;
203
- progress . Report ( percentDone ) ;
204
- }
205
- }
206
-
207
- if ( progress != null )
208
- {
209
- progress . Report ( 100.0 ) ;
210
- }
211
-
212
- // Refresh CalibrationCompensation vector
213
- CalibrationCompensation = new Vector3 ( )
214
- {
215
- X = ( mag_max . X + mag_min . X ) / 2 ,
216
- Y = ( mag_max . Y + mag_min . Y ) / 2 ,
217
- Z = ( mag_max . Z + mag_min . Z ) / 2
218
- } ;
219
- }
220
-
221
136
/// <summary>
222
137
/// True if there is a data to read
223
138
/// </summary>
0 commit comments