fixed crash on modem restart during info retrieve over web ui
This commit is contained in:
parent
9f20a1b08b
commit
394a798a98
|
|
@ -22,16 +22,16 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../include/SysConfiguration.h"
|
#include "../include/SysConfiguration.h"
|
||||||
|
#include "NetTransport.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "esp_event.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_modem_api.h"
|
||||||
|
#include "esp_netif.h"
|
||||||
|
#include "esp_netif_ppp.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_netif.h"
|
|
||||||
#include "esp_netif_ppp.h"
|
|
||||||
#include "esp_event.h"
|
|
||||||
#include "esp_modem_api.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "NetTransport.h"
|
|
||||||
|
|
||||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||||
static EventGroupHandle_t event_group = NULL;
|
static EventGroupHandle_t event_group = NULL;
|
||||||
|
|
@ -56,34 +56,24 @@ esp_modem_dce_t *dce;
|
||||||
TaskHandle_t trasporttask;
|
TaskHandle_t trasporttask;
|
||||||
|
|
||||||
static void (*gsm_reset)(uint8_t level) = NULL;
|
static void (*gsm_reset)(uint8_t level) = NULL;
|
||||||
void RegGSMReset(void (*gsm_rst)(uint8_t level))
|
void RegGSMReset(void (*gsm_rst)(uint8_t level)) { gsm_reset = gsm_rst; }
|
||||||
{
|
|
||||||
gsm_reset = gsm_rst;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_netif_t* GetPPPNetifAdapter(void)
|
esp_netif_t *GetPPPNetifAdapter(void) {
|
||||||
{
|
if (isPPPConn)
|
||||||
return ppp_netif;
|
return ppp_netif;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MODEM_INFO* GetPPPModemInfo(void)
|
MODEM_INFO *GetPPPModemInfo(void) { return &mod_info; }
|
||||||
{
|
|
||||||
return &mod_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isPPPConnected(void)
|
bool isPPPConnected(void) { return isPPPConn; }
|
||||||
{
|
|
||||||
return isPPPConn;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||||
static void on_ppp_changed(void *arg, esp_event_base_t event_base,
|
static void on_ppp_changed(void *arg, esp_event_base_t event_base,
|
||||||
int32_t event_id,
|
int32_t event_id, void *event_data) {
|
||||||
void *event_data)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "PPP state changed event %u", (unsigned int)event_id);
|
ESP_LOGI(TAG, "PPP state changed event %u", (unsigned int)event_id);
|
||||||
if (event_id == NETIF_PPP_ERRORUSER)
|
if (event_id == NETIF_PPP_ERRORUSER) {
|
||||||
{
|
|
||||||
/* User interrupted event from esp-netif */
|
/* User interrupted event from esp-netif */
|
||||||
esp_netif_t *netif = event_data;
|
esp_netif_t *netif = event_data;
|
||||||
ESP_LOGI(TAG, "User interrupted event from netif:%p", netif);
|
ESP_LOGI(TAG, "User interrupted event from netif:%p", netif);
|
||||||
|
|
@ -91,21 +81,21 @@ static void on_ppp_changed(void *arg, esp_event_base_t event_base,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_ip_event(void *arg, esp_event_base_t event_base,
|
static void on_ip_event(void *arg, esp_event_base_t event_base,
|
||||||
int32_t event_id,
|
int32_t event_id, void *event_data) {
|
||||||
void *event_data)
|
|
||||||
{
|
|
||||||
ESP_LOGD(TAG, "IP event! %u", (unsigned int)event_id);
|
ESP_LOGD(TAG, "IP event! %u", (unsigned int)event_id);
|
||||||
if (event_id == IP_EVENT_PPP_GOT_IP)
|
if (event_id == IP_EVENT_PPP_GOT_IP) {
|
||||||
{
|
|
||||||
esp_netif_dns_info_t dns_info;
|
esp_netif_dns_info_t dns_info;
|
||||||
|
|
||||||
ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data;
|
ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data;
|
||||||
esp_netif_t *netif = event->esp_netif;
|
esp_netif_t *netif = event->esp_netif;
|
||||||
|
|
||||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||||
memcpy(&GetSysConf()->gsmSettings.IPAddr, &event->ip_info.ip, sizeof(event->ip_info.ip));
|
memcpy(&GetSysConf()->gsmSettings.IPAddr, &event->ip_info.ip,
|
||||||
memcpy(&GetSysConf()->gsmSettings.Mask, &event->ip_info.netmask, sizeof(event->ip_info.netmask));
|
sizeof(event->ip_info.ip));
|
||||||
memcpy(&GetSysConf()->gsmSettings.Gateway, &event->ip_info.gw, sizeof(event->ip_info.gw));
|
memcpy(&GetSysConf()->gsmSettings.Mask, &event->ip_info.netmask,
|
||||||
|
sizeof(event->ip_info.netmask));
|
||||||
|
memcpy(&GetSysConf()->gsmSettings.Gateway, &event->ip_info.gw,
|
||||||
|
sizeof(event->ip_info.gw));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Modem Connect to PPP Server");
|
ESP_LOGI(TAG, "Modem Connect to PPP Server");
|
||||||
|
|
@ -121,44 +111,34 @@ static void on_ip_event(void *arg, esp_event_base_t event_base,
|
||||||
xEventGroupSetBits(event_group, CONNECT_BIT);
|
xEventGroupSetBits(event_group, CONNECT_BIT);
|
||||||
isPPPConn = true;
|
isPPPConn = true;
|
||||||
ESP_LOGI(TAG, "GOT ip event!!!");
|
ESP_LOGI(TAG, "GOT ip event!!!");
|
||||||
}
|
} else if (event_id == IP_EVENT_PPP_LOST_IP) {
|
||||||
else if (event_id == IP_EVENT_PPP_LOST_IP)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Modem Disconnect from PPP Server");
|
ESP_LOGI(TAG, "Modem Disconnect from PPP Server");
|
||||||
isPPPConn = false;
|
isPPPConn = false;
|
||||||
}
|
} else if (event_id == IP_EVENT_GOT_IP6) {
|
||||||
else if (event_id == IP_EVENT_GOT_IP6)
|
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "GOT IPv6 event!");
|
ESP_LOGI(TAG, "GOT IPv6 event!");
|
||||||
ip_event_got_ip6_t *event = (ip_event_got_ip6_t *)event_data;
|
ip_event_got_ip6_t *event = (ip_event_got_ip6_t *)event_data;
|
||||||
ESP_LOGI(TAG, "Got IPv6 address " IPV6STR, IPV62STR(event->ip6_info.ip));
|
ESP_LOGI(TAG, "Got IPv6 address " IPV6STR, IPV62STR(event->ip6_info.ip));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemNotReady(void)
|
void ModemNotReady(void) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
static void GSMInitTask(void *pvParameter) {
|
||||||
|
|
||||||
static void GSMInitTask(void *pvParameter)
|
|
||||||
{
|
|
||||||
isPPPinitializing = true;
|
isPPPinitializing = true;
|
||||||
int starttype = *((int *)pvParameter);
|
int starttype = *((int *)pvParameter);
|
||||||
esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, &on_ip_event);
|
esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, &on_ip_event);
|
||||||
esp_event_handler_unregister(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &on_ppp_changed);
|
esp_event_handler_unregister(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID,
|
||||||
|
&on_ppp_changed);
|
||||||
|
|
||||||
if (dce)
|
if (dce) {
|
||||||
{
|
|
||||||
esp_modem_destroy(dce);
|
esp_modem_destroy(dce);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppp_netif != NULL)
|
if (ppp_netif != NULL) {
|
||||||
{
|
|
||||||
esp_netif_destroy(ppp_netif);
|
esp_netif_destroy(ppp_netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (starttype == 0)
|
if (starttype == 0) {
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "GSM module power down and up reset");
|
ESP_LOGE(TAG, "GSM module power down and up reset");
|
||||||
#if CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN >= 0
|
#if CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN >= 0
|
||||||
gpio_set_level(CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN, 0);
|
gpio_set_level(CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN, 0);
|
||||||
|
|
@ -166,24 +146,22 @@ static void GSMInitTask(void *pvParameter)
|
||||||
gpio_set_level(CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN, 1);
|
gpio_set_level(CONFIG_MODEM_DEVICE_POWER_CONTROL_PIN, 1);
|
||||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||||
#else
|
#else
|
||||||
if (gsm_reset)
|
if (gsm_reset) {
|
||||||
{
|
|
||||||
gsm_reset(0);
|
gsm_reset(0);
|
||||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||||
gsm_reset(1);
|
gsm_reset(1);
|
||||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "GSM module reset procedure not defined");
|
ESP_LOGE(TAG, "GSM module reset procedure not defined");
|
||||||
ESP_ERROR_CHECK(1);
|
ESP_ERROR_CHECK(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &on_ip_event, NULL));
|
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID,
|
||||||
ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &on_ppp_changed, NULL));
|
&on_ip_event, NULL));
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID,
|
||||||
|
&on_ppp_changed, NULL));
|
||||||
event_group = xEventGroupCreate();
|
event_group = xEventGroupCreate();
|
||||||
/* Configure the DTE */
|
/* Configure the DTE */
|
||||||
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
|
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
|
||||||
|
|
@ -200,7 +178,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
dte_config.task_priority = CONFIG_MODEM_UART_EVENT_TASK_PRIORITY;
|
dte_config.task_priority = CONFIG_MODEM_UART_EVENT_TASK_PRIORITY;
|
||||||
dte_config.dte_buffer_size = CONFIG_MODEM_UART_RX_BUFFER_SIZE / 2;
|
dte_config.dte_buffer_size = CONFIG_MODEM_UART_RX_BUFFER_SIZE / 2;
|
||||||
/* Configure the DCE */
|
/* Configure the DCE */
|
||||||
esp_modem_dce_config_t dce_config = ESP_MODEM_DCE_DEFAULT_CONFIG(GetSysConf()->gsmSettings.APN);
|
esp_modem_dce_config_t dce_config =
|
||||||
|
ESP_MODEM_DCE_DEFAULT_CONFIG(GetSysConf()->gsmSettings.APN);
|
||||||
/* Configure the PPP netif */
|
/* Configure the PPP netif */
|
||||||
esp_netif_inherent_config_t esp_netif_conf = ESP_NETIF_INHERENT_DEFAULT_PPP();
|
esp_netif_inherent_config_t esp_netif_conf = ESP_NETIF_INHERENT_DEFAULT_PPP();
|
||||||
|
|
||||||
|
|
@ -212,7 +191,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
/* Init netif object */
|
/* Init netif object */
|
||||||
ppp_netif = esp_netif_new(&netif_ppp_config);
|
ppp_netif = esp_netif_new(&netif_ppp_config);
|
||||||
assert(ppp_netif);
|
assert(ppp_netif);
|
||||||
dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM800, &dte_config, &dce_config, ppp_netif);
|
dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM800, &dte_config, &dce_config,
|
||||||
|
ppp_netif);
|
||||||
assert(dce);
|
assert(dce);
|
||||||
|
|
||||||
if (esp_modem_set_baud(dce, CUSTOM_MODEM_BAUDRATE) == ESP_OK)
|
if (esp_modem_set_baud(dce, CUSTOM_MODEM_BAUDRATE) == ESP_OK)
|
||||||
|
|
@ -222,10 +202,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
|
|
||||||
int OperationRepeate = 0;
|
int OperationRepeate = 0;
|
||||||
// MODULE NAME
|
// MODULE NAME
|
||||||
while (esp_modem_get_module_name(dce, mod_info.model) != ESP_OK)
|
while (esp_modem_get_module_name(dce, mod_info.model) != ESP_OK) {
|
||||||
{
|
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER) {
|
||||||
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Error get module name");
|
ESP_LOGE(TAG, "Error get module name");
|
||||||
goto modem_init_fail;
|
goto modem_init_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -237,10 +215,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
// IMSI
|
// IMSI
|
||||||
OperationRepeate = 0;
|
OperationRepeate = 0;
|
||||||
mod_info.imsi[0] = 0x00;
|
mod_info.imsi[0] = 0x00;
|
||||||
while (esp_modem_get_imsi(dce, mod_info.imsi) != ESP_OK)
|
while (esp_modem_get_imsi(dce, mod_info.imsi) != ESP_OK) {
|
||||||
{
|
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER) {
|
||||||
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Error get IMSI");
|
ESP_LOGE(TAG, "Error get IMSI");
|
||||||
goto modem_init_fail;
|
goto modem_init_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -254,10 +230,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
mod_info.oper[0] = 0x00;
|
mod_info.oper[0] = 0x00;
|
||||||
int tech = 0;
|
int tech = 0;
|
||||||
vTaskDelay(pdMS_TO_TICKS(10000));
|
vTaskDelay(pdMS_TO_TICKS(10000));
|
||||||
while (esp_modem_get_operator_name(dce, mod_info.oper, &tech) != ESP_OK)
|
while (esp_modem_get_operator_name(dce, mod_info.oper, &tech) != ESP_OK) {
|
||||||
{
|
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER) {
|
||||||
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Error get operator name");
|
ESP_LOGE(TAG, "Error get operator name");
|
||||||
goto modem_init_fail;
|
goto modem_init_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -269,10 +243,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
// IMEI
|
// IMEI
|
||||||
mod_info.imei[0] = 0x00;
|
mod_info.imei[0] = 0x00;
|
||||||
OperationRepeate = 0;
|
OperationRepeate = 0;
|
||||||
while (esp_modem_get_imei(dce, mod_info.imei) != ESP_OK)
|
while (esp_modem_get_imei(dce, mod_info.imei) != ESP_OK) {
|
||||||
{
|
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER) {
|
||||||
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Error get IMEI");
|
ESP_LOGE(TAG, "Error get IMEI");
|
||||||
goto modem_init_fail;
|
goto modem_init_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -283,10 +255,8 @@ static void GSMInitTask(void *pvParameter)
|
||||||
|
|
||||||
// SWITCH TO CMUX
|
// SWITCH TO CMUX
|
||||||
OperationRepeate = 0;
|
OperationRepeate = 0;
|
||||||
while (esp_modem_set_mode(dce, ESP_MODEM_MODE_CMUX) != ESP_OK)
|
while (esp_modem_set_mode(dce, ESP_MODEM_MODE_CMUX) != ESP_OK) {
|
||||||
{
|
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER) {
|
||||||
if (OperationRepeate++ >= MAX_COMMAND_REPEATE_NUMBER)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Error switch module to CMUX");
|
ESP_LOGE(TAG, "Error switch module to CMUX");
|
||||||
goto modem_init_fail;
|
goto modem_init_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -307,26 +277,23 @@ modem_init_fail:
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPPModemColdStart(void)
|
void PPPModemColdStart(void) {
|
||||||
{
|
|
||||||
ResetType = 0;
|
ResetType = 0;
|
||||||
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, &initTaskhandle);
|
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3,
|
||||||
|
&initTaskhandle);
|
||||||
ESP_LOGI(TAG, "Start GSM cold initialization task");
|
ESP_LOGI(TAG, "Start GSM cold initialization task");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPPModemSoftRestart(void)
|
void PPPModemSoftRestart(void) {
|
||||||
{
|
|
||||||
ResetType = 1;
|
ResetType = 1;
|
||||||
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3, &initTaskhandle);
|
xTaskCreate(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3,
|
||||||
|
&initTaskhandle);
|
||||||
ESP_LOGI(TAG, "Start GSM soft initialization task");
|
ESP_LOGI(TAG, "Start GSM soft initialization task");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GSMRunTask(void *pvParameter)
|
static void GSMRunTask(void *pvParameter) {
|
||||||
{
|
while (1) {
|
||||||
while (1)
|
if (!isPPPConn && !isPPPinitializing) { // try to reconnect modem
|
||||||
{
|
|
||||||
if (!isPPPConn && !isPPPinitializing)
|
|
||||||
{ //try to reconnect modem
|
|
||||||
ESP_LOGW(TAG, "Module restart by watchdog");
|
ESP_LOGW(TAG, "Module restart by watchdog");
|
||||||
PPPModemColdStart();
|
PPPModemColdStart();
|
||||||
}
|
}
|
||||||
|
|
@ -334,29 +301,23 @@ static void GSMRunTask(void *pvParameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPPModemStart(void)
|
void PPPModemStart(void) {
|
||||||
{
|
|
||||||
xTaskCreate(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3, NULL);
|
xTaskCreate(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PPPModemGetRSSI(void)
|
int PPPModemGetRSSI(void) {
|
||||||
{
|
|
||||||
int rssi = -1, ber;
|
int rssi = -1, ber;
|
||||||
|
if (isPPPConn)
|
||||||
esp_modem_get_signal_quality(dce, &rssi, &ber);
|
esp_modem_get_signal_quality(dce, &rssi, &ber);
|
||||||
return rssi;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemSetATTimeout(int timeout)
|
void ModemSetATTimeout(int timeout) { attimeout = timeout; }
|
||||||
{
|
|
||||||
attimeout = timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemSendAT(char *cmd, char *resp, int timeout)
|
void ModemSendAT(char *cmd, char *resp, int timeout) {
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Command:%s", cmd);
|
ESP_LOGI(TAG, "Command:%s", cmd);
|
||||||
int res = esp_modem_at(dce, cmd, resp, attimeout);
|
int res = esp_modem_at(dce, cmd, resp, attimeout);
|
||||||
switch (res)
|
switch (res) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
ESP_LOGI(TAG, "OK");
|
ESP_LOGI(TAG, "OK");
|
||||||
break;
|
break;
|
||||||
|
|
@ -371,16 +332,11 @@ void ModemSendAT(char *cmd, char *resp, int timeout)
|
||||||
ESP_LOGI(TAG, "Response:%s", resp);
|
ESP_LOGI(TAG, "Response:%s", resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t cmd_cb(uint8_t *data, int len)
|
esp_err_t cmd_cb(uint8_t *data, int len) {
|
||||||
{
|
|
||||||
ESP_LOGI(TAG, "Response:%*s", len, data);
|
ESP_LOGI(TAG, "Response:%*s", len, data);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemSendSMS(void)
|
void ModemSendSMS(void) { esp_modem_command(dce, "atd", &cmd_cb, 3000); }
|
||||||
{
|
|
||||||
esp_modem_command(dce, "atd", &cmd_cb, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user