64 ESP_LOGW(TAG,
"Invalid temperature!");
74 double a = c5 * (ut - c6);
75 float temp = a + (mc / (a + md));
78 ESP_LOGD(TAG,
"Got Temperature=%.1f °C", temp);
79 PUBLISH_STATE(this->temperature_sensor_, temp);
82 if (!this->
set_mode_(BMP085_CONTROL_MODE_PRESSURE_3)) {
97 if ((
value >> 5) == 0) {
98 ESP_LOGW(TAG,
"Invalid pressure!");
105 double b1 = pow(160.0, 2.0) * pow(2.0, -30.0) * this->
calibration_.
b1;
108 double x2 = pow(160.0, 2.0) * pow(2.0, -25.0) * this->
calibration_.
b2;
109 double y0 = c4 * pow(2.0, 15.0);
112 double p0 = (3791.0 - 8.0) / 1600.0;
113 double p1 = 1.0 - 7357.0 * pow(2, -20);
114 double p2 = 3038.0 * 100.0 * pow(2, -36);
116 double p =
value / 256.0;
118 double x = (x2 * s * s) + (x1 * s) + x0;
119 double y = (y2 * s * s) + (y1 * s) + y0;
120 double z = (p -
x) /
y;
123 ESP_LOGD(TAG,
"Got Pressure=%.1f hPa",
pressure);
125 PUBLISH_STATE(this->pressure_sensor_,
pressure);