services start sequence fixed

This commit is contained in:
Bogdan Pilyugin 2022-08-18 18:09:14 +02:00
parent a239dc9b96
commit 6fa1c4abd4
3 changed files with 32 additions and 15 deletions

10
Kconfig
View File

@ -135,11 +135,11 @@ menu "WebGuiApp configuration"
config WEBGUIAPP_WIFI_IP_AP
string "Default IP address in AP mode"
default "192.168.1.150"
default "192.168.150.1"
config WEBGUIAPP_WIFI_IP_STA
string "Default IP address in STA mode"
default "192.168.1.150"
default "192.168.150.1"
config WEBGUIAPP_WIFI_MASK_STA
string "Default network mask in STA mode"
@ -147,7 +147,7 @@ menu "WebGuiApp configuration"
config WEBGUIAPP_WIFI_GATEWAY_STA
string "Default gateway in STA mode"
default "192.168.1.150"
default "192.168.150.1"
endif
@ -170,7 +170,7 @@ menu "WebGuiApp configuration"
config WEBGUIAPP_ETH_IP_DEFAULT
string "Default IP address"
default "192.168.1.150"
default "192.168.160.1"
config WEBGUIAPP_ETH_MASK_DEFAULT
string "Default network mask"
@ -178,7 +178,7 @@ menu "WebGuiApp configuration"
config WEBGUIAPP_ETH_GATEWAY_DEFAULT
string "Default gateway"
default "192.168.1.150"
default "192.168.160.1"
config WEBGUIAPP_ETHERNET_DHCP_DEFAULT
bool "Default Ethernet DHCP client on"

View File

@ -262,6 +262,7 @@ static HTTP_IO_RESULT HTTPPostIndex21(httpd_req_t *req, char *PostData)
static HTTP_IO_RESULT HTTPPostIndex22(httpd_req_t *req, char *PostData)
{
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
char tmp[32];
bool TempIsGSMEnabled = false;
if (httpd_query_key_value(PostData, "gsmen", tmp, sizeof(tmp)) == ESP_OK)
@ -294,7 +295,7 @@ static HTTP_IO_RESULT HTTPPostIndex22(httpd_req_t *req, char *PostData)
//PPPModemColdStart();
}
}
#endif
return HTTP_IO_DONE;
}

View File

@ -40,11 +40,12 @@
#include "romfs.h"
#include "NetTransport.h"
#include "Helpers.h"
#include "HTTPServer.h"
#define STORAGE_NAMESPACE "storage"
#define TAG "SystemConfiguration"
#define MANUAL_RESET 1
#define MANUAL_RESET 0
static SYS_CONFIG SysConfig;
@ -108,19 +109,28 @@ esp_err_t WebGuiAppInit(void)
}
#endif
bool WiFiApOnly = false;
#if !CONFIG_WEBGUIAPP_GPRS_ENABLE && !CONFIG_WEBGUIAPP_ETHERNET_ENABLE && CONFIG_WEBGUIAPP_WIFI_ENABLE
if(GetSysConf()->wifiSettings.Flags1.bIsAP)
WiFiApOnly = true;
#endif
/*Start services depends on client connection*/
if (CONFIG_WEBGUIAPP_GPRS_ENABLE ||
CONFIG_WEBGUIAPP_ETHERNET_ENABLE ||
(CONFIG_WEBGUIAPP_WIFI_ENABLE && !GetSysConf()->wifiSettings.Flags1.bIsAP))
#if CONFIG_WEBGUIAPP_GPRS_ENABLE || CONFIG_WEBGUIAPP_ETHERNET_ENABLE || CONFIG_WEBGUIAPP_WIFI_ENABLE
{
//StartTimeGet();
if (!WiFiApOnly)
{
StartTimeGet();
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
if (GetSysConf()->mqttStation[0].Flags1.bIsGlobalEnabled
|| GetSysConf()->mqttStation[1].Flags1.bIsGlobalEnabled)
{
// MQTTRun();
if (GetSysConf()->mqttStation[0].Flags1.bIsGlobalEnabled
|| GetSysConf()->mqttStation[1].Flags1.bIsGlobalEnabled)
{
// MQTTRun();
}
#endif
}
ESP_ERROR_CHECK(start_file_server());
#endif
}
@ -250,6 +260,12 @@ static void InitSysI2C(void)
static void ResetSysConfig(SYS_CONFIG *Conf)
{
memcpy(Conf->NetBIOSName, CONFIG_WEBGUIAPP_HOSTNAME, sizeof(CONFIG_WEBGUIAPP_HOSTNAME));
memcpy(Conf->SysName, CONFIG_WEBGUIAPP_USERNAME, sizeof(CONFIG_WEBGUIAPP_USERNAME));
memcpy(Conf->SysPass, CONFIG_WEBGUIAPP_USERPASS, sizeof(CONFIG_WEBGUIAPP_USERPASS));
//memcpy(Conf->OTAURL, CONFIG_WEBGUIAPP_, sizeof(SYSTEM_DEFAULT_OTAURL));
memcpy(Conf->OTAURL, SYSTEM_DEFAULT_OTAURL, sizeof(SYSTEM_DEFAULT_OTAURL));
#if CONFIG_WEBGUIAPP_WIFI_ENABLE
Conf->wifiSettings.Flags1.bIsWiFiEnabled = CONFIG_WEBGUIAPP_WIFI_ON;