From 180e3fbaa8fd9fa93b25cf579a2c57a469c8a229 Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Thu, 16 Dec 2021 21:10:11 +0100 Subject: [PATCH] Fixed if else --- main/espnowfunctions.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/espnowfunctions.cpp b/main/espnowfunctions.cpp index 6e1efd0..8df01f4 100644 --- a/main/espnowfunctions.cpp +++ b/main/espnowfunctions.cpp @@ -127,13 +127,14 @@ void handle() { if (const auto error = esp_now_del_peer(peer.peer_addr); error != ESP_OK) { + if (error == ESP_ERR_ESPNOW_NOT_FOUND) + { + initialized = 0; + return; + } ESP_LOGE(TAG, "esp_now_del_peer() failed with %s", esp_err_to_name(error)); return; } - else if (error == ESP_ERR_ESPNOW_NOT_FOUND) - { - initialized = 0; - } } initialized--; }