mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 07:24:54 +01:00
disable on sim error
This commit is contained in:
parent
900a306eda
commit
171213fe38
1 changed files with 9 additions and 1 deletions
|
@ -306,6 +306,8 @@ void ModemComponent::loop() {
|
||||||
ESP_LOGI(TAG, "Starting modem connection");
|
ESP_LOGI(TAG, "Starting modem connection");
|
||||||
this->state_ = ModemComponentState::CONNECTING;
|
this->state_ = ModemComponentState::CONNECTING;
|
||||||
this->start_connect_();
|
this->start_connect_();
|
||||||
|
} else {
|
||||||
|
this->disable();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->state_ = ModemComponentState::NOT_RESPONDING;
|
this->state_ = ModemComponentState::NOT_RESPONDING;
|
||||||
|
@ -404,6 +406,7 @@ void ModemComponent::loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemComponent::enable() {
|
void ModemComponent::enable() {
|
||||||
|
ESP_LOGD(TAG, "Enabling modem");
|
||||||
if (this->state_ == ModemComponentState::DISABLED) {
|
if (this->state_ == ModemComponentState::DISABLED) {
|
||||||
this->state_ = ModemComponentState::DISCONNECTED;
|
this->state_ = ModemComponentState::DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
@ -412,8 +415,13 @@ void ModemComponent::enable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemComponent::disable() {
|
void ModemComponent::disable() {
|
||||||
|
ESP_LOGD(TAG, "Disabling modem");
|
||||||
this->enabled_ = false;
|
this->enabled_ = false;
|
||||||
|
if (this->state_ == ModemComponentState::CONNECTED) {
|
||||||
this->state_ = ModemComponentState::DISCONNECTING;
|
this->state_ = ModemComponentState::DISCONNECTING;
|
||||||
|
} else {
|
||||||
|
this->state_ = ModemComponentState::DISCONNECTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemComponent::dump_connect_params_() {
|
void ModemComponent::dump_connect_params_() {
|
||||||
|
|
Loading…
Reference in a new issue