From 4d8a414e087c73ff8a98d9d5d432780d5bbed5da Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 13 Oct 2026 19:18:34 -1000 Subject: [PATCH] Keep the accel and gyro scale tables in flash too --- esphome/components/bmi270/bmi270.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/bmi270/bmi270.cpp b/esphome/components/bmi270/bmi270.cpp index ef71eed7ba1..18e9ef20cb2 100644 --- a/esphome/components/bmi270/bmi270.cpp +++ b/esphome/components/bmi270/bmi270.cpp @@ -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;