fix functions that were defined outside of RAK4631 to build on other variants

This commit is contained in:
Dan Welch 2024-12-26 11:28:43 -07:00
parent 459bf65648
commit 962ca6d524
2 changed files with 35 additions and 34 deletions

View File

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

View File

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