added modem reset on many mqtt retry, added reboot and modem reset to
command interface, pppos control from config
This commit is contained in:
parent
ea5bad2c1d
commit
a162ef8091
6
Kconfig
6
Kconfig
|
|
@ -812,6 +812,12 @@ menu "WebGUIApp"
|
|||
endif
|
||||
endmenu
|
||||
|
||||
menu "PPPoS configuration"
|
||||
config WEBGUIAPP_PPPOS_ENABLE
|
||||
bool "Enabled PPPoS transport"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Serial port configuration"
|
||||
|
||||
config WEBGUIAPP_UART_TRANSPORT_ENABLE
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ void EthStart(void);
|
|||
|
||||
void WiFiTransportTask(void *prm);
|
||||
|
||||
void PPPConnReset (void);
|
||||
|
||||
void PPPModemColdStart(void);
|
||||
void PPPModemSoftRestart(void);
|
||||
|
|
@ -96,6 +97,7 @@ esp_netif_t* GetSTANetifAdapter(void);
|
|||
esp_netif_t* GetAPNetifAdapter(void);
|
||||
esp_netif_t* GetETHNetifAdapter(void);
|
||||
|
||||
|
||||
bool isWIFIConnected(void);
|
||||
bool isETHConnected(void);
|
||||
bool isPPPConnected(void);
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@
|
|||
*/
|
||||
|
||||
#include "CommandProcSys.h"
|
||||
#include "NetTransport.h"
|
||||
#include "webguiapp.h"
|
||||
|
||||
|
||||
#define TAG "COMMAND_PROC_SYS"
|
||||
|
||||
//#define MAX_OBJECTS_NUMBER CONFIG_WEBGUIAPP_MAX_OBJECTS_NUM
|
||||
|
|
@ -48,6 +50,14 @@ static void SYSTEM_TEST_handle(char *obj, char *com, char *arg)
|
|||
static void SYSTEM_REBOOT_handle(char *obj, char *com, char *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Object:%s, Command:%s, Argument %s", obj, com, arg);
|
||||
esp_restart();
|
||||
}
|
||||
static void MODEM_REBOOT_handle(char *obj, char *com, char *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Object:%s, Command:%s, Argument %s", obj, com, arg);
|
||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||
PPPConnReset();
|
||||
#endif
|
||||
}
|
||||
|
||||
obj_struct_t *custom_com_obj_arr = NULL;
|
||||
|
|
@ -65,9 +75,9 @@ const obj_struct_t com_obj_arr[] = {
|
|||
},
|
||||
{
|
||||
.index = 0,
|
||||
.object_name = "SYSTEM1",
|
||||
.object_name = "MODEM",
|
||||
.allowed_actions = { "TEST", "REBOOT", "TEST2", "TEST3", "TEST4" },
|
||||
.command_handlers = { &SYSTEM_TEST_handle, &SYSTEM_REBOOT_handle }
|
||||
.command_handlers = { &SYSTEM_TEST_handle, &MODEM_REBOOT_handle }
|
||||
},
|
||||
{
|
||||
.index = 0,
|
||||
|
|
|
|||
|
|
@ -62,13 +62,14 @@ void RegGSMReset(void (*gsm_rst)(uint8_t level)) { gsm_reset = gsm_rst; }
|
|||
esp_netif_t *GetPPPNetifAdapter(void) {
|
||||
if (isPPPConn)
|
||||
return ppp_netif;
|
||||
else
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MODEM_INFO *GetPPPModemInfo(void) { return &mod_info; }
|
||||
|
||||
bool isPPPConnected(void) { return isPPPConn; }
|
||||
void PPPConnReset(void) { isPPPConn = false; }
|
||||
|
||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||
static void on_ppp_changed(void *arg, esp_event_base_t event_base,
|
||||
|
|
@ -266,7 +267,8 @@ static void GSMInitTask(void *pvParameter) {
|
|||
}
|
||||
|
||||
ESP_LOGI(TAG, "PPP data mode OK");
|
||||
xEventGroupWaitBits(event_group, CONNECT_BIT, pdTRUE, pdTRUE, pdMS_TO_TICKS(WAIT_FOR_GET_IP * 1000));
|
||||
xEventGroupWaitBits(event_group, CONNECT_BIT, pdTRUE, pdTRUE,
|
||||
pdMS_TO_TICKS(WAIT_FOR_GET_IP * 1000));
|
||||
|
||||
isPPPinitializing = false;
|
||||
vTaskDelete(NULL);
|
||||
|
|
@ -281,7 +283,7 @@ modem_init_fail:
|
|||
void PPPModemColdStart(void) {
|
||||
ResetType = 0;
|
||||
xTaskCreatePinnedToCore(GSMInitTask, "GSMInitTask", 1024 * 6, &ResetType, 3,
|
||||
&initTaskhandle, 1);
|
||||
&initTaskhandle, 1);
|
||||
ESP_LOGI(TAG, "Start GSM cold initialization task");
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +305,8 @@ static void GSMRunTask(void *pvParameter) {
|
|||
}
|
||||
|
||||
void PPPModemStart(void) {
|
||||
xTaskCreatePinnedToCore(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3, NULL, 1);
|
||||
xTaskCreatePinnedToCore(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3,
|
||||
NULL, 1);
|
||||
}
|
||||
|
||||
int PPPModemGetRSSI(void) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
#include <SysConfiguration.h>
|
||||
#include <SystemApplication.h>
|
||||
#include <string.h>
|
||||
#include "esp_log.h"
|
||||
#include "Helpers.h"
|
||||
#include "NetTransport.h"
|
||||
|
|
@ -319,8 +320,14 @@ msg_id = esp_mqtt_client_subscribe(client, (char*) topic, 0);
|
|||
#endif
|
||||
if (++MQTTReconnectCounter > MQTT_RECONNECT_CHANGE_ADAPTER)
|
||||
{
|
||||
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||
char interface[3];
|
||||
GetDefaultNetIFName(interface);
|
||||
if(!strcmp((const char*)interface , "pp")) //Cold reboot modem on can't connect to ppp
|
||||
PPPConnReset();
|
||||
#endif
|
||||
MQTTReconnectCounter = 0;
|
||||
NextDefaultNetIF();
|
||||
NextDefaultNetIF();
|
||||
}
|
||||
mqtt[idx].is_connected = false;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#define UART_TX_PIN 17
|
||||
#define UART_BUF_SIZE 12000
|
||||
|
||||
#ifdef CONFIG_WEBGUIAPP_PPPOS_ENABLE
|
||||
|
||||
// PPP configuration
|
||||
static ppp_pcb *ppp;
|
||||
static struct netif ppp_netif;
|
||||
|
|
@ -98,3 +100,4 @@ void InitPPPSerial()
|
|||
|
||||
xTaskCreate(pppos_task, "pppos_task", 4096 , (void *)0, 7, NULL);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -179,8 +179,11 @@ esp_err_t WebGuiAppInit(void)
|
|||
#if CONFIG_WEBGUIAPP_UART_TRANSPORT_ENABLE
|
||||
InitSerialPort();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_WEBGUIAPP_PPPOS_ENABLE
|
||||
InitPPPSerial();
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user