]> granicus.if.org Git - esp-idf/commitdiff
wps_ps: add license
authorchenyudong <chenyudong@espressif.com>
Thu, 13 Apr 2017 03:43:01 +0000 (11:43 +0800)
committerchenyudong <chenyudong@espressif.com>
Thu, 13 Apr 2017 03:43:01 +0000 (11:43 +0800)
examples/wifi/power_save/main/power_save.c
examples/wifi/wps/main/wps.c

index 8f6139d89caabd1bc4563de3fce36b2457a61212..f9112c44469588bd7e8b850c0fed4f7d43393dfb 100644 (file)
@@ -1,9 +1,17 @@
 /* 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";
 
index e68ac04556e7475f1770a786f1f592213ca24207..9f60a00a861646332862a4d4ffc84ca86144abdd 100644 (file)
@@ -1,9 +1,19 @@
 /* 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"
@@ -19,7 +29,8 @@
 #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]
@@ -47,7 +58,7 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
         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());
@@ -89,7 +100,6 @@ static void start_wps(void)
     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));
 }