Update ebyte_lora_component.cpp

This commit is contained in:
Daniël Koek 2024-10-04 14:35:26 +01:00
parent 355b84eb78
commit 6e5983beaf

View file

@ -304,9 +304,11 @@ void EbyteLoraComponent::setup() {
} }
void EbyteLoraComponent::get_current_config_() { void EbyteLoraComponent::get_current_config_() {
this->set_mode_(CONFIGURATION); this->set_mode_(CONFIGURATION);
if (this->can_send_message_()) {
uint8_t data[3] = {PROGRAM_CONF, 0x00, 0x08}; uint8_t data[3] = {PROGRAM_CONF, 0x00, 0x08};
this->write_array(data, sizeof(data)); this->write_array(data, sizeof(data));
ESP_LOGD(TAG, "Config info requested"); ESP_LOGD(TAG, "Config info requested");
}
} }
ModeType EbyteLoraComponent::get_mode_() { ModeType EbyteLoraComponent::get_mode_() {
ModeType internal_mode = MODE_INIT; ModeType internal_mode = MODE_INIT;
@ -339,9 +341,6 @@ ModeType EbyteLoraComponent::get_mode_() {
return internal_mode; return internal_mode;
} }
void EbyteLoraComponent::set_mode_(ModeType mode) { void EbyteLoraComponent::set_mode_(ModeType mode) {
if (this->can_send_message_())
return;
if (this->pin_m0_ == nullptr || this->pin_m1_ == nullptr) { if (this->pin_m0_ == nullptr || this->pin_m1_ == nullptr) {
ESP_LOGD(TAG, "The M0 and M1 pins is not set, this mean that you are connect directly the pins as you need!"); ESP_LOGD(TAG, "The M0 and M1 pins is not set, this mean that you are connect directly the pins as you need!");
return; return;
@ -376,7 +375,6 @@ void EbyteLoraComponent::set_mode_(ModeType mode) {
} }
} }
this->config_mode_ = mode; this->config_mode_ = mode;
ESP_LOGD(TAG, "Mode is going to be set");
} }
bool EbyteLoraComponent::can_send_message_() { bool EbyteLoraComponent::can_send_message_() {
// High means no more information is needed // High means no more information is needed