Keep the accel and gyro scale tables in flash too

This commit is contained in:
J. Nick Koston
2026-10-13 19:18:34 -10:00
parent 8dae785300
commit 4d8a414e08
+3 -2
View File
@@ -318,7 +318,8 @@ bool BMI270Component::update_data(motion::MotionData &data) {
}
// Scale factor: LSB/g depends on range
// raw is a signed 16-bit value; full-scale = range_g * 2^15 lsb
static constexpr float ACCEL_SCALE[] = {
// In PROGMEM; each read is a 32-bit load, which is safe from flash on ESP8266
static constexpr float ACCEL_SCALE[] PROGMEM = {
2.0f / 32768.0f,
4.0f / 32768.0f,
8.0f / 32768.0f,
@@ -332,7 +333,7 @@ bool BMI270Component::update_data(motion::MotionData &data) {
// Gyroscope: registers 0x12–0x17 (6 bytes)
// Scale: full-scale range / 2^15
static constexpr float GYRO_SCALE[] = {
static constexpr float GYRO_SCALE[] PROGMEM = {
2000.0f / 32768.0f, 1000.0f / 32768.0f, 500.0f / 32768.0f, 250.0f / 32768.0f, 125.0f / 32768.0f,
};
static constexpr uint8_t GYR_OFFS = BMI270_REG_DATA_14 - BMI270_REG_DATA_8;