mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-13 14:18:19 +00:00
Persist BMX160 compass calibration
- change updateState function to saveState function for clarity - increase max save size
This commit is contained in:
parent
14561f63a8
commit
bff3cc183d
@ -67,7 +67,7 @@ int32_t BMX160Sensor::runOnce()
|
|||||||
showingScreen = false;
|
showingScreen = false;
|
||||||
screen->endAlert();
|
screen->endAlert();
|
||||||
|
|
||||||
updateState();
|
saveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG_DEBUG("BMX160 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX,
|
// LOG_DEBUG("BMX160 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX,
|
||||||
@ -150,7 +150,7 @@ void BMX160Sensor::loadState()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMX160Sensor::updateState()
|
void BMX160Sensor::saveState()
|
||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
memcpy(&bmx160State, &bmx160Config, sizeof(BMX160Config));
|
memcpy(&bmx160State, &bmx160Config, sizeof(BMX160Config));
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "Fusion/Fusion.h"
|
#include "Fusion/Fusion.h"
|
||||||
#include <Rak_BMX160.h>
|
#include <Rak_BMX160.h>
|
||||||
|
|
||||||
#define BMX160_MAX_STATE_BLOB_SIZE (144) // pad size to allow for additional saved config parameters (accel, gyro, etc)
|
#define BMX160_MAX_STATE_BLOB_SIZE (256) // pad size to allow for additional saved config parameters (accel, gyro, etc)
|
||||||
|
|
||||||
struct xyzFloat {
|
struct xyzFloat {
|
||||||
float x;
|
float x;
|
||||||
@ -38,7 +38,7 @@ class BMX160Sensor : public MotionSensor
|
|||||||
const char *bmx160ConfigFileName = "/prefs/bmx160.dat";
|
const char *bmx160ConfigFileName = "/prefs/bmx160.dat";
|
||||||
uint8_t bmx160State[BMX160_MAX_STATE_BLOB_SIZE] = {0};
|
uint8_t bmx160State[BMX160_MAX_STATE_BLOB_SIZE] = {0};
|
||||||
void loadState();
|
void loadState();
|
||||||
void updateState();
|
void saveState();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BMX160Sensor(ScanI2C::FoundDevice foundDevice);
|
explicit BMX160Sensor(ScanI2C::FoundDevice foundDevice);
|
||||||
|
Loading…
Reference in New Issue
Block a user