forked from Archive/PX4-Autopilot
Reset excitement mode for hmc5883 sensor before applying a new one to avoid getting reserved 11 bits set in case of a set_excitement(1) call following a set_excitement(-1) call.
This commit is contained in:
parent
9e099b42fa
commit
690843c53a
|
@ -1283,14 +1283,13 @@ int HMC5883::set_excitement(unsigned enable)
|
|||
if (OK != ret)
|
||||
perf_count(_comms_errors);
|
||||
|
||||
_conf_reg &= ~0x03; // reset previous excitement mode
|
||||
if (((int)enable) < 0) {
|
||||
_conf_reg |= 0x01;
|
||||
|
||||
} else if (enable > 0) {
|
||||
_conf_reg |= 0x02;
|
||||
|
||||
} else {
|
||||
_conf_reg &= ~0x03;
|
||||
}
|
||||
|
||||
// ::printf("set_excitement enable=%d regA=0x%x\n", (int)enable, (unsigned)_conf_reg);
|
||||
|
|
Loading…
Reference in New Issue