Fix non RAK 4631 builds

- exclude changes from non RAK 4631 builds
- remove calls to screen when not present
This commit is contained in:
Dan Welch 2024-12-12 14:17:54 -07:00
parent 4b1db13f25
commit 8db96c17ea
3 changed files with 8 additions and 1 deletions

View File

@ -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;

View File

@ -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

View File

@ -58,7 +58,7 @@ class MotionSensor
// Do calibration if true
bool doCalibration = false;
uint32_t endCalibrationAt;
uint32_t endCalibrationAt = 0;
};
namespace MotionSensorI2C