This commit is contained in:
oarcher 2024-08-07 00:10:03 +02:00
parent 4ec62a2be6
commit 28dd222283
6 changed files with 9 additions and 10 deletions

View file

@ -51,6 +51,8 @@ ModemComponent::ModemComponent() {
global_modem_component = this; global_modem_component = this;
} }
void ModemComponent::enable_debug() { esp_log_level_set("command_lib", ESP_LOG_VERBOSE); }
std::string ModemComponent::send_at(const std::string &cmd) { std::string ModemComponent::send_at(const std::string &cmd) {
std::string result = "ERROR"; std::string result = "ERROR";
command_result status = command_result::FAIL; command_result status = command_result::FAIL;

View file

@ -61,7 +61,7 @@ class ModemComponent : public Component {
void set_gnss_power_command(const std::string &at_command) { this->gnss_power_command_ = at_command; } void set_gnss_power_command(const std::string &at_command) { this->gnss_power_command_ = at_command; }
void set_not_responding_cb(Trigger<> *not_responding_cb) { this->not_responding_cb_ = not_responding_cb; } void set_not_responding_cb(Trigger<> *not_responding_cb) { this->not_responding_cb_ = not_responding_cb; }
void enable_cmux() { this->cmux_ = true; } void enable_cmux() { this->cmux_ = true; }
void enable_debug() { esp_log_level_set("command_lib", ESP_LOG_VERBOSE); } void enable_debug();
void add_init_at_command(const std::string &cmd) { this->init_at_commands_.push_back(cmd); } void add_init_at_command(const std::string &cmd) { this->init_at_commands_.push_back(cmd); }
bool is_connected() { return this->component_state_ == ModemComponentState::CONNECTED; } bool is_connected() { return this->component_state_ == ModemComponentState::CONNECTED; }
bool is_disabled() { return this->component_state_ == ModemComponentState::DISABLED; } bool is_disabled() { return this->component_state_ == ModemComponentState::DISABLED; }

View file

@ -1,10 +1,5 @@
import esphome.codegen as cg import esphome.codegen as cg
from esphome.components import sensor from esphome.components import sensor
from esphome.components.modem import (
CONF_ENABLE_GNSS,
CONF_MODEM,
final_validate_platform,
)
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import ( from esphome.const import (
CONF_ALTITUDE, CONF_ALTITUDE,
@ -20,6 +15,8 @@ from esphome.const import (
) )
import esphome.final_validate as fv import esphome.final_validate as fv
from .. import CONF_ENABLE_GNSS, CONF_MODEM, final_validate_platform
CODEOWNERS = ["@oarcher"] CODEOWNERS = ["@oarcher"]
AUTO_LOAD = [] AUTO_LOAD = []

View file

@ -10,7 +10,7 @@
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/components/modem/modem_component.h" #include "../modem_component.h"
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -1,9 +1,10 @@
import esphome.codegen as cg import esphome.codegen as cg
from esphome.components import text_sensor from esphome.components import text_sensor
from esphome.components.modem import final_validate_platform
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import CONF_ID, DEVICE_CLASS_EMPTY from esphome.const import CONF_ID, DEVICE_CLASS_EMPTY
from .. import final_validate_platform
CODEOWNERS = ["@oarcher"] CODEOWNERS = ["@oarcher"]
AUTO_LOAD = [] AUTO_LOAD = []

View file

@ -10,8 +10,7 @@
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
// #include "esphome/components/watchdog/watchdog.h" #include "../modem_component.h"
#include "esphome/components/modem/modem_component.h"
#define ESPHL_ERROR_CHECK(err, message) \ #define ESPHL_ERROR_CHECK(err, message) \
if ((err) != ESP_OK) { \ if ((err) != ESP_OK) { \