mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
Update ebyte_lora_component.cpp
This commit is contained in:
parent
355b84eb78
commit
6e5983beaf
1 changed files with 5 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue