diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs index ca0ea0066..942db5488 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs @@ -91,6 +91,23 @@ public Ens160(II2cBus i2cBus, byte address = (byte)Addresses.Default) CurrentOperatingMode = OperatingMode.Standard; } + /// + /// Create a new ENS160 object + /// + /// + /// The constructor sends the stop periodic updates method otherwise + /// the sensor may not respond to new commands + /// + /// The I2C bus + /// The I2C address + public Ens160(II2cBus i2cBus, Ens160.Addresses address = Addresses.Default) + : base(i2cBus, (byte)address, readBufferSize: 9, writeBufferSize: 9) + { + Initialize().Wait(); + + CurrentOperatingMode = OperatingMode.Standard; + } + /// /// Initialize the sensor /// @@ -175,7 +192,7 @@ public UBAAirQualityIndex GetAirQualityIndex() { var value = BusComms.ReadRegister((byte)Registers.DATA_AQI); - var aqi = value >> 5; + var aqi = value & 0b0111; return (UBAAirQualityIndex)aqi; }