Cleanup for 20948 compass

This commit is contained in:
Jonathan Bennett 2025-05-05 21:18:33 -05:00
parent d6958b68d6
commit bf0a5ca83d
2 changed files with 7 additions and 8 deletions

View File

@ -1300,7 +1300,8 @@ void setup()
LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap());
LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram());
#endif
accelerometerThread->calibrate(30);
if (accelerometerThread)
accelerometerThread->calibrate(30);
}
#endif
uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes)

View File

@ -88,18 +88,16 @@ int32_t ICM20948Sensor::runOnce()
// lowestY, highestY, lowestZ, highestZ);
}
int highestRealX = highestX - (highestX + lowestX) / 2;
magX -= (highestX + lowestX) / 2;
magY -= (highestY + lowestY) / 2;
magZ -= (highestZ + lowestZ) / 2;
FusionVector ga, ma;
ga.axis.x = -(sensor->agmt.acc.axes.x); // default location for the BMX160 is on the rear of the board
ga.axis.x = (sensor->agmt.acc.axes.x);
ga.axis.y = -(sensor->agmt.acc.axes.y);
ga.axis.z = (sensor->agmt.acc.axes.z);
ma.axis.x = -magX;
ma.axis.y = -magY;
ma.axis.z = magZ * 3;
ga.axis.z = -(sensor->agmt.acc.axes.z);
ma.axis.x = magX;
ma.axis.y = magY;
ma.axis.z = magZ;
// If we're set to one of the inverted positions
if (config.display.compass_orientation > meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270) {