mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-01 15:40:49 +00:00
Further fix compass calibration (#8740)
* Update calibration logic for ICM20948 sensor Initialize highest and lowest magnetic values based on sensor data readiness during calibration. * Refactor BMX160 calibration to use magnetometer data Update calibration logic to initialize highest and lowest values using magnetometer data. * Add missed viable defines in ::calibrate()
This commit is contained in:
@@ -115,8 +115,13 @@ int32_t BMX160Sensor::runOnce()
|
||||
void BMX160Sensor::calibrate(uint16_t forSeconds)
|
||||
{
|
||||
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
|
||||
sBmx160SensorData_t magAccel;
|
||||
sBmx160SensorData_t gAccel;
|
||||
LOG_DEBUG("BMX160 calibration started for %is", forSeconds);
|
||||
highestX = 0, lowestX = 0, highestY = 0, lowestY = 0, highestZ = 0, lowestZ = 0;
|
||||
sensor.getAllData(&magAccel, NULL, &gAccel);
|
||||
highestX = magAccel.x, lowestX = magAccel.x;
|
||||
highestY = magAccel.y, lowestY = magAccel.y;
|
||||
highestZ = magAccel.z, lowestZ = magAccel.z;
|
||||
|
||||
doCalibration = true;
|
||||
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
|
||||
|
||||
Reference in New Issue
Block a user