implemented all WiFi modes (AP, STA and AP+STA)
This commit is contained in:
parent
0cd3d9f1f9
commit
67d676c5c9
|
|
@ -57,6 +57,7 @@ void StartTimeGet(void);
|
|||
void WiFiAPStart(void);
|
||||
void WiFiSTAStart(void);
|
||||
void WiFiAPSTAStart(void);
|
||||
void WiFiDisconnect(void);
|
||||
void WiFiScan(void);
|
||||
void EthStart(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@
|
|||
struct
|
||||
{
|
||||
char bIsDHCPEnabled :1;
|
||||
char bIsAP :1;
|
||||
char b1 :1;
|
||||
char b2 :1;
|
||||
char b3 :1;
|
||||
char b4 :1;
|
||||
|
|
|
|||
|
|
@ -137,13 +137,6 @@ static HTTP_IO_RESULT HTTPPostAdaptersSettings(httpd_req_t *req, char *PostData)
|
|||
if (!strcmp((const char*) tmp, (const char*) "1"))
|
||||
TempIsWiFiEnabled = true;
|
||||
}
|
||||
if (httpd_query_key_value(PostData, "netm", tmp, sizeof(tmp)) == ESP_OK)
|
||||
{
|
||||
if (!strcmp((const char*) tmp, (const char*) "1"))
|
||||
GetSysConf()->wifiSettings.Flags1.bIsAP = true;
|
||||
else if (!strcmp((const char*) tmp, (const char*) "2"))
|
||||
GetSysConf()->wifiSettings.Flags1.bIsAP = false;
|
||||
}
|
||||
if (httpd_query_key_value(PostData, "wfmode", tmp, sizeof(tmp)) == ESP_OK)
|
||||
{
|
||||
if (!strcmp((const char*) tmp, (const char*) "sta"))
|
||||
|
|
@ -491,7 +484,6 @@ static HTTP_IO_RESULT HTTPPostSystemSettings(httpd_req_t *req, char *PostData)
|
|||
{
|
||||
if (!strcmp(tmp, (const char*) "1"))
|
||||
{
|
||||
WiFiConnect();
|
||||
return HTTP_IO_DONE_NOREFRESH;
|
||||
}
|
||||
else if (!strcmp(tmp, (const char*) "2"))
|
||||
|
|
|
|||
|
|
@ -245,18 +245,18 @@ static void HTTPPrint_wfen(char *VarData, void *arg)
|
|||
}
|
||||
static void HTTPPrint_wfstat(char *VarData, void *arg)
|
||||
{
|
||||
if (GetSysConf()->wifiSettings.Flags1.bIsAP)
|
||||
if (GetSysConf()->wifiSettings.WiFiMode == WIFI_MODE_AP)
|
||||
PrintInterfaceState(VarData, arg, GetAPNetifAdapter());
|
||||
else
|
||||
PrintInterfaceState(VarData, arg, GetSTANetifAdapter());
|
||||
}
|
||||
static void HTTPPrint_cln(char *VarData, void *arg)
|
||||
{
|
||||
PrintCheckbox(VarData, arg, !GetSysConf()->wifiSettings.Flags1.bIsAP);
|
||||
//PrintCheckbox(VarData, arg, !GetSysConf()->wifiSettings.Flags1.bIsAP);
|
||||
}
|
||||
static void HTTPPrint_apn(char *VarData, void *arg)
|
||||
{
|
||||
PrintCheckbox(VarData, arg, GetSysConf()->wifiSettings.Flags1.bIsAP);
|
||||
//PrintCheckbox(VarData, arg, GetSysConf()->wifiSettings.Flags1.bIsAP);
|
||||
}
|
||||
|
||||
static void HTTPPrint_wfmode(char *VarData, void *arg)
|
||||
|
|
|
|||
|
|
@ -161,11 +161,6 @@ esp_err_t WebGuiAppInit(void)
|
|||
WiFiAPSTAStart();
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetSysConf()->wifiSettings.Flags1.bIsAP)
|
||||
WiFiAPStart();
|
||||
else
|
||||
WiFiSTAStart();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -314,7 +309,7 @@ static void ResetSysConfig(SYS_CONFIG *Conf)
|
|||
(esp_ip4_addr_t*) &Conf->wifiSettings.InfGateway);
|
||||
esp_netif_str_to_ip4(CONFIG_WEBGUIAPP_WIFI_IP_AP,
|
||||
(esp_ip4_addr_t*) &Conf->wifiSettings.ApIPAddr);
|
||||
Conf->wifiSettings.Flags1.bIsAP = true;
|
||||
|
||||
Conf->wifiSettings.WiFiMode = 3; //AP+STA mode
|
||||
memcpy(Conf->wifiSettings.ApSecurityKey, CONFIG_WEBGUIAPP_WIFI_KEY_AP,
|
||||
sizeof(CONFIG_WEBGUIAPP_WIFI_KEY_AP));
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
static void wifi_init_softap(void *pvParameter)
|
||||
{
|
||||
char if_key_str[24];
|
||||
|
|
@ -203,7 +203,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
ESP_LOGI(TAG, "wifi_init_softap finished");
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static void wifi_init_sta(void *pvParameter)
|
||||
{
|
||||
|
|
@ -498,7 +498,7 @@ static void wifi_init_apsta(void *pvParameter)
|
|||
|
||||
void WiFiAPStart(void)
|
||||
{
|
||||
xTaskCreate(wifi_init_apsta, "InitSoftAPTask", 1024 * 4, (void*) 0, 3, NULL);
|
||||
xTaskCreate(wifi_init_softap, "InitSoftAPTask", 1024 * 4, (void*) 0, 3, NULL);
|
||||
}
|
||||
|
||||
void WiFiAPSTAStart(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user