mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 09:44:12 +01:00
lint and status check
This commit is contained in:
parent
73ff266096
commit
a3ed854b51
2 changed files with 28 additions and 29 deletions
|
@ -74,16 +74,15 @@ void GSMComponent::setup() {
|
||||||
|
|
||||||
this->config_gpio_();
|
this->config_gpio_();
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Status: %d", (int) this->get_status());
|
if (this->get_status()) {
|
||||||
|
// at setup, the modem must be down
|
||||||
// to be sure the modem is not allready connected
|
this->powerdown();
|
||||||
this->powerdown();
|
}
|
||||||
|
|
||||||
ESP_LOGV(TAG, "DTE setup");
|
ESP_LOGV(TAG, "DTE setup");
|
||||||
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
|
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
|
||||||
this->dte_config_ = dte_config;
|
this->dte_config_ = dte_config;
|
||||||
|
|
||||||
// this->dte_config_ = ESP_MODEM_DTE_DEFAULT_CONFIG();
|
|
||||||
this->dte_config_.uart_config.tx_io_num = this->tx_pin_;
|
this->dte_config_.uart_config.tx_io_num = this->tx_pin_;
|
||||||
this->dte_config_.uart_config.rx_io_num = this->rx_pin_;
|
this->dte_config_.uart_config.rx_io_num = this->rx_pin_;
|
||||||
// this->dte_config_.uart_config.rts_io_num = static_cast<gpio_num_t>( CONFIG_EXAMPLE_MODEM_UART_RTS_PIN);
|
// this->dte_config_.uart_config.rts_io_num = static_cast<gpio_num_t>( CONFIG_EXAMPLE_MODEM_UART_RTS_PIN);
|
||||||
|
@ -158,13 +157,11 @@ void GSMComponent::setup() {
|
||||||
|
|
||||||
void GSMComponent::start_connect_() {
|
void GSMComponent::start_connect_() {
|
||||||
this->connect_begin_ = millis();
|
this->connect_begin_ = millis();
|
||||||
this->status_set_warning();
|
this->status_set_warning("Starting connection");
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Status: %d", (int) this->get_status());
|
if (!this->get_status()) {
|
||||||
|
this->poweron();
|
||||||
this->poweron();
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Status: %d", (int) this->get_status());
|
|
||||||
|
|
||||||
// esp_err_t err;
|
// esp_err_t err;
|
||||||
// err = esp_netif_set_hostname(this->ppp_netif_, App.get_name().c_str());
|
// err = esp_netif_set_hostname(this->ppp_netif_, App.get_name().c_str());
|
||||||
|
@ -179,20 +176,22 @@ void GSMComponent::start_connect_() {
|
||||||
|
|
||||||
command_result res = command_result::TIMEOUT;
|
command_result res = command_result::TIMEOUT;
|
||||||
|
|
||||||
int retry = 0;
|
// int retry = 0;
|
||||||
while (res != command_result::OK) {
|
// while (res != command_result::OK) {
|
||||||
res = this->dce_->sync();
|
// res = this->dce_->sync();
|
||||||
if (res != command_result::OK) {
|
// if (res != command_result::OK) {
|
||||||
ESP_LOGW(TAG, "modem not responding");
|
// ESP_LOGW(TAG, "modem not responding");
|
||||||
ESP_LOGI(TAG, "Status: %d", (int) this->get_status());
|
// ESP_LOGI(TAG, "Status: %d", (int) this->get_status());
|
||||||
this->dce_->set_command_mode();
|
// this->dce_->set_command_mode();
|
||||||
App.feed_wdt();
|
// App.feed_wdt();
|
||||||
vTaskDelay(pdMS_TO_TICKS(7000));
|
// vTaskDelay(pdMS_TO_TICKS(7000));
|
||||||
}
|
// }
|
||||||
retry++;
|
// retry++;
|
||||||
if (retry > 10)
|
// if (retry > 10)
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
res = this->dce_->sync();
|
||||||
|
|
||||||
if (res != command_result::OK) {
|
if (res != command_result::OK) {
|
||||||
ESP_LOGW(TAG, "Unable to sync modem. Will retry later");
|
ESP_LOGW(TAG, "Unable to sync modem. Will retry later");
|
||||||
|
|
|
@ -47,10 +47,10 @@ class GSMComponent : public Component {
|
||||||
void set_tx_pin(gpio_num_t tx_pin) { this->tx_pin_ = tx_pin; }
|
void set_tx_pin(gpio_num_t tx_pin) { this->tx_pin_ = tx_pin; }
|
||||||
void set_power_pin(gpio_num_t power_pin) { this->power_pin_ = power_pin; }
|
void set_power_pin(gpio_num_t power_pin) { this->power_pin_ = power_pin; }
|
||||||
void set_flight_pin(gpio_num_t flight_pin) { this->flight_pin_ = flight_pin; }
|
void set_flight_pin(gpio_num_t flight_pin) { this->flight_pin_ = flight_pin; }
|
||||||
void set_username(std::string username) { this->username_ = std::move(username); }
|
void set_username(const std::string username) { this->username_ = std::move(username); }
|
||||||
void set_password(std::string password) { this->password_ = std::move(password); }
|
void set_password(const std::string password) { this->password_ = std::move(password); }
|
||||||
void set_pin_code(std::string pin_code) { this->pin_code_ = std::move(pin_code); }
|
void set_pin_code(const std::string pin_code) { this->pin_code_ = std::move(pin_code); }
|
||||||
void set_apn(std::string apn) { this->apn_ = std::move(apn); }
|
void set_apn(const std::string apn) { this->apn_ = std::move(apn); }
|
||||||
void set_status_pin(gpio_num_t status_pin) { this->status_pin_ = status_pin; }
|
void set_status_pin(gpio_num_t status_pin) { this->status_pin_ = status_pin; }
|
||||||
void set_dtr_pin(gpio_num_t dtr_pin) { this->dtr_pin_ = dtr_pin; }
|
void set_dtr_pin(gpio_num_t dtr_pin) { this->dtr_pin_ = dtr_pin; }
|
||||||
void set_model(const std::string &model) {
|
void set_model(const std::string &model) {
|
||||||
|
|
Loading…
Reference in a new issue