mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
allow wifi AP & increase buffer size
This commit is contained in:
parent
4d348aae3c
commit
c4c96e4bc9
2 changed files with 18 additions and 19 deletions
|
@ -1,23 +1,23 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from esphome import automation, pins
|
||||||
|
import esphome.codegen as cg
|
||||||
|
from esphome.components.esp32 import add_idf_component, add_idf_sdkconfig_option
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_ENABLE_ON_BOOT,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_USE_ADDRESS,
|
|
||||||
CONF_TX_PIN,
|
|
||||||
CONF_RX_PIN,
|
|
||||||
CONF_USERNAME,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_MODEL,
|
CONF_MODEL,
|
||||||
CONF_TRIGGER_ID,
|
|
||||||
CONF_ON_CONNECT,
|
CONF_ON_CONNECT,
|
||||||
CONF_ON_DISCONNECT,
|
CONF_ON_DISCONNECT,
|
||||||
CONF_ENABLE_ON_BOOT,
|
CONF_PASSWORD,
|
||||||
|
CONF_RX_PIN,
|
||||||
|
CONF_TRIGGER_ID,
|
||||||
|
CONF_TX_PIN,
|
||||||
|
CONF_USE_ADDRESS,
|
||||||
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.core import coroutine_with_priority
|
from esphome.core import coroutine_with_priority
|
||||||
from esphome.components.esp32 import add_idf_component, add_idf_sdkconfig_option
|
|
||||||
from esphome import pins, automation
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ CODEOWNERS = ["@oarcher"]
|
||||||
DEPENDENCIES = ["esp32"]
|
DEPENDENCIES = ["esp32"]
|
||||||
AUTO_LOAD = ["network"]
|
AUTO_LOAD = ["network"]
|
||||||
# following should be removed if conflicts are resolved (so we can have a wifi ap using modem)
|
# following should be removed if conflicts are resolved (so we can have a wifi ap using modem)
|
||||||
CONFLICTS_WITH = ["wifi", "captive_portal", "ethernet"]
|
CONFLICTS_WITH = ["captive_portal", "ethernet"]
|
||||||
|
|
||||||
CONF_PIN_CODE = "pin_code"
|
CONF_PIN_CODE = "pin_code"
|
||||||
CONF_APN = "apn"
|
CONF_APN = "apn"
|
||||||
|
@ -131,7 +131,6 @@ async def to_code(config):
|
||||||
path="components/esp_modem",
|
path="components/esp_modem",
|
||||||
)
|
)
|
||||||
|
|
||||||
add_idf_sdkconfig_option("CONFIG_LWIP_DHCPS", False)
|
|
||||||
add_idf_sdkconfig_option("CONFIG_PPP", True)
|
add_idf_sdkconfig_option("CONFIG_PPP", True)
|
||||||
add_idf_sdkconfig_option("CONFIG_LWIP_PPP_SUPPORT", True)
|
add_idf_sdkconfig_option("CONFIG_LWIP_PPP_SUPPORT", True)
|
||||||
add_idf_sdkconfig_option("CONFIG_PPP_PAP_SUPPORT", True)
|
add_idf_sdkconfig_option("CONFIG_PPP_PAP_SUPPORT", True)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef USE_MODEM_MODEL
|
#ifndef USE_MODEM_MODEL
|
||||||
#define USE_MODEM_MODEL UNKNOWN
|
#define USE_MODEM_MODEL "UNKNOWN"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ESPHL_ERROR_CHECK(err, message) \
|
#define ESPHL_ERROR_CHECK(err, message) \
|
||||||
|
@ -36,10 +36,10 @@
|
||||||
ESP_LOGE(TAG, message ": %s", command_result_to_string(err).c_str()); \
|
ESP_LOGE(TAG, message ": %s", command_result_to_string(err).c_str()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const size_t CONFIG_MODEM_UART_RX_BUFFER_SIZE = 2048;
|
static const size_t CONFIG_MODEM_UART_RX_BUFFER_SIZE = 32768;
|
||||||
static const size_t CONFIG_MODEM_UART_TX_BUFFER_SIZE = 1024;
|
static const size_t CONFIG_MODEM_UART_TX_BUFFER_SIZE = 32768;
|
||||||
static const uint8_t CONFIG_MODEM_UART_EVENT_QUEUE_SIZE = 30;
|
static const uint8_t CONFIG_MODEM_UART_EVENT_QUEUE_SIZE = 30;
|
||||||
static const size_t CONFIG_MODEM_UART_EVENT_TASK_STACK_SIZE = 2048;
|
static const size_t CONFIG_MODEM_UART_EVENT_TASK_STACK_SIZE = 32768;
|
||||||
static const uint8_t CONFIG_MODEM_UART_EVENT_TASK_PRIORITY = 5;
|
static const uint8_t CONFIG_MODEM_UART_EVENT_TASK_PRIORITY = 5;
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
@ -56,7 +56,7 @@ ModemComponent::ModemComponent() {
|
||||||
|
|
||||||
void ModemComponent::dump_config() { this->dump_connect_params_(); }
|
void ModemComponent::dump_config() { this->dump_connect_params_(); }
|
||||||
|
|
||||||
float ModemComponent::get_setup_priority() const { return setup_priority::WIFI; } // FIXME AFTER_WIFI
|
float ModemComponent::get_setup_priority() const { return setup_priority::WIFI + 1; } // just before WIFI
|
||||||
|
|
||||||
bool ModemComponent::can_proceed() { return this->is_connected(); }
|
bool ModemComponent::can_proceed() { return this->is_connected(); }
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ void ModemComponent::loop() {
|
||||||
// assert(this->dce->set_mode(modem_mode::COMMAND_MODE)); // OK on 7600, nok on 7670...
|
// assert(this->dce->set_mode(modem_mode::COMMAND_MODE)); // OK on 7600, nok on 7670...
|
||||||
this->dce->set_mode(modem_mode::COMMAND_MODE);
|
this->dce->set_mode(modem_mode::COMMAND_MODE);
|
||||||
}
|
}
|
||||||
delay(500);
|
delay(200); // NOLINT
|
||||||
ESP_LOGD(TAG, "Hanging up connection after %.1fmin", float(this->connect_begin_) / (1000 * 60));
|
ESP_LOGD(TAG, "Hanging up connection after %.1fmin", float(this->connect_begin_) / (1000 * 60));
|
||||||
if (this->dce->hang_up() != command_result::OK) {
|
if (this->dce->hang_up() != command_result::OK) {
|
||||||
ESP_LOGW(TAG, "Unable to hang up modem. Trying to continue anyway.");
|
ESP_LOGW(TAG, "Unable to hang up modem. Trying to continue anyway.");
|
||||||
|
|
Loading…
Reference in a new issue