AP_Compass: Scale adjusted QMC5883L

geändert:       libraries/AP_Compass/AP_Compass_QMC5883L.cpp
This commit is contained in:
Jonny Roeker 2024-05-25 17:42:40 +02:00
parent 8a58affe24
commit 17743dc413
1 changed files with 13 additions and 11 deletions

View File

@ -27,6 +27,7 @@
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL/utility/sparse-endian.h>
#include <AP_Math/AP_Math.h>
#include <GCS_MAVLink/GCS.h>
#define QMC5883L_REG_CONF1 0x09
#define QMC5883L_REG_CONF2 0x0A
@ -99,9 +100,9 @@ bool AP_Compass_QMC5883L::init()
goto fail;
}
/* Registers 0x20 and 0x21 are not documented in the data sheet and do not show any function during operation */
if (!_dev->write_register(0x0B, 0x01)||
!_dev->write_register(0x20, 0x40)||
!_dev->write_register(0x21, 0x01)||
!_dev->write_register(QMC5883L_REG_CONF1,
QMC5883L_MODE_CONTINUOUS|
QMC5883L_ODR_100HZ|
@ -165,7 +166,8 @@ void AP_Compass_QMC5883L::timer()
le16_t rz;
} buffer;
const float range_scale = 1000.0f / 3000.0f;
/* Most modules deliver a value four times higher */
const float range_scale = 1000.0f / (3000.0f * 4.0f);
uint8_t status;
if(!_dev->read_registers(QMC5883L_REG_STATUS,&status,1)){