From a74d7a0ef09011dfd19e0d46ea46093bb8787af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Koek?= Date: Tue, 26 Mar 2024 15:46:32 +0000 Subject: [PATCH] wrong order! --- esphome/components/lora/lora.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/components/lora/lora.cpp b/esphome/components/lora/lora.cpp index 958b3444c1..f99ff577c1 100644 --- a/esphome/components/lora/lora.cpp +++ b/esphome/components/lora/lora.cpp @@ -3,8 +3,8 @@ namespace esphome { namespace lora { void Lora::update() { - // all good! - if (!this->pin_aux_->digital_read()) { + // High means no more information is needed + if (this->pin_aux_->digital_read()) { this->starting_to_check_ = 0; this->time_out_after_ = 0; } @@ -87,15 +87,15 @@ void Lora::set_mode_(ModeType mode) { ESP_LOGD(TAG, "Mode is going to be set"); } bool Lora::can_send_message_() { - // if the pin is still high, we should not be doing anything if (this->pin_aux_->digital_read()) { - ESP_LOGD(TAG, "Aux pin is still high!"); - return false; - } else { - // the pin isn't high anymore, but the system isn't updated yet + // If it is high then all good and settings have been saved this->starting_to_check_ = 0; this->time_out_after_ = 0; return true; + + } else { + ESP_LOGD(TAG, "Aux pin is still LOW! Have to wait before sending message"); + return false; } } void Lora::setup_wait_response_(uint32_t timeout) {