Skip to content

Commit

Permalink
Fix build on RAK4631_eth_gw
Browse files Browse the repository at this point in the history
- exclude all compass heading updates on variant without screen
  • Loading branch information
danwelch3 committed Dec 12, 2024
1 parent 1d6ea97 commit 2f7e479
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/motion/BMX160Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bool BMX160Sensor::init()

int32_t BMX160Sensor::runOnce()
{
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
sBmx160SensorData_t magAccel;
sBmx160SensorData_t gAccel;

Expand All @@ -33,13 +34,11 @@ int32_t BMX160Sensor::runOnce()

if (doCalibration) {

#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
if (!showingScreen) {
powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration
showingScreen = true;
screen->startAlert((FrameCallback)drawFrameCalibration);
}
#endif

if (magAccel.x > highestX)
highestX = magAccel.x;
Expand All @@ -66,7 +65,6 @@ int32_t BMX160Sensor::runOnce()
// lowestY, highestY, lowestZ, highestZ);
}

#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
int highestRealX = highestX - (highestX + lowestX) / 2;

magAccel.x -= (highestX + lowestX) / 2;
Expand Down Expand Up @@ -114,13 +112,12 @@ int32_t BMX160Sensor::runOnce()

void BMX160Sensor::calibrate(uint16_t forSeconds)
{

#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
LOG_DEBUG("BMX160 calibration started for %is", forSeconds);

doCalibration = true;
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
endCalibrationAt = millis() + calibrateFor;
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
screen->setEndCalibration(endCalibrationAt);
#endif
}
Expand Down

0 comments on commit 2f7e479

Please sign in to comment.