Skip to content

Commit 9173fa6

Browse files
committed
fix(steami_config): Fix heading method name and module paths in mag example.
1 parent 3afaaff commit 9173fa6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/steami_config/examples/calibrate_magnetometer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121

2222
from machine import I2C
2323

24+
# Add driver paths when running via mpremote mount lib/
25+
for p in ("daplink_flash", "steami_config", "lis2mdl", "ssd1327"):
26+
path = "/remote/" + p
27+
if path not in sys.path:
28+
sys.path.insert(0, path)
29+
2430

2531
def show_screen(i2c, lines):
2632
"""Display text lines on the OLED screen, then free the driver."""
@@ -133,13 +139,13 @@ def show_screen(i2c, lines):
133139
print("Verification (5 heading readings after reload):")
134140
lines = ["=== COMPAS ===", "", "Verification:"]
135141
for i in range(5):
136-
heading = mag2.heading()
142+
heading = mag2.heading_flat_only()
137143
norm = mag2.calibrated_field()
138144
line = " {}: cap={:.0f} deg".format(i + 1, heading)
139145
print(" Reading {}: heading={:.1f} deg norm=({:.3f}, {:.3f}, {:.3f})".format(
140146
i + 1, heading, norm[0], norm[1], norm[2]))
141147
lines.append(line)
142148
sleep_ms(500)
143149

144-
show_screen(i2c, [*lines, "", "Termine !"])
150+
show_screen(i2c, lines + ["", "Termine !"]) # noqa: RUF005
145151
print("\nDone! Calibration is stored and will be restored at next boot.")

0 commit comments

Comments
 (0)