mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-07 15:12:45 +00:00
Compass is more than just RAK4631
This commit is contained in:
parent
8d464bb07e
commit
d6958b68d6
@ -255,7 +255,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)
|
#if !MESHTASTIC_EXCLUDE_SCREEN
|
||||||
// 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) {
|
||||||
|
@ -105,7 +105,7 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr;
|
|||||||
#include "AmbientLightingThread.h"
|
#include "AmbientLightingThread.h"
|
||||||
#include "PowerFSMThread.h"
|
#include "PowerFSMThread.h"
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
||||||
#include "motion/AccelerometerThread.h"
|
#include "motion/AccelerometerThread.h"
|
||||||
AccelerometerThread *accelerometerThread = nullptr;
|
AccelerometerThread *accelerometerThread = nullptr;
|
||||||
#endif
|
#endif
|
||||||
@ -692,7 +692,7 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_STM32WL)
|
||||||
auto acc_info = i2cScanner->firstAccelerometer();
|
auto acc_info = i2cScanner->firstAccelerometer();
|
||||||
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
|
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
|
||||||
LOG_DEBUG("acc_info = %i", acc_info.type);
|
LOG_DEBUG("acc_info = %i", acc_info.type);
|
||||||
@ -807,7 +807,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C
|
#if !MESHTASTIC_EXCLUDE_I2C
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_STM32WL)
|
||||||
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
||||||
accelerometerThread = new AccelerometerThread(acc_info.type);
|
accelerometerThread = new AccelerometerThread(acc_info.type);
|
||||||
}
|
}
|
||||||
@ -1300,6 +1300,7 @@ void setup()
|
|||||||
LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap());
|
LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap());
|
||||||
LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram());
|
LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram());
|
||||||
#endif
|
#endif
|
||||||
|
accelerometerThread->calibrate(30);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes)
|
uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes)
|
||||||
|
@ -58,7 +58,7 @@ extern UdpMulticastHandler *udpHandler;
|
|||||||
// Global Screen singleton.
|
// Global Screen singleton.
|
||||||
extern graphics::Screen *screen;
|
extern graphics::Screen *screen;
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
||||||
#include "motion/AccelerometerThread.h"
|
#include "motion/AccelerometerThread.h"
|
||||||
extern AccelerometerThread *accelerometerThread;
|
extern AccelerometerThread *accelerometerThread;
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "modules/PositionModule.h"
|
#include "modules/PositionModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
||||||
#include "motion/AccelerometerThread.h"
|
#include "motion/AccelerometerThread.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
||||||
|
|
||||||
#include "../concurrency/OSThread.h"
|
#include "../concurrency/OSThread.h"
|
||||||
#ifdef HAS_BMA423
|
#ifdef HAS_BMA423
|
||||||
@ -81,14 +81,6 @@ class AccelerometerThread : public concurrency::OSThread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RAK_4631
|
|
||||||
if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) {
|
|
||||||
LOG_DEBUG("AccelerometerThread Disable due to no interested configurations");
|
|
||||||
disable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (device.type) {
|
switch (device.type) {
|
||||||
#ifdef HAS_BMA423
|
#ifdef HAS_BMA423
|
||||||
case ScanI2C::DeviceType::BMA423:
|
case ScanI2C::DeviceType::BMA423:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
BMX160Sensor::BMX160Sensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {}
|
BMX160Sensor::BMX160Sensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {}
|
||||||
|
|
||||||
#if defined(RAK_4631) && !defined(RAK2560) && __has_include(<Rak_BMX160.h>)
|
#if !defined(RAK2560) && __has_include(<Rak_BMX160.h>)
|
||||||
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
|
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
|
||||||
|
|
||||||
// screen is defined in main.cpp
|
// screen is defined in main.cpp
|
||||||
|
@ -31,7 +31,7 @@ ScanI2C::I2CPort MotionSensor::devicePort()
|
|||||||
return device.address.port;
|
return device.address.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN
|
#if !MESHTASTIC_EXCLUDE_SCREEN
|
||||||
void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
// int x_offset = display->width() / 2;
|
// int x_offset = display->width() / 2;
|
||||||
|
@ -49,7 +49,7 @@ class MotionSensor
|
|||||||
// Register a button press when a double-tap is detected
|
// Register a button press when a double-tap is detected
|
||||||
virtual void buttonPress();
|
virtual void buttonPress();
|
||||||
|
|
||||||
#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN
|
#if !MESHTASTIC_EXCLUDE_SCREEN
|
||||||
// draw an OLED frame (currently only used by the RAK4631 BMX160 sensor)
|
// 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 drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user