feat(example): Clean up the code in example

This commit is contained in:
Wu Jian Gang
2018-05-25 16:57:01 +08:00
parent 80e919642d
commit 74be880138
13 changed files with 350 additions and 233 deletions

View File

@ -19,13 +19,15 @@
#include "freertos/task.h"
static void user_wps_status_cb(int status)
{
{
printf("scan status %d\n", status);
switch (status) {
case WPS_CB_ST_SUCCESS:
wifi_wps_disable();
wifi_station_connect();
break;
case WPS_CB_ST_FAILED:
case WPS_CB_ST_TIMEOUT:
wifi_wps_start();
@ -76,12 +78,15 @@ uint32_t user_rf_cal_sector_set(void)
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;
case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal_sec = 2048 - 5;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal_sec = 4096 - 5;
break;
default:
rf_cal_sec = 0;
break;
@ -89,16 +94,15 @@ uint32_t user_rf_cal_sector_set(void)
return rf_cal_sec;
}
static void wps_task(void *pvParameters)
static void wps_task(void* pvParameters)
{
wifi_set_opmode(STATION_MODE);
user_wps_start();
vTaskDelete(NULL);
}
void user_init(void)
{
xTaskCreate(wps_task, "wps_task", 1024, NULL, 4, NULL);
xTaskCreate(wps_task, "wps_task", 1024, NULL, 4, NULL);
}