reconnect timeout in AP and STA changed
This commit is contained in:
parent
89d33842ec
commit
89cddc53a3
|
|
@ -55,7 +55,6 @@ static int TempAPCounter = 0;
|
||||||
#define DEFAULT_SCAN_LIST_SIZE 20
|
#define DEFAULT_SCAN_LIST_SIZE 20
|
||||||
static wifi_ap_record_t ap_info[DEFAULT_SCAN_LIST_SIZE];
|
static wifi_ap_record_t ap_info[DEFAULT_SCAN_LIST_SIZE];
|
||||||
static bool isScanExecuting = false;
|
static bool isScanExecuting = false;
|
||||||
static bool isStaConnecting = false;
|
|
||||||
|
|
||||||
wifi_ap_record_t* GetWiFiAPRecord(uint8_t n)
|
wifi_ap_record_t* GetWiFiAPRecord(uint8_t n)
|
||||||
{
|
{
|
||||||
|
|
@ -93,13 +92,10 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
||||||
void *event_data)
|
void *event_data)
|
||||||
{
|
{
|
||||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START)
|
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START)
|
||||||
{
|
|
||||||
if (GetSysConf()->wifiSettings.WiFiMode == WIFI_MODE_STA)
|
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "WiFi STA started, connecting to AP...");
|
ESP_LOGI(TAG, "WiFi STA started, connecting to AP...");
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_STOP)
|
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_STOP)
|
||||||
{
|
{
|
||||||
isWiFiGotIp = false;
|
isWiFiGotIp = false;
|
||||||
|
|
@ -492,8 +488,8 @@ void WiFiConnect(void)
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RECONNECT_INTERVAL_AP 200
|
#define RECONNECT_INTERVAL_AP 60
|
||||||
#define RECONNECT_INTERVAL_STA 20
|
#define RECONNECT_INTERVAL_STA 30
|
||||||
#define WAITIP_INTERVAL 10
|
#define WAITIP_INTERVAL 10
|
||||||
|
|
||||||
static void WiFiControlTask(void *arg)
|
static void WiFiControlTask(void *arg)
|
||||||
|
|
@ -543,8 +539,7 @@ static void WiFiControlTask(void *arg)
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
reconnect_counter =
|
reconnect_counter =
|
||||||
(GetSysConf()->wifiSettings.WiFiMode == WIFI_MODE_STA) ?
|
(GetSysConf()->wifiSettings.WiFiMode == WIFI_MODE_STA) ?
|
||||||
RECONNECT_INTERVAL_STA :
|
RECONNECT_INTERVAL_STA : RECONNECT_INTERVAL_AP;
|
||||||
RECONNECT_INTERVAL_AP;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TempAPCounter > 0)
|
if (TempAPCounter > 0)
|
||||||
|
|
@ -611,11 +606,11 @@ static void wifi_scan(void *arg)
|
||||||
{
|
{
|
||||||
uint16_t number = DEFAULT_SCAN_LIST_SIZE;
|
uint16_t number = DEFAULT_SCAN_LIST_SIZE;
|
||||||
uint16_t ap_count = 0;
|
uint16_t ap_count = 0;
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000)); //delay for command result get before network break
|
vTaskDelay(pdMS_TO_TICKS(1000)); //delay for command result get before network break
|
||||||
memset(ap_info, 0, sizeof(ap_info));
|
memset(ap_info, 0, sizeof(ap_info));
|
||||||
while (esp_wifi_scan_start(NULL, true) == ESP_ERR_WIFI_STATE)
|
while (esp_wifi_scan_start(NULL, true) == ESP_ERR_WIFI_STATE)
|
||||||
{
|
{
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info));
|
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user