From ae8cb94bd24f3d494bfca8486389fd51ff01abd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Koek?= Date: Fri, 29 Mar 2024 13:45:50 +0000 Subject: [PATCH] Update ebyte_lora.cpp --- esphome/components/ebyte_lora/ebyte_lora.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/esphome/components/ebyte_lora/ebyte_lora.cpp b/esphome/components/ebyte_lora/ebyte_lora.cpp index 9b8547d9dc..c0ef180ff0 100644 --- a/esphome/components/ebyte_lora/ebyte_lora.cpp +++ b/esphome/components/ebyte_lora/ebyte_lora.cpp @@ -5,15 +5,16 @@ static const uint8_t SWITCH_PUSH = 0x55; static const uint8_t SWITCH_INFO = 0x66; static const uint8_t PROGRAM_CONF = 0xC1; void EbyteLoraComponent::update() { + if (this->config.command == 0) { + ESP_LOGD(TAG, "Config not set yet!, gonna request it now!"); + get_current_config_(); + return; + } if (get_mode_() != NORMAL) { - if (this->config.command == 0) { - ESP_LOGD(TAG, "Config not set yet!, gonna request it now!"); - get_current_config_(); - return; - } ESP_LOGD(TAG, "Mode was not set right"); set_mode_(NORMAL); } + send_switch_info_(); } void EbyteLoraComponent::setup() { @@ -59,19 +60,19 @@ ModeType EbyteLoraComponent::get_mode_() { bool pin1 = this->pin_m0_->digital_read(); bool pin2 = this->pin_m1_->digital_read(); if (!pin1 && !pin2) { - ESP_LOGD(TAG, "MODE NORMAL!"); + // ESP_LOGD(TAG, "MODE NORMAL!"); internalMode = NORMAL; } if (pin1 && !pin2) { - ESP_LOGD(TAG, "MODE WOR!"); + // ESP_LOGD(TAG, "MODE WOR!"); internalMode = WOR_SEND; } if (!pin1 && pin2) { - ESP_LOGD(TAG, "MODE WOR!"); + // ESP_LOGD(TAG, "MODE WOR!"); internalMode = WOR_RECEIVER; } if (pin1 && pin2) { - ESP_LOGD(TAG, "MODE Conf!"); + // ESP_LOGD(TAG, "MODE Conf!"); internalMode = CONFIGURATION; } if (internalMode != this->mode_) {