File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -655,8 +655,15 @@ IPv6Address WiFiSTAClass::localIPv6()
655655bool  WiFiSTAClass::_smartConfigStarted = false ;
656656bool  WiFiSTAClass::_smartConfigDone = false ;
657657
658- 
659- bool  WiFiSTAClass::beginSmartConfig () {
658+ /* *
659+  * @brief  
660+  *  
661+  * @param type Select type of SmartConfig. Default type is SC_TYPE_ESPTOUCH 
662+  * @param crypt_key When using type SC_TYPE_ESPTOUTCH_V2 crypt key needed, else ignored. Lenght should be 16 chars. 
663+  * @return true if configuration is successful. 
664+  * @return false if configuration fails. 
665+  */  
666+ bool  WiFiSTAClass::beginSmartConfig (smartconfig_type_t  type, char * crypt_key) {
660667 esp_err_t  err;
661668 if  (_smartConfigStarted) {
662669 return  false ;
@@ -668,7 +675,13 @@ bool WiFiSTAClass::beginSmartConfig() {
668675 esp_wifi_disconnect ();
669676
670677 smartconfig_start_config_t  conf = SMARTCONFIG_START_CONFIG_DEFAULT ();
671-  err = esp_smartconfig_set_type (SC_TYPE_ESPTOUCH);
678+ 
679+  if  (type == SC_TYPE_ESPTOUCH_V2){
680+  conf.esp_touch_v2_enable_crypt  = true ;
681+  conf.esp_touch_v2_key  = crypt_key;
682+  }
683+ 
684+  err = esp_smartconfig_set_type (type);
672685 if  (err != ESP_OK) {
673686 log_e (" SmartConfig Set Type Failed!"  );
674687 return  false ;
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class WiFiSTAClass
9292 static  bool  _autoReconnect;
9393
9494public:  
95-  bool  beginSmartConfig ();
95+  bool  beginSmartConfig (smartconfig_type_t  type = SC_TYPE_ESPTOUCH,  char * crypt_key =  NULL );
9696 bool  stopSmartConfig ();
9797 bool  smartConfigDone ();
9898
                                 You can’t perform that action at this time. 
               
                  
0 commit comments