Fix pmsa003i cold boot marked as failed on ESP32 et al (#7064)

This commit is contained in:
Z3LIFF 2024-07-11 00:01:14 -04:00 committed by Jesse Hills
parent d1bfad9890
commit 114476d8b1
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -13,6 +13,15 @@ void PMSA003IComponent::setup() {
PM25AQIData data; PM25AQIData data;
bool successful_read = this->read_data_(&data); bool successful_read = this->read_data_(&data);
if (!successful_read) {
for (int i = 0; i < 3; i++) {
successful_read = this->read_data_(&data);
if (successful_read) {
break;
}
}
}
if (!successful_read) { if (!successful_read) {
this->mark_failed(); this->mark_failed();
return; return;