From fbc129ccccbdb8ed9495903c8dc7a7334c909197 Mon Sep 17 00:00:00 2001 From: tracestep <16390082+tracestep@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:23:31 -0300 Subject: [PATCH] Version retry (fixes esphome/issues#3823) (#4651) --- esphome/components/pn532/pn532.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/esphome/components/pn532/pn532.cpp b/esphome/components/pn532/pn532.cpp index 7ebf328cff..dc831ef6e0 100644 --- a/esphome/components/pn532/pn532.cpp +++ b/esphome/components/pn532/pn532.cpp @@ -19,9 +19,12 @@ void PN532::setup() { // Get version data if (!this->write_command_({PN532_COMMAND_VERSION_DATA})) { - ESP_LOGE(TAG, "Error sending version command"); - this->mark_failed(); - return; + ESP_LOGW(TAG, "Error sending version command, trying again..."); + if (!this->write_command_({PN532_COMMAND_VERSION_DATA})) { + ESP_LOGE(TAG, "Error sending version command"); + this->mark_failed(); + return; + } } std::vector version_data;