Initiate magnetometer based compass calibration from button presses (#5553)

* Initiate magenetometer based compass calibration from button presses

- only active for BMX160 accelerometers on RAK_4631
- replace automatic calibration on power on with button triggered
  calibration
- set 5 presses to trigger 30s calibration
- set 6 presses to trigger 60s calibration (useful if unit is not
  handheld, ie vehicle mounted)
- show calibration time remaining on calibration alert screen

* Fix non RAK 4631 builds

- exclude changes from non RAK 4631 builds
- remove calls to screen when not present

* Fix build on RAK4631_eth_gw

- exclude all compass heading updates on variant without screen

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
danwelch3
2025-01-16 16:22:27 -07:00
committed by GitHub
parent 7acd72ede1
commit a085614aaa
7 changed files with 71 additions and 6 deletions

View File

@@ -40,6 +40,8 @@ class MotionSensor
// Refer to /src/concurrency/OSThread.h for more information
inline virtual int32_t runOnce() { return MOTION_SENSOR_CHECK_INTERVAL_MS; };
virtual void calibrate(uint16_t forSeconds){};
protected:
// Turn on the screen when a tap or motion is detected
virtual void wakeScreen();
@@ -53,6 +55,10 @@ class MotionSensor
#endif
ScanI2C::FoundDevice device;
// Do calibration if true
bool doCalibration = false;
uint32_t endCalibrationAt = 0;
};
namespace MotionSensorI2C