Skip to content

Commit

Permalink
Fix non RAK 4631 builds
Browse files Browse the repository at this point in the history
- exclude changes from non RAK 4631 builds
- remove calls to screen when not present
  • Loading branch information
danwelch3 committed Dec 12, 2024
1 parent 65d5e93 commit 1d6ea97
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ButtonThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ int32_t ButtonThread::runOnce()
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
break;
#endif
#if defined(RAK_4631)
// 5 clicks: start accelerometer/magenetometer calibration for 30 seconds
case 5:
if (accelerometerThread) {
Expand All @@ -203,6 +204,7 @@ int32_t ButtonThread::runOnce()
accelerometerThread->calibrate(60);
}
break;
#endif
// No valid multipress action
default:
break;
Expand Down
5 changes: 5 additions & 0 deletions src/motion/BMX160Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ 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 Down Expand Up @@ -103,6 +105,7 @@ int32_t BMX160Sensor::runOnce()
heading += 270;
break;
}

screen->setHeading(heading);
#endif

Expand All @@ -117,7 +120,9 @@ void BMX160Sensor::calibrate(uint16_t forSeconds)
doCalibration = true;
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
endCalibrationAt = millis() + calibrateFor;
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
screen->setEndCalibration(endCalibrationAt);
#endif
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion src/motion/MotionSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MotionSensor

// Do calibration if true
bool doCalibration = false;
uint32_t endCalibrationAt;
uint32_t endCalibrationAt = 0;
};

namespace MotionSensorI2C
Expand Down

0 comments on commit 1d6ea97

Please sign in to comment.