mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 22:56:37 +00:00
particle matter improvements (#8846)
This commit is contained in:
parent
8c77e40695
commit
12997451f6
@ -55,8 +55,8 @@ uint8_t PM1006Component::pm1006_checksum_(const uint8_t *command_data, uint8_t l
|
||||
}
|
||||
|
||||
optional<bool> PM1006Component::check_byte_() const {
|
||||
uint8_t index = this->data_index_;
|
||||
uint8_t byte = this->data_[index];
|
||||
const uint8_t index = this->data_index_;
|
||||
const uint8_t byte = this->data_[index];
|
||||
|
||||
// index 0..2 are the fixed header
|
||||
if (index < sizeof(PM1006_RESPONSE_HEADER)) {
|
||||
@ -86,7 +86,7 @@ optional<bool> PM1006Component::check_byte_() const {
|
||||
}
|
||||
|
||||
void PM1006Component::parse_data_() {
|
||||
const int pm_2_5_concentration = this->get_16_bit_uint_(5);
|
||||
const uint16_t pm_2_5_concentration = this->get_16_bit_uint_(5);
|
||||
|
||||
ESP_LOGD(TAG, "Got PM2.5 Concentration: %d µg/m³", pm_2_5_concentration);
|
||||
|
||||
|
@ -82,10 +82,10 @@ void PM2005Component::update() {
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t pm1 = get_sensor_value(this->data_buffer_, this->pm_1_0_value_index_);
|
||||
uint16_t pm25 = get_sensor_value(this->data_buffer_, this->pm_2_5_value_index_);
|
||||
uint16_t pm10 = get_sensor_value(this->data_buffer_, this->pm_10_0_value_index_);
|
||||
uint16_t sensor_measuring_mode = get_sensor_value(this->data_buffer_, this->measuring_value_index_);
|
||||
const uint16_t pm1 = get_sensor_value(this->data_buffer_, this->pm_1_0_value_index_);
|
||||
const uint16_t pm25 = get_sensor_value(this->data_buffer_, this->pm_2_5_value_index_);
|
||||
const uint16_t pm10 = get_sensor_value(this->data_buffer_, this->pm_10_0_value_index_);
|
||||
const uint16_t sensor_measuring_mode = get_sensor_value(this->data_buffer_, this->measuring_value_index_);
|
||||
ESP_LOGD(TAG, "PM1.0: %d, PM2.5: %d, PM10: %d, Measuring mode: %s.", pm1, pm25, pm10,
|
||||
LOG_STR_ARG(pm2005_get_measuring_mode_string(sensor_measuring_mode)));
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""PM2005/2105 Sensor component for ESPHome."""
|
||||
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import i2c, sensor
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_PM_1_0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user