From 3a289c8284e5e44257c87cf08a231df815b18516 Mon Sep 17 00:00:00 2001 From: oarcher Date: Tue, 13 Aug 2024 16:41:27 +0200 Subject: [PATCH] debug option --- esphome/components/modem/__init__.py | 3 ++- esphome/components/modem/modem_component.cpp | 7 +++++-- esphome/components/modem/modem_component.h | 4 ++-- esphome/components/modem/switch/gnns_switch.h | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/esphome/components/modem/__init__.py b/esphome/components/modem/__init__.py index 92ea8e7d52..ff591e6bfe 100644 --- a/esphome/components/modem/__init__.py +++ b/esphome/components/modem/__init__.py @@ -82,7 +82,7 @@ CONFIG_SCHEMA = cv.All( cv.Optional(CONF_INIT_AT): cv.All(cv.ensure_list(cv.string)), cv.Optional(CONF_ENABLE_ON_BOOT, default=True): cv.boolean, cv.Optional(CONF_ENABLE_CMUX, default=False): cv.boolean, - cv.Optional(CONF_DEBUG, default=False): cv.boolean, # needs also + cv.Optional(CONF_DEBUG, default=False): cv.boolean, cv.Optional(CONF_ON_NOT_RESPONDING): automation.validate_automation( { cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id( @@ -176,6 +176,7 @@ async def to_code(config): cg.add(var.enable_cmux()) if config[CONF_DEBUG]: + add_idf_sdkconfig_option("CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE", True) cg.add(var.enable_debug()) if init_at := config.get(CONF_INIT_AT, None): diff --git a/esphome/components/modem/modem_component.cpp b/esphome/components/modem/modem_component.cpp index 005bbb375b..a06d4de24e 100644 --- a/esphome/components/modem/modem_component.cpp +++ b/esphome/components/modem/modem_component.cpp @@ -48,7 +48,11 @@ ModemComponent::ModemComponent() { global_modem_component = this; } -void ModemComponent::enable_debug() { esp_log_level_set("command_lib", ESP_LOG_VERBOSE); } +void ModemComponent::enable_debug() { + esp_log_level_set("command_lib", ESP_LOG_VERBOSE); + // esp_log_level_set("CMUX", ESP_LOG_VERBOSE); + // esp_log_level_set("CMUX Received", ESP_LOG_VERBOSE); +} AtCommandResult ModemComponent::send_at(const std::string &cmd, uint32_t timeout) { AtCommandResult at_command_result; @@ -643,7 +647,6 @@ bool ModemComponent::start_ppp_() { if (!status) { ESP_LOGE(TAG, "Unable to change modem mode to PPP"); - this->poweroff_(); } return status; diff --git a/esphome/components/modem/modem_component.h b/esphome/components/modem/modem_component.h index c5c71d4cd0..9407e66a22 100644 --- a/esphome/components/modem/modem_component.h +++ b/esphome/components/modem/modem_component.h @@ -139,9 +139,9 @@ class ModemComponent : public Component { size_t uart_rx_buffer_size_ = 2048; // 256-2048 size_t uart_tx_buffer_size_ = 1024; // 256-2048 uint8_t uart_event_queue_size_ = 30; // 10-40 - size_t uart_event_task_stack_size_ = 2048; // 2000-6000 + size_t uart_event_task_stack_size_ = 4096; // 2000-6000 uint8_t uart_event_task_priority_ = 5; // 3-22 - uint32_t command_delay_ = 10000; // timeout for AT commands + uint32_t command_delay_ = 1000; // timeout for AT commands uint32_t update_interval_ = 60 * 1000; // Changes will trigger user callback diff --git a/esphome/components/modem/switch/gnns_switch.h b/esphome/components/modem/switch/gnns_switch.h index ee1ce0eef0..a80c42f486 100644 --- a/esphome/components/modem/switch/gnns_switch.h +++ b/esphome/components/modem/switch/gnns_switch.h @@ -20,6 +20,7 @@ class GnssSwitch : public switch_::Switch, public Component { // ========== INTERNAL METHODS ========== // (In most use cases you won't need these) + float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } void dump_config() override; void setup() override; void loop() override;