diff --git a/lib/lis2mdl/lis2mdl/device.py b/lib/lis2mdl/lis2mdl/device.py index 04b5e019..66e24cce 100644 --- a/lib/lis2mdl/lis2mdl/device.py +++ b/lib/lis2mdl/lis2mdl/device.py @@ -554,10 +554,7 @@ def soft_reset(self, wait_ms: int = 10): r = self.read_reg(LIS2MDL_CFG_REG_A) r |= 1 << 5 # SOFT_RST self.setReg(r, LIS2MDL_CFG_REG_A) - try: - sleep_ms(wait_ms) - except: - pass + sleep_ms(wait_ms) def reboot(self, wait_ms: int = 10): """ @@ -567,10 +564,7 @@ def reboot(self, wait_ms: int = 10): r = self.read_reg(LIS2MDL_CFG_REG_A) r |= 1 << 6 # REBOOT self.setReg(r, LIS2MDL_CFG_REG_A) - try: - sleep_ms(wait_ms) - except Exception: - pass + sleep_ms(wait_ms) def is_idle(self) -> bool: """True if the sensor is in IDLE mode (MD1..0 == 11).""" diff --git a/tests/scenarios/lis2mdl.yaml b/tests/scenarios/lis2mdl.yaml index 95c1a2c7..a68f55a3 100644 --- a/tests/scenarios/lis2mdl.yaml +++ b/tests/scenarios/lis2mdl.yaml @@ -82,6 +82,22 @@ tests: expect_range: [-10.0, 60.0] mode: [hardware] + - name: "Soft reset then WHO_AM_I" + action: hardware_script + script: | + dev.soft_reset() + result = dev.read_who_am_i() + expect: 0x40 + mode: [hardware] + + - name: "Reboot then WHO_AM_I" + action: hardware_script + script: | + dev.reboot() + result = dev.read_who_am_i() + expect: 0x40 + mode: [hardware] + - name: "Magnetic field values feel correct" action: manual display: