Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the ENS160 #1089

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ public Ens160(II2cBus i2cBus, byte address = (byte)Addresses.Default)
CurrentOperatingMode = OperatingMode.Standard;
}

/// <summary>
/// Create a new ENS160 object
/// </summary>
/// <remarks>
/// The constructor sends the stop periodic updates method otherwise
/// the sensor may not respond to new commands
/// </remarks>
/// <param name="i2cBus">The I2C bus</param>
/// <param name="address">The I2C address</param>
public Ens160(II2cBus i2cBus, Ens160.Addresses address = Addresses.Default)
: base(i2cBus, (byte)address, readBufferSize: 9, writeBufferSize: 9)
{
Initialize().Wait();

CurrentOperatingMode = OperatingMode.Standard;
}

/// <summary>
/// Initialize the sensor
/// </summary>
Expand Down Expand Up @@ -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;
}
Expand Down
Loading