@@ -223,7 +223,6 @@ static filterResult filter(stateFilter *self, stateEstimation *state)
223223 UNSET_MASK (state -> updated , SENSORUPDATES_vel );
224224 UNSET_MASK (state -> updated , SENSORUPDATES_attitude );
225225 UNSET_MASK (state -> updated , SENSORUPDATES_gyro );
226- UNSET_MASK (state -> updated , SENSORUPDATES_mag );
227226 return FILTERRESULT_OK ;
228227 }
229228
@@ -387,15 +386,18 @@ static filterResult filter(stateFilter *self, stateEstimation *state)
387386 local_down [2 ] *= MagStrength ;
388387 rot_mult (R , local_down , this -> work .mag );
389388 }
389+ // From Eric: "exporting it in MagState was meant for debugging, but I think it makes a
390+ // lot of sense to have a "corrected" magnetometer reading available in the system."
391+ // TODO: Should move above calc to filtermag, updating from here cause trouble with the state->MagStatus (LP-534)
390392 // debug rotated mags
391- state -> mag [0 ] = this -> work .mag [0 ];
392- state -> mag [1 ] = this -> work .mag [1 ];
393- state -> mag [2 ] = this -> work .mag [2 ];
394- state -> updated |= SENSORUPDATES_mag ;
395- } else {
396- // mag state is delayed until EKF processed it, allows overriding/debugging magnetometer estimate
397- UNSET_MASK (state -> updated , SENSORUPDATES_mag );
398- }
393+ // state->mag[0] = this->work.mag[0];
394+ // state->mag[1] = this->work.mag[1];
395+ // state->mag[2] = this->work.mag[2];
396+ // state->updated |= SENSORUPDATES_mag;
397+ } // else {
398+ // mag state is delayed until EKF processed it, allows overriding/debugging magnetometer estimate
399+ // UNSET_MASK(state->updated, SENSORUPDATES_mag);
400+ // }
399401
400402 if (IS_SET (this -> work .updated , SENSORUPDATES_baro )) {
401403 sensors |= BARO_SENSOR ;
0 commit comments