Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
4c2dd92bd1
2
Kconfig
2
Kconfig
|
|
@ -37,7 +37,7 @@ menu "WebGUIApp"
|
||||||
|
|
||||||
config MAIN_FUNCTIONAL_BUTTON_GPIO
|
config MAIN_FUNCTIONAL_BUTTON_GPIO
|
||||||
int "Main functional button GPIO"
|
int "Main functional button GPIO"
|
||||||
range -1 34
|
range -1 39
|
||||||
default 15
|
default 15
|
||||||
help
|
help
|
||||||
Set the GPIO number for main system button. Mainly needed for settings default reset. If not
|
Set the GPIO number for main system button. Mainly needed for settings default reset. If not
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ void PPPModemColdStart(void);
|
||||||
void PPPModemSoftRestart(void);
|
void PPPModemSoftRestart(void);
|
||||||
void PPPModemStart(void);
|
void PPPModemStart(void);
|
||||||
|
|
||||||
void PPPModemGetRSSI(void);
|
int PPPModemGetRSSI(void);
|
||||||
void ModemSendSMS(void);
|
void ModemSendSMS(void);
|
||||||
void ModemSendAT(char *cmd, char *resp, int timeout);
|
void ModemSendAT(char *cmd, char *resp, int timeout);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#if CONFIG_ETH_USE_SPI_ETHERNET
|
#if CONFIG_ETH_USE_SPI_ETHERNET
|
||||||
#include "driver/spi_master.h"
|
#include "driver/spi_master.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "esp_mac.h"
|
||||||
|
|
||||||
static const char *TAG = "EthTransport";
|
static const char *TAG = "EthTransport";
|
||||||
static bool isEthConn = false;
|
static bool isEthConn = false;
|
||||||
|
|
@ -289,8 +290,11 @@ static void eth_init(void *pvParameter)
|
||||||
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_SPI_HOST, &devcfg, &spi_handle[i]));
|
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_SPI_HOST, &devcfg, &spi_handle[i]));
|
||||||
ESP_LOGI(TAG, "ETHERNET SPI device added OK");
|
ESP_LOGI(TAG, "ETHERNET SPI device added OK");
|
||||||
// w5500 ethernet driver is based on spi driver
|
// w5500 ethernet driver is based on spi driver
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
|
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(CONFIG_SPI_HOST, &devcfg);
|
||||||
|
#else
|
||||||
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle[i]);
|
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle[i]);
|
||||||
|
#endif
|
||||||
// Set remaining GPIO numbers and configuration used by the SPI module
|
// Set remaining GPIO numbers and configuration used by the SPI module
|
||||||
w5500_config.int_gpio_num = spi_eth_module_config[i].int_gpio;
|
w5500_config.int_gpio_num = spi_eth_module_config[i].int_gpio;
|
||||||
phy_config_spi.phy_addr = spi_eth_module_config[i].phy_addr;
|
phy_config_spi.phy_addr = spi_eth_module_config[i].phy_addr;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ 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 %d", 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 */
|
||||||
|
|
@ -90,7 +90,7 @@ 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! %d", 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;
|
||||||
|
|
@ -264,13 +264,13 @@ modem_init_fail:
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GSMRunTask(void *pvParameter)
|
static void GSMRunTask(void *pvParameter)
|
||||||
|
|
@ -291,11 +291,12 @@ void PPPModemStart(void)
|
||||||
xTaskCreate(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3, NULL);
|
xTaskCreate(GSMRunTask, "GSMRunTask", 1024 * 4, &ResetType, 3, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPPModemGetRSSI(void)
|
int PPPModemGetRSSI(void)
|
||||||
{
|
{
|
||||||
int rssi, ber;
|
int rssi = -1, ber;
|
||||||
esp_modem_get_signal_quality(dce, &rssi, &ber);
|
esp_modem_get_signal_quality(dce, &rssi, &ber);
|
||||||
ESP_LOGW(TAG, "Signal %d, ber %d", rssi, ber);
|
//ESP_LOGW(TAG, "Signal %d, ber %d", rssi, ber);
|
||||||
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemSendAT(char *cmd, char *resp, int timeout)
|
void ModemSendAT(char *cmd, char *resp, int timeout)
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ static void HTTPPrint_ipap(char *VarData, void *arg)
|
||||||
if (GetAPNetifAdapter() && esp_netif_is_netif_up(GetAPNetifAdapter()))
|
if (GetAPNetifAdapter() && esp_netif_is_netif_up(GetAPNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetAPNetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetAPNetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.ApIPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.ApIPAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HTTPPrint_ssid(char *VarData, void *arg)
|
static void HTTPPrint_ssid(char *VarData, void *arg)
|
||||||
|
|
@ -308,7 +308,7 @@ static void HTTPPrint_ip(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfIPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfIPAddr));
|
||||||
}
|
}
|
||||||
/*STA NETMASK*/
|
/*STA NETMASK*/
|
||||||
static void HTTPPrint_msk(char *VarData, void *arg)
|
static void HTTPPrint_msk(char *VarData, void *arg)
|
||||||
|
|
@ -316,7 +316,7 @@ static void HTTPPrint_msk(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), NETMASK);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), NETMASK);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfMask));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfMask));
|
||||||
}
|
}
|
||||||
/*STA GATEWAY*/
|
/*STA GATEWAY*/
|
||||||
static void HTTPPrint_gate(char *VarData, void *arg)
|
static void HTTPPrint_gate(char *VarData, void *arg)
|
||||||
|
|
@ -324,7 +324,7 @@ static void HTTPPrint_gate(char *VarData, void *arg)
|
||||||
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
if (GetSTANetifAdapter() && esp_netif_is_netif_up(GetSTANetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), GW);
|
PrintIPFromInterface(VarData, arg, GetSTANetifAdapter(), GW);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->wifiSettings.InfGateway));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->wifiSettings.InfGateway));
|
||||||
}
|
}
|
||||||
/*Current DNS*/
|
/*Current DNS*/
|
||||||
static void HTTPPrint_dns(char *VarData, void *arg)
|
static void HTTPPrint_dns(char *VarData, void *arg)
|
||||||
|
|
@ -391,7 +391,7 @@ static void HTTPPrint_eip(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), IP);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), IP);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.IPAddr));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.IPAddr));
|
||||||
}
|
}
|
||||||
/*Etherbox NETMASK*/
|
/*Etherbox NETMASK*/
|
||||||
static void HTTPPrint_emsk(char *VarData, void *arg)
|
static void HTTPPrint_emsk(char *VarData, void *arg)
|
||||||
|
|
@ -399,7 +399,7 @@ static void HTTPPrint_emsk(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), NETMASK);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), NETMASK);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.Mask));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.Mask));
|
||||||
}
|
}
|
||||||
/*Ethernet GATEWAY*/
|
/*Ethernet GATEWAY*/
|
||||||
static void HTTPPrint_egate(char *VarData, void *arg)
|
static void HTTPPrint_egate(char *VarData, void *arg)
|
||||||
|
|
@ -407,7 +407,7 @@ static void HTTPPrint_egate(char *VarData, void *arg)
|
||||||
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
if (GetETHNetifAdapter() && esp_netif_is_netif_up(GetETHNetifAdapter()))
|
||||||
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), GW);
|
PrintIPFromInterface(VarData, arg, GetETHNetifAdapter(), GW);
|
||||||
else
|
else
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa(&GetSysConf()->ethSettings.Gateway));
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", ip4addr_ntoa((const ip4_addr_t*)&GetSysConf()->ethSettings.Gateway));
|
||||||
}
|
}
|
||||||
/*Current DNS*/
|
/*Current DNS*/
|
||||||
static void HTTPPrint_edns(char *VarData, void *arg)
|
static void HTTPPrint_edns(char *VarData, void *arg)
|
||||||
|
|
@ -920,7 +920,7 @@ void GenerateSystemSettingsJSONFile(void)
|
||||||
strcat(val, "~");
|
strcat(val, "~");
|
||||||
strcat(val, HANDLERS_ARRAY[i].tag);
|
strcat(val, HANDLERS_ARRAY[i].tag);
|
||||||
strcat(val, "~");
|
strcat(val, "~");
|
||||||
jwObj_string(HANDLERS_ARRAY[i].tag, val);
|
jwObj_string((char*)HANDLERS_ARRAY[i].tag, val);
|
||||||
}
|
}
|
||||||
jwEnd();
|
jwEnd();
|
||||||
jwClose();
|
jwClose();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#define MQTT_MESSAGE_BUFER_LENTH 5 //size of mqtt queue
|
#define MQTT_MESSAGE_BUFER_LENTH 5 //size of mqtt queue
|
||||||
#define MQTT_RECONNECT_CHANGE_ADAPTER 3
|
#define MQTT_RECONNECT_CHANGE_ADAPTER 3
|
||||||
|
|
||||||
#define MQTT_RECONNECT_TIMEOUT 30
|
#define MQTT_RECONNECT_TIMEOUT 20
|
||||||
|
|
||||||
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
|
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,6 @@ void WiFiConnect(void)
|
||||||
static void WiFiControlTask(void *arg)
|
static void WiFiControlTask(void *arg)
|
||||||
{
|
{
|
||||||
//WiFi init and start block
|
//WiFi init and start block
|
||||||
static int reconnect_interval = BASE_RECONNECT_INTERVAL;
|
|
||||||
static int reconnect_counter = BASE_RECONNECT_INTERVAL;
|
static int reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
switch (GetSysConf()->wifiSettings.WiFiMode)
|
switch (GetSysConf()->wifiSettings.WiFiMode)
|
||||||
|
|
@ -515,7 +514,6 @@ static void WiFiControlTask(void *arg)
|
||||||
portMAX_DELAY);
|
portMAX_DELAY);
|
||||||
if (bits & WIFI_CONNECTED_BIT)
|
if (bits & WIFI_CONNECTED_BIT)
|
||||||
{
|
{
|
||||||
reconnect_interval = BASE_RECONNECT_INTERVAL;
|
|
||||||
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
}
|
}
|
||||||
else if (bits & WIFI_FAIL_BIT)
|
else if (bits & WIFI_FAIL_BIT)
|
||||||
|
|
@ -524,12 +522,6 @@ static void WiFiControlTask(void *arg)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "WiFi STA started, reconnecting to AP...");
|
ESP_LOGI(TAG, "WiFi STA started, reconnecting to AP...");
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
/*
|
|
||||||
reconnect_interval += BASE_RECONNECT_INTERVAL;
|
|
||||||
if (reconnect_interval >= BASE_RECONNECT_INTERVAL * 10)
|
|
||||||
reconnect_interval = BASE_RECONNECT_INTERVAL * 10;
|
|
||||||
reconnect_counter = reconnect_interval;
|
|
||||||
*/
|
|
||||||
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
reconnect_counter = BASE_RECONNECT_INTERVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user