mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 17:54:13 +01:00
Update lora.cpp
This commit is contained in:
parent
49aed48728
commit
14466a4a4b
1 changed files with 9 additions and 3 deletions
|
@ -5,9 +5,11 @@ namespace lora {
|
||||||
void Lora::update() {
|
void Lora::update() {
|
||||||
// High means no more information is needed
|
// High means no more information is needed
|
||||||
if (this->pin_aux_->digital_read()) {
|
if (this->pin_aux_->digital_read()) {
|
||||||
|
if (!this->starting_to_check_ == 0 && !this->time_out_after_ == 0) {
|
||||||
this->starting_to_check_ = 0;
|
this->starting_to_check_ = 0;
|
||||||
this->time_out_after_ = 0;
|
this->time_out_after_ = 0;
|
||||||
ESP_LOGD(TAG, "Aux pin is High! Can send again!");
|
ESP_LOGD(TAG, "Aux pin is High! Can send again!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// it has taken too long to complete, error out!
|
// it has taken too long to complete, error out!
|
||||||
if ((millis() - this->starting_to_check_) > this->time_out_after_) {
|
if ((millis() - this->starting_to_check_) > this->time_out_after_) {
|
||||||
|
@ -61,15 +63,19 @@ ModeType Lora::get_mode_() {
|
||||||
bool pin1 = this->pin_m0_->digital_read();
|
bool pin1 = this->pin_m0_->digital_read();
|
||||||
bool pin2 = this->pin_m1_->digital_read();
|
bool pin2 = this->pin_m1_->digital_read();
|
||||||
if (!pin1 && !pin2) {
|
if (!pin1 && !pin2) {
|
||||||
|
ESP_LOGD(TAG, "MODE NORMAL!");
|
||||||
internalMode = MODE_0_NORMAL;
|
internalMode = MODE_0_NORMAL;
|
||||||
}
|
}
|
||||||
if (pin1 && !pin2) {
|
if (pin1 && !pin2) {
|
||||||
|
ESP_LOGD(TAG, "MODE WOR!");
|
||||||
internalMode = MODE_1_WOR_TRANSMITTER;
|
internalMode = MODE_1_WOR_TRANSMITTER;
|
||||||
}
|
}
|
||||||
if (!pin1 && pin2) {
|
if (!pin1 && pin2) {
|
||||||
|
ESP_LOGD(TAG, "MODE WOR!");
|
||||||
internalMode = MODE_2_WOR_RECEIVER;
|
internalMode = MODE_2_WOR_RECEIVER;
|
||||||
}
|
}
|
||||||
if (pin1 && pin2) {
|
if (pin1 && pin2) {
|
||||||
|
ESP_LOGD(TAG, "MODE Conf!");
|
||||||
internalMode = MODE_3_CONFIGURATION;
|
internalMode = MODE_3_CONFIGURATION;
|
||||||
}
|
}
|
||||||
if (internalMode != this->mode_) {
|
if (internalMode != this->mode_) {
|
||||||
|
|
Loading…
Reference in a new issue