mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
fix send_at return
This commit is contained in:
parent
d33207bda7
commit
a78885c391
1 changed files with 4 additions and 4 deletions
|
@ -52,7 +52,7 @@ ModemComponent::ModemComponent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModemComponent::send_at(const std::string &cmd) {
|
std::string ModemComponent::send_at(const std::string &cmd) {
|
||||||
std::string result;
|
std::string result = "ERROR";
|
||||||
command_result status = command_result::FAIL;
|
command_result status = command_result::FAIL;
|
||||||
ESP_LOGV(TAG, "Sending command: %s", cmd.c_str());
|
ESP_LOGV(TAG, "Sending command: %s", cmd.c_str());
|
||||||
if (this->modem_ready()) {
|
if (this->modem_ready()) {
|
||||||
|
@ -60,9 +60,6 @@ std::string ModemComponent::send_at(const std::string &cmd) {
|
||||||
ESP_LOGV(TAG, "Result for command %s: %s (status %s)", cmd.c_str(), result.c_str(),
|
ESP_LOGV(TAG, "Result for command %s: %s (status %s)", cmd.c_str(), result.c_str(),
|
||||||
command_result_to_string(status).c_str());
|
command_result_to_string(status).c_str());
|
||||||
}
|
}
|
||||||
if (status != esp_modem::command_result::OK) {
|
|
||||||
result = "ERROR";
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,6 +557,9 @@ bool ModemComponent::modem_sync_() {
|
||||||
if (status && !this->internal_state_.modem_synced) {
|
if (status && !this->internal_state_.modem_synced) {
|
||||||
// First time the modem is synced, or modem recovered
|
// First time the modem is synced, or modem recovered
|
||||||
this->internal_state_.modem_synced = true;
|
this->internal_state_.modem_synced = true;
|
||||||
|
|
||||||
|
ESPMODEM_ERROR_CHECK(this->dce->set_gnss_power_mode(this->gnss_), "Enabling/disabling GNSS");
|
||||||
|
|
||||||
if (!this->prepare_sim_()) {
|
if (!this->prepare_sim_()) {
|
||||||
// fatal error
|
// fatal error
|
||||||
this->disable();
|
this->disable();
|
||||||
|
|
Loading…
Reference in a new issue