mirror of
https://github.com/esphome/esphome.git
synced 2025-02-26 03:24:43 +01:00
Update imports
This commit is contained in:
parent
93c2ec2bbb
commit
5094f7fd51
@ -1,6 +1,7 @@
|
|||||||
#include "sen0501.h"
|
#include "sen0501.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
|
#include "esphome/core/helpers.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace sen0501 {
|
namespace sen0501 {
|
||||||
@ -161,7 +162,7 @@ void Sen0501Component::read_atmospheric_pressure_() {
|
|||||||
this->atmospheric_pressure_->publish_state(atmosphere);
|
this->atmospheric_pressure_->publish_state(atmosphere);
|
||||||
if (this->elevation_ == nullptr)
|
if (this->elevation_ == nullptr)
|
||||||
return;
|
return;
|
||||||
float elevation = 44330 * (1.0 - this->pow(atmosphere / 1015.0f, 0.1903));
|
float elevation = 44330 * (1.0 - pow(atmosphere / 1015.0f, 0.1903));
|
||||||
this->elevation_->publish_state(elevation);
|
this->elevation_->publish_state(elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ class Sen0501Component : public PollingComponent, public i2c::I2CDevice {
|
|||||||
void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; }
|
void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; }
|
||||||
void set_uv_intensity(sensor::Sensor *uv_intensity) { this->uv_intensity_ = uv_intensity; }
|
void set_uv_intensity(sensor::Sensor *uv_intensity) { this->uv_intensity_ = uv_intensity; }
|
||||||
void set_luminous_intensity(sensor::Sensor *luminous_intensity) { this->luminous_intensity_ = luminous_intensity; }
|
void set_luminous_intensity(sensor::Sensor *luminous_intensity) { this->luminous_intensity_ = luminous_intensity; }
|
||||||
void set_atmospheric_pressure(sensor::Sensor *atmospheric_pressure) { this->atmospheric_pressure_ = atmospheric_pressure; }
|
void set_atmospheric_pressure(sensor::Sensor *atmospheric_pressure) {
|
||||||
|
this->atmospheric_pressure_ = atmospheric_pressure;
|
||||||
|
}
|
||||||
void set_elevation(sensor::Sensor *elevation) { this->elevation_ = elevation; }
|
void set_elevation(sensor::Sensor *elevation) { this->elevation_ = elevation; }
|
||||||
|
|
||||||
void setup() override;
|
void setup() override;
|
||||||
@ -44,7 +46,7 @@ class Sen0501Component : public PollingComponent, public i2c::I2CDevice {
|
|||||||
COMMUNICATION_FAILED,
|
COMMUNICATION_FAILED,
|
||||||
WRONG_DEVICE_ID,
|
WRONG_DEVICE_ID,
|
||||||
WRONG_VENDOR_ID,
|
WRONG_VENDOR_ID,
|
||||||
} this->error_code_{NONE};
|
} error_code_{NONE};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sen0501
|
} // namespace sen0501
|
||||||
|
Loading…
Reference in New Issue
Block a user