Skip to content

feat(bmm150): heading, tilt compensation, and hard-iron calibration - #313

Merged
eigger merged 5 commits into
masterfrom
feat/bmm150-phase-b
Aug 18, 2026
Merged

feat(bmm150): heading, tilt compensation, and hard-iron calibration#313
eigger merged 5 commits into
masterfrom
feat/bmm150-phase-b

Conversation

@eigger

@eigger eigger commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add heading (0-360 deg), optional tilt compensation via accel sensor IDs (no BMI270 dependency), YAML mag/accel axis remap, and declination (default 0)
  • Hard-iron (+ optional soft-iron) calibration via bmm150.calibrate; persist only if each axis delta > 20 uT; on_calibration_finished with success bool
  • Heading stays unknown until a valid calibration is stored; vendor BMM150 files unchanged

Test plan

  • esphome compile tests/components/bmm150/test.esp32-idf.yaml (heading + accel IDs + calibrate action)
  • git diff confirms bmm150_lib.c/h and bmm150_defs.h untouched
  • Hardware: B-1 scale (expect ~50 uT total field / ~30 uT horizontal in Seoul)
  • Hardware: B-4 mag vs accel axis alignment on M5 Unit GNSS
  • Hardware: I2C address 0x10 and bus stability after recovery
  • Hardware: figure-8 calibration quality gate and NVS restore across reboot

Made with Cursor

eigger added 5 commits August 18, 2026 12:56
Add compass heading with optional accel-sensor tilt fusion, YAML axis remapping, declination, and a calibrate action that only persists offsets after per-axis delta checks.
…bration

If accel IDs are set but unpublished, keep heading unknown and log enter/leave. Stamp calibration with version, mag axes, and uT scale so YAML remaps cannot reload old offsets.
…ration usable

Re-init after five consecutive read/overflow failures. Default to yaw-only calibration with a relaxed Z gate, add heading_offset, and let the test accel templates actually publish.
Check bus_error_ before chip_id so boot-time and runtime NAKs do not mark_failed. Apply yaw Z offset when delta exceeds the Z gate, and always reset soft-iron Z scale to 1 when disabled.
A missing chip is indistinguishable from a dead bus (both NAK). Keep retrying but do not spam the log every update_interval.
@eigger
eigger merged commit ee880b0 into master Aug 18, 2026
3 checks passed
@eigger
eigger deleted the feat/bmm150-phase-b branch August 18, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant