mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
[pmsa003i] Fix read from uninitialized stack memory (#19053)
This commit is contained in:
@@ -88,7 +88,11 @@ void PMSA003IComponent::update() {
|
||||
bool PMSA003IComponent::read_data_(PM25AQIData *data) {
|
||||
uint8_t buffer[COUNT_DATA_BYTES];
|
||||
|
||||
this->read_bytes_raw(buffer, COUNT_DATA_BYTES);
|
||||
const i2c::ErrorCode error = this->read(buffer, COUNT_DATA_BYTES);
|
||||
if (error != i2c::ERROR_OK) {
|
||||
ESP_LOGW(TAG, "I2C error %d", error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://github.com/adafruit/Adafruit_PM25AQI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user