mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 18:24:13 +01:00
commit
ec3162282c
4 changed files with 10 additions and 6 deletions
|
@ -217,8 +217,12 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||||
uint16_t raw_humidity = (uint16_t(data[0] & 0xFF) << 8) | (data[1] & 0xFF);
|
uint16_t raw_humidity = (uint16_t(data[0] & 0xFF) << 8) | (data[1] & 0xFF);
|
||||||
uint16_t raw_temperature = (uint16_t(data[2] & 0xFF) << 8) | (data[3] & 0xFF);
|
uint16_t raw_temperature = (uint16_t(data[2] & 0xFF) << 8) | (data[3] & 0xFF);
|
||||||
|
|
||||||
if (this->model_ != DHT_MODEL_DHT22_TYPE2 && (raw_temperature & 0x8000) != 0)
|
if (raw_temperature & 0x8000) {
|
||||||
|
if (!(raw_temperature & 0x4000))
|
||||||
raw_temperature = ~(raw_temperature & 0x7FFF);
|
raw_temperature = ~(raw_temperature & 0x7FFF);
|
||||||
|
} else if (raw_temperature & 0x800) {
|
||||||
|
raw_temperature |= 0xf000;
|
||||||
|
}
|
||||||
|
|
||||||
if (raw_temperature == 1 && raw_humidity == 10) {
|
if (raw_temperature == 1 && raw_humidity == 10) {
|
||||||
if (report_errors) {
|
if (report_errors) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ void PMSX003Component::send_command_(uint8_t cmd, uint16_t data) {
|
||||||
void PMSX003Component::parse_data_() {
|
void PMSX003Component::parse_data_() {
|
||||||
switch (this->type_) {
|
switch (this->type_) {
|
||||||
case PMSX003_TYPE_5003ST: {
|
case PMSX003_TYPE_5003ST: {
|
||||||
float temperature = this->get_16_bit_uint_(30) / 10.0f;
|
float temperature = (int16_t) this->get_16_bit_uint_(30) / 10.0f;
|
||||||
float humidity = this->get_16_bit_uint_(32) / 10.0f;
|
float humidity = this->get_16_bit_uint_(32) / 10.0f;
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Got Temperature: %.1f°C, Humidity: %.1f%%", temperature, humidity);
|
ESP_LOGD(TAG, "Got Temperature: %.1f°C, Humidity: %.1f%%", temperature, humidity);
|
||||||
|
@ -279,7 +279,7 @@ void PMSX003Component::parse_data_() {
|
||||||
// Note the pm particles 50um & 100um are not returned,
|
// Note the pm particles 50um & 100um are not returned,
|
||||||
// as PMS5003T uses those data values for temperature and humidity.
|
// as PMS5003T uses those data values for temperature and humidity.
|
||||||
|
|
||||||
float temperature = this->get_16_bit_uint_(24) / 10.0f;
|
float temperature = (int16_t) this->get_16_bit_uint_(24) / 10.0f;
|
||||||
float humidity = this->get_16_bit_uint_(26) / 10.0f;
|
float humidity = this->get_16_bit_uint_(26) / 10.0f;
|
||||||
|
|
||||||
ESP_LOGD(TAG,
|
ESP_LOGD(TAG,
|
||||||
|
|
|
@ -352,7 +352,7 @@ void SEN5XComponent::update() {
|
||||||
float humidity = measurements[4] / 100.0;
|
float humidity = measurements[4] / 100.0;
|
||||||
if (measurements[4] == 0xFFFF)
|
if (measurements[4] == 0xFFFF)
|
||||||
humidity = NAN;
|
humidity = NAN;
|
||||||
float temperature = measurements[5] / 200.0;
|
float temperature = (int16_t) measurements[5] / 200.0;
|
||||||
if (measurements[5] == 0xFFFF)
|
if (measurements[5] == 0xFFFF)
|
||||||
temperature = NAN;
|
temperature = NAN;
|
||||||
float voc = measurements[6] / 10.0;
|
float voc = measurements[6] / 10.0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2023.12.8"
|
__version__ = "2023.12.9"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
|
Loading…
Reference in a new issue