fix send_at return

This commit is contained in:
oarcher 2024-08-06 01:40:29 +02:00
parent d33207bda7
commit a78885c391

View file

@ -52,7 +52,7 @@ ModemComponent::ModemComponent() {
}
std::string ModemComponent::send_at(const std::string &cmd) {
std::string result;
std::string result = "ERROR";
command_result status = command_result::FAIL;
ESP_LOGV(TAG, "Sending command: %s", cmd.c_str());
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(),
command_result_to_string(status).c_str());
}
if (status != esp_modem::command_result::OK) {
result = "ERROR";
}
return result;
}
@ -560,6 +557,9 @@ bool ModemComponent::modem_sync_() {
if (status && !this->internal_state_.modem_synced) {
// First time the modem is synced, or modem recovered
this->internal_state_.modem_synced = true;
ESPMODEM_ERROR_CHECK(this->dce->set_gnss_power_mode(this->gnss_), "Enabling/disabling GNSS");
if (!this->prepare_sim_()) {
// fatal error
this->disable();