clang-format

This commit is contained in:
Alexandr Pyslar 2024-10-20 08:23:20 +00:00
parent b97e90d21f
commit 868f5357c1
7 changed files with 30 additions and 23 deletions

View file

@ -61,8 +61,12 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(
CONF_UART_EVENT_TASK_STACK_SIZE, default=2048
): cv.positive_not_null_int,
cv.Optional(CONF_UART_EVENT_TASK_PRIORITY, default=5): cv.positive_not_null_int,
cv.Optional(CONF_UART_EVENT_QUEUE_SIZE, default=30): cv.positive_not_null_int,
cv.Optional(
CONF_UART_EVENT_TASK_PRIORITY, default=5
): cv.positive_not_null_int,
cv.Optional(
CONF_UART_EVENT_QUEUE_SIZE, default=30
): cv.positive_not_null_int,
cv.Optional(CONF_TX_BUFFER_SIZE, default=512): cv.positive_not_null_int,
cv.Optional(CONF_RX_BUFFER_SIZE, default=1024): cv.positive_not_null_int,
cv.Optional(CONF_DOMAIN, default=".local"): cv.domain_name,

View file

@ -1,11 +1,12 @@
#ifdef USE_ESP32
#ifdef USE_ESP_IDF
#include "modem_component.h"
#include "esphome/core/log.h"
#include "esphome/core/util.h"
#include "esphome/core/application.h"
#ifdef USE_ESP32
#include "esp_modem_c_api_types.h"
#include "esp_netif_ppp.h"
#include "cxx_include/esp_modem_types.hpp"
@ -64,7 +65,7 @@ void ModemComponent::setup() {
err = esp_event_loop_create_default();
ESPHL_ERROR_CHECK(err, "modem event loop error");
ESP_LOGCONFIG(TAG, "Initing netif");
esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &ModemComponent::got_ip_event_handler, NULL);
esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &ModemComponent::got_ip_event_handler, nullptr);
ESP_LOGD(TAG, "Initializing esp_modem");
this->modem_netif_init();
this->dte_init();
@ -230,15 +231,14 @@ bool ModemComponent::check_modem_component_state_timings() {
}
void ModemComponent::set_state(ModemComponentState state) {
// execute before transition to state
switch (state)
{
case ModemComponentState::SYNC:
this->dce_init();
break;
default:
break;
// execute before transition to state
switch (state) {
case ModemComponentState::SYNC:
this->dce_init();
break;
default:
break;
}
ESP_LOGCONFIG(TAG, "Modem component change state from %s to %s", this->state_to_string(this->state_),
this->state_to_string(state));
@ -278,7 +278,8 @@ void ModemComponent::dump_config() {
ESP_LOGCONFIG(TAG, " Type: %d", this->type_);
ESP_LOGCONFIG(TAG, " Power pin : %s", (this->power_pin_) ? this->power_pin_->dump_summary().c_str() : "Not defined");
ESP_LOGCONFIG(TAG, " Reset pin : %s", (this->reset_pin_) ? this->reset_pin_->dump_summary().c_str() : "Not defined");
ESP_LOGCONFIG(TAG, " Pwrkey pin : %s", (this->pwrkey_pin_) ? this->pwrkey_pin_->dump_summary().c_str() : "Not defined");
ESP_LOGCONFIG(TAG, " Pwrkey pin : %s",
(this->pwrkey_pin_) ? this->pwrkey_pin_->dump_summary().c_str() : "Not defined");
ESP_LOGCONFIG(TAG, " APN: %s", this->apn_.c_str());
ESP_LOGCONFIG(TAG, " TX Pin: %d", this->tx_pin_);
ESP_LOGCONFIG(TAG, " RX Pin: %d", this->rx_pin_);
@ -385,4 +386,5 @@ void ModemComponent::set_use_address(const std::string &use_address) { this->use
} // namespace modem
} // namespace esphome
#endif // USE_ESP_IDF
#endif // USE_ESP32

View file

@ -1,4 +1,6 @@
#pragma once
#ifdef USE_ESP32
#ifdef USE_ESP_IDF
#include "esphome/core/component.h"
#include "esphome/core/log.h"
@ -6,8 +8,6 @@
#include "esphome/core/hal.h"
#include "esphome/components/network/ip_address.h"
#ifdef USE_ESP32
#include <map>
using esphome::esp_log_printf_;
@ -132,4 +132,5 @@ extern ModemComponent *global_modem_component;
} // namespace modem
} // namespace esphome
#endif // USE_ESP_IDF
#endif // USE_ESP32

View file

@ -32,9 +32,9 @@ bool is_connected() {
#endif
#ifdef USE_MODEM
if (modem::global_modem_component != nullptr && modem::global_modem_component->is_connected()){
return true;
}
if (modem::global_modem_component != nullptr && modem::global_modem_component->is_connected()) {
return true;
}
#endif
return false;
}

View file

@ -269,7 +269,6 @@ CONF_ESP8266_DISABLE_SSL_SUPPORT = "esp8266_disable_ssl_support"
CONF_ESPHOME = "esphome"
CONF_ETHANOL = "ethanol"
CONF_ETHERNET = "ethernet"
CONF_MODEM = "modem"
CONF_EVENT = "event"
CONF_EVENT_TYPE = "event_type"
CONF_EVENT_TYPES = "event_types"
@ -516,6 +515,7 @@ CONF_MODE = "mode"
CONF_MODE_COMMAND_TOPIC = "mode_command_topic"
CONF_MODE_STATE_TOPIC = "mode_state_topic"
CONF_MODEL = "model"
CONF_MODEM = "modem"
CONF_MOISTURE = "moisture"
CONF_MONTH = "month"
CONF_MONTHS = "months"

View file

@ -565,7 +565,7 @@ class EsphomeCore:
if CONF_ETHERNET in self.config:
return self.config[CONF_ETHERNET][CONF_USE_ADDRESS]
if CONF_MODEM in self.config:
return self.config[CONF_MODEM][CONF_USE_ADDRESS]

View file

@ -13,4 +13,4 @@ dependencies:
- if: "idf_version >=5.0"
esp_modem:
git: https://github.com/espressif/esp-protocols.git
path: components/esp_modem
path: components/esp_modem