Commit 1236c632 authored by Guillaume Blanchy's avatar Guillaume Blanchy
Browse files

Merge branch 'v2024_rc' of gitlab-ssh.irstea.fr:reversaal/OhmPi into v2024_rc

Showing with 6 additions and 6 deletions
+6 -6
...@@ -37,19 +37,19 @@ class Ctl(CtlAbstract): ...@@ -37,19 +37,19 @@ class Ctl(CtlAbstract):
# None interface for battery # None interface for battery
self.interfaces['none'] = None self.interfaces['none'] = None
warnings.filterwarnings("error") # to filter out adafruit warning about setting I2C frequency # warnings.filterwarnings("error") # to filter out adafruit warning about setting I2C frequency
# I2C # I2C
warnings.filterwarnings(RuntimeWarning, action='ignore', module=busio)
try: try:
self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa
except RuntimeWarning: except Exception as e:
pass self.exec_logger.warning(f'Could not initialize I2C:\n{e}')
warnings.resetwarnings() # warnings.resetwarnings()
# Extended I2C # Extended I2C
warnings.filterwarnings(RuntimeWarning, action='ignore', module=ExtendedI2C)
try: try:
self.interfaces['i2c_ext'] = ExtendedI2C(4) # 4 is defined self.interfaces['i2c_ext'] = ExtendedI2C(4) # 4 is defined
except RuntimeWarning:
pass
except Exception as e: except Exception as e:
self.exec_logger.warning(f'Could not initialize Extended I2C:\n{e}') self.exec_logger.warning(f'Could not initialize Extended I2C:\n{e}')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment