Skip to content

fix: Correct broken method calls in lis2mdl and wsen-pads examples. #214

Description

@nedseb

Context

The new example validation test suite (PR #213) detected 2 examples calling methods that don't exist in their respective drivers.

Bugs

1. lib/lis2mdl/examples/magnet_test.py

Calls mag.read_reg() (28 occurrences) but the method in device.py is _read_reg() (private, with underscore prefix).

Fix: Either expose a public read_reg() method in the driver, or replace calls with mag._read_reg() in the example (acceptable since this is a low-level test/debug script).

2. lib/wsen-pads/examples/test.py

Calls sensor._read_u8() (5 occurrences) but this method doesn't exist in wsen_pads/device.py. The driver uses _read_reg() instead.

Fix: Replace sensor._read_u8(reg) with sensor._read_reg(reg).

Verification

After fixing, run:

python3 -m pytest tests/test_examples.py -v -k "magnet_test or wsen-pads/test"

Both tests should pass.

Checklist

  • Fix lib/lis2mdl/examples/magnet_test.py — replace read_reg() with _read_reg()
  • Fix lib/wsen-pads/examples/test.py — replace _read_u8() with _read_reg()
  • All example validation tests pass

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreleased

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions