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); digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
break; break;
#endif #endif
#if defined(RAK_4631)
// 5 clicks: start accelerometer/magenetometer calibration for 30 seconds // 5 clicks: start accelerometer/magenetometer calibration for 30 seconds
case 5: case 5:
if (accelerometerThread) { if (accelerometerThread) {
@ -203,6 +204,7 @@ int32_t ButtonThread::runOnce()
accelerometerThread->calibrate(60); accelerometerThread->calibrate(60);
} }
break; break;
#endif
// No valid multipress action // No valid multipress action
default: default:
break; break;

View File

@ -33,11 +33,13 @@ int32_t BMX160Sensor::runOnce()
if (doCalibration) { if (doCalibration) {
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
if (!showingScreen) { if (!showingScreen) {
powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration
showingScreen = true; showingScreen = true;
screen->startAlert((FrameCallback)drawFrameCalibration); screen->startAlert((FrameCallback)drawFrameCalibration);
} }
#endif
if (magAccel.x > highestX) if (magAccel.x > highestX)
highestX = magAccel.x; highestX = magAccel.x;
@ -103,6 +105,7 @@ int32_t BMX160Sensor::runOnce()
heading += 270; heading += 270;
break; break;
} }
screen->setHeading(heading); screen->setHeading(heading);
#endif #endif
@ -117,7 +120,9 @@ void BMX160Sensor::calibrate(uint16_t forSeconds)
doCalibration = true; doCalibration = true;
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
endCalibrationAt = millis() + calibrateFor; endCalibrationAt = millis() + calibrateFor;
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
screen->setEndCalibration(endCalibrationAt); screen->setEndCalibration(endCalibrationAt);
#endif
} }
#endif #endif

View File

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