From 8db96c17ea83adc7bc4ad2e80f5ab1cc9c0c09dd Mon Sep 17 00:00:00 2001 From: Dan Welch Date: Thu, 12 Dec 2024 14:17:54 -0700 Subject: [PATCH] Fix non RAK 4631 builds - exclude changes from non RAK 4631 builds - remove calls to screen when not present --- src/ButtonThread.cpp | 2 ++ src/motion/BMX160Sensor.cpp | 5 +++++ src/motion/MotionSensor.h | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 664c3560f..5175a2680 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -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) { @@ -203,6 +204,7 @@ int32_t ButtonThread::runOnce() accelerometerThread->calibrate(60); } break; +#endif // No valid multipress action default: break; diff --git a/src/motion/BMX160Sensor.cpp b/src/motion/BMX160Sensor.cpp index 8e483fc53..69485cedd 100755 --- a/src/motion/BMX160Sensor.cpp +++ b/src/motion/BMX160Sensor.cpp @@ -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; @@ -103,6 +105,7 @@ int32_t BMX160Sensor::runOnce() heading += 270; break; } + screen->setHeading(heading); #endif @@ -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 diff --git a/src/motion/MotionSensor.h b/src/motion/MotionSensor.h index 1848c472a..1f4d093bf 100755 --- a/src/motion/MotionSensor.h +++ b/src/motion/MotionSensor.h @@ -58,7 +58,7 @@ class MotionSensor // Do calibration if true bool doCalibration = false; - uint32_t endCalibrationAt; + uint32_t endCalibrationAt = 0; }; namespace MotionSensorI2C