/* Power save Example
- * this example shows how to use power save mode
- *
- * set a router or a AP using the same SSID&PASSWORD as configuration of this example.
- * start esp32 and when it connected to AP it will enter power save mode
- */
+
+ This example code is in the Public Domain (or CC0 licensed, at your option.)
+
+ Unless required by applicable law or agreed to in writing, this
+ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied.
+*/
+
+/*
+ this example shows how to use power save mode
+ set a router or a AP using the same SSID&PASSWORD as configuration of this example.
+ start esp32 and when it connected to AP it will enter power save mode
+*/
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp_wifi.h"
#if CONFIG_POWER_SAVE_MODEM
#define DEFAULT_PS_MODE WIFI_PS_MODEM
-//#elif CONFIG_POWER_SAVE_NONE
-//#define DEFAULT_PS_MODE WIFI_PS_NONE
+#elif CONFIG_POWER_SAVE_NONE
+#define DEFAULT_PS_MODE WIFI_PS_NONE
#else
#define DEFAULT_PS_MODE WIFI_PS_NONE
-#endif
+#endif /*CONFIG_POWER_SAVE_MODEM*/
+
static const char *TAG = "power_save";
/* WiFi Connection Example using WPS
- *
- * WPS_TYPE_PBC: Start esp32 and it will enter wps PBC mode. Then push the button of wps on router down. The esp32 will connected to the router.
- *
- * WPS_TYPE_PIN: Start esp32, You'll see PIN code which is a eight-digit number showing on COM. Enter the PIN code in router and then the esp32 will connected to router.
- */
+
+ This example code is in the Public Domain (or CC0 licensed, at your option.)
+
+ Unless required by applicable law or agreed to in writing, this
+ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied.
+*/
+
+/*
+ Showing how to use WPS.
+
+ WPS_TYPE_PBC: Start esp32 and it will enter wps PBC mode. Then push the button of wps on router down. The esp32 will connected to the router.
+ WPS_TYPE_PIN: Start esp32, You'll see PIN code which is a eight-digit number showing on COM. Enter the PIN code in router and then the esp32 will connected to router.
+*/
+
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp_wifi.h"
#define WPS_TEST_MODE WPS_TYPE_PIN
#else
#define WPS_TEST_MODE WPS_TYPE_DISABLE
-#endif
+#endif /*CONFIG_EXAMPLE_WPS_TYPE_PBC*/
+
#ifndef PIN2STR
#define PIN2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5], (a)[6], (a)[7]
break;
case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
/*point: the function esp_wifi_wps_start() only get ssid & password
- * and we suggest you call the function esp_wifi_connect() here
+ * so call the function esp_wifi_connect() here
* */
ESP_LOGI(TAG, "SYSTEM_EVENT_STA_WPS_ER_SUCCESS");
ESP_ERROR_CHECK(esp_wifi_wps_disable());
ESP_ERROR_CHECK(esp_wifi_start());
ESP_LOGI(TAG, "start wps...");
- //ESP_ERROR_CHECK(esp_wifi_wps_enable(WPS_TYPE_PBC));
ESP_ERROR_CHECK(esp_wifi_wps_enable(WPS_TEST_MODE));
ESP_ERROR_CHECK(esp_wifi_wps_start(0));
}