@Test public void testCompensateTemperature() { final float[] tempResults = Bmx280.compensateTemperature(RAW_TEMPERATURE, TEMP_CALIBRATION); Assert.assertEquals(EXPECTED_TEMPERATURE, tempResults[0], EXPECTED_TEMPERATURE * TOLERANCE); Assert.assertEquals(EXPECTED_FINE_TEMPERATURE, tempResults[1], EXPECTED_FINE_TEMPERATURE * TOLERANCE); }
@VisibleForTesting static float[] compensateTemperature(int rawTemp, int[] calibrationData) { int dig_T1 = calibrationData[0]; int dig_T2 = calibrationData[1]; int dig_T3 = calibrationData[2]; float adc_T = (float) rawTemp; float var1 = (adc_T / 16384f - ((float) dig_T1) / 1024f) * ((float) dig_T2); float var2 = ((adc_T / 131072f - ((float) dig_T1) / 8192f) * (adc_T / 131072f - ((float) dig_T1) / 8192f)) * ((float) dig_T3); float fineTemp = var1 + var2; return new float[]{fineTemp / 5120.0f, fineTemp}; }
Bmx280 implements AutoCloseable { @VisibleForTesting static float[] compensateTemperature(int rawTemp, int[] calibrationData) { int dig_T1 = calibrationData[0]; int dig_T2 = calibrationData[1]; int dig_T3 = calibrationData[2]; float adc_T = (float) rawTemp; float var1 = (adc_T / 16384f - ((float) dig_T1) / 1024f) * ((float) dig_T2); float var2 = ((adc_T / 131072f - ((float) dig_T1) / 8192f) * (adc_T / 131072f - ((float) dig_T1) / 8192f)) * ((float) dig_T3); float fineTemp = var1 + var2; return new float[]{fineTemp / 5120.0f, fineTemp}; } }
Bmx280 implements AutoCloseable { @VisibleForTesting static float[] compensateTemperature(int rawTemp, int[] calibrationData) { int dig_T1 = calibrationData[0]; int dig_T2 = calibrationData[1]; int dig_T3 = calibrationData[2]; float adc_T = (float) rawTemp; float var1 = (adc_T / 16384f - ((float) dig_T1) / 1024f) * ((float) dig_T2); float var2 = ((adc_T / 131072f - ((float) dig_T1) / 8192f) * (adc_T / 131072f - ((float) dig_T1) / 8192f)) * ((float) dig_T3); float fineTemp = var1 + var2; return new float[]{fineTemp / 5120.0f, fineTemp}; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); }
Bmx280 implements AutoCloseable { @VisibleForTesting static float[] compensateTemperature(int rawTemp, int[] calibrationData) { int dig_T1 = calibrationData[0]; int dig_T2 = calibrationData[1]; int dig_T3 = calibrationData[2]; float adc_T = (float) rawTemp; float var1 = (adc_T / 16384f - ((float) dig_T1) / 1024f) * ((float) dig_T2); float var2 = ((adc_T / 131072f - ((float) dig_T1) / 8192f) * (adc_T / 131072f - ((float) dig_T1) / 8192f)) * ((float) dig_T3); float fineTemp = var1 + var2; return new float[]{fineTemp / 5120.0f, fineTemp}; } 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[] compensateTemperature(int rawTemp, int[] calibrationData) { int dig_T1 = calibrationData[0]; int dig_T2 = calibrationData[1]; int dig_T3 = calibrationData[2]; float adc_T = (float) rawTemp; float var1 = (adc_T / 16384f - ((float) dig_T1) / 1024f) * ((float) dig_T2); float var2 = ((adc_T / 131072f - ((float) dig_T1) / 8192f) * (adc_T / 131072f - ((float) dig_T1) / 8192f)) * ((float) dig_T3); float fineTemp = var1 + var2; return new float[]{fineTemp / 5120.0f, fineTemp}; } 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; }