Skip to content

Commit 2497a00

Browse files
committed
.
1 parent 9d5f628 commit 2497a00

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/cli/cli.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void cli_po() {
137137
Serial.printf("rcl.roll:%+.2f\t", rcl.roll);
138138
Serial.printf("ahr.gx:%+.2f\t", ahr.gx);
139139
Serial.printf("ahr.ax:%+.2f\t", ahr.ax);
140-
Serial.printf("ahr.mx:%+.2f\t", ahr.mx);
140+
Serial.printf("mag.mx:%+.2f\t", mag.mx);
141141
Serial.printf("ahr.roll:%+.1f\t", ahr.roll);
142142
Serial.printf("pid.roll:%+.3f\t", pid.roll);
143143
Serial.printf("out.%c%d:%1.0f\t", out.type(0), 0, 100*out.get_output(0));
@@ -181,7 +181,7 @@ static void cli_pacc() {
181181
}
182182

183183
static void cli_pmag() {
184-
Serial.printf("mx:%+.2f\tmy:%+.2f\tmz:%+.2f\tmtot:%+.2f\t", ahr.mx, ahr.my, ahr.mz, sqrtf(ahr.mx*ahr.mx + ahr.my*ahr.my + ahr.mz*ahr.mz));
184+
Serial.printf("mx:%+.2f\tmy:%+.2f\tmz:%+.2f\tmtot:%+.2f\t", mag.mx, mag.my, mag.mz, sqrtf(mag.mx*mag.mx + mag.my*mag.my + mag.mz*mag.mz));
185185
}
186186

187187
static void cli_pahr() {

src/madflight.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ void madflight_setup() {
295295
mag.config.i2c_bus = hal_get_i2c_bus(cfg.mag_i2c_bus); //i2c bus
296296
mag.config.i2c_adr = cfg.mag_i2c_adr; //i2c address. 0=default address
297297
mag.config.sample_rate = 100; //sample rate [Hz]
298-
mag.config.mag_cal_x = &(cfg.mag_cal_x); //mag offset[3] [adc_lsb]
299-
mag.config.mag_cal_sx = &(cfg.mag_cal_sx); //mag scale[3] [uT/adc_lsb]
300-
mag.config.mag_align = &(cfg.mag_align); //alignment
298+
mag.config.mag_cal_x = &(cfg.mag_cal_x); //mag offset[3] (by reference)
299+
mag.config.mag_cal_sx = &(cfg.mag_cal_sx); //mag scale[3] (by reference)
300+
mag.config.mag_align = &(cfg.mag_align); //alignment (by reference)
301301
mag.setup();
302302

303303
// BAT - Battery Monitor

src/mag/mag.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ void Mag::cli_calibrate() {
184184
// finds bias and scale factor calibration for the magnetometer, the sensor should be rotated in a figure 8 motion until complete
185185
// Note: Earth's field ranges between approximately 25 and 65 uT. (Europe & USA: 45-55 uT, inclination 50-70 degrees)
186186
bool Mag::_calibrate(float bias[3], float scale[3]) {
187-
const int sample_interval = 10000; //in us
188187
const int maxCounts = 1000; //sample for at least 10 seconds @ 100Hz
189188
const float count_reduction_factor = 0.7; // reduce counter when a min/max changed by at least 10% of current min-max range
190189

0 commit comments

Comments
 (0)