@Test public void testCompensateHumidity() { final float[] tempResults = Bmx280.compensateTemperature(RAW_TEMPERATURE, TEMP_CALIBRATION); final float humidity = Bmx280.compensateHumidity(RAW_HUMIDITY, tempResults[1], HUM_CALIBRATION); Assert.assertEquals(EXPECTED_HUMIDITY, humidity, EXPECTED_HUMIDITY * TOLERANCE); }
@VisibleForTesting static float compensateHumidity(int rawHumidity, float fineTemperature, int[] calibration) { int dig_H1 = calibration[0]; int dig_H2 = calibration[1]; int dig_H3 = calibration[2]; int dig_H4 = calibration[3]; int dig_H5 = calibration[4]; int dig_H6 = calibration[5]; float var_H; var_H = (fineTemperature - 76800f); var_H = (rawHumidity - (((float) dig_H4) * 64f + ((float) dig_H5) / 16384f * var_H)) * (((float) dig_H2) / 65536f * (1f + ((float) dig_H6) / 67108864f * var_H * (1f + ((float) dig_H3) / 67108864f * var_H))); var_H = var_H * (1f - ((float) dig_H1) * var_H / 524288f); if (var_H > 100) var_H = 100f; else if (var_H < 0) var_H = 0f; return var_H; }
Bmx280 implements AutoCloseable { @VisibleForTesting static float compensateHumidity(int rawHumidity, float fineTemperature, int[] calibration) { int dig_H1 = calibration[0]; int dig_H2 = calibration[1]; int dig_H3 = calibration[2]; int dig_H4 = calibration[3]; int dig_H5 = calibration[4]; int dig_H6 = calibration[5]; float var_H; var_H = (fineTemperature - 76800f); var_H = (rawHumidity - (((float) dig_H4) * 64f + ((float) dig_H5) / 16384f * var_H)) * (((float) dig_H2) / 65536f * (1f + ((float) dig_H6) / 67108864f * var_H * (1f + ((float) dig_H3) / 67108864f * var_H))); var_H = var_H * (1f - ((float) dig_H1) * var_H / 524288f); if (var_H > 100) var_H = 100f; else if (var_H < 0) var_H = 0f; return var_H; } }
Bmx280 implements AutoCloseable { @VisibleForTesting static float compensateHumidity(int rawHumidity, float fineTemperature, int[] calibration) { int dig_H1 = calibration[0]; int dig_H2 = calibration[1]; int dig_H3 = calibration[2]; int dig_H4 = calibration[3]; int dig_H5 = calibration[4]; int dig_H6 = calibration[5]; float var_H; var_H = (fineTemperature - 76800f); var_H = (rawHumidity - (((float) dig_H4) * 64f + ((float) dig_H5) / 16384f * var_H)) * (((float) dig_H2) / 65536f * (1f + ((float) dig_H6) / 67108864f * var_H * (1f + ((float) dig_H3) / 67108864f * var_H))); var_H = var_H * (1f - ((float) dig_H1) * var_H / 524288f); if (var_H > 100) var_H = 100f; else if (var_H < 0) var_H = 0f; return var_H; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); }
Bmx280 implements AutoCloseable { @VisibleForTesting static float compensateHumidity(int rawHumidity, float fineTemperature, int[] calibration) { int dig_H1 = calibration[0]; int dig_H2 = calibration[1]; int dig_H3 = calibration[2]; int dig_H4 = calibration[3]; int dig_H5 = calibration[4]; int dig_H6 = calibration[5]; float var_H; var_H = (fineTemperature - 76800f); var_H = (rawHumidity - (((float) dig_H4) * 64f + ((float) dig_H5) / 16384f * var_H)) * (((float) dig_H2) / 65536f * (1f + ((float) dig_H6) / 67108864f * var_H * (1f + ((float) dig_H3) / 67108864f * var_H))); var_H = var_H * (1f - ((float) dig_H1) * var_H / 524288f); if (var_H > 100) var_H = 100f; else if (var_H < 0) var_H = 0f; return var_H; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); }
Bmx280 implements AutoCloseable { @VisibleForTesting static float compensateHumidity(int rawHumidity, float fineTemperature, int[] calibration) { int dig_H1 = calibration[0]; int dig_H2 = calibration[1]; int dig_H3 = calibration[2]; int dig_H4 = calibration[3]; int dig_H5 = calibration[4]; int dig_H6 = calibration[5]; float var_H; var_H = (fineTemperature - 76800f); var_H = (rawHumidity - (((float) dig_H4) * 64f + ((float) dig_H5) / 16384f * var_H)) * (((float) dig_H2) / 65536f * (1f + ((float) dig_H6) / 67108864f * var_H * (1f + ((float) dig_H3) / 67108864f * var_H))); var_H = var_H * (1f - ((float) dig_H1) * var_H / 524288f); if (var_H > 100) var_H = 100f; else if (var_H < 0) var_H = 0f; return var_H; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); static final int CHIP_ID_BMP280; static final int CHIP_ID_BME280; static final int DEFAULT_I2C_ADDRESS; @Deprecated
    static final int I2C_ADDRESS; static final float MIN_TEMP_C; static final float MAX_TEMP_C; static final float MIN_PRESSURE_HPA; static final float MAX_PRESSURE_HPA; static final float MIN_HUM_RH; static final float MAX_HUM_RH; static final float MAX_POWER_CONSUMPTION_TEMP_UA; static final float MAX_POWER_CONSUMPTION_PRESSURE_UA; static final float MAX_POWER_CONSUMPTION_HUMIDITY_UA; static final float MAX_FREQ_HZ; static final float MIN_FREQ_HZ; static final int MODE_SLEEP; static final int MODE_FORCED; static final int MODE_NORMAL; static final int OVERSAMPLING_SKIPPED; static final int OVERSAMPLING_1X; }