diff --git a/src/motion/MotionSensor.cpp b/src/motion/MotionSensor.cpp index db679f4a1..f69389c66 100755 --- a/src/motion/MotionSensor.cpp +++ b/src/motion/MotionSensor.cpp @@ -31,6 +31,29 @@ ScanI2C::I2CPort MotionSensor::devicePort() return device.address.port; } +#if !MESHTASTIC_EXCLUDE_POWER_FSM +void MotionSensor::wakeScreen() +{ + if (powerFSM.getState() == &stateDARK) { + LOG_DEBUG("Motion wakeScreen detected"); + powerFSM.trigger(EVENT_INPUT); + } +} + +void MotionSensor::buttonPress() +{ + LOG_DEBUG("Motion buttonPress detected"); + powerFSM.trigger(EVENT_PRESS); +} + +#else + +void MotionSensor::wakeScreen() {} + +void MotionSensor::buttonPress() {} + +#endif + #if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { @@ -86,30 +109,6 @@ void MotionSensor::drawFrameGyroCalibration(OLEDDisplay *display, OLEDDisplayUiS display->setFont(FONT_SMALL); display->drawString(x, y + 40, timeRemainingBuffer); } -#endif - -#if !MESHTASTIC_EXCLUDE_POWER_FSM -void MotionSensor::wakeScreen() -{ - if (powerFSM.getState() == &stateDARK) { - LOG_DEBUG("Motion wakeScreen detected"); - powerFSM.trigger(EVENT_INPUT); - } -} - -void MotionSensor::buttonPress() -{ - LOG_DEBUG("Motion buttonPress detected"); - powerFSM.trigger(EVENT_PRESS); -} - -#else - -void MotionSensor::wakeScreen() {} - -void MotionSensor::buttonPress() {} - -#endif void MotionSensor::getMagCalibrationData(float x, float y, float z) { @@ -336,4 +335,6 @@ void MotionSensor::saveState() #endif } +#endif + #endif \ No newline at end of file diff --git a/src/motion/MotionSensor.h b/src/motion/MotionSensor.h index 5b142b21a..5f5c7b81d 100755 --- a/src/motion/MotionSensor.h +++ b/src/motion/MotionSensor.h @@ -73,13 +73,6 @@ class MotionSensor // Register a button press when a double-tap is detected virtual void buttonPress(); -#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN - // draw an OLED frame (currently only used by the RAK4631 BMX160 sensor) - static void drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); - static void drawFrameGyroWarning(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); - static void drawFrameGyroCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); -#endif - ScanI2C::FoundDevice device; SensorConfig sensorConfig; @@ -96,14 +89,21 @@ class MotionSensor minMaxXYZ magCalibrationMinMax; uint16_t calibrationCount = 0; + const char *configFileName = "/prefs/motionSensor.dat"; + uint8_t sensorState[MAX_STATE_BLOB_SIZE] = {0}; + +#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN + // draw an OLED frame (currently only used by the RAK4631 BMX160 sensor) + static void drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); + static void drawFrameGyroWarning(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); + static void drawFrameGyroCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); + void getMagCalibrationData(float x, float y, float z); void gyroCalibrationWarning(); void getGyroCalibrationData(float g_x, float g_y, float g_z, float a_x, float a_y, float a_z); - - const char *configFileName = "/prefs/motionSensor.dat"; - uint8_t sensorState[MAX_STATE_BLOB_SIZE] = {0}; void loadState(); void saveState(); +#endif }; namespace MotionSensorI2C